2 * hep related structure
4 * Copyright (C) 2011-14 Alexandr Dubovikov <alexandr.dubovikov@gmail.com>
6 * This file is part of Kamailio, a free SIP server.
8 * Kamailio is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version
13 * Kamailio is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "../../endianness.h"
29 #ifdef __IS_BIG_ENDIAN
30 #define to_le(x) bswap32(x)
36 typedef uint8_t u_int8_t;
37 typedef uint16_t u_int16_t;
38 typedef uint32_t u_int32_t;
39 #define IPPROTO_IPIP IPPROTO_ENCAP /* Solaris IPIP protocol has name ENCAP */
42 extern int hep_capture_on;
43 extern int hep_offset;
45 extern char *correlation_id;
47 /* int hep_msg_received(char * buf, unsigned int len, struct receive_info * ri);*/
48 int hep_msg_received(void *data);
50 /* new method for events */
51 int hepv3_message_parse(char *buf, unsigned int len, sip_msg_t* msg);
52 int hepv2_message_parse(char *buf, unsigned int len, sip_msg_t* msg);
53 int hepv3_get_chunk(struct sip_msg *msg, char *buf, unsigned int len, int req_chunk, pv_param_t *param, pv_value_t *res);
58 u_int8_t hp_v; /* version */
59 u_int8_t hp_l; /* length */
60 u_int8_t hp_f; /* family */
61 u_int8_t hp_p; /* protocol */
62 u_int16_t hp_sport; /* source port */
63 u_int16_t hp_dport; /* destination port */
67 struct in_addr hp_src;
68 struct in_addr hp_dst; /* source and dest address */
72 u_int32_t tv_sec; /* seconds */
73 u_int32_t tv_usec; /* useconds */
74 u_int16_t captid; /* Capture ID node */
78 u_int32_t tv_sec; /* seconds */
79 u_int32_t tv_usec; /* useconds */
80 u_int32_t captid; /* Capture ID node */
84 struct in6_addr hp6_src; /* source address */
85 struct in6_addr hp6_dst; /* destination address */
94 } __attribute__((packed));
96 typedef struct hep_chunk hep_chunk_t;
98 struct hep_chunk_uint8 {
101 } __attribute__((packed));
103 typedef struct hep_chunk_uint8 hep_chunk_uint8_t;
105 struct hep_chunk_uint16 {
108 } __attribute__((packed));
110 typedef struct hep_chunk_uint16 hep_chunk_uint16_t;
112 struct hep_chunk_uint32 {
115 } __attribute__((packed));
117 typedef struct hep_chunk_uint32 hep_chunk_uint32_t;
119 struct hep_chunk_str {
122 } __attribute__((packed));
124 typedef struct hep_chunk_str hep_chunk_str_t;
126 struct hep_chunk_ip4 {
129 } __attribute__((packed));
131 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
133 struct hep_chunk_ip6 {
135 struct in6_addr data;
136 } __attribute__((packed));
138 typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
140 struct hep_chunk_payload {
143 } __attribute__((packed));
145 typedef struct hep_chunk_payload hep_chunk_payload_t;
151 } __attribute__((packed));
153 typedef struct hep_ctrl hep_ctrl_t;
156 /* Structure of HEP */
158 struct hep_generic_recv {
160 hep_chunk_uint8_t *ip_family;
161 hep_chunk_uint8_t *ip_proto;
162 hep_chunk_uint16_t *src_port;
163 hep_chunk_uint16_t *dst_port;
164 hep_chunk_uint32_t *time_sec;
165 hep_chunk_uint32_t *time_usec;
166 hep_chunk_ip4_t *hep_src_ip4;
167 hep_chunk_ip4_t *hep_dst_ip4;
168 hep_chunk_ip6_t *hep_src_ip6;
169 hep_chunk_ip6_t *hep_dst_ip6;
170 hep_chunk_uint8_t *proto_t;
171 hep_chunk_uint32_t *capt_id;
172 hep_chunk_uint16_t *keep_tm;
173 hep_chunk_str_t *auth_key;
174 hep_chunk_str_t *correlation_id;
175 hep_chunk_t *payload_chunk;
176 } __attribute__((packed));
178 typedef struct hep_generic_recv hep_generic_recv_t;