|
| Budget: |
$ 100-300 |
| Status: |
Closed
for Bidding (selected
user daizisheng)
|
| Project
Creator: |
|
| |
        
2
reviews
|
| Required
Skills: |
|
| Attached
Files: |
(None) |
 |
|
|
|
|
|
|
|
|
|
|
Description
Write a program for GNU Linux that simulates the IP routing. The following algorithm MUST be used:
Algorithm:
RouteDatagram ( Datagram, Routing Table)
Extract destination IP address, D, from the datagram And compute the network prefix, N; if N matches any directly connected network address deliver datagram to destination D over that network (This involves resolving D to a physical address, encapsulating the datagram, and sending the frame.) else if the table contains a host-specific route for D send datagram to nest-hop specified in table else if the table contains a route for network N send datagram to next-hop specified in table else if the table contains a default route send datagram to the default router specified in table else declare a routing error.
The algorithm uses IP to forward a datagram. If this program is given an IP datagram and a routing table, this algorithm selects the next hop to which the datagram should be sent. All routes must specify a next hop that lies on a directly connected network. Network topology must vary. The simulation needs to be fairly detailed, with statistics from the routing table like next hop.
Here is sample data for routing test:
M_ENTRIES table = { 4, { {1, 0xc0a80016, 0xffffffff}, {2, 0xabf34718, 0xabf30001}, {3, 0xc0a801ff, 0xc0a80101}, {4, 0xffffffff, 0xc0a80001} } }
unsigned char data1[] = {0x45, 0x20, 0x00, 0x80, 0xD3, 0xD5, 0x00, 0x00, 0x72, 0x11, 0xC5, 0xC9, 0xab, 0xf3, 0x47, 0x18, 0xC0, 0xA8, 0x00, 0x05, 0x98, 0xED, 0x9C, 0x86, 0x00, 0x6C, 0xD7, 0x1A, 0x98, 0xED, 0xC5, 0x1A, 0x00, 0x00, 0x48, 0x23, 0x62, 0x1A, 0x71, 0x78, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x23, 0x7D, 0x00, 0x00, 0x01, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x17, 0x03, 0x00, 0x00, 0x40, 0x1D, 0x02, 0xEC, 0x77, 0x6C, 0xC9, 0xBF, 0x1A, 0x8C, 0x7F, 0x57, 0xB7, 0xC7, 0x5A, 0x00, 0xE5, 0xB3, 0xF4, 0x2B, 0x35, 0x64, 0x2B, 0x0F, 0xD9, 0x5E, 0x0A, 0xBB, 0xEB, 0x4B, 0x67, 0x25, 0x1A, 0xF4, 0x78, 0xCB, 0x36, 0x06, 0x7F, 0xC2, 0xC6, 0xFC, 0xCE, 0x7C, 0x83, 0xFE, 0xB0, 0x9B, 0xC9, 0x0D, 0x8A, 0xB0, 0x21, 0x88, 0x35, 0xAD, 0x15, 0xFD, 0xF3, 0xF0, 0x45, 0x03, 0x5A, 0x86, 0x85, 0x00, 0x00, 0x00 };
here is what program might look like:
/* A structure that defines a single entry The first byte specifies the type of entry. There are three types of entries, 1. A host specific entry 2. A routed network entry 3. A default entry
see for more info:
http://computer.howstuffworks.com/routing-algorithm2.htm http://en.wikipedia.org/wiki/Distance-vector for more info
a directly connected networks are only determined by looking at the machines IP address and the destination IP address. If they both are on the same N then the destination is considered to be on the same network. */ typedef struct entry{
#define DIRECT_NETWORK_ENTRY 1 #define HOST_SPECIFIC_ENTRY 2 #define ROUTED_NETWORK_ENTRY 3 #define DEFAULT_GETEWAY_ENTRY 4 unsigned char type_of_entry;
unsigned char matching_criteria[4]; /* routing decision is based if it matches this address */ unsigned char forwarding_address[4]; /* forwarding or next hop address */
} ENTRY; typedef struct entry * PENTRY;
/* A structure that defines a table of entries
The first element specifies how many entries exist in the table
Each entry that follows is of type ENTRY */ typedef struct multiple_entries { int number_of_entries; PENTRY* entries;
} M_ENTRIES;
typedef struct multiple_entries * P_MENTRIES;
/* An example of a Table ---------------------
M_ENTRIES table = { 3, { {2, 192.168.0.20, 192.168.0.2}, {3, 192.168.1.* , 192.168.1.2}, {4, 192.168.0.* , 192.168.0.1} } }
*/
Reminder
You may not start working in this and any project before
your bid is accepted. Any user who violates this policy
may have their account permanently suspended.
|