-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsr_if.h
More file actions
56 lines (45 loc) · 1.49 KB
/
sr_if.h
File metadata and controls
56 lines (45 loc) · 1.49 KB
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
/*-----------------------------------------------------------------------------
* file: sr_if.h
* date: Sun Oct 06 14:13:13 PDT 2002
* Contact: casado@stanford.edu
*
* 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
#include "sr_protocol.h"
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[ETHER_ADDR_LEN];
uint32_t ip;
uint32_t speed;
struct sr_if *next;
};
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_print_if_list(struct sr_instance *);
void sr_print_if(struct sr_if *);
struct sr_if *get_interface_from_ip(struct sr_instance *, uint32_t);
struct sr_if *get_interface_from_eth(struct sr_instance *, uint8_t *);
#endif /* -- sr_INTERFACE_H -- */