-
Notifications
You must be signed in to change notification settings - Fork 2
/
core_hep.h
161 lines (128 loc) · 4.01 KB
/
core_hep.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
* $Id$
*
* captagent - Homer capture agent. Modular
* Duplicate SIP messages in Homer Encapulate Protocol [HEP] [ipv6 version]
*
* Author: Alexandr Dubovikov <alexandr.dubovikov@gmail.com>
* (C) Homer Project 2012 (http://www.sipcapture.org)
*
* Homer capture agent is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version
*
* Homer capture agent is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define USE_IPV6
#ifdef USE_IPV6
#include <netinet/ip6.h>
#endif /* USE_IPV6 */
int hep_version = 3;
int usessl = 0;
int pl_compress = 0;
struct rc_info {
uint8_t ip_family; /* IP family IPv6 IPv4 */
uint8_t ip_proto; /* IP protocol ID : tcp/udp */
uint8_t proto_type; /* SIP: 0x001, SDP: 0x03*/
char *src_ip;
char *dst_ip;
uint16_t src_port;
uint16_t dst_port;
uint32_t time_sec;
uint32_t time_usec;
uint16_t val1;
uint16_t val2;
} ;
typedef struct rc_info rc_info_t;
/* HEPv3 types */
struct hep_chunk {
uint16_t vendor_id;
uint16_t type_id;
uint16_t length;
} __attribute__((packed));
typedef struct hep_chunk hep_chunk_t;
struct hep_chunk_uint8 {
hep_chunk_t chunk;
uint8_t data;
} __attribute__((packed));
typedef struct hep_chunk_uint8 hep_chunk_uint8_t;
struct hep_chunk_uint16 {
hep_chunk_t chunk;
uint16_t data;
} __attribute__((packed));
typedef struct hep_chunk_uint16 hep_chunk_uint16_t;
struct hep_chunk_uint32 {
hep_chunk_t chunk;
uint32_t data;
} __attribute__((packed));
typedef struct hep_chunk_uint32 hep_chunk_uint32_t;
struct hep_chunk_str {
hep_chunk_t chunk;
char *data;
} __attribute__((packed));
typedef struct hep_chunk_str hep_chunk_str_t;
struct hep_chunk_ip4 {
hep_chunk_t chunk;
struct in_addr data;
} __attribute__((packed));
typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
struct hep_chunk_ip6 {
hep_chunk_t chunk;
struct in6_addr data;
} __attribute__((packed));
typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
struct hep_ctrl {
char id[4];
uint16_t length;
} __attribute__((packed));
typedef struct hep_ctrl hep_ctrl_t;
struct hep_chunk_payload {
hep_chunk_t chunk;
char *data;
} __attribute__((packed));
typedef struct hep_chunk_payload hep_chunk_payload_t;
/* Structure of HEP */
struct hep_generic {
hep_ctrl_t header;
hep_chunk_uint8_t ip_family;
hep_chunk_uint8_t ip_proto;
hep_chunk_uint16_t src_port;
hep_chunk_uint16_t dst_port;
hep_chunk_uint32_t time_sec;
hep_chunk_uint32_t time_usec;
hep_chunk_uint8_t proto_t;
hep_chunk_uint32_t capt_id;
} __attribute__((packed));
typedef struct hep_generic hep_generic_t;
struct hep_hdr{
uint8_t hp_v; /* version */
uint8_t hp_l; /* length */
uint8_t hp_f; /* family */
uint8_t hp_p; /* protocol */
uint16_t hp_sport; /* source port */
uint16_t hp_dport; /* destination port */
};
struct hep_timehdr{
uint32_t tv_sec; /* seconds */
uint32_t tv_usec; /* useconds */
uint16_t captid; /* Capture ID node */
};
struct hep_iphdr{
struct in_addr hp_src;
struct in_addr hp_dst; /* source and dest address */
};
#ifdef USE_IPV6
struct hep_ip6hdr {
struct in6_addr hp6_src; /* source address */
struct in6_addr hp6_dst; /* destination address */
};
#endif