-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathip_linked_list.h
More file actions
38 lines (27 loc) · 986 Bytes
/
ip_linked_list.h
File metadata and controls
38 lines (27 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __IP_LINKED_LIST__
#define __IP_LINKED_LIST__
#include <semaphore.h>
#include "definitions.h"
// Node of the linked list where the ARP table will be stored
typedef struct LNode
{
unsigned int dstIP;
unsigned int gatewayIP; // aka next hop
unsigned int netmask;
char ifaceName[MAX_IFNAME_LEN];
char ifaceID;
short int ttl;
sem_t semaphore;
struct LNode *next;
} IPNode;
char addLine(IPNode*, IPNode*);
char removeLine(IPNode*, unsigned int, unsigned int, unsigned int);
IPNode* newLine(unsigned int, unsigned int, unsigned int, short int, char, char*);
// This functions returns a pointer to the previous node
// of the node who has the requested target and gateway ipAddress and netmask
// if Null means that there is no node with the exact three numbers
IPNode* searchLine(IPNode*, unsigned int, unsigned int, unsigned int);
IPNode* searchLineWithMask(IPNode *, unsigned int );
void printLine(IPNode*, unsigned int);
void printTable(IPNode*);
#endif