Show
Ignore:
Timestamp:
05/14/08 00:02:22 (4 months ago)
Author:
mwhitworth
Message:

Build the network subsystem as a module.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/hybrid/net/socket.c

    r333 r503  
    2323#include <fs/vfs.h> 
    2424#include <malloc.h> 
     25#include <module.h> 
    2526#include <net/network.h> 
    2627#include <net/socket.h> 
     
    8687 
    8788        if (UNLIKELY(!file)) 
    88                 return -EBADF; 
     89                return; 
    8990 
    9091        file->vNode=NULL; 
     
    167168} 
    168169 
     170/* Make local-only? */ 
    169171int SocketDoAccept(struct Socket* server, struct Socket* client, struct Socket** child) 
    170172{ 
     
    186188} 
    187189 
     190SYMBOL_EXPORT(SocketDoAccept); 
     191 
    188192struct SocketBuffer* SocketAllocateBuffer(const void* buffer, int length) 
    189193{ 
     
    200204} 
    201205 
     206SYMBOL_EXPORT(SocketAllocateBuffer); 
     207 
    202208int SocketDestroyBuffer(struct SocketBuffer* sockBuff) 
    203209{ 
     
    207213} 
    208214 
     215SYMBOL_EXPORT(SocketDestroyBuffer); 
     216 
    209217int SocketPoll(struct File* file, struct PollItem* item, struct PollQueue* pollQueue) 
    210218{ 
     
    221229{ 
    222230        struct VMArea* base, *curr; 
    223         int verifiedLen=0; 
     231        DWORD verifiedLen=0; 
    224232 
    225233        base=VmLookupAddress(current, (DWORD)buffer); 
     
    435443} 
    436444 
     445SYMBOL_EXPORT(SocketRegisterFamily); 
     446 
     447#define NET_SYS_BASE    42 
     448 
    437449int SocketInit() 
    438450{ 
     
    442454                return -ENOMEM; 
    443455 
    444         return 0; 
    445 } 
    446  
     456        /* Register system calls. */ 
     457        SysRegisterCall(NET_SYS_BASE+0, (DWORD)&SysSocketCreate); 
     458        SysRegisterCall(NET_SYS_BASE+1, (DWORD)&SysSocketBind); 
     459        SysRegisterCall(NET_SYS_BASE+2, (DWORD)&SysSocketConnect); 
     460        SysRegisterCall(NET_SYS_BASE+3, (DWORD)&SysSocketListen); 
     461        SysRegisterCall(NET_SYS_BASE+4, (DWORD)&SysSocketAccept); 
     462        SysRegisterCall(NET_SYS_BASE+5, (DWORD)&SysSocketSend); 
     463        SysRegisterCall(NET_SYS_BASE+6, (DWORD)&SysSocketReceive); 
     464        SysRegisterCall(NET_SYS_BASE+7, (DWORD)&SysSocketIoCtl); 
     465        SysRegisterCall(NET_SYS_BASE+8, (DWORD)&SysSocketClose); 
     466 
     467        return 0; 
     468} 
     469