本文整理汇总了C++中TInetAddr::Output方法的典型用法代码示例。如果您正苦于以下问题:C++ TInetAddr::Output方法的具体用法?C++ TInetAddr::Output怎么用?C++ TInetAddr::Output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TInetAddr
的用法示例。
在下文中一共展示了TInetAddr::Output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void UT_CTBCPFloorControlImpl::UT_CTBCPFloorControlImpl_ConnectionStarted2LL( )
{
iPlugIn->SetIapId(KIAPID);
TBuf<KBufLength> addressbuffer;
TInetAddr addr;
addr.Input(KAddr3);
addr.Output(addressbuffer);
iPlugIn->SetAddressL(addressbuffer, KPort1);
iPlugIn->SetLocalPort(KPort2);
iPlugIn->ConnectL( ETrue );
iPlugIn->ConnectionStarted(0);
EUNIT_ASSERT(iError==0);
TBuf<KBufLength> addressbuffer2;
TInetAddr addr2;
addr2.Input(KAddr2);
addr2.Output(addressbuffer2);
iPlugIn->SetAddressL(addressbuffer2, KPort1);
iPlugIn->iConnection->Cancel();
iPlugIn->iConnection->iStatus = KErrNone;
iPlugIn->iConnection->RunL();
FC_EUNIT_ASSERT_EQUALS( iError, KErrNone );
}
示例2: ConstructL
// -----------------------------------------------------------------------------
// CSdpOriginField::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CSdpOriginField::ConstructL(
const TDesC8& aUserName,
TInt64 aSessionId,
TInt64 aSessionVersion,
TInetAddr& aUnicastAddress )
{
iPool = SdpCodecStringPool::StringPoolL();
__ASSERT_ALWAYS(
IsValidUserName( aUserName )
&& IsValidAddress( aUnicastAddress )
&& aSessionId >= 0 && aSessionVersion >= 0,
User::Leave( KErrSdpCodecOriginField ) );
iUserName = reinterpret_cast< HBufC8* >
( CSdpOriginFieldPtrs::NewL( aSessionId, aSessionVersion ) );
OriginFieldPtrs().SetUserNameL( aUserName );
TBuf<KMaxIPDesLength> des;
aUnicastAddress.Output( des );
//if aUnicastAddress was IPv4-Mapped IPv6 address,
// the result of Output is IPv4
// the address is stored in IPv4 format, so the iAddressType
// must also be IPv4.
iAddress.Copy( des );
SetIPAddressType( aUnicastAddress );
iNetType = iPool.StringF( SdpCodecStringConstants::ENetType,
SdpCodecStringConstants::Table ).Copy();
__TEST_INVARIANT;
}
示例3: UT_CTBCPFloorControlImpl_CancelSendL
void UT_CTBCPFloorControlImpl::UT_CTBCPFloorControlImpl_CancelSendL( )
{
iPlugIn->SetIapId(KIAPID);
TBuf<KBufLength> addressbuffer;
TInetAddr addr;
addr.Input(KAddr2);
addr.Output(addressbuffer);
iPlugIn->SetAddressL(addressbuffer, KPort1);
iPlugIn->SetLocalPort(KPort2);
iPlugIn->ConnectL(ETrue);
iPlugIn->iConnection->Cancel();
iPlugIn->iConnection->RunL();
EUNIT_PRINT( _L( "DigiaEunit::Socket has open and start Listen!" ) );
HBufC8* data = HBufC8::NewLC(KLength);
data->Des().Copy(KHello);
EUNIT_PRINT( _L( "DigiaEunit::BeforeSendToNetL" ) );
iPlugIn ->SendToNetL(data);
CleanupStack::Pop( data );
iPlugIn->ConnectL(ETrue);
iPlugIn->iConnection->Cancel();
iPlugIn->iConnection->RunL();
iPlugIn->CancelSend();
EUNIT_PRINT( _L( "DigiaEunit::After Cancel Send" ) );
EUNIT_ASSERT( iError==0);
}
示例4: SetDefaultNetTypeAndAddrType
// ---------------------------------------------------------------------------
// SdpUtil::SetDefaultNetTypeAndAddrType
// Sets network type and address type to their "default" values
// ---------------------------------------------------------------------------
//
void SdpUtil::SetDefaultNetTypeAndAddrType(
RStringPool aPool,
const TInetAddr& aAddress,
RStringF& aNetType,
RStringF& aAddressType )
{
// Sets network type to IN
aNetType.Close();
aNetType = aPool.StringF( SdpCodecStringConstants::ENetType,
SdpCodecStringConstants::Table ).Copy();
// Address type
aAddressType.Close();
TBuf16 <KMaxAddressLength> output;
aAddress.Output(output);
//addresstype for IPv4
if((aAddress.Address() && !aAddress.IsV4Mapped()) ||
(!aAddress.Address() && aAddress.IsWildAddr() &&
output.Match(KWildAddr) == 0))
{
aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressTypeIP4,
SdpCodecStringConstants::Table ).Copy();
}
else
{
//addresstype for IPv4-Mapped IPv6 && IPv6
aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressType,
SdpCodecStringConstants::Table ).Copy();
}
}
示例5: ConnectionAcceptedL
// -----------------------------------------------------------------------------
// CUpnpHttpServer::ConnectionAcceptedL
//
// -----------------------------------------------------------------------------
//
CUpnpTcpSession* CUpnpHttpServer::ConnectionAcceptedL( RSocket aSocket )
{
LOG_FUNC_NAME;
#ifdef _DEBUG
TInetAddr tempAddr;
aSocket.RemoteName( tempAddr );
tempAddr.ConvertToV4();
const TInt KMaxAdressLength = 20;
TBuf<KMaxAdressLength> addrBuf;
tempAddr.Output( addrBuf );
HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
CleanupStack::PushL( addrBuf8 );
LOGS( "CUpnpHttpServer::ConnectionAcceptedL - Remote socket connected" );
LOGT( addrBuf8->Des() );
LOGS1("CUpnpHttpServer::ConnectionAcceptedL - Creating a new Http session. Session count: %i", iSessionList.Count());
CleanupStack::PopAndDestroy(addrBuf8);
#endif //_DEBUG
CUpnpHttpSession* sess = CUpnpHttpSession::NewL( aSocket, this,
CUpnpHttpMessage::NewSessionIdL(), EPriorityNormal );
return sess;
}
示例6: SetDescriptionUrlL
// -----------------------------------------------------------------------------
// CUpnpDeviceLibraryElement::SetDescriptionUrlL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CUpnpDeviceLibraryElement::SetDescriptionUrlL(
const TDesC8& aDescriptionURL, const TInetAddr& aAddr, const TDesC8& aPort )
{
TBuf<UpnpSSDP::KIPAddBuffLen> addrBuf;
aAddr.Output( addrBuf );
HBufC8* addrBuf8 = UpnpString::FromUnicodeL( addrBuf );
CleanupStack::PushL( addrBuf8 );
HBufC8* url = HBufC8::NewLC( (UpnpHTTP::KHTTPUrl().Length( ))
+ aDescriptionURL.Length( ) + addrBuf8->Length( )
+ aPort.Length( )+ 2 );//+2 reserved for colon and slashes in url
url->Des().Append( UpnpHTTP::KHTTPUrl( ) );
url->Des().Append( *addrBuf8 );
if ( aPort.Length( ) > 0 )
{
url->Des().Append( UpnpString::KColon( ) );
url->Des().Append( aPort );
}
// After Ip address there should be slash and device Url so device url
// must start with slash
ASSERT( aDescriptionURL.Find( UpnpString::KSlash) == 0 );
url->Des().Append( aDescriptionURL );
SetDescriptionUrlL( *url );
CleanupStack::PopAndDestroy( url );
CleanupStack::PopAndDestroy( addrBuf8 );
}
示例7: SetLocalIpAddrL
/**
* Function that takes an IP address from user input, accesses the
* Bluetooth PAN Profile table in the CommDb and updates the IpAddr
* field with the supplied address.
*/
void CPanConnections::SetLocalIpAddrL(TUint32 addr)
{
iLocalIpAddr = addr;
iSrcAddr.SetAddress(iLocalIpAddr);
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
// Get the LAN service table
CCommsDbTableView* tableView = db->OpenTableLC(TPtrC(LAN_SERVICE));
TBuf<KMaxBufferSize> tableName;
TInt err = tableView->GotoFirstRecord();
if(err == KErrNone)
{
// Get the name of the table
tableView->ReadTextL(TPtrC(COMMDB_NAME), tableName);
if(tableName == TPtrC(_S("BluetoothPANProfile")))
{
TInetAddr tempAddr;
TBuf<KMaxBufferSize> dispBuf;
tempAddr.SetAddress(iLocalIpAddr);
tempAddr.Output(dispBuf);
User::LeaveIfError(tableView->UpdateRecord());
tableView->WriteTextL(_L("IpAddr"), dispBuf);
User::LeaveIfError(tableView->PutRecordChanges());
User::LeaveIfError(db->CommitTransaction());
}
}
else
{
User::Leave(KErrNotFound);
}
CleanupStack::PopAndDestroy(2);//db & tableView
}
示例8: UT_CTBCPFloorControlImpl_SetAddressLL
void UT_CTBCPFloorControlImpl::UT_CTBCPFloorControlImpl_SetAddressLL( )
{
TBuf<KBufLength> addressbuffer;
TInetAddr addr;
addr.Input(KAddr2);
addr.Output(addressbuffer);
iPlugIn->SetAddressL(addressbuffer, KPort1);
EUNIT_ASSERT( iPlugIn->iRemoteAddr.Address()==addr.Address());
}
示例9: PrintConns
/**
* Function to print the current connections we have.
*/
void CPanConnections::PrintConns()
{
iConsole.Printf(_L("\nRemotenames : %d\n"), iRemoteNames.Count());
PrintTcpSocketConnections();
iConsole.Printf(_L("--------------------------------------------------\n"));
iConsole.Printf(_L("Listening Mode: "));
iListening ? iConsole.Printf(_L("Enabled ")) : iConsole.Printf(_L("Disabled "));
if(iIapStarted)
{
iConsole.Printf(_L(" IAP Started"));
TInt err = UpdateCurrentConnections();
if(err != KErrNone)
{
iConsole.Printf(_L("FAILED TO ENUMERATE CONNECTIONS. Err %d\n"), err);
}
else
{
iConsole.Printf(_L("\n------------------ CONNECTIONS -------------------\n"));
iConsole.Printf(_L("Index Remote Addr\n"));
for(TInt i=0;i<iActiveConnections.Count();i++)
{
TBuf<KMaxBufferSize> dispBuf;
iActiveConnections[i].GetReadable(dispBuf);
if(iActivePanConn == i)
{
iConsole.Printf(_L("-> "));
}
else
{
iConsole.Printf(_L(" "));
}
iConsole.Printf(_L("%d 0x%S\n"), i, &dispBuf);
}
}
}
if(iLocalIpAddr == 0)
{
iConsole.Printf(_L("\nNo local IP address set\n"));
}
else
{
TInetAddr tempAddr;
TBuf<KMaxBufferSize> dispBuf;
tempAddr.SetAddress(iLocalIpAddr);
tempAddr.Output(dispBuf);
iConsole.Printf(_L("\nLocal IP address: %S\n"), &dispBuf);
}
}
示例10: IsValidAddress
// -----------------------------------------------------------------------------
// CSdpOriginField::IsValidAddress
// Checks if the address is valid
// -----------------------------------------------------------------------------
//
TBool CSdpOriginField::IsValidAddress(
const TInetAddr& addr ) const
{
TBuf<KMaxIPDesLength> buf16;
TBuf8<KMaxIPDesLength> buf;
//if addr is IPv4-Mapped IPv6, buf value will be IPv4 after Output
addr.Output( buf16 );
buf.Copy( buf16 );
return IsValidAddress( buf );
}
示例11: UT_CTBCPFloorControlImpl_ConnectionStartedLL
void UT_CTBCPFloorControlImpl::UT_CTBCPFloorControlImpl_ConnectionStartedLL()
{
iPlugIn->SetIapId(KIAPID);
TBuf<KBufLength> addressbuffer;
TInetAddr addr;
addr.Input(KAddr2);
addr.Output(addressbuffer);
iPlugIn->SetAddressL(addressbuffer, KPort1);
iPlugIn->SetLocalPort(KPort2);
iPlugIn->ConnectionStarted(1);
EUNIT_ASSERT( iError==1);
}
示例12: FetchIpAddressL
void CApConnectEngine::FetchIpAddressL()
{
RSocket socket;
CleanupClosePushL( socket);
while (socket.Open(iSocketServ, KAfInet, KSockDatagram, KProtocolInetUdp,
iConnect)!= KErrNone)
{
};
TSoInetInterfaceInfo inf;
TPckg<TSoInetInterfaceInfo> opt( inf);
TRAPD(err, socket.SetOpt (KSoInetEnumInterfaces, KSolInetIfCtrl ))
;
if (err != KErrNone)
{
return;
}
while ( socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, opt)== KErrNone)
{
if ( inf.iAddress.Address()==0) // if the stored address is not an IPv4 address
{
}
else
{
if ( inf.iAddress.IsUnspecified())
{
// Interface inf.iName has no address
}
else
{
// have to do this, strange
TInetAddr addr;
addr.SetAddress( inf.iAddress.Address());
addr.Output(iConnInfo.ipAddress);
// have to do this, strange
if ( iConnInfo.ipAddress.Compare(KZeroIP)!= 0 && iConnInfo.ipAddress.Compare(KLocalIP)!= 0)
{
if ( iConnInfo.ipAddress.Left(3).Compare(_L("169"))!= 0)
{
CleanupStack::PopAndDestroy(); // socket
return;
}
}
}
}
}
CleanupStack::PopAndDestroy(); // socket
}
示例13: TestOutgoingAddrL
// ---------------------------------------------------------------------------
// CStunTurnTests::TestOutgoingAddrL
// ---------------------------------------------------------------------------
//
void CStunTurnTests::TestOutgoingAddrL()
{
TInetAddr inetAddr;
TBuf<40> buffer;
RDebug::Print( _L( "\nTEST CASE: Get outgoing address" ) );
iWrapper->OutgoingAddr( inetAddr );
inetAddr.Output( buffer );
RDebug::Print( _L("TEST PRINT: CStunTurnTests::TestOutgoingAddrL, wrapper outgoing Address: %S:%d "), &buffer, inetAddr.Port() );
if ( buffer.Length() == 0 )
{
User::Leave( KErrCompletion );
}
}
示例14: UT_CTBCPFloorControlImpl_ConnectLL
void UT_CTBCPFloorControlImpl::UT_CTBCPFloorControlImpl_ConnectLL( )
{
iPlugIn->SetIapId(KIAPID);
TBuf<KBufLength> addressbuffer;
TInetAddr addr;
addr.Input(KAddr2);
addr.Output(addressbuffer);
iPlugIn->SetAddressL(addressbuffer, KPort1);
iPlugIn->SetLocalPort(KPort2);
FC_EUNIT_ASSERT_NO_LEAVE(iPlugIn->ConnectL(ETrue) );
iPlugIn->iConnection->Cancel();
iPlugIn->iConnection->RunL();
EUNIT_PRINT( _L( "DigiaEunit::Socket has open and start Listen!" ) );
EUNIT_ASSERT( iError==0);
}
示例15: ConstructL
// -----------------------------------------------------------------------------
// CSdpConnectionField::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CSdpConnectionField::ConstructL(
const TInetAddr& aAddress,
TInt aTTL,
TUint aNumOfAddress )
{
__ASSERT_ALWAYS( IsValidAddress(aAddress, aTTL, aNumOfAddress) == KErrNone,
User::Leave( KErrSdpCodecConnectionField ) );
iPool = SdpCodecStringPool::StringPoolL();
TBuf<KMaxIPDesLength> addr;
//If aAddress is IPv4-Mapped IPv6,the result of Output is IPv4
aAddress.Output( addr );
// Copy address
iAddress = HBufC8::NewL( addr.Length() );
iAddress->Des().Copy( addr );
// TTL
iTTL = aTTL;
// Num of addresses
iNumOfAddress = aNumOfAddress;
// Network type
iNetType = iPool.StringF( SdpCodecStringConstants::ENetType,
SdpCodecStringConstants::Table ).Copy();
// Address type
if ( UriUtils::HostType( addr ) == UriUtils::EIPv4Host )
{
//addresstype for IPv4
iAddressType = iPool.StringF( SdpCodecStringConstants::EAddressTypeIP4,
SdpCodecStringConstants::Table ).Copy();
}
else if ( UriUtils::HostType( addr ) == UriUtils::EIPv6Host )
{
//addresstype IPv6
iAddressType = iPool.StringF( SdpCodecStringConstants::EAddressType,
SdpCodecStringConstants::Table ).Copy();
}
else
{
User::Leave(KErrArgument);
}
__TEST_INVARIANT;
}