Updated InitRD to new usermode layout, cleanups in networking
authorJohn Hodge <[email protected]>
Wed, 2 Feb 2011 12:33:49 +0000 (20:33 +0800)
committerJohn Hodge <[email protected]>
Wed, 2 Feb 2011 12:33:49 +0000 (20:33 +0800)
Modules/Filesystems/InitRD/files.lst
Modules/Filesystems/InitRD/main.c
Modules/IPStack/tcp.c
Modules/Network/NE2000/ne2000.c
Usermode/Applications/testclient_src/main.c

index 7ac6083..141e45d 100644 (file)
@@ -1,20 +1,21 @@
 Dir "SBin" {
-       File "init" "../../../Usermode/Applications/init"
-       File "login" "../../../Usermode/Applications/login"
+       File "init" "../../../Usermode/Output/i386/SBin/init"
+       File "login" "../../../Usermode/Output/i386/SBin/login"
 }
 Dir "Bin" {
-       File "CLIShell" "../../../Usermode/Applications/CLIShell"
-       File "ls" "../../../Usermode/Applications/ls"
-       File "cat" "../../../Usermode/Applications/cat"
-       File "mount" "../../../Usermode/Applications/mount"
-       File "pcidump" "../../../Usermode/Applications/pcidump"
+       File "CLIShell" "../../../Usermode/Output/i386/Bin/CLIShell"
+       File "ls" "../../../Usermode/Output/i386/Bin/ls"
+       File "cat" "../../../Usermode/Output/i386/Bin/cat"
+       File "mount" "../../../Usermode/Output/i386/Bin/mount"
+       File "pcidump" "../../../Usermode/Output/i386/Bin/pcidump"
+       File "ifconfig" "../../../Usermode/Output/i386/Bin/ifconfig"
 }
 Dir "Libs" {
-       File "ld-acess.so" "../../../Usermode/Libraries/ld-acess.so"
-       File "libacess.so" "../../../Usermode/Libraries/libacess.so"
-       File "libc.so" "../../../Usermode/Libraries/libc.so"
-       File "libgcc.so" "../../../Usermode/Libraries/libgcc.so"
-       File "libreadline.so" "../../../Usermode/Libraries/libreadline.so"
+       File "ld-acess.so" "../../../Usermode/Output/i386/Libs/ld-acess.so"
+       File "libc.so" "../../../Usermode/Output/i386/Libs/libc.so"
+       File "libgcc.so" "../../../Usermode/Output/i386/Libs/libgcc.so"
+       File "libreadline.so" "../../../Usermode/Output/i386/Libs/libreadline.so"
+       File "libreadline.so" "../../../Usermode/Output/i386/Libs/libnet.so"
 }
 Dir "Conf" {
        File "BootConf.cfg" "../../../Usermode/Filesystem/Conf/BootConf.cfg"
index ff24b51..e578191 100644 (file)
@@ -12,7 +12,7 @@ extern tVFS_Node      gInitRD_RootNode;
 
 // === PROTOTYPES ===
  int   InitRD_Install(char **Arguments);
-tVFS_Node      *InitRD_InitDevice(char *Device, char **Arguments);
+tVFS_Node      *InitRD_InitDevice(const char *Device, const char **Arguments);
 void   InitRD_Unmount(tVFS_Node *Node);
 Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer);
 char   *InitRD_ReadDir(tVFS_Node *Node, int ID);
@@ -38,7 +38,7 @@ int InitRD_Install(char **Arguments)
 /**
  * \brief Mount the InitRD
  */
-tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments)
+tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments)
 {
        #if DUMP_ON_MOUNT
        InitRD_DumpDir( &gInitRD_RootNode, 0 );
index 18150a3..51f6ae4 100644 (file)
@@ -282,14 +282,16 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head
        tTCPStoredPacket        *pkt;
         int    dataLen;
        
+       // Syncronise sequence values
        if(Header->Flags & TCP_FLAG_SYN) {
                Connection->NextSequenceRcv = ntohl(Header->SequenceNumber) + 1;
        }
        
+       // Handle a server replying to our initial SYN
        if( Connection->State == TCP_ST_SYN_SENT )
        {
-               if( (Header->Flags & (TCP_FLAG_SYN|TCP_FLAG_ACK)) == (TCP_FLAG_SYN|TCP_FLAG_ACK) ) {
-                       
+               if( (Header->Flags & (TCP_FLAG_SYN|TCP_FLAG_ACK)) == (TCP_FLAG_SYN|TCP_FLAG_ACK) )
+               {       
                        Header->DestPort = Header->SourcePort;
                        Header->SourcePort = htons(Connection->LocalPort);
                        Header->AcknowlegementNumber = htonl(Connection->NextSequenceRcv);
@@ -303,6 +305,13 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head
                }
        }
        
+       // Handle a client confirming the connection
+       if( Connection->State == TCP_ST_HALFOPEN && (Header->Flags & TCP_FLAG_ACK) )
+       {
+               Connection->State = TCP_ST_OPEN;
+               Log_Log("TCP", "Connection fully opened");
+       }
+       
        // Get length of data
        dataLen = Length - (Header->DataOffset>>4)*4;
        Log_Log("TCP", "HandleConnectionPacket - dataLen = %i", dataLen);
@@ -330,6 +339,7 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head
                }
        }
        
+       // Check for an empty packet
        if(dataLen == 0) {
                Log_Log("TCP", "Empty Packet");
                return ;
index d77bfb8..d5eadb7 100644 (file)
@@ -256,23 +256,7 @@ int Ne2k_IOCtl(tVFS_Node *Node, int ID, void *Data)
        ENTER("pNode iID pData", Node, ID, Data);
        switch( ID )
        {
-       case DRV_IOCTL_TYPE:
-               LEAVE('i', DRV_TYPE_NETWORK);
-               return DRV_TYPE_NETWORK;
-       
-       case DRV_IOCTL_IDENT:
-               tmp = ModUtil_SetIdent(Data, "Ne2k");
-               LEAVE('i', tmp);
-               return tmp;
-       
-       case DRV_IOCTL_VERSION:
-               LEAVE('x', VERSION);
-               return VERSION;
-       
-       case DRV_IOCTL_LOOKUP:
-               tmp = ModUtil_LookupString( (char**)casIOCtls, Data );
-               LEAVE('i', tmp);
-               return tmp;
+       BASE_IOCTLS(DRV_TYPE_NETWORK, "NE2000", VERSION, casIOCtls);
        }
        
        // If this is the root, return
@@ -382,6 +366,7 @@ Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
        
        ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
        
+       // TODO: Use MutexP/MutexV instead
        while(Card->NumWaitingPackets == 0)     Threads_Yield();
        
        // Make sure that the card is in page 0
index 5682a8d..8401e0b 100644 (file)
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
         int    con = -1;
         int    len;
        uint16_t        port;
-       uint8_t buf[4] = {10,0,2,1};
+       uint8_t buf[4] = {10,2,0,37};
        uint8_t data[4096];     // Packet Data
         
        con = open("/Devices/ip/1/tcpc", OPENFLAG_READ|OPENFLAG_WRITE);
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
        ioctl(con, 7, NULL);    // Connect
        
        #define REQ_STR "GET / HTTP/1.1\r\n"\
-               "Host: prelude\r\n"\
+               "Host: sonata\r\n"\
                "User-Agent: Acess2 TCP Test Client\r\n"\
                "\r\n"
        

UCC git Repository :: git.ucc.asn.au