-
Notifications
You must be signed in to change notification settings - Fork 0
/
sr_if.h
60 lines (49 loc) · 1.48 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
/*-----------------------------------------------------------------------------
* file: sr_if.h
* date: Sun Oct 06 14:13:13 PDT 2002
* Contact: [email protected]
*sr_router
* Description:
*
* Data structures and methods for handling 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
#include "sr_protocol.h"
#include "sr_base_internal.h"
#include "sr_utils.h"
#define sr_IFACE_NAMELEN 32
struct sr_router;
/* ----------------------------------------------------------------------------
* struct sr_if
*
* Node in the interface list for each router
*
* -------------------------------------------------------------------------- */
struct sr_if
{
char name[sr_IFACE_NAMELEN];
unsigned char addr[ETHER_ADDR_LEN];
uint32_t ip;
uint32_t speed;
uint32_t mask;
struct sr_if* next;
};
struct sr_if* sr_get_interface(struct sr_router* sr, const char* name);
void sr_add_interface(struct sr_router*, const char*);
void sr_add_iface_from_vns(struct sr_router* sr, struct sr_vns_if* vns_iface);
void sr_set_ether_addr(struct sr_router*, const unsigned char*);
void sr_set_ether_ip(struct sr_router*, uint32_t ip_nbo);
void sr_print_if_list(struct sr_router*);
void sr_print_if(struct sr_if*);
#endif /* -- sr_INTERFACE_H -- */