-
Notifications
You must be signed in to change notification settings - Fork 0
/
port.h
44 lines (32 loc) · 1.4 KB
/
port.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
#ifndef PORT_H
#define PORT_H
#include "trema.h"
typedef struct port_info {
uint64_t dpid;
uint16_t port_no;
bool external_link;
bool switch_to_switch_link;
bool switch_to_switch_reverse_link;
} port_info;
typedef struct switch_info {
uint64_t dpid;
list_element *ports; // list of port_info
} switch_info;
void delete_port( list_element **switches, port_info *delete_port );
void add_port( list_element **switches, uint64_t dpid, uint16_t port_no, uint8_t external );
void update_port( port_info *port, uint8_t external );
void delete_all_ports( list_element **switches );
port_info *lookup_port( list_element *switches, uint64_t dpid, uint16_t port_no );
int foreach_port( const list_element *ports,
int ( *function )( port_info *port,
openflow_actions *actions,
uint64_t dpid, uint16_t in_port ),
openflow_actions *actions, uint64_t dpid, uint16_t port );
void foreach_switch( const list_element *switches,
void ( *function )( switch_info *sw,
const buffer *packet,
uint64_t dpid,
uint16_t in_port ),
const buffer *packet, uint64_t dpid, uint16_t in_port );
list_element *create_ports( list_element **switches );
#endif // PORT_H