13#ifndef PACKET_LBM_H_INCLUDED
14#define PACKET_LBM_H_INCLUDED
79#if defined(__FreeBSD__)
81#include <netinet/in.h>
85#ifdef HAVE_NETINET_IN_H
86# include <netinet/in.h>
95typedef uint8_t lbm_uint8_t;
96typedef uint16_t lbm_uint16_t;
97typedef uint32_t lbm_uint32_t;
98typedef uint64_t lbm_uint64_t;
99#define SIZEOF(TYPE, MEMBER) (int)(sizeof(((TYPE *)0)->MEMBER))
100#define OFFSETOF(TYPE, MEMBER) (int)(offsetof(TYPE, MEMBER))
101#define STRINGIZE(a) #a
102#define MAKESTRING(a) STRINGIZE(a)
103#define LBM_OTID_BLOCK_SZ 32
104#define LBM_CONTEXT_INSTANCE_BLOCK_SZ 8
105#define LBM_HMAC_BLOCK_SZ 20
108#define UAT_IPV4_CB_DEF(basename,field_name,rec_t) \
109 static bool basename ## _ ## field_name ## _chk_cb(void * u1 _U_, const char * strptr, unsigned len _U_, const void * u2 _U_, const void * u3 _U_, char ** err) \
112 if (!ws_inet_pton4(strptr, &addr)) \
114 *err = g_strdup("invalid address"); \
119 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) \
122 char* new_buf = g_strndup(buf,len); \
123 g_free((((rec_t*)rec)->field_name)); \
124 (((rec_t*)rec)->field_name) = new_buf; \
125 ws_inet_pton4(new_buf, &addr); \
126 (((rec_t*)rec)->field_name ## _val_h) = g_ntohl(addr); \
128 static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
130 if (((rec_t*)rec)->field_name ) \
132 *out_ptr = g_strdup((((rec_t*)rec)->field_name)); \
133 *out_len = (unsigned)strlen((((rec_t*)rec)->field_name)); \
137 *out_ptr = g_strdup(""); \
142#define UAT_FLD_IPV4(basename,field_name,title,desc) \
143 {#field_name, title, PT_TXTMOD_STRING,{basename ## _ ## field_name ## _chk_cb,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
146#define UAT_IPV4_MC_CB_DEF(basename,field_name,rec_t) \
147 static bool basename ## _ ## field_name ## _chk_cb(void * u1 _U_, const char * strptr, unsigned len _U_, const void * u2 _U_, const void * u3 _U_, char ** err) \
150 if (!ws_inet_pton4(strptr, &addr)) \
152 *err = g_strdup("invalid address"); \
155 if (!IN_MULTICAST(g_ntohl(addr)) && (g_ntohl(addr) != 0)) \
157 *err = g_strdup("invalid multicast address"); \
162 static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) \
165 char* new_buf = g_strndup(buf,len); \
166 g_free((((rec_t*)rec)->field_name)); \
167 (((rec_t*)rec)->field_name) = new_buf; \
168 ws_inet_pton4(new_buf, &addr); \
169 (((rec_t*)rec)->field_name ## _val_h) = g_ntohl(addr); \
171 static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
173 if (((rec_t*)rec)->field_name ) \
175 *out_ptr = g_strdup((((rec_t*)rec)->field_name)); \
176 *out_len = (unsigned)strlen((((rec_t*)rec)->field_name)); \
180 *out_ptr = g_strdup(""); \
185#define UAT_FLD_IPV4_MC(basename,field_name,title,desc) \
186 {#field_name, title, PT_TXTMOD_STRING,{basename ## _ ## field_name ## _chk_cb,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
197 uint8_t ctxinst[LBM_CONTEXT_INSTANCE_BLOCK_SZ];
202 lbm_uim_instance_stream,
203 lbm_uim_domain_stream
204} lbm_uim_stream_type_t;
208 lbm_uim_stream_type_t type;
219 uint32_t substream_id;
252 uint8_t topic_length;
253 uint8_t source_length;
254 uint32_t topic_index;
262 uint8_t topic_length;
270 uint8_t pattern_length;
274#define LBMR_WILDCARD_PATTERN_TYPE_PCRE 1
275#define LBMR_WILDCARD_PATTERN_TYPE_REGEX 2
281 uint8_t queue_length;
282 uint8_t topic_length;
290 uint8_t queue_length;
294#define LBM_TOPIC_OPT_EXFUNC_FFLAG_LJ 0x00000001
295#define LBM_TOPIC_OPT_EXFUNC_FFLAG_UME 0x00000002
296#define LBM_TOPIC_OPT_EXFUNC_FFLAG_UMQ 0x00000004
297#define LBM_TOPIC_OPT_EXFUNC_FFLAG_ULB 0x00000008
300#define LBTRM_PACKET_TYPE_DATA 0x00
301#define LBTRM_PACKET_TYPE_SM 0x02
302#define LBTRM_PACKET_TYPE_NAK 0x03
303#define LBTRM_PACKET_TYPE_NCF 0x04
306#define LBTRM_NCF_REASON_NO_RETRY 0x0
307#define LBTRM_NCF_REASON_IGNORED 0x1
308#define LBTRM_NCF_REASON_RX_DELAY 0x2
309#define LBTRM_NCF_REASON_SHED 0x3
312#define LBTRU_PACKET_TYPE_DATA 0x00
313#define LBTRU_PACKET_TYPE_SM 0x02
314#define LBTRU_PACKET_TYPE_NAK 0x03
315#define LBTRU_PACKET_TYPE_NCF 0x04
316#define LBTRU_PACKET_TYPE_ACK 0x05
317#define LBTRU_PACKET_TYPE_CREQ 0x06
318#define LBTRU_PACKET_TYPE_RST 0x07
321#define LBTRU_NCF_REASON_NO_RETRY 0x0
322#define LBTRU_NCF_REASON_IGNORED 0x1
323#define LBTRU_NCF_REASON_RX_DELAY 0x2
324#define LBTRU_NCF_REASON_SHED 0x3
327#define LBTRU_CREQ_REQUEST_SYN 0x0
330#define LBTRU_RST_REASON_DEFAULT 0x0
332bool lbmc_test_lbmc_header(
tvbuff_t * tvb,
int offset);
334int lbmc_get_minimum_length(
void);
335uint16_t lbmc_get_message_length(
tvbuff_t * tvb,
int offset);
336bool lbmpdm_verify_payload(
tvbuff_t * tvb,
int offset,
int * encoding,
int * length);
338int lbmpdm_get_minimum_length(
void);
343extern const value_string lbm_wildcard_pattern_type_short[];
348#define LBM_CHANNEL_NO_CHANNEL (~((uint64_t) 0))
350#define LBM_CHANNEL_TRANSPORT_LBTTCP 0x00
351#define LBM_CHANNEL_TRANSPORT_LBTRU 0x01
352#define LBM_CHANNEL_TRANSPORT_LBTRM 0x02
353#define LBM_CHANNEL_TRANSPORT_LBTIPC 0x03
354#define LBM_CHANNEL_TRANSPORT_LBTRDMA 0x04
355#define LBM_CHANNEL_TRANSPORT_LBTSMX 0x05
356#define LBM_CHANNEL_STREAM_TCP 0x10
357#define LBM_CHANNEL_TCP 0x20
359#define LBM_CHANNEL_VALUE_MASK UINT64_C(0xfffffffffffff000)
360#define LBM_CHANNEL_VALUE_SHIFT_COUNT 12
362void lbm_channel_reset(
void);
363uint64_t lbm_channel_assign(uint8_t channel_type);
364bool lbm_channel_is_transport(uint64_t channel);
365uint8_t lbm_channel_type(uint64_t channel);
366uint64_t lbm_channel_assign_unknown_transport_source_lbttcp(
void);
367uint64_t lbm_channel_assign_unknown_transport_client_lbttcp(
void);
368uint64_t lbm_channel_assign_unknown_stream_tcp(
void);
369bool lbm_channel_is_unknown_transport_lbttcp(uint64_t channel);
370bool lbm_channel_is_unknown_transport_source_lbttcp(uint64_t channel);
371bool lbm_channel_is_unknown_transport_client_lbttcp(uint64_t channel);
372bool lbm_channel_is_unknown_stream_tcp(uint64_t channel);
373bool lbm_channel_is_known(uint64_t channel);
375#define LBM_CHANNEL_ID(ch) ((ch & LBM_CHANNEL_VALUE_MASK) >> LBM_CHANNEL_VALUE_SHIFT_COUNT)
385 uint32_t previous_frame;
386 uint32_t previous_type_frame;
388 uint32_t next_type_frame;
404 uint32_t frame_count;
414void lbm_topic_init(
void);
415const char * lbm_topic_find(uint64_t channel, uint32_t topic_index);
416void lbm_topic_add(uint64_t channel, uint32_t topic_index,
const char * name);
Definition packet_info.h:43
Definition value_string.h:25
Definition wmem_tree-int.h:48
Definition packet-lbm.h:267
Definition packet-lbm.h:278
Definition packet-lbm.h:288
Definition packet-lbm.h:250
Definition packet-lbm.h:260
Definition packet-lbm.h:226
Definition packet-lbm.h:237
Definition packet-lbm.h:381
Definition packet-lbm.h:396
Definition packet-lbm.h:402
Definition packet-lbm.h:196
Definition packet-lbm.h:189
Definition packet-lbm.h:207
Definition packet-lbm.h:217
Definition tvbuff-int.h:35