当前位置: 首页>>代码示例>>C++>>正文


C++ TInetAddr::Family方法代码示例

本文整理汇总了C++中TInetAddr::Family方法的典型用法代码示例。如果您正苦于以下问题:C++ TInetAddr::Family方法的具体用法?C++ TInetAddr::Family怎么用?C++ TInetAddr::Family使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TInetAddr的用法示例。


在下文中一共展示了TInetAddr::Family方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Bind

int CTcpSock::Bind(TInetAddr &ia)
{
	TInt ret;

	ret = iSocket.Open(ts->cts->iSockServer->iSocketServer, ia.Family(),
			   KSockStream, KProtocolInetTcp);
	if (KErrNone != ret) {
		DEBUG_WARNING("bind: Open (ret=%d)\n", ret);
		goto error;
	}

	ret = iSocket.SetOpt(KSoReuseAddr, KSolInetIp, 1);
	if (KErrNone != ret) {
		DEBUG_WARNING("SetOpt ReuseAddr: ret=%d\n", ret);
	}

	ret = iSocket.Bind(ia);
	if (KErrNone != ret) {
		DEBUG_WARNING("bind: Bind (ret=%d)\n", ret);
		goto error;
	}

 error:
	return kerr2errno(ret);
}
开发者ID:anchowee,项目名称:traversal_server,代码行数:25,代码来源:tcp.cpp

示例2: Open

int CTcpConn::Open(TInetAddr &ia)
{
	TInt ret;
	if (rconnection) {
		DEBUG_INFO("TCP Socket Open: Using RConnection=%p\n",
			   rconnection);
		ret = iSocket.Open(iSockServer->iSocketServer, ia.Family(),
				   KSockStream, KProtocolInetTcp,
				   *rconnection);
	}
	else {
		ret = iSocket.Open(iSockServer->iSocketServer, ia.Family(),
				   KSockStream, KProtocolInetTcp);
	}

	return kerr2errno(ret);
}
开发者ID:anchowee,项目名称:traversal_server,代码行数:17,代码来源:tcp.cpp

示例3: qt_QHostAddressFromTInetAddr

QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr)
{
    if (addr.IsV4Mapped() || addr.Family() == KAfInet) {
        //convert v4 host address
        return QHostAddress(addr.Address());
    } else {
        //convert v6 host address
        return QHostAddress((quint8 *)(addr.Ip6Address().u.iAddr8));
    }
}
开发者ID:phen89,项目名称:rtqt,代码行数:10,代码来源:qnetworkinterface_symbian.cpp

示例4: qt_QHostAddressFromTInetAddr

//TODO: share this, at least QHostInfo needs to do the same thing
static QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr)
{
    //TODO: do we want to call v4 mapped addresses v4 or v6 outside of this file?
    if (addr.IsV4Mapped() || addr.Family() == KAfInet) {
        //convert v4 host address
        return QHostAddress(addr.Address());
    } else {
        //convert v6 host address
        return QHostAddress((quint8 *)(addr.Ip6Address().u.iAddr8));
    }
}
开发者ID:Blizzard,项目名称:qt4,代码行数:12,代码来源:qnetworkinterface_symbian.cpp

示例5: SetAddr

// -----------------------------------------------------------------------------
// CLocalAddrResolver::SetAddr
// -----------------------------------------------------------------------------
//
void CLocalAddrResolver::SetAddr( TInetAddr& aTarget, TInetAddr& aSource )
    {
    if ( aSource.Family() == KAfInet6 )
        {
        if(!aSource.IsLinkLocal())
			{
			aTarget = aSource;
			aTarget.SetScope(0);
			}
        }
    else
        {
        aTarget = aSource;
        aTarget.SetScope(0);
        }
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:20,代码来源:localaddrresolver.cpp

示例6: ILibSocketWrapper_getsockname

int ILibSocketWrapper_getsockname(int socketObject, struct sockaddr* local, int* length)
{
  struct sockaddr_in* localAddr = (struct sockaddr_in*)local;
	RSocket *s = (RSocket*)SocketArray[socketObject];
  TInetAddr sockAddr;

  // get the local name
  s->LocalName(sockAddr);

  // convert from Symbian
  localAddr->sin_family = sockAddr.Family();
  localAddr->sin_port = sockAddr.Port();
  localAddr->sin_addr.s_addr = ntohl(sockAddr.Address());
  
  return 0;
}
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:16,代码来源:ILibSocketWrapper.cpp

示例7: FetchCandidateL

// ---------------------------------------------------------------------------
// CNATFWStunConnectionHandler::FetchCandidateL
// ---------------------------------------------------------------------------
//
void CNATFWStunConnectionHandler::FetchCandidateL( TUint aStreamId,
    TUint /*aRtoValue*/, TUint /*aAddrFamily*/, 
    const TInetAddr& aBaseAddr )
    {
    __STUNPLUGIN( "CNATFWStunConnectionHandler::FetchCandidateL start" )
      
    // Store data in array
    TStreamData streamData;
    streamData.iStreamId = aStreamId;

    CNATFWCandidate* newCandidate = CNATFWCandidate::NewLC();
    TInetAddr publicAddr;
    if ( KAfInet6 == aBaseAddr.Family() )
        {
        const TIp6Addr KIp6Addr = {{{1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,1}}};
        publicAddr.SetAddress( KIp6Addr );
        }
    else
        {
        publicAddr.SetAddress( INET_ADDR( 1,2,3,4 ) );
        }

    // Set candidate parameters
    newCandidate->SetStreamId( aStreamId );
    newCandidate->SetType( CNATFWCandidate::EServerReflexive );
    newCandidate->SetTransportAddrL( publicAddr );
    newCandidate->SetTransportProtocol( KProtocolInetUdp );

    TConnectionData connData;    
    connData.iLocalCandidate = newCandidate;
    streamData.iConnArray.AppendL( connData );
    iStreamArray.AppendL( streamData );   

    TCallBackCmd cmd 
        = TCallBackCmd( aStreamId, EFetchCandidate, 0, newCandidate );
    iCallBackCmds.AppendL( cmd );
    CleanupStack::Pop( newCandidate );
    
    if ( !IsActive() )
        {
        After( KWaitTime );
        }
    // wait MNcmConnectionObserver::ConnectionNotify
    
    __STUNPLUGIN( "CNATFWStunConnectionHandler::FetchCandidateL end" )
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:50,代码来源:natfwstunconnectionhandler_stub.cpp

示例8: Connect

int CPjSSLSocket::Connect(CPjSSLSocket_cb cb, void *key, 
			  const TInetAddr &local_addr, 
			  const TInetAddr &rem_addr,
			  const TDesC8 &servername,
			  const TDesC8 &ciphers)
{
    pj_status_t status;
    
    PJ_ASSERT_RETURN(state_ == SSL_STATE_NULL, PJ_EINVALIDOP);
    
    status = pj_sock_socket(rem_addr.Family(), pj_SOCK_STREAM(), 0, &sock_);
    if (status != PJ_SUCCESS)
	return status;

    // Apply QoS
    status = pj_sock_apply_qos2(sock_, qos_type_, &qos_params_, 
    				2,  THIS_FILE, NULL);
    
    RSocket &rSock = ((CPjSocket*)sock_)->Socket();

    local_addr_ = local_addr;
    
    if (!local_addr_.IsUnspecified()) {
	TInt err = rSock.Bind(local_addr_);
	if (err != KErrNone)
	    return PJ_RETURN_OS_ERROR(err);
    }
    
    cb_ = cb;
    key_ = key;
    rem_addr_ = rem_addr;
    
    /* Note: the following members only keep the pointer, not the data */
    servername_.Set(servername);
    ciphers_.Set(ciphers);

    rSock.Connect(rem_addr_, iStatus);
    SetActive();
    state_ = SSL_STATE_CONNECTING;
    
    rSock.LocalName(local_addr_);

    return PJ_EPENDING;
}
开发者ID:AGProjects,项目名称:python-sipsimple,代码行数:44,代码来源:ssl_sock_symbian.cpp

示例9: SetAddressesIfNotSet

// -----------------------------------------------------------------------------
// CMceLocalAddrResolver::SetAddressesIfNotSet
// -----------------------------------------------------------------------------
//
void CMceLocalAddrResolver::SetAddressesIfNotSet( const TInetAddr& aAddr )
    {
    if ( aAddr.Family() == KAfInet )
        {
        if ( iAddr.IsUnspecified() )
            {
            iAddr = aAddr;
            }
        iIPv4Addr = aAddr;
        }
    else
        {
        iAddr = aAddr;
        }
    if ( iIPv4Addr.IsUnspecified() && iAddr.IsV4Mapped() )
        {
        iIPv4Addr = iAddr;
        iIPv4Addr.ConvertToV4();
        }    
    }
开发者ID:piashishi,项目名称:mce,代码行数:24,代码来源:mcelocaladdrresolver.cpp

示例10: BuildUdpEncExtensionData

// ---------------------------------------------------------------------------
// This static method builds a generic PFKEY API extension data for IPSEC.
// This data contains all parameters needed by the IPSEC to do UDP
// encapsulation/decpsulation for ESP packet. Generic extension data format is
// LID format begining with four bytes extension header. Extension header
// consists two bytes extension length and two bytes  extension ID. LID format
// consists from one byte length, one byte ID and parameter data. 
// Buffer format: HL,HID,LID,LID,...LID
// Generic extension data buffer handling macros are defined in pfkeyext.h
// (common macros with IPSEC)
// ---------------------------------------------------------------------------
//
EXPORT_C void PFKeyExtDataUtil::BuildUdpEncExtensionData( TDes8& aExtData,
                                                 TUint32 aNAT_D_Flags,
                                                 TBool aNATDetected,
                                                 TBool aNokiaNATProbeUsed,
                                                 TUint16 aUdpEncapsPort,
                                                 TUint16 aKeepAliveTimeout,
                                                 const TInetAddr& aDestinAddr,
                                                 const TInetAddr& aOriginalAddr )
    {
    if ( aNAT_D_Flags )
        {
        aUdpEncapsPort = FLOATED_IKE_PORT; // for IETF specified ESP UDP encapsulation
        if ( ( aNAT_D_Flags & LOCAL_END_NAT ) == 0 )
            {
            aKeepAliveTimeout = 0; // Local end is not behind NAT, no keepalive needed
            }
        }
    else
        {
        //
        // Nokia specific NAT traversal info (=ESP UDP tunneling)  
        // If aNATDetected is true connection is over NAT:ted
        // network (=local end behind NAT). UDP encapsulation shall
        // then be done using configured port iEspUdpPort. If that
        // value is undefined default port 9872 shall be used then.
        // If aNATDetected is false and aNokiaNATProbeUsed is true
        // the NAT probe procedure has confirmed that there is no
        // NAT device between. ESP UDP encapsulation port is zeroed
        // then to avoid unnecessary ESP UDP encapsulation.
        // If aNokiaNATProbeUsed is false ESP UDP encapsulation is done
        // without probing, if any aUdpEncapsPort is defined 
        //
        if ( !aNATDetected && aNokiaNATProbeUsed )
            {
            aUdpEncapsPort = 0;
            }
        }   

    if ( aUdpEncapsPort == 0 )
        {
        aExtData.SetLength(0); // No extension data needed
        return;
        }

    TPfkeyGenExtension NatExtension( aExtData, ESP_UDP_ENCAPSULATION_EXT );
    
    NatExtension.StoreParameter( UDP_ENCAPSULATION_PORT,
                                 2,
                                 (TUint8*)&aUdpEncapsPort );
    
    if ( aKeepAliveTimeout )
        {
        NatExtension.StoreParameter( NAT_KEEPALIVE_TIMEOUT,
                                     2,
                                     (TUint8*)&aKeepAliveTimeout );
        }
    
    if ( aNAT_D_Flags & REMOTE_END_NAT )
        {
        NatExtension.StoreParameter( DESTINATION_ADDRESS,
                                     sizeof(TInetAddr),
                                     (TUint8*)&aDestinAddr );
        }
    
    if ( aOriginalAddr.Family() != KAFUnspec )
        {
        NatExtension.StoreParameter( PEER_ORIGINAL_ADDRESS,
                                     sizeof(TInetAddr),
                                     (TUint8*)&aOriginalAddr );
        }       
    }   
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:83,代码来源:pfkeyextdatautil.cpp


注:本文中的TInetAddr::Family方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。