Show
Ignore:
Timestamp:
06/03/10 22:43:33 (2 years ago)
Author:
mwhitworth
Message:

Add to network stack.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/netchannel/user/sdk/network/socket.c

    r2096 r2099  
    11#include <net/socket.h> 
     2#include <net/inet_raw.h> 
    23 
    34#include <stdio.h> 
    45 
    5 #include "tcp.h" 
     6#include "tcp/tcp.h" 
    67#include "udp.h" 
    78 
     
    1213                return -1; 
    1314 
    14         if (type == NET_TYPE_STREAM) 
     15        memset(socket, 0, sizeof(Socket)); 
     16 
     17        switch (type) 
    1518        { 
    16                 return _TcpSocketCreate(socket); 
    17         }else{ 
    18                 return _UdpSocketCreate(socket); 
     19                case NET_TYPE_STREAM: 
     20                        return _TcpSocketCreate(socket); 
     21 
     22                case NET_TYPE_DGRAM: 
     23                        return _UdpSocketCreate(socket); 
     24 
     25                case NET_TYPE_DIAG: 
     26                        return _IcmpSocketCreate(socket); 
    1927        } 
    2028 
     
    4048int SocketAccept(Socket* socket, Socket* child, struct SockAddr* addr, int* addrLen) 
    4149{ 
    42         printf("SocketAccept(%#X, %#X, %#X, %#X)\n", socket, child, addr, addrLen); 
    43  
    44         printf("accept = %#X\n", socket->ops->accept); 
    45  
    4650        if (socket && socket->ops && socket->ops->accept) 
    4751                return socket->ops->accept(socket, child, addr, addrLen);