OSPF Hello Packet Format 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Version # | 1 | Packet length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Router ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Area ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | AuType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Network Mask | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | HelloInterval | Options | Rtr Pri | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RouterDeadInterval | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Designated Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Backup Designated Router | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Neighbor | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Messages from client to server will have only upto the Backup designated router. Server will send its neighbors to the client. Version = 2 from client to server and vice versa Type = Hello(1) from client to server Link State Update (4) from server to client Packet len = length of the packet Router ID = Local IP address Area ID = 0 for all Checksum = 0 AuType = 0 if no auth, 1 for MD5, 2 for SHA-1 Auth = 0 if no auth Netmask = local subnet mask Options = 0 RtrPri = 0 RouterDeadInterval = 0 Designated Router = server IP addr Backup Desig router = 0 Neighbor = 0 In this, create client and server processes that will exchange the messages with the format given above. Client sets type to 1 whereas server sets it to 4. The total length of the packet is calculated and set in packet len. Group 5 will use MD5 authentication whereas Group 13 will use SHA-1 authentication. The authentication data is calculated using the following functions: FOR SHA-1 =========== #include unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md); FOR MD5 ======== #include unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); SHA-1 returns a 20 byte character string and MD5 returns a 16-byte string. Truncate it to 8 bytes and copy those 8 bytes to the authentication field in the message format. Apply this on a string accepted from the client. Server will copy that in the reply sent back to the client. Verify that it is same as that sent. Group 5 : Implement as a TCP concurrent server with processes Group 13 : Implement as a TCP concurrent server with threads