-
Notifications
You must be signed in to change notification settings - Fork 1
/
sr_if.h
executable file
·62 lines (51 loc) · 1.54 KB
/
sr_if.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*-----------------------------------------------------------------------------
* file: sr_if.h
* date: Sun Oct 06 14:13:13 PDT 2002
* Contact: [email protected]
*
* Description:
*
* Data structures and methods for handeling interfaces
*
*---------------------------------------------------------------------------*/
#ifndef sr_INTERFACE_H
#define sr_INTERFACE_H
#ifdef _LINUX_
#include <stdint.h>
#endif /* _LINUX_ */
#ifdef _SOLARIS_
#include </usr/include/sys/int_types.h>
#endif /* SOLARIS */
#ifdef _DARWIN_
#include <inttypes.h>
#endif
#define sr_IFACE_NAMELEN 32
struct sr_instance;
/* ----------------------------------------------------------------------------
* struct sr_if
*
* Node in the interface list for each router
*
* -------------------------------------------------------------------------- */
struct sr_if
{
char name[sr_IFACE_NAMELEN];
unsigned char addr[6];
uint32_t ip;
uint32_t speed;
volatile uint32_t mask;
struct sr_if* next;
/**** New Fields ****/
uint8_t helloint;
uint32_t neighbor_id;
uint32_t neighbor_ip;
/********************/
};
struct sr_if* sr_get_interface(struct sr_instance* sr, const char* name);
void sr_add_interface(struct sr_instance*, const char*);
void sr_set_ether_addr(struct sr_instance*, const unsigned char*);
void sr_set_ether_ip(struct sr_instance*, uint32_t ip_nbo);
void sr_set_ether_mask(struct sr_instance*, uint32_t ip_nbo);
void sr_print_if_list(struct sr_instance*);
void sr_print_if(struct sr_if*);
#endif /* -- sr_INTERFACE_H -- */