forked from voipmonitor/sniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mgcp.h
98 lines (83 loc) · 1.74 KB
/
mgcp.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
#ifndef MGCP_H
#define MGCP_H
#include <string>
#include "tools.h"
enum eMgcpRequestType {
_mgcp_na,
_mgcp_EPCF,
_mgcp_CRCX,
_mgcp_MDCX,
_mgcp_DLCX,
_mgcp_RQNT,
_mgcp_NTFY,
_mgcp_AUEP,
_mgcp_AUCX,
_mgcp_RSIP,
_mgcp_MESG
};
struct sMgcpRequestType {
eMgcpRequestType type;
const char *string;
const char *description;
};
struct sMgcpParameters {
sMgcpParameters() {
}
bool is_set() {
return(!call_id.empty() ||
!requested_events.empty() ||
!connection_mode.empty());
}
void debug_output();
std::string call_id;
std::string requested_events;
std::string connection_mode;
};
struct sMgcpRequest {
sMgcpRequest() {
type = _mgcp_na;
transaction_id = 0;
version_prefix_ok = false;
}
bool is_set() {
return(type != _mgcp_na && transaction_id);
}
bool is_set_call_id() {
return(!parameters.call_id.empty());
}
string call_id() {
return("MGCP#" + parameters.call_id + "/" + intToString(transaction_id));
}
void debug_output(const char *firstLineSuffix);
eMgcpRequestType type;
u_int32_t transaction_id;
std::string endpoint;
bool version_prefix_ok;
std::string version;
sMgcpParameters parameters;
u_int64_t time;
};
struct sMgcpResponse {
sMgcpResponse() {
code = -1;
transaction_id = 0;
}
bool is_set() {
return(code >= 0 && transaction_id);
}
void debug_output();
int code;
u_int32_t transaction_id;
std::string response;
sMgcpParameters parameters;
u_int64_t time;
};
struct sMgcpRequestResponse {
u_int64_t request_time;
u_int64_t response_time;
};
eMgcpRequestType check_mgcp_request(char *data, unsigned long len);
int check_mgcp_response(char *data, unsigned long len);
bool check_mgcp(char *data, unsigned long len);
void *handle_mgcp(struct packet_s_process *packetS);
#endif