-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared.h
More file actions
85 lines (64 loc) · 1.4 KB
/
shared.h
File metadata and controls
85 lines (64 loc) · 1.4 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// This file contains the declarations of shared structs and methods
#ifndef SHARED_INCLUDE
#define SHARED_INCLUDE
#include "includes.h"
enum MSG_TYPE {OPEN, ACK, QUERY, ADD, RELAY};
struct Open_Data{
int switch_number;
int left;
int right;
int ip_range_lo;
int ip_range_hi;
void print();
};
struct Ack_Data{
void print();
};
struct Query_Data{
int source_ip;
int dest_ip;
void print();
};
enum actionType {FORWARD, DROP};
string actionType_to_string(enum actionType type);
struct flow_element{
int scrIP_lo;
int scrIP_hi;
int destIP_lo;
int destIP_hi;
enum actionType actionType;
int actionVal;
int pri;
int pktCount;
void print();
};
struct Add_Data{
struct flow_element rule;
void print();
};
struct instruction{
int source_ip;
int dest_ip;
};
struct Relay_Data{
struct instruction ins;
void print();
};
union MSG_DATA {
struct Open_Data open_data;
struct Ack_Data ack_data;
struct Query_Data query_data;
struct Add_Data add_data;
struct Relay_Data relay_data;
};
struct message{
enum MSG_TYPE type;
union MSG_DATA data;
void print();
};
string int_to_string(int i);
string msg_type_to_string(enum MSG_TYPE type);
void get_vector_input(vector<string> *split_input, string input);
void controller_handle_signal_USR1(int sigNo);
void switch_handle_signal_USR1(int sigNo);
#endif