forked from voipmonitor/sniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter_mysql.h
103 lines (93 loc) · 1.96 KB
/
filter_mysql.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <map>
#include <vector>
#include <deque>
#include <deque>
#define FLAG_RTP (1 << 0)
#define FLAG_NORTP (1 << 1)
#define FLAG_SIP (1 << 2)
#define FLAG_NOSIP (1 << 3)
#define FLAG_REGISTER (1 << 4)
#define FLAG_NOREGISTER (1 << 5)
#define FLAG_GRAPH (1 << 6)
#define FLAG_NOGRAPH (1 << 7)
#define FLAG_WAV (1 << 8)
#define FLAG_NOWAV (1 << 9)
#define FLAG_SKIP (1 << 10)
#define FLAG_NOSKIP (1 << 11)
#define FLAG_SCRIPT (1 << 12)
#define FLAG_NOSCRIPT (1 << 13)
#define FLAG_AMOSLQO (1 << 14)
#define FLAG_BMOSLQO (1 << 15)
#define FLAG_ABMOSLQO (1 << 16)
#define FLAG_NOMOSLQO (1 << 17)
#define MAX_PREFIX 64
class IPfilter {
private:
struct db_row {
unsigned int ip;
int mask;
int direction;
int rtp;
int sip;
int reg;
int graph;
int wav;
int skip;
int mos_lqo;
int script;
};
struct t_node {
unsigned int ip;
int mask;
int direction;
unsigned int flags;
t_node *next;
};
t_node *first_node;
public:
IPfilter();
~IPfilter();
int count;
void load();
void dump();
int add_call_flags(unsigned int *flags, unsigned int saddr, unsigned int daddr);
};
class TELNUMfilter {
private:
struct db_row {
char prefix[MAX_PREFIX];
int direction;
int rtp;
int sip;
int reg;
int graph;
int wav;
int skip;
int mos_lqo;
int script;
};
struct t_payload {
char prefix[MAX_PREFIX];
int direction;
unsigned int ip;
int mask;
unsigned int flags;
};
struct t_node_tel {
t_node_tel *nodes[256];
t_payload *payload;
};
t_node_tel *first_node;
public:
TELNUMfilter();
~TELNUMfilter();
int count;
void load();
void dump(t_node_tel *node = NULL);
void add_payload(t_payload *payload);
int add_call_flags(unsigned int *flags, char *telnum_src, char *telnum_dst);
};