-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.h
More file actions
74 lines (73 loc) · 1.49 KB
/
Graph.h
File metadata and controls
74 lines (73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include<vector>
#include<iostream>
using namespace std;
#define rule_set_Size 50
class Src_IP {
public:
Src_IP();
Src_IP(const unsigned int low, const unsigned int high);
unsigned int low;
unsigned int high;
};
class Dst_IP {
public:
Dst_IP();
Dst_IP(const unsigned int low, const unsigned int high);
unsigned int low;
unsigned int high;
};
class Src_PORT {
public:
Src_PORT();
Src_PORT(const unsigned int low, const unsigned int high);
unsigned int low;
unsigned int high;
};
class Dst_PORT {
public:
Dst_PORT();
Dst_PORT(const unsigned int low, const unsigned int high);
unsigned int low;
unsigned int high;
};
class Protocol {
public:
Protocol();
Protocol(const unsigned int value, const unsigned int mask);
unsigned int value;
unsigned int mask;
};
class Node {
public:
Node();
// void Node_Print();
bool flag;
unsigned int priority;
unsigned int position;
unsigned int low_cost;
unsigned int low_cost_index;
unsigned int high_cost;
unsigned int high_cost_index;
Src_IP src_ip;
Dst_IP dst_ip;
Src_PORT src_port;
Dst_PORT dst_port;
Protocol protocol;
vector<int>p_out;
vector<int>p_in;
};
class Graph {
public:
static unsigned int Capability;
static unsigned int N_current;
vector<Node>array;
Graph();
void Graph_Init();
void Graph_Print();
void Graph_Isolated_Node_Find(vector<int>& r);
};
void Graph_Build(Graph& DAG);
bool Node_Overlap(const Node& x,const Node& y);
template <typename T>
bool Range_Overlap(T& x,T& y);
void Find_Relevant_Rule(const Graph& dag,Node& update);