コード例 #1
0
/*----------------------------------------------------------------------*
                          rtp_sig_semaphore_clear
 *----------------------------------------------------------------------*/
void rtp_sig_semaphore_clear (RTP_SEMAPHORE semHandle)
{
    NATIVE_PROFILE_PAL_NETWORK();

	pollos_clear_q((P_POLLOS_SIGNAL)semHandle);

}
コード例 #2
0
/*----------------------------------------------------------------------*
                          rtp_sig_semaphore_wait
 *----------------------------------------------------------------------*/
int rtp_sig_semaphore_wait (RTP_SEMAPHORE semHandle)
{
    NATIVE_PROFILE_PAL_NETWORK();

    return (!pollos_test((P_POLLOS_SIGNAL)semHandle, RTP_TIMEOUT_INFINITE));

}
コード例 #3
0
void lwip_network_uptime_completion(void *arg)
{
    NATIVE_PROFILE_PAL_NETWORK();

    struct netif* pNetIf = (struct netif*)arg;

    BOOL status = enc28j60_get_link_status(&g_ENC28J60_LWIP_Config.DeviceConfigs[0].SPI_Config);

    if(status != LwipNetworkStatus)
    {        
        if(status)
        {
            tcpip_callback((sys_timeout_handler)netif_set_link_up, (void*)pNetIf);
            tcpip_callback((sys_timeout_handler)netif_set_up, (void*)pNetIf);

            Network_PostEvent( NETWORK_EVENT_TYPE__AVAILABILITY_CHANGED, NETWORK_EVENT_FLAGS_IS_AVAILABLE );
        }
        else
        {
            tcpip_callback((sys_timeout_handler)netif_set_link_down, (void*)pNetIf);
            tcpip_callback((sys_timeout_handler)netif_set_down, (void*)pNetIf);

            Network_PostEvent( NETWORK_EVENT_TYPE__AVAILABILITY_CHANGED, 0);
        }

        Events_Set(SYSTEM_EVENT_FLAG_SOCKET);
        Events_Set(SYSTEM_EVENT_FLAG_NETWORK);

        LwipNetworkStatus = status;
    }

    LwipUpTimeCompletion.EnqueueDelta64( 2000000 );
}
コード例 #4
0
HRESULT RTIP_SOCKETS_Driver::LoadAdapterConfiguration( UINT32 interfaceIndex, SOCK_NetworkConfiguration* config )
{
    NATIVE_PROFILE_PAL_NETWORK();
    if(interfaceIndex >= NETWORK_INTERFACE_COUNT) 
    {
        return CLR_E_INVALID_PARAMETER;
    }

    memcpy(config, &g_NetworkConfig.NetworkInterfaces[interfaceIndex], sizeof(g_NetworkConfig.NetworkInterfaces[interfaceIndex]));

    if(config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DHCP)
    {
        IFACE_INFO info;
        
        if(SOCK_SOCKET_ERROR != xn_interface_info(g_RTIP_SOCKETS_Driver.m_interfaces[interfaceIndex].m_interfaceNumber, &info ))
        {
            config->ipaddr     = *(UINT32*)info.my_ip_address;
            config->subnetmask = *(UINT32*)info.ip_mask;
            config->gateway    = *(UINT32*)info.gateways[0];
            config->dnsServer1 = *(UINT32*)info.dns_servers[0];
            config->dnsServer2 = *(UINT32*)info.dns_servers[1];
        }
        else
        {
            config->ipaddr     = 0;
            config->subnetmask = 0;
            config->gateway    = 0;
        }
    }
    
    
    return S_OK;
}
コード例 #5
0
void HAL_SOCK_EventsSet( UINT32 events ) 
{
    NATIVE_PROFILE_PAL_NETWORK();
    ASSERT( (events == SOCKET_EVENT_FLAG_SOCKET) || (events == SOCKET_EVENT_FLAG_SOCKETS_READY));

    Events_Set( SYSTEM_EVENT_FLAG_SOCKET );
}
コード例 #6
0
HRESULT LWIP_SOCKETS_Driver::LoadAdapterConfiguration( UINT32 interfaceIndex, SOCK_NetworkConfiguration* config )
{
    NATIVE_PROFILE_PAL_NETWORK();

    if(interfaceIndex >= NETWORK_INTERFACE_COUNT) 
    {
        return CLR_E_INVALID_PARAMETER;
    }

    memcpy(config, &g_NetworkConfig.NetworkInterfaces[interfaceIndex], sizeof(g_NetworkConfig.NetworkInterfaces[interfaceIndex]));

    if(config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DHCP)
    {
        struct netif *pNetIf;

        if (pNetIf = netif_find_interface(g_LWIP_SOCKETS_Driver.m_interfaces[interfaceIndex].m_interfaceNumber))
        {
            config->ipaddr     = pNetIf->ip_addr.addr;
            config->subnetmask = pNetIf->netmask.addr;
            config->gateway    = pNetIf->gw.addr;
#if LWIP_DNS
            config->dnsServer1 = dns_getserver(0).addr;
            config->dnsServer2 = dns_getserver(1).addr;
#endif
        }
        else
        {
            config->ipaddr     = 0;
            config->subnetmask = 0;
            config->gateway    = 0;
        }
    }
    
    return S_OK;
}
コード例 #7
0
int RTIP_SOCKETS_Driver::SendTo( SOCK_SOCKET s, const char* buf, int len, int flags, const SOCK_sockaddr* to, int tolen )
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int    ret;
    UINT32 ipAddr;
    int    port;

    if(to == NULL)
    {
        set_errno(EINVAL);
        return SOCK_SOCKET_ERROR;
    }
    
    ipAddr = ((SOCK_sockaddr_in *) to)->sin_addr.S_un.S_addr;
    port   = ((SOCK_sockaddr_in *) to)->sin_port;

    ret = rtp_net_sendto ((RTP_HANDLE) s,
                                (const unsigned char *) buf, 
                                len,
                                (unsigned char *)&ipAddr,
                                port, 
                                RTP_NET_TYPE_IPV4,
                                flags);

    return ret;
}
コード例 #8
0
void lwip_network_uptime_completion(void *arg)
{
    NATIVE_PROFILE_PAL_NETWORK();

    BOOL status = ENET_PHY_lwip_get_link_status( );

    if(status != LwipNetworkStatus)
    {
        struct netif* pNetIf = (struct netif*)arg;

        if(status)
        {
            SOCK_NetworkConfiguration *pNetCfg = &g_NetworkConfig.NetworkInterfaces[0];

            ENET_PHY_lwip_set_link_speed( );
            netif_set_up( pNetIf );

            if(pNetCfg->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DHCP)
            {
                dhcp_start( pNetIf );
            }
            Network_PostEvent( NETWORK_EVENT_TYPE__AVAILABILITY_CHANGED, NETWORK_EVENT_FLAGS_IS_AVAILABLE );
        }
        else
        {
            netif_set_down( (struct netif*)arg );
            Network_PostEvent( NETWORK_EVENT_TYPE__AVAILABILITY_CHANGED, 0);
        }

        LwipNetworkStatus = status;
    }

    LwipUpTimeCompletion.EnqueueDelta64( 2000000 );
}
コード例 #9
0
int RTIP_SOCKETS_Driver::Ioctl( SOCK_SOCKET socket, int cmd, int* data )
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int ret = SOCK_SOCKET_ERROR;
    int blocking = !(*data);
    int nToRead;
    
    switch( cmd )
    {
        case SOCK_FIONBIO:
            ret = rtp_net_setblocking((RTP_SOCKET) socket, 
                                        (unsigned int) blocking);
            break; 
        case SOCK_FIONREAD:
            ret = rtp_net_getntoread ((RTP_SOCKET) socket, 
                                        (unsigned long *) &nToRead);
            *data = nToRead;
            
            if (ret != -1)
            {
                return nToRead;
            }
            break; 
        default:
            ret = 0;
            break;
    }
    
    return ret;
}
コード例 #10
0
ファイル: rtpthrd.cpp プロジェクト: Wampamba-Nooh/NETMF-LPC
/*----------------------------------------------------------------------*
                            rtp_threads_init
 *----------------------------------------------------------------------*/
int rtp_threads_init (void)
{   
    NATIVE_PROFILE_PAL_NETWORK();
    int i;
    
#if (INCLUDE_RUN_TIME_CONFIG)
    IPTaskContinuation = (HAL_CONTINUATION  *) rtp_malloc(sizeof(HAL_CONTINUATION) * CFG_NIFACES);           
    InterruptTaskContinuation = (HAL_CONTINUATION  *) rtp_malloc(sizeof(HAL_CONTINUATION) * CFG_NIFACES);
    IPTaskInitialized = (int *) rtp_malloc(sizeof(int) * CFG_NIFACES);  
    InterruptTaskContInitialized = (int *) rtp_malloc(sizeof(int) * CFG_NIFACES);  

    if ( ((int)IPTaskContinuation== -1) || ((int)InterruptTaskContinuation== -1) || 
         ((int)IPTaskInitialized== -1) || ((int)InterruptTaskContInitialized== -1) )
    {
        return (-1);
    }
    if ( ((int)IPTaskContinuation== NULL) || ((int)InterruptTaskContinuation== NULL) || 
         ((int)IPTaskInitialized== NULL) || ((int)InterruptTaskContInitialized== NULL) )
    {
        return (-1);
    }
#endif

    for (i = 0; i < CFG_NIFACES; i++)
    {
        IPTaskInitialized[i] = 0;
        InterruptTaskContInitialized[i] = 0;
    }
    TimerTaskContInitialized = 0;        
    TimerTaskCompInitialized = 0;                 
    DHCPTaskInitialized = 0;                     
    
    return (0);
}   
コード例 #11
0
/*----------------------------------------------------------------------*
                         rtp_sig_semaphore_free
 *----------------------------------------------------------------------*/
void rtp_sig_semaphore_free (RTP_SEMAPHORE semHandle)
{
    NATIVE_PROFILE_PAL_NETWORK();

	rtp_free((void *)semHandle);

}
コード例 #12
0
int RTIP_SOCKETS_Driver::GetNativeIPOption (int optname)
{
    NATIVE_PROFILE_PAL_NETWORK();
    int nativeOptionName;
    
    switch(optname)
    {
        case SOCK_IPO_MULTICAST_IF:    
            nativeOptionName = RTP_NET_IP_OPTS_MULTICAST_IF;
            break;         
        case SOCK_IPO_MULTICAST_TTL:   
            nativeOptionName = RTP_NET_IP_OPTS_MULTICAST_TTL;
            break;         
        case SOCK_IPO_MULTICAST_LOOP:
            nativeOptionName = RTP_NET_IP_OPTS_MULTICAST_LOOP;
            break;
        case SOCK_IPO_ADD_MEMBERSHIP:  
            nativeOptionName = RTP_NET_IP_OPTS_ADD_MEMBERSHIP;
            break;         
        case SOCK_IPO_DROP_MEMBERSHIP: 
            nativeOptionName = RTP_NET_IP_OPTS_DROP_MEMBERSHIP;
            break;         
        case SOCK_IPO_IP_DONTFRAGMENT:
            nativeOptionName = RTP_NET_IP_OPTS_DONTFRAG;
            break;
        case SOCK_IPO_TTL:
            nativeOptionName = RTP_NET_SO_IP_TTL;
            break;
        default:
            nativeOptionName = 0;
            break;
    }   
    
    return nativeOptionName;
}   
コード例 #13
0
int rtp_get_gmt_date (RTP_DATE * gmDate, unsigned long utcSec)
{
    NATIVE_PROFILE_PAL_NETWORK();

    SSL_GetTime( (DATE_TIME_INFO*) gmDate );
    
    return (1);
}
コード例 #14
0
ファイル: rtpthrd.cpp プロジェクト: Wampamba-Nooh/NETMF-LPC
/** @memo   Shutdown the RTPlatform thread API.

    @doc    When use of the RTPlatform thread API is no longer 
    needed, this function clears and/or releases any allocated 
    resources setup by the rtp_threads_init function call.

    @return void
 */
void rtp_threads_shutdown_cooperative (void)
{
    NATIVE_PROFILE_PAL_NETWORK();
    if (rtp_threads_up_cooperative > 0)
    {
        rtp_threads_up_cooperative --;
    }
}
コード例 #15
0
ファイル: rtpthrd.cpp プロジェクト: Wampamba-Nooh/NETMF-LPC
/*----------------------------------------------------------------------*
                            rtp_thrd_ip_process
 *----------------------------------------------------------------------*/
void rtp_thrd_ip_process(void* arg)
{
    NATIVE_PROFILE_PAL_NETWORK();
    
    tc_ip_process((int*)arg);
    SOCKETS_ProcessSocketActivity(SOCK_SOCKET_ERROR);
    
}
コード例 #16
0
ファイル: rtpthrd.cpp プロジェクト: Wampamba-Nooh/NETMF-LPC
/*----------------------------------------------------------------------*
                            rtp_thrd_timer_continuation
 *----------------------------------------------------------------------*/
void rtp_thrd_timer_continuation(void* arg)
{
    NATIVE_PROFILE_PAL_NETWORK();
    
    /* Step the time in the stack and handle timeouts if any */
    tc_timer_main();
    
}
コード例 #17
0
int LWIP_SOCKETS_Driver::GetSockOpt( SOCK_SOCKET socket, int level, int optname, char* optval, int* optlen )
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int         nativeLevel;
    int         nativeOptionName;
    char*       pNativeOptval = optval;
    int         ret;
    
    switch(level)
    {
        case SOCK_IPPROTO_IP:
            nativeLevel         = IPPROTO_IP;
            nativeOptionName    = GetNativeIPOption(optname);
            break;
        case SOCK_IPPROTO_TCP:    
            nativeLevel         = IPPROTO_TCP;
            nativeOptionName    = GetNativeTcpOption(optname);
            break;
        case SOCK_IPPROTO_UDP: 
        case SOCK_IPPROTO_ICMP:
        case SOCK_IPPROTO_IGMP:
        case SOCK_IPPROTO_IPV4:
        case SOCK_SOL_SOCKET:
            nativeLevel         = SOL_SOCKET;
            nativeOptionName    = GetNativeSockOption(optname);
            break;
        default:
            nativeLevel         = level;
            nativeOptionName    = optname;
            break;
    }

    ret = lwip_getsockopt(socket, nativeLevel, nativeOptionName, pNativeOptval, (u32_t*)optlen);

    if(ret == 0)
    {
        switch(level)
        {
            case SOCK_SOL_SOCKET:
                switch(optname)
                {
                    case SOCK_SOCKO_EXCLUSIVEADDRESSUSE:
                    case SOCK_SOCKO_DONTLINGER:
                        *optval = !(*(int*)optval != 0);
                        break;
                        
                    case SOCK_SOCKO_ACCEPTCONNECTION:
                    case SOCK_SOCKO_BROADCAST:
                    case SOCK_SOCKO_KEEPALIVE:
                        *optval = (*(int*)optval != 0);
                        break;
                }
                break;
        }
    }

    return ret;    
}
コード例 #18
0
int RTIP_SOCKETS_Driver::Close(SOCK_SOCKET socket)
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int ret;
    
    ret = rtp_net_closesocket((RTP_HANDLE) socket);
    
    return ret;
}
コード例 #19
0
int RTIP_SOCKETS_Driver::GetLastError()
{
    NATIVE_PROFILE_PAL_NETWORK();
    int err = 0;
    
    err = rtp_net_getlasterror();

    return GetNativeError(err);
}
コード例 #20
0
int LWIP_SOCKETS_Driver::GetNativeIPOption (int optname)
{
    NATIVE_PROFILE_PAL_NETWORK();
    int nativeOptionName = 0;

    switch(optname)
    {
        case SOCK_IPO_TTL:           
            nativeOptionName = IP_TTL;
            break;
        case SOCK_IPO_TOS:    
            nativeOptionName = IP_TOS;
            break;
#if LWIP_IGMP
        case SOCK_IPO_MULTICAST_IF:
            nativeOptionName = IP_MULTICAST_IF;
            break;
        case SOCK_IPO_MULTICAST_TTL:  
            nativeOptionName = IP_MULTICAST_TTL;
            break;
        case SOCK_IPO_MULTICAST_LOOP: 
            nativeOptionName = IP_MULTICAST_LOOP;
            break;
        case SOCK_IPO_ADD_MEMBERSHIP:
            nativeOptionName = IP_ADD_MEMBERSHIP;
            break;
        case SOCK_IPO_DROP_MEMBERSHIP:
            nativeOptionName = IP_DROP_MEMBERSHIP;
            break;
#else
        case SOCK_IPO_MULTICAST_IF:
        case SOCK_IPO_MULTICAST_TTL:  
        case SOCK_IPO_MULTICAST_LOOP: 
        case SOCK_IPO_ADD_MEMBERSHIP:
        case SOCK_IPO_DROP_MEMBERSHIP:
#endif
        case SOCK_IPO_ADD_SOURCE_MEMBERSHIP:
        case SOCK_IPO_DROP_SOURCE_MEMBERSHIP:
        case SOCK_IPO_OPTIONS:
        case SOCK_IPO_HDRINCL:
        case SOCK_IPO_IP_DONTFRAGMENT:
        case SOCK_IPO_BLOCK_SOURCE:
        case SOCK_IPO_UBLOCK_SOURCE:
        case SOCK_IPO_PACKET_INFO: 
            nativeOptionName = 0;
            break;

        // allow the C# user to specify LWIP options that our managed enum
        // doesn't support
        default:
            nativeOptionName = optname;
            break;
    }
    
    return nativeOptionName;
}   
コード例 #21
0
ファイル: rtpthrd.cpp プロジェクト: Wampamba-Nooh/NETMF-LPC
/*----------------------------------------------------------------------*
                            rtp_thrd_interrupt_continuation
 *----------------------------------------------------------------------*/
void rtp_thrd_interrupt_continuation(int index)
{
    NATIVE_PROFILE_PAL_NETWORK();
    GLOBAL_LOCK(irq);
    
    if(!InterruptTaskContinuation[index].IsLinked())
    {
        InterruptTaskContinuation[index].Enqueue();
    }
}
コード例 #22
0
void lwip_interrupt_continuation( void )
{
    NATIVE_PROFILE_PAL_NETWORK();
    GLOBAL_LOCK(irq);
    
    if(!InterruptTaskContinuation.IsLinked())
    {
        InterruptTaskContinuation.Enqueue();
    }
}
コード例 #23
0
int LWIP_SOCKETS_Driver::SendTo( SOCK_SOCKET socket, const char* buf, int len, int flags, const SOCK_sockaddr* to, int tolen )
{ 
    NATIVE_PROFILE_PAL_NETWORK();

    sockaddr_in addr;

    SOCK_SOCKADDR_TO_SOCKADDR(to, addr, &tolen);

    return lwip_sendto(socket, buf, len, flags, (sockaddr*)&addr, (u32_t)tolen);
}
コード例 #24
0
int LWIP_SOCKETS_Driver::Connect(SOCK_SOCKET socket, const SOCK_sockaddr* address, int addressLen) 
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    
    sockaddr_in addr;

    SOCK_SOCKADDR_TO_SOCKADDR(address, addr, &addressLen);
        
    return lwip_connect(socket, (sockaddr*)&addr, addressLen);
}
コード例 #25
0
BOOL LWIP_SOCKETS_Driver::Initialize()
{   
    NATIVE_PROFILE_PAL_NETWORK();
    struct netif *pNetIf;

    int i;

    /* Initialize the raw lwIP stack and the tcp_tmr completion */
    lwip_init();
    
#if defined(NETWORK_USE_LOOPBACK)

    /* Bind and Open the loopback driver */
    g_LOOPBACK_LWIP_Driver.Bind();
    g_LOOPBACK_LWIP_Driver.Open();
#endif 

    for(i=0; i<g_NetworkConfig.NetworkInterfaceCount; i++)
    {
        int interfaceNumber;

        SOCK_NetworkConfiguration *pNetCfg = &g_NetworkConfig.NetworkInterfaces[i];

        /* Bind and Open the Ethernet driver */
        Network_Interface_Bind( i );
        interfaceNumber = Network_Interface_Open( i );

        if (interfaceNumber == SOCK_SOCKET_ERROR)
        {
            DEBUG_HANDLE_SOCKET_ERROR("Network init", FALSE);
            debug_printf("SocketError: %d\n", errno);
            continue;
        }
        
        g_LWIP_SOCKETS_Driver.m_interfaces[i].m_interfaceNumber = interfaceNumber;

        UpdateAdapterConfiguration(i, SOCK_NETWORKCONFIGURATION_UPDATE_DHCP | SOCK_NETWORKCONFIGURATION_UPDATE_DNS, pNetCfg);
        
        // default debugger interface
        if(0 == i)
        {
            pNetIf = netif_find_interface(interfaceNumber);

            if (pNetIf)
            {
                UINT8* addr = (UINT8*)&pNetIf->ip_addr.addr;
                lcd_printf( "\f\n\n\n\n\n\n\nip address: %d.%d.%d.%d\r\n", addr[0], addr[1], addr[2], addr[3] );
                debug_printf( "ip address from interface info: %d.%d.%d.%d\r\n", addr[0], addr[1], addr[2], addr[3] );
            }
        }
        
    }

    return TRUE;
}
コード例 #26
0
int LWIP_SOCKETS_Driver::SetSockOpt( SOCK_SOCKET socket, int level, int optname, const char* optval, int  optlen )
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int nativeLevel;
    int nativeOptionName;
    int nativeIntValue;
    char *pNativeOptionValue = (char*)optval;

    switch(level)
    {
        case SOCK_IPPROTO_IP:
            nativeLevel = IPPROTO_IP;
            nativeOptionName = GetNativeIPOption(optname);
            break;
        case SOCK_IPPROTO_TCP:    
            nativeLevel = IPPROTO_TCP;
            nativeOptionName = GetNativeTcpOption(optname);
            break;
        case SOCK_IPPROTO_UDP: 
        case SOCK_IPPROTO_ICMP:
        case SOCK_IPPROTO_IGMP:
        case SOCK_IPPROTO_IPV4:
        case SOCK_SOL_SOCKET:
            nativeLevel      = SOL_SOCKET;
            nativeOptionName = GetNativeSockOption(optname);            

            switch(optname)
            {        
                // LINGER and DONTLINGER are not implemented in LWIP
                case SOCK_SOCKO_LINGER:
                    errno = SOCK_ENOPROTOOPT;
                    return SOCK_SOCKET_ERROR;
                case SOCK_SOCKO_DONTLINGER:
                    errno = SOCK_ENOPROTOOPT;
                    return SOCK_SOCKET_ERROR;
				// ignore this item to enable http to work
				case SOCK_SOCKO_REUSEADDRESS:
					return 0;
                
                case SOCK_SOCKO_EXCLUSIVEADDRESSUSE:
                    nativeIntValue     = !*(int*)optval;
                    pNativeOptionValue = (char*)&nativeIntValue;
                    break;
                default:
                    break;
            }
            break;
        default:
            nativeLevel         = 0;
            nativeOptionName    = 0;
            break;
    }

    return lwip_setsockopt(socket, nativeLevel, nativeOptionName, pNativeOptionValue, optlen);
}
コード例 #27
0
/*----------------------------------------------------------------------*
                         rtp_get_system_msec
 *----------------------------------------------------------------------*/
unsigned long rtp_get_system_msec (void)
{
    NATIVE_PROFILE_PAL_NETWORK();
    UINT64  currentTime;
    
    /* JRT */
    currentTime = HAL_Time_CurrentTime() / 10000;
    
    return ((unsigned long)(currentTime));
    
}
コード例 #28
0
int RTIP_SOCKETS_Driver::RecvFrom( SOCK_SOCKET s, char* buf, int len, int flags, SOCK_sockaddr* from, int* fromlen )
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int             ret;
    int             type;
    int             port;
    UINT32          ipAddr;
    int             nativeFlag;
    
    type = RTP_NET_TYPE_IPV4;
    
    switch (flags)
    {
        case SOCKET_READ_PEEK_OPTION:
            nativeFlag = RTP_NET_MSG_PEEK;
            break;
        default:
            nativeFlag = flags;
            break;
    }
    if(from == NULL)
    {
        ret = (int ) rtp_net_recvfrom ((RTP_HANDLE) s,
                             (unsigned char *)buf, 
                             len,
                             NULL,
                             NULL, 
                             &type,
                             nativeFlag);
    }
    else
    {
        port    = ((SOCK_sockaddr_in *) from)->sin_port;
        ipAddr  = ((SOCK_sockaddr_in *) from)->sin_addr.S_un.S_addr;
    
        ret = (int) rtp_net_recvfrom ((RTP_HANDLE) s,
                             (unsigned char *)buf, 
                             len,
                             (unsigned char*)&ipAddr, 
                             &port,
                             &type, 
                             nativeFlag);

        if (SOCK_SOCKET_ERROR != ret)
        {
            ((SOCK_sockaddr_in *) from)->sin_port             = port;
            ((SOCK_sockaddr_in *) from)->sin_family           = RTP_NET_AF_INET;
            ((SOCK_sockaddr_in *) from)->sin_addr.S_un.S_addr = ipAddr;
        }
    }
        
    return ret; 
}
コード例 #29
0
void LWIP_SOCKETS_Driver::FreeAddrInfo( SOCK_addrinfo* ai )
{ 
    NATIVE_PROFILE_PAL_NETWORK();

    SOCK_addrinfo *next;
    
    while (ai != NULL) {
      next = ai->ai_next;
      mem_free(ai);
      ai = next;
    }
}
コード例 #30
0
int RTIP_SOCKETS_Driver::Send(SOCK_SOCKET socket, const char* buf, int len, int flags) 
{ 
    NATIVE_PROFILE_PAL_NETWORK();
    int ret;
    
    
    ret = (int) rtp_net_send ((RTP_HANDLE) socket, 
                        (const unsigned char *) buf, 
                        len, flags);
                        
    return ret;
}