1 /* packet-lbmsrs.c
2 * Routines for SRS Packet dissection
3 *
4 * Copyright (c) 2005-2014 Informatica Corporation. All Rights Reserved.
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 *
12 * Special thanks to the team at https://github.com/rsocket/rsocket-wireshark
13 * for getting us started on the right path for this Ultra Messaging rsocket dissector.
14 * Rsocket Protocol Description: https://rsocket.io/docs/Protocol.html
15 */
16 
17 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/expert.h>
20 #include <epan/column-info.h>
21 #include <epan/to_str.h>
22 #include <packet-lbm.h>
23 #include <epan/proto.h>
24 #include <epan/column-utils.h>
25 #include <epan/prefs.h>
26 #include <epan/uat.h>
27 #include <wsutil/pint.h>
28 #include <dissectors/packet-tcp.h>
29 
30 
31 
32 static gint proto_lbmsrs = -1;
33 
34 void proto_register_lbmsrs(void);
35 void proto_reg_handoff_lbmsrs(void);
36 
37 /****************************************LBMSRS Packet definitions**************************************************/
38 /*******************************************************************************************************************/
39 #define LBM_SRS_PROTOCOL_VERSION 1
40 #define L_LBM_SRS_MESSAGE_ID 2
41 
42 /* LBMSRS Registration Request
43 typedef struct lbm_srs_registration_request_info_t_stct {
44     lbm_uint8_t app_type;
45     lbm_uint32_t client_addr;
46     lbm_uint16_t client_port;
47     lbm_uint32_t session_id;
48     lbm_uint32_t host_id;
49     lbm_uint8_t protocol_version;
50     lbm_uint8_t interest_mode;
51     lbm_uint32_t local_domain_id;
52 } lbm_srs_registration_request_info_t;
53 */
54 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_APP_TYPE 1
55 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_ADDR 4
56 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_PORT 2
57 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_SESSION_ID 4
58 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_HOST_ID 4
59 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_PROTOCOL_VERSION 1
60 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_INTEREST_MODE 1
61 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_LOCAL_DOMAIN_ID 4
62 #define L_LBM_SRS_REGISTRATION_REQUEST_INFO_T 21 /*padding is giving length as 24 above*/
63 
64 
65 #define LBM_SRS_INTEREST_MODE_FLOOD 0
66 #define LBM_SRS_INTEREST_MODE_FILTER 1
67 #define LBM_SRS_INTEREST_MODE_FLOOD_FORWARD_INTEREST 2
68 #define LBM_SRS_INTEREST_MODE_FILTER_FORWARD_INTEREST 3
69 #define LBM_SRS_APP_TYPE_APPLICATION 0
70 #define LBM_SRS_APP_TYPE_TNWGD 1
71 #define LBM_SRS_APP_TYPE_STORE 2
72 
73 /* LBMSRS Registration Response
74 typedef struct lbm_srs_registration_response_info_t_stct {
75     lbm_uint64_t client_id;
76     lbm_uint32_t local_domain_id;
77     lbm_uint8_t protocol_version;
78 } lbm_srs_registration_response_info_t;
79 */
80 #define L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_CLIENT_ID 8
81 #define L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_PROTOCOL_VERSION 4
82 #define L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_LOCAL_DOMAIN_ID 1
83 #define L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T 13
84 
85 
86 /* LBMSRS Stream Request
87 typedef struct lbm_srs_stream_request_info_t_stct {
88     lbm_uint8_t unused;
89 } lbm_srs_stream_request_info_t;
90 */
91 #define L_LBM_SRS_STREAM_REQUEST_INFO_T_UNUSED 1
92 #define L_LBM_SRS_STREAM_REQUEST_INFO_T 1
93 
94 /* LBMSRS Source Info
95 typedef struct lbm_srs_src_info_info_t_stct {
96     char * otid;
97     lbm_uint8_t topic_len;
98     char * topic;
99     lbm_uint8_t source_len;
100     char * source;
101     lbm_uint32_t host_id;
102     lbm_uint32_t topic_idx;
103     lbm_uint32_t functionality_flags;
104     lbm_uint32_t request_ip;
105     lbm_uint16_t request_port;
106     lbm_uint32_t domain_id;
107     lbm_uint8_t encryption;
108     lbm_uint8_t compression;
109     lbm_uint32_t ulb_src_id;
110     lbm_uint32_t ulb_queue_id;
111     lbm_uint64_t ulb_reg_id;
112     char* context_instance;
113     lbm_uint8_t context_type;
114     lbm_uint32_t version;
115     lbm_uint32_t version_flags;
116     lbm_uint16_t ttl;
117     lbm_uint32_t cost;
118 } lbm_srs_src_info_info_t;
119 */
120 #define L_LBM_SRS_SRC_INFO_INFO_T_OTID 32 //fixed length
121 #define L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_LEN 1
122 #define L_LBM_SRS_SRC_INFO_INFO_T_SOURCE_LEN 1
123 #define L_LBM_SRS_SRC_INFO_INFO_T_HOST_ID 4
124 #define L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_IDX 4
125 #define L_LBM_SRS_SRC_INFO_INFO_T_FUNCTIONALITY_FLAGS 4
126 #define L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_IP 4
127 #define L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_PORT 2
128 #define L_LBM_SRS_SRC_INFO_INFO_T_DOMAIN_ID 4
129 #define L_LBM_SRS_SRC_INFO_INFO_T_ENCRYPTION 1
130 #define L_LBM_SRS_SRC_INFO_INFO_T_COMPRESSION 1
131 #define L_LBM_SRS_SRC_INFO_INFO_T_ULB_SRC_ID 4
132 #define L_LBM_SRS_SRC_INFO_INFO_T_ULB_QUEUE_ID 4
133 #define L_LBM_SRS_SRC_INFO_INFO_T_ULB_REG_ID 8
134 #define L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_INSTANCE 8
135 #define L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_TYPE 1
136 #define L_LBM_SRS_SRC_INFO_INFO_T_VERSION 4
137 #define L_LBM_SRS_SRC_INFO_INFO_T_VERSION_FLAGS 4
lbm_stream_init(void)138 #define L_LBM_SRS_SRC_INFO_INFO_T_TTL 2
139 #define L_LBM_SRS_SRC_INFO_INFO_T_COST 4
140 
141 
142 /* LBMSRS Source Delete Info
143 typedef struct lbm_srs_src_delete_info_t_stct {
144     char * otid;
145     lbm_uint8_t topic_len;
146     char * topic;
147 } lbm_srs_src_delete_info_t;
148 */
149 #define L_LBM_SRS_SRC_DELETE_INFO_T_OTID 32
150 #define L_LBM_SRS_SRC_DELETE_INFO_T_TOPIC_LEN 1
151 
152 
153 /* LBMSRS Receiver Info
154 typedef struct lbm_srs_rcv_info_info_t_stct {
155     lbm_uint8_t topic_len;
156     char * topic;
157     lbm_uint32_t domain_id;
158     char* context_instance;
159     lbm_uint8_t context_type;
160     lbm_uint32_t version;
161     lbm_uint32_t version_flags;
162     lbm_uint32_t reserved;
163 } lbm_srs_rcv_info_info_t;
164 */
165 #define L_LBM_SRS_RCV_INFO_INFO_T_TOPIC_LEN 1
166 #define L_LBM_SRS_RCV_INFO_INFO_T_DOMAIN_ID 4
167 #define L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_INSTANCE 8
168 #define L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_TYPE 1
169 #define L_LBM_SRS_RCV_INFO_INFO_T_VERSION 4
170 #define L_LBM_SRS_RCV_INFO_INFO_T_VERSION_FLAGS 4
171 #define L_LBM_SRS_RCV_INFO_INFO_T_RESERVED 4
172 
173 
174 /* LBMSRS Receiver Delete Info
175 typedef struct lbm_srs_rcv_delete_info_t_stct {
176     lbm_uint8_t topic_len;
177     char * topic;
178     lbm_uint32_t domain_id;
179     char* context_instance;
180     lbm_uint8_t context_type;
181     lbm_uint32_t version;
182     lbm_uint32_t version_flags;
183     lbm_uint32_t reserved;
184 } lbm_srs_rcv_delete_info_t;
185 */
186 #define L_LBM_SRS_RCV_DELETE_INFO_T_TOPIC_LEN 1
187 #define L_LBM_SRS_RCV_DELETE_INFO_T_DOMAIN_ID 4
188 #define L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_INSTANCE 8
189 #define L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_TYPE 1
190 #define L_LBM_SRS_RCV_DELETE_INFO_T_VERSION 4
191 #define L_LBM_SRS_RCV_DELETE_INFO_T_VERSION_FLAGS 4
192 #define L_LBM_SRS_RCV_DELETE_INFO_T_RESERVED 4
193 
194 /* LBMSRS Receiver End info
195 typedef struct lbm_srs_rcv_end_info_t_stct {
196     lbm_uint8_t topic_len;
197     char * topic;
198     lbm_uint32_t domain_id;
199     char* context_iinstance;
200     lbm_uint8_t context_type;
201     lbm_uint32_t version;
202     lbm_uint32_t version_flags;
203     lbm_uint32_t reserved;
204 } lbm_srs_rcv_end_info_t;
205 */
206 #define L_LBM_SRS_RCV_END_INFO_T_TOPIC_LEN 1
207 #define L_LBM_SRS_RCV_END_INFO_T_DOMAIN_ID 4
208 #define L_LBM_SRS_RCV_END_INFO_T_CONTEXT_INSTANCE 8
209 #define L_LBM_SRS_RCV_END_INFO_T_CONTEXT_TYPE 1
210 #define L_LBM_SRS_RCV_END_INFO_T_VERSION 4
211 #define L_LBM_SRS_RCV_END_INFO_T_VERSION_FLAGS 4
212 #define L_LBM_SRS_RCV_END_INFO_T_RESERVED 4
213 
214 
215 /* LBMSRS Wildcard Receiver Info
216 typedef struct lbm_srs_wrcv_info_info_t_stct {
217     lbm_uint8_t pattern_len;
218     char * pattern;
219     lbm_uint32_t domain_id;
220     char* context_instance;
221     lbm_uint8_t context_type;
222     lbm_uint32_t version;
223     lbm_uint32_t version_flags;
224     lbm_uint32_t reserved;
225 } lbm_srs_wrcv_info_info_t;
226 */
227 #define L_LBM_SRS_WRCV_INFO_INFO_T_PATTERN_LEN 1
228 #define L_LBM_SRS_WRCV_INFO_INFO_T_DOMAIN_ID 4
229 #define L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_INSTANCE 8
230 #define L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_TYPE 1
231 #define L_LBM_SRS_WRCV_INFO_INFO_T_VERSION 4
232 #define L_LBM_SRS_WRCV_INFO_INFO_T_VERSION_FLAGS 4
233 #define L_LBM_SRS_WRCV_INFO_INFO_T_RESERVED 4
234 
235 
236 /* LBMSRS Wildcard Receive Delete Info
237 typedef struct lbm_srs_wrcv_delete_info_t_stct {
238     lbm_uint8_t pattern_len;
239     char * pattern;
240     lbm_uint32_t domain_id;
241     char* context_instance;
242     lbm_uint8_t context_type;
243     lbm_uint32_t version;
244     lbm_uint32_t version_flags;
245     lbm_uint32_t reserved;
246 } lbm_srs_wrcv_delete_info_t;
247 */
248 #define L_LBM_SRS_WRCV_DELETE_INFO_T_PATTERN_LEN 1
249 #define L_LBM_SRS_WRCV_DELETE_INFO_T_DOMAIN_ID 4
250 #define L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_INSTANCE 8
251 #define L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_TYPE 1
252 #define L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION 4
253 #define L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION_FLAGS 4
254 #define L_LBM_SRS_WRCV_DELETE_INFO_T_RESERVED 4
255 
256 
257 /* LBMSRS Wildcard Receive End Info
258 typedef struct lbm_srs_wrcv_end_info_t_stct {
259     lbm_uint8_t pattern_len;
260     char * pattern;
261     lbm_uint32_t domain_id;
262     char* context_instance;
263     lbm_uint8_t context_type;
264     lbm_uint32_t version;
265     lbm_uint32_t version_flags;
266     lbm_uint32_t reserved;
267 } lbm_srs_wrcv_end_info_t;
268 */
269 #define L_LBM_SRS_WRCV_END_INFO_T_PATTERN_LEN 1
270 #define L_LBM_SRS_WRCV_END_INFO_T_DOMAIN_ID 4
271 #define L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_INSTANCE 8
272 #define L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_TYPE 1
273 #define L_LBM_SRS_WRCV_END_INFO_T_VERSION 4
274 #define L_LBM_SRS_WRCV_END_INFO_T_VERSION_FLAGS 4
275 #define L_LBM_SRS_WRCV_END_INFO_T_RESERVED 4
276 
277 
278 /* LBMSRS Source Leave Info
279 typedef struct lbm_srs_src_leave_info_t_stct {
280     char * otid;
281     lbm_uint8_t topic_len;
282     char * topic;
283     lbm_uint8_t source_len;
284     char * source;
285     char* context_instance;
286     lbm_uint8_t context_type;
287     lbm_uint32_t version;
288     lbm_uint32_t version_flags;
289     lbm_uint32_t reserved;
290 }lbm_srs_src_leave_info_t;
291 */
292 #define L_LBM_SRS_SRC_LEAVE_INFO_T_OTID 32 //fixed length
293 #define L_LBM_SRS_SRC_LEAVE_INFO_T_TOPIC_LEN 1
294 #define L_LBM_SRS_SRC_LEAVE_INFO_T_SOURCE_LEN 1
295 #define L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_INSTANCE 8
296 #define L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_TYPE 1
297 #define L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION 4
298 #define L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION_FLAGS 4
299 #define L_LBM_SRS_SRC_LEAVE_INFO_T_RESERVED 4
300 
301 
302 /*SRS Message IDs*/
303 #define MSG_ID_REGISTRATION_REQUEST 1
304 #define MSG_ID_REGISTRATION_RESPONSE 2
305 #define MSG_ID_STREAM_REQUEST 3
306 #define MSG_ID_SOURCE_INFO 4
307 #define MSG_ID_SOURCE_DELETE 5
308 #define MSG_ID_RCV_INFO 6
309 #define MSG_ID_RCV_DELETE 7
310 #define MSG_ID_RCV_END 8
311 #define MSG_ID_WRCV_INFO 9
312 #define MSG_ID_WRCV_DELETE 10
313 #define MSG_ID_WRCV_END 11
314 #define MSG_ID_SRC_LEAVE 12
315 
316 /*SRS Tag definitions*/
317 typedef struct
318 {
319     char * name;
320     char * ip_address;
321     guint32 ip_address_val_h;
322     guint32 tcp_port;
323 } lbmsrs_tag_entry_t;
324 
325 static lbmsrs_tag_entry_t* lbmsrs_tag_entry;
326 static guint lbmsrs_tag_count = 0;
327 
328 UAT_CSTRING_CB_DEF(lbmsrs_tag, name, lbmsrs_tag_entry_t)
329 UAT_IPV4_CB_DEF(lbmsrs_tag, ip_address, lbmsrs_tag_entry_t)
330 UAT_DEC_CB_DEF(lbmsrs_tag, tcp_port, lbmsrs_tag_entry_t)
331 
332 static uat_field_t lbmsrs_tag_array[] =
333 {
334     UAT_FLD_CSTRING(lbmsrs_tag, name, "Tag name", "Tag name"),
335     UAT_FLD_IPV4(lbmsrs_tag, ip_address, "LBMSRS IP Address", "LBMSRS IP Address"),
lbm_stream_order_dstream_key(lbm_dstream_entry_t * stream)336     UAT_FLD_DEC(lbmsrs_tag, tcp_port, "LBMSRS TCP port", "LBMSRS TCP port"),
337     UAT_END_FIELDS
338 };
339 
340 static const value_string lbmsrsMessageId[] =
341 {
342     { MSG_ID_REGISTRATION_REQUEST, "SRS_REGISTRATION_REQUEST" },
343     { MSG_ID_REGISTRATION_RESPONSE, "SRS_REGISTRATION_RESPONSE" },
344     { MSG_ID_STREAM_REQUEST, "SRS_STREAM_REQUEST" },
345     { MSG_ID_SOURCE_INFO, "SRS_SRC_INFO" },
346     { MSG_ID_SOURCE_DELETE, "SRS_SRC_DELETE" },
347     { MSG_ID_RCV_INFO, "SRS_RCV_INFO" },
348     { MSG_ID_RCV_DELETE, "SRS_RCV_DELETE" },
349     { MSG_ID_RCV_END, "SRS_RCV_END" },
350     { MSG_ID_WRCV_INFO, "SRS_WRCV_INFO" },
351     { MSG_ID_WRCV_DELETE, "SRS_WRCV_DELETE" },
352     { MSG_ID_WRCV_END, "SRS_WRCV_END" },
353     { MSG_ID_SRC_LEAVE, "SRS_LEAVE_INFO" },
354     { 0,NULL}
355 };
356 static const value_string lbmsrsInterestMode[]=
357 {
358     { LBM_SRS_INTEREST_MODE_FLOOD, "INTEREST_MODE_FLOOD"},
359     { LBM_SRS_INTEREST_MODE_FILTER, "INTEREST_MODE_FILTER" },
360     { LBM_SRS_INTEREST_MODE_FLOOD_FORWARD_INTEREST, "INTEREST_MODE_FLOOD_FORWARD_INTEREST" },
361     { LBM_SRS_INTEREST_MODE_FILTER_FORWARD_INTEREST, "INTEREST_MODE_FILTER_FORWARD_INTEREST" },
362     { 0,NULL}
363 };
364 static const value_string lbmsrsApplicationType[] =
365 {
366     { LBM_SRS_APP_TYPE_APPLICATION, "APP_TYPE_APPLICATION" },
367     { LBM_SRS_APP_TYPE_TNWGD, "APP_TYPE_TNWGD" },
368     { LBM_SRS_APP_TYPE_STORE, "APP_TYPE_STORE" },
369     { 0,NULL}
370 };
371 
372 /* Dissector field handles */
373 static gint hf_lbmsrs_message_id = -1;
374 
375 /*handles for registration request*/
376 static gint hf_lbmsrs_app_type = -1;
377 static gint hf_lbmsrs_client_addr = -1;
378 static gint hf_lbmsrs_client_port = -1;
379 static gint hf_lbmsrs_session_id = -1;
lbm_stream_dstream_find(const lbm_uim_stream_destination_t * endpoint_a,const lbm_uim_stream_destination_t * endpoint_b)380 static gint hf_lbmsrs_host_id = -1;
381 static gint hf_lbmsrs_protocol_version = -1;
382 static gint hf_lbmsrs_interest_mode = -1;
383 static gint hf_lbmsrs_req_local_domain_id = -1;
384 
385 /*handles for registration respose*/
386 static gint hf_lbmsrs_client_id = -1;
387 static gint hf_lbmsrs_resp_local_domain_id = -1;
388 static gint hf_lbmsrs_reg_resp_protocol_version = -1;
389 
390 /*handles for stream request*/
391 static gint hf_lbmsrs_stream_req_unused = -1;
392 
393 /*handles for source info*/
394 static gint hf_lbmsrs_sir = -1;
395 static gint hf_lbmsrs_sir_otid = -1;
396 static gint hf_lbmsrs_sir_topic_len = -1;
397 static gint hf_lbmsrs_sir_topic = -1;
398 static gint hf_lbmsrs_sir_source_len = -1;
lbm_stream_dstream_add(const lbm_uim_stream_destination_t * endpoint_a,const lbm_uim_stream_destination_t * endpoint_b)399 static gint hf_lbmsrs_sir_source = -1;
400 static gint hf_lbmsrs_sir_host_id = -1;
401 static gint hf_lbmsrs_sir_topic_idx = -1;
402 static gint hf_lbmsrs_sir_functionality_flags = -1;
403 static gint hf_lbmsrs_sir_request_ip = -1;
404 static gint hf_lbmsrs_sir_request_port = -1;
405 static gint hf_lbmsrs_sir_domain_id = -1;
406 static gint hf_lbmsrs_sir_encryption = -1;
407 static gint hf_lbmsrs_sir_compression = -1;
408 static gint hf_lbmsrs_sir_ulb_src_id = -1;
409 static gint hf_lbmsrs_sir_ulb_queue_id = -1;
410 static gint hf_lbmsrs_sir_ulb_reg_id = -1;
411 static gint hf_lbmsrs_sir_context_instance = -1;
412 static gint hf_lbmsrs_sir_context_type = -1;
413 static gint hf_lbmsrs_sir_version = -1;
414 static gint hf_lbmsrs_sir_version_flags = -1;
415 static gint hf_lbmsrs_sir_ttl = -1;
416 static gint hf_lbmsrs_sir_cost = -1;
417 
418 /*handles for source delete*/
419 static gint hf_lbmsrs_sdr = -1;
420 static gint hf_lbmsrs_sdr_otid = -1;
421 static gint hf_lbmsrs_sdr_topic_len = -1;
422 static gint hf_lbmsrs_sdr_topic = -1;
423 
424 /*handles for receiver info*/
425 static gint hf_lbmsrs_rir = -1;
426 static gint hf_lbmsrs_rir_topic_len = -1;
427 static gint hf_lbmsrs_rir_topic = -1;
428 static gint hf_lbmsrs_rir_domain_id = -1;
429 static gint hf_lbmsrs_rir_context_instance = -1;
lbm_dstream_substream_build_key(guint32 * key_value,wmem_tree_key_t * key,const lbm_dstream_substream_entry_t * substream)430 static gint hf_lbmsrs_rir_context_type = -1;
431 static gint hf_lbmsrs_rir_version = -1;
432 static gint hf_lbmsrs_rir_version_flags = -1;
433 static gint hf_lbmsrs_rir_reserved = -1;
434 
435 /*handles for receiver delete*/
436 static gint hf_lbmsrs_rdr = -1;
437 static gint hf_lbmsrs_rdr_topic_len = -1;
438 static gint hf_lbmsrs_rdr_topic = -1;
439 static gint hf_lbmsrs_rdr_domain_id = -1;
440 static gint hf_lbmsrs_rdr_context_instance = -1;
441 static gint hf_lbmsrs_rdr_context_type = -1;
442 static gint hf_lbmsrs_rdr_version = -1;
443 static gint hf_lbmsrs_rdr_version_flags = -1;
444 static gint hf_lbmsrs_rdr_reserved = -1;
445 
446 /*handles for receiver end*/
447 static gint hf_lbmsrs_rer = -1;
448 static gint hf_lbmsrs_rer_topic_len = -1;
449 static gint hf_lbmsrs_rer_topic = -1;
450 static gint hf_lbmsrs_rer_domain_id = -1;
451 static gint hf_lbmsrs_rer_context_instance = -1;
lbm_stream_dstream_substream_find(lbm_dstream_entry_t * stream,const address * src_addr,guint16 src_port,const address * dst_addr,guint16 dst_port,guint32 stream_id)452 static gint hf_lbmsrs_rer_context_type = -1;
453 static gint hf_lbmsrs_rer_version = -1;
454 static gint hf_lbmsrs_rer_version_flags = -1;
455 static gint hf_lbmsrs_rer_reserved = -1;
456 
457 /*handles for wildcard receiver info*/
458 static gint hf_lbmsrs_wir = -1;
459 static gint hf_lbmsrs_wir_pattern_len = -1;
460 static gint hf_lbmsrs_wir_pattern = -1;
461 static gint hf_lbmsrs_wir_domain_id = -1;
462 static gint hf_lbmsrs_wir_context_instance = -1;
463 static gint hf_lbmsrs_wir_context_type = -1;
464 static gint hf_lbmsrs_wir_version = -1;
465 static gint hf_lbmsrs_wir_version_flags = -1;
466 static gint hf_lbmsrs_wir_reserved = -1;
467 
468 /*handles for wildcard receiver delete*/
469 static gint hf_lbmsrs_wdr = -1;
lbm_stream_dstream_substream_add(lbm_dstream_entry_t * stream,const address * src_addr,guint16 src_port,const address * dst_addr,guint16 dst_port,guint32 stream_id)470 static gint hf_lbmsrs_wdr_pattern_len = -1;
471 static gint hf_lbmsrs_wdr_pattern = -1;
472 static gint hf_lbmsrs_wdr_domain_id = -1;
473 static gint hf_lbmsrs_wdr_context_instance = -1;
474 static gint hf_lbmsrs_wdr_context_type = -1;
475 static gint hf_lbmsrs_wdr_version = -1;
476 static gint hf_lbmsrs_wdr_version_flags = -1;
477 static gint hf_lbmsrs_wdr_reserved = -1;
478 
479 /*handles for wildcard receiver end*/
480 static gint hf_lbmsrs_wer = -1;
481 static gint hf_lbmsrs_wer_pattern_len = -1;
482 static gint hf_lbmsrs_wer_pattern = -1;
483 static gint hf_lbmsrs_wer_domain_id = -1;
484 static gint hf_lbmsrs_wer_context_instance = -1;
485 static gint hf_lbmsrs_wer_context_type = -1;
486 static gint hf_lbmsrs_wer_version = -1;
487 static gint hf_lbmsrs_wer_version_flags = -1;
488 static gint hf_lbmsrs_wer_reserved = -1;
489 
490 /*handles for src leave info*/
491 static gint hf_lbmsrs_sli = -1;
492 static gint hf_lbmsrs_sli_otid = -1;
493 static gint hf_lbmsrs_sli_topic_len = -1;
494 static gint hf_lbmsrs_sli_topic = -1;
495 static gint hf_lbmsrs_sli_source_len = -1;
496 static gint hf_lbmsrs_sli_source = -1;
497 static gint hf_lbmsrs_sli_context_instance = -1;
lbm_stream_dstream_substream_update(lbm_dstream_substream_entry_t * substream,guint16 length,guint32 frame)498 static gint hf_lbmsrs_sli_context_type = -1;
499 static gint hf_lbmsrs_sli_version = -1;
500 static gint hf_lbmsrs_sli_version_flags = -1;
501 static gint hf_lbmsrs_sli_reserved = -1;
502 
503 
504 /*rsocket dissector field handles*/
505 static gint hf_lbmsrs_rsocket_frame_len = -1;
506 static gint hf_lbmsrs_rsocket_stream_id = -1;
507 static gint hf_lbmsrs_rsocket_frame_type = -1;
508 static gint hf_lbmsrs_rsocket_mdata_len = -1;
509 static gint hf_lbmsrs_rsocket_mdata = -1;
510 static gint hf_lbmsrs_rsocket_major_version = -1;
511 static gint hf_lbmsrs_rsocket_minor_version = -1;
512 static gint hf_lbmsrs_rsocket_keepalive_interval = -1;
513 static gint hf_lbmsrs_rsocket_max_lifetime = -1;
514 static gint hf_lbmsrs_rsocket_mdata_mime_length = -1;
515 static gint hf_lbmsrs_rsocket_mdata_mime_type = -1;
516 static gint hf_lbmsrs_rsocket_data_mime_length = -1;
517 static gint hf_lbmsrs_rsocket_data_mime_type = -1;
518 static gint hf_lbmsrs_rsocket_req_n = -1;
519 static gint hf_lbmsrs_rsocket_error_code = -1;
520 static gint hf_lbmsrs_rsocket_keepalive_last_rcvd_pos = -1;
521 static gint hf_lbmsrs_rsocket_resume_token_len = -1;
522 static gint hf_lbmsrs_rsocket_resume_token = -1;
523 
524 // other flags
525 static gint hf_lbmsrs_rsocket_ignore_flag = -1;
526 static gint hf_lbmsrs_rsocket_metadata_flag = -1;
527 static gint hf_lbmsrs_rsocket_resume_flag = -1;
528 static gint hf_lbmsrs_rsocket_lease_flag = -1;
529 static gint hf_lbmsrs_rsocket_follows_flag = -1;
530 static gint hf_lbmsrs_rsocket_complete_flag = -1;
531 static gint hf_lbmsrs_rsocket_next_flag = -1;
532 static gint hf_lbmsrs_rsocket_respond_flag = -1;
533 
534 /*dissector tree handles*/
535 static gint ett_lbmsrs = -1;
536 static gint ett_lbmsrs_data = -1;
537 static gint ett_lbmsrs_details = -1;
538 static gint ett_lbmsrs_sir = -1;
539 static gint ett_lbmsrs_sdr = -1;
540 static gint ett_lbmsrs_ser = -1;
541 static gint ett_lbmsrs_rir = -1;
542 static gint ett_lbmsrs_rdr = -1;
543 static gint ett_lbmsrs_rer = -1;
544 static gint ett_lbmsrs_wir = -1;
545 static gint ett_lbmsrs_wdr = -1;
546 static gint ett_lbmsrs_wer = -1;
547 static gint ett_lbmsrs_sli = -1;
548 
549 static gint ett_lbmsrs_rsocket_frame = -1;
550 
551 /*Expert analysis fields*/
552 static expert_field ei_lbmsrs_analysis_invalid_msg_id = EI_INIT;
553 
554 /* Dissector handle */
555 static dissector_handle_t lbmsrs_dissector_handle;
556 
557 static const guint rsocket_frame_len_field_size = 3;
558 static const guint rsocket_stream_id_field_size = 4;
559 
560 /* SRS default definitions*/
561 #define LBMSRS_DEFAULT_SOURCE_PORT 0
562 #define LBMSRS_DEFAULT_SOURCE_IP "127.0.0.1"
563 
564 static guint32 lbmsrs_source_ip_address;
565 static const char* global_lbmsrs_source_ip_address = LBMSRS_DEFAULT_SOURCE_IP;
566 static guint32 global_lbmsrs_source_port = LBMSRS_DEFAULT_SOURCE_PORT;
567 static gboolean global_lbmsrs_use_tag = FALSE;
568 static guint32 lbmsrs_source_port = LBMSRS_DEFAULT_SOURCE_PORT;
569 static gboolean lbmsrs_use_tag = FALSE;
570 
571 
572 #define RSOCKET_FRAME_RESERVED 0x00
573 #define RSOCKET_FRAME_SETUP 0x01
574 #define RSOCKET_FRAME_LEASE 0x02
575 #define RSOCKET_FRAME_KEEPALIVE 0x03
576 #define RSOCKET_FRAME_REQUEST_RESPONSE 0x04
577 #define RSOCKET_FRAME_REQUEST_FNF 0x05
578 #define RSOCKET_FRAME_REQUEST_STREAM 0x06
579 #define RSOCKET_FRAME_REQUEST_CHANNEL 0x07
580 #define RSOCKET_FRAME_REQUEST_N 0x08
581 #define RSOCKET_FRAME_CANCEL 0x09
582 #define RSOCKET_FRAME_PAYLOAD 0x0A
583 #define RSOCKET_FRAME_ERROR 0x0B
584 #define RSOCKET_FRAME_METADATA_PUSH 0x0C
585 #define RSOCKET_FRAME_RESUME 0x0D
586 #define RSOCKET_FRAME_RESUME_OK 0x0E
587 #define RSOCKET_FRAME_EXT 0x3F
588 
589 #define RSOCKET_FRAME_SETUP_MIN_SIZE 14
590 #define RSOCKET_FRAME_KEEPALIVE_SIZE 10
591 #define RSOCKET_FRAME_REQUEST_RESPONSE_SIZE 2
592 #define RSOCKET_FRAME_REQUEST_FNF_SIZE 2
593 #define RSOCKET_FRAME_REQUEST_STREAM_SIZE 6
594 #define RSOCKET_FRAME_REQUEST_CHANNEL_SIZE 6
595 #define RSOCKET_FRAME_REQUEST_N_SIZE 6
596 #define RSOCKET_FRAME_CANCEL_SIZE 2
597 #define RSOCKET_FRAME_PAYLOAD_SIZE 2
598 
599 static const value_string rSocketFrameTypeNames[] = {
600     { RSOCKET_FRAME_RESERVED, "RESERVED" },
601     { RSOCKET_FRAME_SETUP, "SETUP" },
602     { RSOCKET_FRAME_LEASE, "LEASE" },
603     { RSOCKET_FRAME_KEEPALIVE, "KEEPALIVE" },
604     { RSOCKET_FRAME_REQUEST_RESPONSE, "REQUEST_RESPONSE" },
605     { RSOCKET_FRAME_REQUEST_FNF, "REQUEST_FNF" },
606     { RSOCKET_FRAME_REQUEST_STREAM, "REQUEST_STREAM" },
607     { RSOCKET_FRAME_REQUEST_CHANNEL, "REQUEST_CHANNEL" },
608     { RSOCKET_FRAME_REQUEST_N, "REQUEST_N" },
609     { RSOCKET_FRAME_CANCEL, "CANCEL" },
610     { RSOCKET_FRAME_PAYLOAD, "PAYLOAD" },
611     { RSOCKET_FRAME_ERROR, "ERROR" },
612     { RSOCKET_FRAME_METADATA_PUSH, "METADATA_PUSH" },
613     { RSOCKET_FRAME_RESUME, "RESUME" },
614     { RSOCKET_FRAME_RESUME_OK, "RESUME_OK" },
615     { RSOCKET_FRAME_EXT, "EXT" },
616     { 0,NULL} };
617 
618 
619 static const value_string rSocketErrorCodeNames[] =
620 {
621     { 0x00000000, "RESERVED" },
622     { 0x00000001, "INVALID_SETUP" },
623     { 0x00000002, "UNSUPPORTED_SETUP" },
624     { 0x00000003, "REJECTED_SETUP" },
625     { 0x00000004, "REJECTED_RESUME" },
626     { 0x00000101, "CONNECTION_ERROR" },
627     { 0x00000102, "CONNECTION_CLOSE" },
628     { 0x00000201, "APPLICATION_ERROR" },
629     { 0x00000202, "REJECTED" },
630     { 0x00000203, "CANCELED" },
631     { 0x00000204, "INVALID" },
632     { 0xFFFFFFFF, "REJECTED" },
633     { 0,NULL}
634 };
635 
636 /*----------------------------------------------------------------------------*/
637 /* UAT callback functions.                                                    */
638 /*----------------------------------------------------------------------------*/
639 static gboolean lbmsrs_tag_update_cb(void * record, char * * error_string)
640 {
641     lbmsrs_tag_entry_t * tag = (lbmsrs_tag_entry_t *)record;
642 
643     if (tag->name == NULL)
644     {
645         *error_string = g_strdup("Tag name can't be empty");
646         return FALSE;
647     }
648     else
649     {
650         g_strstrip(tag->name);
651         if (tag->name[0] == 0)
652         {
653             *error_string = g_strdup("Tag name can't be empty");
654             return FALSE;
655         }
656     }
657     return TRUE;
658 }
659 
660 static void * lbmsrs_tag_copy_cb(void * destination, const void * source, size_t length _U_)
661 {
662     const lbmsrs_tag_entry_t * src = (const lbmsrs_tag_entry_t *)source;
663     lbmsrs_tag_entry_t * dest = (lbmsrs_tag_entry_t *)destination;
664 
665     dest->name = g_strdup(src->name);
666     dest->ip_address = g_strdup(src->ip_address);
667     dest->ip_address_val_h = src->ip_address_val_h;
668     dest->tcp_port = src->tcp_port;
669     return (dest);
670 }
671 
672 static void lbmsrs_tag_free_cb(void * record)
673 {
674     lbmsrs_tag_entry_t * tag = (lbmsrs_tag_entry_t *)record;
675 
676     if (tag->name != NULL)
677     {
678         g_free(tag->name);
679         tag->name = NULL;
680     }
681 
682     if (tag->ip_address != NULL)
683     {
684         g_free(tag->ip_address);
685         tag->ip_address = NULL;
686     }
687 }
688 
689 /*Tag helper functions*/
690 static gboolean lbmsrs_match_packet(packet_info * pinfo, const lbmsrs_tag_entry_t * entry)
691 {
692     if ((pinfo->dst.type != AT_IPv4) || (pinfo->dst.len != 4) ||
693         (pinfo->src.type != AT_IPv4) || (pinfo->src.len != 4))
694         return (FALSE);
695 
696     guint32 dest_addr_h = pntoh32(pinfo->dst.data);
697     guint32 src_addr_h = pntoh32(pinfo->src.data);
698 
699     guint32 ip_address_val_h = 0;
700     if (NULL != entry->ip_address)
701     {
702         ip_address_val_h = entry->ip_address_val_h;
703     }
704 
705     /*if only port number is specified*/
706     if ((entry->tcp_port > 0) && (ip_address_val_h == 0))
707     {
708         if ((entry->tcp_port == pinfo->destport) || (entry->tcp_port == pinfo->srcport))
709         {
710             return (TRUE);
711         }
712     }
713     /*if only IP is specified*/
714     else if ((entry->tcp_port == 0) && (ip_address_val_h > 0))
715     {
716         if ((ip_address_val_h == dest_addr_h) || (ip_address_val_h == src_addr_h))
717         {
718             return (TRUE);
719         }
720     }
721     /*if both IP and port is specified*/
722     else
723     {
724         if (((ip_address_val_h == dest_addr_h) && (entry->tcp_port == pinfo->destport))
725             || ((ip_address_val_h == src_addr_h) && (entry->tcp_port == pinfo->srcport)))
726         {
727             return (TRUE);
728         }
729     }
730 
731     return (FALSE);
732 }
733 
734 static char * lbmsrs_tag_find(packet_info * pinfo)
735 {
736     guint idx;
737     lbmsrs_tag_entry_t * tag = NULL;
738 
739     if (!lbmsrs_use_tag)
740     {
741         return (NULL);
742     }
743     for (idx = 0; idx < lbmsrs_tag_count; ++idx)
744     {
745         tag = &(lbmsrs_tag_entry[idx]);
746         if (lbmsrs_match_packet(pinfo, tag))
747         {
748             return tag->name;
749         }
750     }
751     return (NULL);
752 }
753 
754 /*Utility functions*/
755 static const gchar *getFrameTypeName(const guint64 frame_type) {
756     for (size_t i = 0; i < sizeof(rSocketFrameTypeNames) / sizeof(value_string);
757         i++) {
758         if (rSocketFrameTypeNames[i].value == frame_type) {
759             return rSocketFrameTypeNames[i].strptr;
760         }
761     }
762     return NULL;
763 }
764 
765 static gboolean check_lbmsrs_packet(tvbuff_t *tvb, guint offset)
766 {
767     /*check if valid rsocket packet*/
768     guint start_offset = offset;
769     offset += rsocket_frame_len_field_size;
770 
771     /*check the length*/
772     /*rsocket data maybe split accross multiple packets*/
773     guint32 tvb_length = tvb_captured_length(tvb);
774 
775     if (tvb_length < (offset - start_offset + rsocket_stream_id_field_size))
776     {
777         return FALSE;
778     }
779 
780     /*get the stream-id*/
781     guint32 rsocket_stream_id = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN);
782 
783     /*move the offset past the stream id field*/
784     offset += rsocket_stream_id_field_size;
785 
786     if (tvb_length < (offset - start_offset + 1))
787     {
788         return FALSE;
789     }
790 
791     /*get the rsocket frame type*/
792     guint64 rsocket_frame_type = tvb_get_bits64(tvb, offset * 8, 6, ENC_BIG_ENDIAN);
793 
794     /*read the rsocket metadata flag*/
795     guint8 rsocket_metadata_flag = tvb_get_bits8(tvb, (offset * 8) + 6, 2);
796 
797     /*check if valid rsocket frame type*/
798     /*update the offset according to the frame type*/
799     switch (rsocket_frame_type)
800     {
801     case RSOCKET_FRAME_SETUP:
802     case RSOCKET_FRAME_KEEPALIVE:
803     case RSOCKET_FRAME_METADATA_PUSH:
804     case RSOCKET_FRAME_RESUME:
805     case RSOCKET_FRAME_RESUME_OK:
806     {
807         /*for these frame types stream id must be 0 */
808         if (rsocket_stream_id != 0)
809         {
810             return FALSE;
811         }
812 
813         return TRUE;
814     }
815     case RSOCKET_FRAME_EXT:
816     {
817         return TRUE;
818     }
819 
820     case RSOCKET_FRAME_REQUEST_RESPONSE:
821     case RSOCKET_FRAME_REQUEST_FNF:
822     case RSOCKET_FRAME_CANCEL:
823     case RSOCKET_FRAME_PAYLOAD:
824     {
825         offset += 2;
826         break;
827     }
828 
829     case RSOCKET_FRAME_REQUEST_STREAM:
830     case RSOCKET_FRAME_REQUEST_CHANNEL:
831     case RSOCKET_FRAME_REQUEST_N:
832     case RSOCKET_FRAME_ERROR:
833     {
834         offset += 6;
835         break;
836     }
837 
838     default:
839         return FALSE;
840     }
841 
842     /*if rsocket metadata is available get the metadata length*/
843     if (rsocket_metadata_flag)
844     {
845         if (tvb_length < (offset - start_offset + 3))
846         {
847             return FALSE;
848         }
849 
850         /*add the rsocket metadata length field*/
851         guint32 rsocket_metadata_len = tvb_get_guint24(tvb, offset, ENC_BIG_ENDIAN);;
852         offset += 3;
853         /*move the offset by the metadata length*/
854         offset += rsocket_metadata_len;
855         if (tvb_length < (offset - start_offset + 6))
856         {
857             return FALSE;
858         }
859     }
860 
861 
862     /*check the SRS message id*/
863 
864     guint32 rsocket_payload_len = tvb_length - offset;
865     /*if payload is available start processing for SRS*/
866     if (rsocket_payload_len > 2)
867     {
868         guint16 message_id = tvb_get_guint16(tvb, offset, ENC_BIG_ENDIAN);
869         switch (message_id)
870         {
871         case MSG_ID_REGISTRATION_REQUEST:
872         case MSG_ID_REGISTRATION_RESPONSE:
873         case MSG_ID_STREAM_REQUEST:
874         case MSG_ID_SOURCE_INFO:
875         case MSG_ID_SOURCE_DELETE:
876         case MSG_ID_RCV_INFO:
877         case MSG_ID_RCV_DELETE:
878         case MSG_ID_RCV_END:
879         case MSG_ID_WRCV_INFO:
880         case MSG_ID_WRCV_DELETE:
881         case MSG_ID_WRCV_END:
882         case MSG_ID_SRC_LEAVE:
883         {
884             return TRUE;
885         }
886 
887         default:
888             return FALSE;
889 
890         }
891     }
892 
893     return FALSE;
894 }
895 
896 
897 
898 static guint get_rsocket_frame_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
899 {
900     /*get the rsocket frame length (3-byte long field)*/
901     /*offset argument points to the begining of the Rsocket PDU*/
902     guint32 rsocket_frame_len = tvb_get_guint24(tvb, offset, ENC_BIG_ENDIAN);
903 
904     /*return total RSocket PDU size*/
905     return (rsocket_frame_len + rsocket_frame_len_field_size);
906 }
907 
908 /*----------------Main Dissection Functions----------------------*/
909 /*Rsocket dissector function*/
910 static guint dissect_rsocket_frame(guint64 rsocket_frame_type,proto_tree* rsocket_frame_tree, tvbuff_t * tvb,guint offset, gboolean *can_dissect_further)
911 {
912     guint total_payload_len = tvb_captured_length(tvb);
913     guint remaining_payload_len = total_payload_len - offset;
914     guint start_offset = offset;
915 
916     switch (rsocket_frame_type)
917     {
918         case RSOCKET_FRAME_SETUP:/*SETUP Frame*/
919         {
920 
921             if (remaining_payload_len < RSOCKET_FRAME_SETUP_MIN_SIZE)
922             {
923                 *can_dissect_further = FALSE;
924                 break;
925             }
926 
927             gint8 resume_flag = tvb_get_bits8(tvb, (offset + 1) * 8, 1);
928             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_resume_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
929             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_lease_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
930             offset += 2;
931 
932             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_major_version, tvb, offset, 2,ENC_BIG_ENDIAN);
933             offset += 2;
934 
935             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_minor_version, tvb, offset, 2,ENC_BIG_ENDIAN);
936             offset += 2;
937             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_keepalive_interval, tvb, offset, 4,ENC_BIG_ENDIAN);
938             offset += 4;
939             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_max_lifetime, tvb, offset, 4,ENC_BIG_ENDIAN);
940             offset += 4;
941             if (resume_flag) {
942                 if ((total_payload_len - offset) < 2)
943                 {
944                     *can_dissect_further = FALSE;
945                     break;
946                 }
947                 guint resume_token_len;
948                 proto_tree_add_item_ret_uint(rsocket_frame_tree, hf_lbmsrs_rsocket_resume_token_len, tvb, offset,2, ENC_BIG_ENDIAN, &resume_token_len);
949                 offset += 2;
950 
951                 if ((total_payload_len - offset) < resume_token_len)
952                 {
953                     *can_dissect_further = FALSE;
954                     break;
955                 }
956                 proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_resume_token, tvb, offset,resume_token_len, ENC_STRING);
957                 offset += resume_token_len;
958             }
959 
960             if ((total_payload_len - offset) < 1)
961             {
962                 *can_dissect_further = FALSE;
963                 break;
964             }
965 
966             guint mdata_mime_length;
967             proto_tree_add_item_ret_uint(rsocket_frame_tree, hf_lbmsrs_rsocket_mdata_mime_length, tvb, offset,1, ENC_BIG_ENDIAN, &mdata_mime_length);
968             offset += 1;
969 
970             if ((total_payload_len - offset) < mdata_mime_length)
971             {
972                 *can_dissect_further = FALSE;
973                 break;
974             }
975 
976             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_mdata_mime_type, tvb, offset,mdata_mime_length, ENC_ASCII | ENC_NA);
977             offset += mdata_mime_length;
978 
979             if ((total_payload_len - offset) < 1)
980             {
981                 *can_dissect_further = FALSE;
982                 break;
983             }
984             guint data_mime_length;
985             proto_tree_add_item_ret_uint(rsocket_frame_tree, hf_lbmsrs_rsocket_data_mime_length, tvb, offset,1, ENC_BIG_ENDIAN, &data_mime_length);
986             offset += 1;
987 
988             if ((total_payload_len - offset) < data_mime_length)
989             {
990                 *can_dissect_further = FALSE;
991                 break;
992             }
993 
994             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_data_mime_type, tvb, offset,data_mime_length, ENC_ASCII | ENC_NA);
995             offset += data_mime_length;
996             break;
997         }
998 
999         case RSOCKET_FRAME_KEEPALIVE:/*KEEPALIVE FRAME*/
1000         {
1001 
1002             if (remaining_payload_len < RSOCKET_FRAME_KEEPALIVE_SIZE)
1003             {
1004                 *can_dissect_further = FALSE;
1005                 break;
1006             }
1007 
1008             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_respond_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1009             offset += 2;
1010 
1011             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_keepalive_last_rcvd_pos, tvb, offset, 8,ENC_BIG_ENDIAN);
1012             offset += 8;
1013 
1014             break;
1015         }
1016 
1017         case RSOCKET_FRAME_REQUEST_RESPONSE:/*REQUEST_RESPONSE FRAME*/
1018         {
1019 
1020             if (remaining_payload_len < RSOCKET_FRAME_REQUEST_RESPONSE_SIZE)
1021             {
1022                 *can_dissect_further = FALSE;
1023                 break;
1024             }
1025             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_follows_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1026             offset += 2;
1027 
1028             break;
1029         }
1030 
1031         case RSOCKET_FRAME_REQUEST_FNF:/*FNF FRAME*/
1032         {
1033             if (remaining_payload_len < RSOCKET_FRAME_REQUEST_FNF_SIZE)
1034             {
1035                 *can_dissect_further = FALSE;
1036                 break;
1037             }
1038             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_follows_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1039             offset += 2;
1040             break;
1041         }
1042 
1043         case RSOCKET_FRAME_REQUEST_STREAM:/*REQ_STREAM FRAME*/
1044         {
1045             if (remaining_payload_len < RSOCKET_FRAME_REQUEST_STREAM_SIZE)
1046             {
1047                 *can_dissect_further = FALSE;
1048                 break;
1049             }
1050             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_follows_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1051             offset += 2;
1052 
1053             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_req_n, tvb, offset, 4, ENC_BIG_ENDIAN);
1054             offset += 4;
1055             break;
1056         }
1057 
1058         case RSOCKET_FRAME_REQUEST_CHANNEL:/*REQ_CHANNEL FRAME*/
1059         {
1060             if (remaining_payload_len < RSOCKET_FRAME_REQUEST_CHANNEL_SIZE)
1061             {
1062                 *can_dissect_further = FALSE;
1063                 break;
1064             }
1065             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_follows_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1066             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_complete_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1067             offset += 2;
1068 
1069             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_req_n, tvb, offset, 4, ENC_BIG_ENDIAN);
1070             offset += 4;
1071             break;
1072         }
1073 
1074         case RSOCKET_FRAME_REQUEST_N:/*REQ_N FRAME*/
1075         {
1076             if (remaining_payload_len < RSOCKET_FRAME_REQUEST_N_SIZE)
1077             {
1078                 *can_dissect_further = FALSE;
1079                 break;
1080             }
1081             offset += 2;
1082             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_req_n, tvb, offset, 4, ENC_BIG_ENDIAN);
1083             offset += 4;
1084             break;
1085         }
1086 
1087         case RSOCKET_FRAME_CANCEL:/*CANCEL FRAME*/
1088         {
1089             if (remaining_payload_len < RSOCKET_FRAME_CANCEL_SIZE)
1090             {
1091                 *can_dissect_further = FALSE;
1092                 break;
1093             }
1094             offset += 2;
1095             break;
1096         }
1097 
1098         case RSOCKET_FRAME_PAYLOAD:/*PAYLOAD FRAME*/
1099         {
1100             if (remaining_payload_len < RSOCKET_FRAME_PAYLOAD_SIZE)
1101             {
1102                 *can_dissect_further = FALSE;
1103                 break;
1104             }
1105             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_follows_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1106             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_complete_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1107             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_next_flag, tvb, offset, 2,ENC_BIG_ENDIAN);
1108 
1109             offset += 2;
1110             break;
1111         }
1112 
1113         case RSOCKET_FRAME_ERROR:
1114         {
1115             if (remaining_payload_len < 6)
1116             {
1117                 *can_dissect_further = FALSE;
1118                 break;
1119             }
1120             offset += 2;
1121             proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_error_code, tvb, offset, 4,ENC_BIG_ENDIAN);
1122             offset += 4;
1123             break;
1124         }
1125 
1126         default:
1127         {
1128             *can_dissect_further = FALSE;
1129         }
1130 
1131     }
1132 
1133     return (offset - start_offset);
1134 
1135 }
1136 
1137 static guint dissect_lbmsrs_sir_ser(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_sir, guint *cnt_ser, gboolean *can_dissect_further)
1138 {
1139     guint total_payload_len = tvb_captured_length(tvb);
1140     guint start_offset = offset;
1141 
1142     /*first filed is OTID, check if that many bytes are left to process*/
1143     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_OTID)
1144     {
1145         /*stop processing in case not available*/
1146         *can_dissect_further = FALSE;
1147         return 0;
1148     }
1149 
1150     proto_item *batch_item = NULL;
1151 
1152     batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_sir, tvb, offset, -1, "SIR");
1153     proto_tree *sir_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_sir);
1154 
1155     proto_tree_add_item(sir_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1156     offset += 2;
1157 
1158     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_otid, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_OTID, ENC_NA);
1159     offset += L_LBM_SRS_SRC_INFO_INFO_T_OTID;
1160 
1161     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_LEN)
1162     {
1163         /*stop processing in case not available*/
1164         *can_dissect_further = FALSE;
1165         return (offset - start_offset);
1166     }
1167     guint8 topic_len = tvb_get_guint8(tvb, offset);
1168     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_topic_len, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
1169     offset += L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_LEN;
1170 
1171     if ((total_payload_len - offset) < topic_len)
1172     {
1173         /*stop processing in case not available*/
1174         *can_dissect_further = FALSE;
1175         return (offset - start_offset);
1176     }
1177     gint len;
1178     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1179     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
1180     offset += topic_len;
1181 
1182     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_SOURCE_LEN)
1183     {
1184         /*stop processing in case not available*/
1185         *can_dissect_further = FALSE;
1186         return (offset - start_offset);
1187     }
1188     guint8 source_len = tvb_get_guint8(tvb, offset);
1189     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_source_len, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_SOURCE_LEN, ENC_BIG_ENDIAN);
1190     offset += L_LBM_SRS_SRC_INFO_INFO_T_SOURCE_LEN;
1191 
1192     if ((total_payload_len - offset) < source_len)
1193     {
1194         /*stop processing in case not available*/
1195         *can_dissect_further = FALSE;
1196         return (offset - start_offset);
1197     }
1198 
1199     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_source, tvb, offset, source_len, ENC_ASCII | ENC_NA);
1200     offset += source_len;
1201 
1202     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_HOST_ID)
1203     {
1204         /*stop processing in case not available*/
1205         *can_dissect_further = FALSE;
1206         return (offset - start_offset);
1207     }
1208     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_host_id, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_HOST_ID, ENC_BIG_ENDIAN);
1209     offset += L_LBM_SRS_SRC_INFO_INFO_T_HOST_ID;
1210 
1211     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_IDX)
1212     {
1213         /*stop processing in case not available*/
1214         *can_dissect_further = FALSE;
1215         return (offset - start_offset);
1216     }
1217     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_topic_idx, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_IDX, ENC_BIG_ENDIAN);
1218     offset += L_LBM_SRS_SRC_INFO_INFO_T_TOPIC_IDX;
1219 
1220     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_FUNCTIONALITY_FLAGS)
1221     {
1222         /*stop processing in case not available*/
1223         *can_dissect_further = FALSE;
1224         return (offset - start_offset);
1225     }
1226     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_functionality_flags, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_FUNCTIONALITY_FLAGS, ENC_BIG_ENDIAN);
1227     offset += L_LBM_SRS_SRC_INFO_INFO_T_FUNCTIONALITY_FLAGS;
1228 
1229     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_IP)
1230     {
1231         /*stop processing in case not available*/
1232         *can_dissect_further = FALSE;
1233         return (offset - start_offset);
1234     }
1235     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_request_ip, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_IP, ENC_BIG_ENDIAN);
1236     offset += L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_IP;
1237 
1238     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_PORT)
1239     {
1240         /*stop processing in case not available*/
1241         *can_dissect_further = FALSE;
1242         return (offset - start_offset);
1243     }
1244     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_request_port, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_PORT, ENC_BIG_ENDIAN);
1245     offset += L_LBM_SRS_SRC_INFO_INFO_T_REQUEST_PORT;
1246 
1247     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_DOMAIN_ID)
1248     {
1249         /*stop processing in case not available*/
1250         *can_dissect_further = FALSE;
1251         return (offset - start_offset);
1252     }
1253     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_domain_id, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1254     offset += L_LBM_SRS_SRC_INFO_INFO_T_DOMAIN_ID;
1255 
1256     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_ENCRYPTION)
1257     {
1258         /*stop processing in case not available*/
1259         *can_dissect_further = FALSE;
1260         return (offset - start_offset);
1261     }
1262     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_encryption, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_ENCRYPTION, ENC_BIG_ENDIAN);
1263     offset += L_LBM_SRS_SRC_INFO_INFO_T_ENCRYPTION;
1264 
1265     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_COMPRESSION)
1266     {
1267         /*stop processing in case not available*/
1268         *can_dissect_further = FALSE;
1269         return (offset - start_offset);
1270     }
1271     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_compression, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_COMPRESSION, ENC_BIG_ENDIAN);
1272     offset += L_LBM_SRS_SRC_INFO_INFO_T_COMPRESSION;
1273 
1274     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_ULB_SRC_ID)
1275     {
1276         /*stop processing in case not available*/
1277         *can_dissect_further = FALSE;
1278         return (offset - start_offset);
1279     }
1280     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_ulb_src_id, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_ULB_SRC_ID, ENC_BIG_ENDIAN);
1281     offset += L_LBM_SRS_SRC_INFO_INFO_T_ULB_SRC_ID;
1282 
1283     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_ULB_QUEUE_ID)
1284     {
1285         /*stop processing in case not available*/
1286         *can_dissect_further = FALSE;
1287         return (offset - start_offset);
1288     }
1289     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_ulb_queue_id, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_ULB_QUEUE_ID, ENC_BIG_ENDIAN);
1290     offset += L_LBM_SRS_SRC_INFO_INFO_T_ULB_QUEUE_ID;
1291 
1292     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_ULB_REG_ID)
1293     {
1294         /*stop processing in case not available*/
1295         *can_dissect_further = FALSE;
1296         return (offset - start_offset);
1297     }
1298     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_ulb_reg_id, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_ULB_REG_ID, ENC_BIG_ENDIAN);
1299     offset += L_LBM_SRS_SRC_INFO_INFO_T_ULB_REG_ID;
1300 
1301     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_INSTANCE)
1302     {
1303         /*stop processing in case not available*/
1304         *can_dissect_further = FALSE;
1305         return (offset - start_offset);
1306     }
1307     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_context_instance, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1308     offset += L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_INSTANCE;
1309 
1310     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_TYPE)
1311     {
1312         /*stop processing in case not available*/
1313         *can_dissect_further = FALSE;
1314         return (offset - start_offset);
1315     }
1316     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_context_type, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1317     offset += L_LBM_SRS_SRC_INFO_INFO_T_CONTEXT_TYPE;
1318 
1319     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_VERSION)
1320     {
1321         /*stop processing in case not available*/
1322         *can_dissect_further = FALSE;
1323         return (offset - start_offset);
1324     }
1325     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_version, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_VERSION, ENC_BIG_ENDIAN);
1326     offset += L_LBM_SRS_SRC_INFO_INFO_T_VERSION;
1327 
1328     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_VERSION_FLAGS)
1329     {
1330         /*stop processing in case not available*/
1331         *can_dissect_further = FALSE;
1332         return (offset - start_offset);
1333     }
1334     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_version_flags, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1335     offset += L_LBM_SRS_SRC_INFO_INFO_T_VERSION_FLAGS;
1336 
1337     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_TTL)
1338     {
1339         /*stop processing in case not available*/
1340         *can_dissect_further = FALSE;
1341         return (offset - start_offset);
1342     }
1343     proto_tree_add_item(sir_tree, hf_lbmsrs_sir_ttl, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_TTL, ENC_BIG_ENDIAN);
1344     offset += L_LBM_SRS_SRC_INFO_INFO_T_TTL;
1345 
1346     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_COST)
1347     {
1348         /*stop processing in case not available*/
1349         *can_dissect_further = FALSE;
1350         return (offset - start_offset);
1351     }
1352     gint32 cost;
1353     proto_tree_add_item_ret_int(sir_tree, hf_lbmsrs_sir_cost, tvb, offset, L_LBM_SRS_SRC_INFO_INFO_T_COST, ENC_BIG_ENDIAN, &cost);
1354     offset += L_LBM_SRS_SRC_INFO_INFO_T_COST;
1355 
1356     if (-1 == cost)
1357     {
1358         proto_item_set_text(batch_item, "SER:Topic:%s", name);
1359         (*cnt_ser)++;
1360     }
1361     else
1362     {
1363         proto_item_set_text(batch_item, "SIR:Topic:%s", name);
1364         (*cnt_sir)++;
1365     }
1366 
1367 
1368     proto_item_set_len(batch_item, (offset - start_offset));
1369     return (offset - start_offset);
1370 }
1371 
1372 static guint dissect_lbmsrs_sdr(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_sdr,gboolean *can_dissect_further)
1373 {
1374     guint total_payload_len = tvb_captured_length(tvb);
1375     guint start_offset = offset;
1376 
1377     /*first filed is OTID, check if that many bytes are left to process*/
1378     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_OTID)
1379     {
1380         /*stop processing in case not available*/
1381         *can_dissect_further = FALSE;
1382         return 0;
1383     }
1384 
1385     /*add a sub-tree for SDR */
1386     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_sdr, tvb, offset, -1, "SDR");
1387     proto_tree *sdr_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_sdr);
1388 
1389     proto_tree_add_item(sdr_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1390     offset += 2;
1391 
1392     /*first filed is OTID, check if that many bytes are left to process*/
1393     if ((total_payload_len - offset) < L_LBM_SRS_SRC_INFO_INFO_T_OTID)
1394     {
1395         /*stop processing in case not available*/
1396         *can_dissect_further = FALSE;
1397         return (offset - start_offset);
1398     }
1399 
1400     proto_tree_add_item(sdr_tree, hf_lbmsrs_sdr_otid, tvb, offset, L_LBM_SRS_SRC_DELETE_INFO_T_OTID, ENC_NA);
1401     offset += L_LBM_SRS_SRC_DELETE_INFO_T_OTID;
1402 
1403     if ((total_payload_len - offset) < L_LBM_SRS_SRC_DELETE_INFO_T_TOPIC_LEN)
1404     {
1405         /*stop processing in case not available*/
1406         *can_dissect_further = FALSE;
1407         return (offset - start_offset);
1408     }
1409     guint8 topic_len = tvb_get_guint8(tvb, offset);
1410     proto_tree_add_item(sdr_tree, hf_lbmsrs_sdr_topic_len, tvb, offset, L_LBM_SRS_SRC_DELETE_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
1411 
1412     offset += L_LBM_SRS_SRC_DELETE_INFO_T_TOPIC_LEN;
1413 
1414     if ((total_payload_len - offset) < topic_len)
1415     {
1416         /*stop processing in case not available*/
1417         *can_dissect_further = FALSE;
1418         return (offset - start_offset);
1419     }
1420     gint len;
1421     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1422     proto_tree_add_item(sdr_tree, hf_lbmsrs_sdr_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
1423     offset += topic_len;
1424 
1425     proto_item_set_text(batch_item, "SDR:Topic:%s", name);
1426     (*cnt_sdr)++;
1427 
1428     proto_item_set_len(batch_item, (offset - start_offset));
1429     return (offset - start_offset);
1430 
1431 }
1432 
1433 static guint dissect_lbmsrs_rir(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_rir, gboolean *can_dissect_further)
1434 {
1435     guint total_payload_len = tvb_captured_length(tvb);
1436     guint start_offset = offset;
1437 
1438     /*first field is Topic length, check if that many bytes are left to process*/
1439     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_TOPIC_LEN)
1440     {
1441         /*stop processing in case not available*/
1442         *can_dissect_further = FALSE;
1443         return 0;
1444     }
1445 
1446     /*add a sub-tree for RIR */
1447     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_rir, tvb, offset, -1, "RIR");
1448     proto_tree *rir_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_rir);
1449 
1450     proto_tree_add_item(rir_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1451     offset += 2;
1452 
1453     /*first field is Topic length, check if that many bytes are left to process*/
1454     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_TOPIC_LEN)
1455     {
1456         /*stop processing in case not available*/
1457         *can_dissect_further = FALSE;
1458         return (offset - start_offset);
1459     }
1460 
1461     guint8 topic_len = tvb_get_guint8(tvb, offset);
1462     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_topic_len, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
1463 
1464     offset += L_LBM_SRS_RCV_INFO_INFO_T_TOPIC_LEN;
1465 
1466     if ((total_payload_len - offset) < topic_len)
1467     {
1468         /*stop processing in case not available*/
1469         *can_dissect_further = FALSE;
1470         return (offset - start_offset);
1471     }
1472     gint len;
1473     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1474     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
1475     offset += topic_len;
1476 
1477     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_DOMAIN_ID)
1478     {
1479         /*stop processing in case not available*/
1480         *can_dissect_further = FALSE;
1481         return (offset - start_offset);
1482     }
1483     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_domain_id, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1484     offset += L_LBM_SRS_RCV_INFO_INFO_T_DOMAIN_ID;
1485 
1486     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_INSTANCE)
1487     {
1488         /*stop processing in case not available*/
1489         *can_dissect_further = FALSE;
1490         return (offset - start_offset);
1491     }
1492     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_context_instance, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1493     offset += L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_INSTANCE;
1494 
1495     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_TYPE)
1496     {
1497         /*stop processing in case not available*/
1498         *can_dissect_further = FALSE;
1499         return (offset - start_offset);
1500     }
1501     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_context_type, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1502     offset += L_LBM_SRS_RCV_INFO_INFO_T_CONTEXT_TYPE;
1503 
1504     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_VERSION)
1505     {
1506         /*stop processing in case not available*/
1507         *can_dissect_further = FALSE;
1508         return (offset - start_offset);
1509     }
1510     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_version, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_VERSION, ENC_BIG_ENDIAN);
1511     offset += L_LBM_SRS_RCV_INFO_INFO_T_VERSION;
1512 
1513     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_VERSION_FLAGS)
1514     {
1515         /*stop processing in case not available*/
1516         *can_dissect_further = FALSE;
1517         return (offset - start_offset);
1518     }
1519     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_version_flags, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1520     offset += L_LBM_SRS_RCV_INFO_INFO_T_VERSION_FLAGS;
1521 
1522     if ((total_payload_len - offset) < L_LBM_SRS_RCV_INFO_INFO_T_RESERVED)
1523     {
1524         /*stop processing in case not available*/
1525         *can_dissect_further = FALSE;
1526         return (offset - start_offset);
1527     }
1528     proto_tree_add_item(rir_tree, hf_lbmsrs_rir_reserved, tvb, offset, L_LBM_SRS_RCV_INFO_INFO_T_RESERVED, ENC_BIG_ENDIAN);
1529     offset += L_LBM_SRS_RCV_INFO_INFO_T_RESERVED;
1530 
1531     proto_item_set_text(batch_item, "RIR:Topic:%s", name);
1532     (*cnt_rir)++;
1533 
1534     proto_item_set_len(batch_item, (offset - start_offset));
1535     return (offset - start_offset);
1536 
1537 }
1538 
1539 static guint dissect_lbmsrs_rer(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_rer, gboolean *can_dissect_further)
1540 {
1541     guint total_payload_len = tvb_captured_length(tvb);
1542     guint start_offset = offset;
1543 
1544     /*first field is Topic length, check if that many bytes are left to process*/
1545     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_TOPIC_LEN)
1546     {
1547         /*stop processing in case not available*/
1548         *can_dissect_further = FALSE;
1549         return 0;
1550     }
1551 
1552     /*add a sub-tree for RIR */
1553     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_rer, tvb, offset, -1, "RER");
1554     proto_tree *rer_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_rer);
1555 
1556     proto_tree_add_item(rer_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1557     offset += 2;
1558 
1559     /*first field is Topic length, check if that many bytes are left to process*/
1560     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_TOPIC_LEN)
1561     {
1562         /*stop processing in case not available*/
1563         *can_dissect_further = FALSE;
1564         return (offset - start_offset);
1565     }
1566 
1567     guint8 topic_len = tvb_get_guint8(tvb, offset);
1568     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_topic_len, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
1569 
1570     offset += L_LBM_SRS_RCV_END_INFO_T_TOPIC_LEN;
1571 
1572     if ((total_payload_len - offset) < topic_len)
1573     {
1574         /*stop processing in case not available*/
1575         *can_dissect_further = FALSE;
1576         return (offset - start_offset);
1577     }
1578     gint len;
1579     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1580     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
1581     offset += topic_len;
1582 
1583     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_DOMAIN_ID)
1584     {
1585         /*stop processing in case not available*/
1586         *can_dissect_further = FALSE;
1587         return (offset - start_offset);
1588     }
1589     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_domain_id, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1590     offset += L_LBM_SRS_RCV_END_INFO_T_DOMAIN_ID;
1591 
1592     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_CONTEXT_INSTANCE)
1593     {
1594         /*stop processing in case not available*/
1595         *can_dissect_further = FALSE;
1596         return (offset - start_offset);
1597     }
1598     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_context_instance, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1599     offset += L_LBM_SRS_RCV_END_INFO_T_CONTEXT_INSTANCE;
1600 
1601     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_CONTEXT_TYPE)
1602     {
1603         /*stop processing in case not available*/
1604         *can_dissect_further = FALSE;
1605         return (offset - start_offset);
1606     }
1607     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_context_type, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1608     offset += L_LBM_SRS_RCV_END_INFO_T_CONTEXT_TYPE;
1609 
1610     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_VERSION)
1611     {
1612         /*stop processing in case not available*/
1613         *can_dissect_further = FALSE;
1614         return (offset - start_offset);
1615     }
1616     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_version, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_VERSION, ENC_BIG_ENDIAN);
1617     offset += L_LBM_SRS_RCV_END_INFO_T_VERSION;
1618 
1619     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_VERSION_FLAGS)
1620     {
1621         /*stop processing in case not available*/
1622         *can_dissect_further = FALSE;
1623         return (offset - start_offset);
1624     }
1625     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_version_flags, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1626     offset += L_LBM_SRS_RCV_END_INFO_T_VERSION_FLAGS;
1627 
1628 
1629     if ((total_payload_len - offset) < L_LBM_SRS_RCV_END_INFO_T_RESERVED)
1630     {
1631         /*stop processing in case not available*/
1632         *can_dissect_further = FALSE;
1633         return (offset - start_offset);
1634     }
1635     proto_tree_add_item(rer_tree, hf_lbmsrs_rer_reserved, tvb, offset, L_LBM_SRS_RCV_END_INFO_T_RESERVED, ENC_BIG_ENDIAN);
1636     offset += L_LBM_SRS_RCV_END_INFO_T_RESERVED;
1637 
1638     proto_item_set_text(batch_item, "RER:Topic:%s", name);
1639     (*cnt_rer)++;
1640 
1641     proto_item_set_len(batch_item, (offset - start_offset));
1642     return (offset - start_offset);
1643 
1644 }
1645 
1646 static guint dissect_lbmsrs_rdr(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_rdr, gboolean *can_dissect_further)
1647 {
1648     guint total_payload_len = tvb_captured_length(tvb);
1649     guint start_offset = offset;
1650 
1651     /*first field is Topic length, check if that many bytes are left to process*/
1652     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_TOPIC_LEN)
1653     {
1654         /*stop processing in case not available*/
1655         *can_dissect_further = FALSE;
1656         return 0;
1657     }
1658 
1659     /*add a sub-tree for RIR */
1660     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_rdr, tvb, offset, -1, "RDR");
1661     proto_tree *rdr_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_rdr);
1662 
1663     proto_tree_add_item(rdr_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1664     offset += 2;
1665 
1666     /*first field is Topic length, check if that many bytes are left to process*/
1667     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_TOPIC_LEN)
1668     {
1669         /*stop processing in case not available*/
1670         *can_dissect_further = FALSE;
1671         return (offset - start_offset);
1672     }
1673 
1674     guint8 topic_len = tvb_get_guint8(tvb, offset);
1675     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_topic_len, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
1676 
1677     offset += L_LBM_SRS_RCV_DELETE_INFO_T_TOPIC_LEN;
1678 
1679     if ((total_payload_len - offset) < topic_len)
1680     {
1681         /*stop processing in case not available*/
1682         *can_dissect_further = FALSE;
1683         return (offset - start_offset);
1684     }
1685     gint len;
1686     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1687     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
1688     offset += topic_len;
1689 
1690     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_DOMAIN_ID)
1691     {
1692         /*stop processing in case not available*/
1693         *can_dissect_further = FALSE;
1694         return (offset - start_offset);
1695     }
1696     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_domain_id, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1697     offset += L_LBM_SRS_RCV_DELETE_INFO_T_DOMAIN_ID;
1698 
1699     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_INSTANCE)
1700     {
1701         /*stop processing in case not available*/
1702         *can_dissect_further = FALSE;
1703         return (offset - start_offset);
1704     }
1705     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_context_instance, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1706     offset += L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_INSTANCE;
1707 
1708     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_TYPE)
1709     {
1710         /*stop processing in case not available*/
1711         *can_dissect_further = FALSE;
1712         return (offset - start_offset);
1713     }
1714     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_context_type, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1715     offset += L_LBM_SRS_RCV_DELETE_INFO_T_CONTEXT_TYPE;
1716 
1717 
1718     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_VERSION)
1719     {
1720         /*stop processing in case not available*/
1721         *can_dissect_further = FALSE;
1722         return (offset - start_offset);
1723     }
1724     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_version, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_VERSION, ENC_BIG_ENDIAN);
1725     offset += L_LBM_SRS_RCV_DELETE_INFO_T_VERSION;
1726 
1727     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_VERSION_FLAGS)
1728     {
1729         /*stop processing in case not available*/
1730         *can_dissect_further = FALSE;
1731         return (offset - start_offset);
1732     }
1733     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_version_flags, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1734     offset += L_LBM_SRS_RCV_INFO_INFO_T_VERSION_FLAGS;
1735 
1736     if ((total_payload_len - offset) < L_LBM_SRS_RCV_DELETE_INFO_T_RESERVED)
1737     {
1738         /*stop processing in case not available*/
1739         *can_dissect_further = FALSE;
1740         return (offset - start_offset);
1741     }
1742     proto_tree_add_item(rdr_tree, hf_lbmsrs_rdr_reserved, tvb, offset, L_LBM_SRS_RCV_DELETE_INFO_T_RESERVED, ENC_BIG_ENDIAN);
1743     offset += L_LBM_SRS_RCV_DELETE_INFO_T_RESERVED;
1744 
1745     proto_item_set_text(batch_item, "RDR:Topic:%s", name);
1746     (*cnt_rdr)++;
1747 
1748     proto_item_set_len(batch_item, (offset - start_offset));
1749     return (offset - start_offset);
1750 
1751 }
1752 
1753 static guint dissect_lbmsrs_wir(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_wir, gboolean *can_dissect_further)
1754 {
1755     guint total_payload_len = tvb_captured_length(tvb);
1756     guint start_offset = offset;
1757 
1758     /*first field is Topic length, check if that many bytes are left to process*/
1759     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_PATTERN_LEN)
1760     {
1761         /*stop processing in case not available*/
1762         *can_dissect_further = FALSE;
1763         return 0;
1764     }
1765 
1766     /*add a sub-tree for RIR */
1767     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_wir, tvb, offset, -1, "WIR");
1768     proto_tree *wir_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_wir);
1769 
1770     proto_tree_add_item(wir_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1771     offset += 2;
1772 
1773     /*first field is Topic length, check if that many bytes are left to process*/
1774     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_PATTERN_LEN)
1775     {
1776         /*stop processing in case not available*/
1777         *can_dissect_further = FALSE;
1778         return (offset - start_offset);
1779     }
1780 
1781     guint8 pattern_len = tvb_get_guint8(tvb, offset);
1782     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_pattern_len, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_PATTERN_LEN, ENC_BIG_ENDIAN);
1783 
1784     offset += L_LBM_SRS_WRCV_INFO_INFO_T_PATTERN_LEN;
1785 
1786     if ((total_payload_len - offset) < pattern_len)
1787     {
1788         /*stop processing in case not available*/
1789         *can_dissect_further = FALSE;
1790         return (offset - start_offset);
1791     }
1792     gint len;
1793     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1794     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_pattern, tvb, offset, pattern_len, ENC_ASCII | ENC_NA);
1795     offset += pattern_len;
1796 
1797     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_DOMAIN_ID)
1798     {
1799         /*stop processing in case not available*/
1800         *can_dissect_further = FALSE;
1801         return (offset - start_offset);
1802     }
1803     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_domain_id, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1804     offset += L_LBM_SRS_WRCV_INFO_INFO_T_DOMAIN_ID;
1805 
1806     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_INSTANCE)
1807     {
1808         /*stop processing in case not available*/
1809         *can_dissect_further = FALSE;
1810         return (offset - start_offset);
1811     }
1812     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_context_instance, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1813     offset += L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_INSTANCE;
1814 
1815     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_TYPE)
1816     {
1817         /*stop processing in case not available*/
1818         *can_dissect_further = FALSE;
1819         return (offset - start_offset);
1820     }
1821     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_context_type, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1822     offset += L_LBM_SRS_WRCV_INFO_INFO_T_CONTEXT_TYPE;
1823 
1824 
1825     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_VERSION)
1826     {
1827         /*stop processing in case not available*/
1828         *can_dissect_further = FALSE;
1829         return (offset - start_offset);
1830     }
1831     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_version, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_VERSION, ENC_BIG_ENDIAN);
1832     offset += L_LBM_SRS_WRCV_INFO_INFO_T_VERSION;
1833 
1834     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_VERSION_FLAGS)
1835     {
1836         /*stop processing in case not available*/
1837         *can_dissect_further = FALSE;
1838         return (offset - start_offset);
1839     }
1840     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_version_flags, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1841     offset += L_LBM_SRS_WRCV_INFO_INFO_T_VERSION_FLAGS;
1842 
1843     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_INFO_INFO_T_RESERVED)
1844     {
1845         /*stop processing in case not available*/
1846         *can_dissect_further = FALSE;
1847         return (offset - start_offset);
1848     }
1849     proto_tree_add_item(wir_tree, hf_lbmsrs_wir_reserved, tvb, offset, L_LBM_SRS_WRCV_INFO_INFO_T_RESERVED, ENC_BIG_ENDIAN);
1850     offset += L_LBM_SRS_WRCV_INFO_INFO_T_RESERVED;
1851 
1852     proto_item_set_text(batch_item, "WIR:Topic:%s", name);
1853     (*cnt_wir)++;
1854 
1855     proto_item_set_len(batch_item, (offset - start_offset));
1856     return (offset - start_offset);
1857 
1858 }
1859 
1860 static guint dissect_lbmsrs_wdr(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_wdr, gboolean *can_dissect_further)
1861 {
1862     guint total_payload_len = tvb_captured_length(tvb);
1863     guint start_offset = offset;
1864 
1865     /*first field is Topic length, check if that many bytes are left to process*/
1866     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_PATTERN_LEN)
1867     {
1868         /*stop processing in case not available*/
1869         *can_dissect_further = FALSE;
1870         return 0;
1871     }
1872 
1873     /*add a sub-tree for RIR */
1874     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_wdr, tvb, offset, -1, "WDR");
1875     proto_tree *wdr_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_wdr);
1876 
1877     proto_tree_add_item(wdr_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1878     offset += 2;
1879 
1880     /*first field is Topic length, check if that many bytes are left to process*/
1881     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_PATTERN_LEN)
1882     {
1883         /*stop processing in case not available*/
1884         *can_dissect_further = FALSE;
1885         return (offset - start_offset);
1886     }
1887 
1888     guint8 pattern_len = tvb_get_guint8(tvb, offset);
1889     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_pattern_len, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_PATTERN_LEN, ENC_BIG_ENDIAN);
1890 
1891     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_PATTERN_LEN;
1892 
1893     if ((total_payload_len - offset) < pattern_len)
1894     {
1895         /*stop processing in case not available*/
1896         *can_dissect_further = FALSE;
1897         return (offset - start_offset);
1898     }
1899     gint len;
1900     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
1901     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_pattern, tvb, offset, pattern_len, ENC_ASCII | ENC_NA);
1902     offset += pattern_len;
1903 
1904     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_DOMAIN_ID)
1905     {
1906         /*stop processing in case not available*/
1907         *can_dissect_further = FALSE;
1908         return (offset - start_offset);
1909     }
1910     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_domain_id, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
1911     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_DOMAIN_ID;
1912 
1913     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_INSTANCE)
1914     {
1915         /*stop processing in case not available*/
1916         *can_dissect_further = FALSE;
1917         return (offset - start_offset);
1918     }
1919     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_context_instance, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_INSTANCE, ENC_NA);
1920     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_INSTANCE;
1921 
1922     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_TYPE)
1923     {
1924         /*stop processing in case not available*/
1925         *can_dissect_further = FALSE;
1926         return (offset - start_offset);
1927     }
1928     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_context_type, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
1929     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_CONTEXT_TYPE;
1930 
1931 
1932     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION)
1933     {
1934         /*stop processing in case not available*/
1935         *can_dissect_further = FALSE;
1936         return (offset - start_offset);
1937     }
1938     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_version, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION, ENC_BIG_ENDIAN);
1939     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION;
1940 
1941     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION_FLAGS)
1942     {
1943         /*stop processing in case not available*/
1944         *can_dissect_further = FALSE;
1945         return (offset - start_offset);
1946     }
1947     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_version_flags, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
1948     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_VERSION_FLAGS;
1949 
1950     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_DELETE_INFO_T_RESERVED)
1951     {
1952         /*stop processing in case not available*/
1953         *can_dissect_further = FALSE;
1954         return (offset - start_offset);
1955     }
1956     proto_tree_add_item(wdr_tree, hf_lbmsrs_wdr_reserved, tvb, offset, L_LBM_SRS_WRCV_DELETE_INFO_T_RESERVED, ENC_BIG_ENDIAN);
1957     offset += L_LBM_SRS_WRCV_DELETE_INFO_T_RESERVED;
1958 
1959     proto_item_set_text(batch_item, "WDR:Topic:%s", name);
1960     (*cnt_wdr)++;
1961 
1962     proto_item_set_len(batch_item, (offset - start_offset));
1963     return (offset - start_offset);
1964 
1965 }
1966 
1967 static guint dissect_lbmsrs_wer(tvbuff_t * tvb, proto_tree * tree, guint offset, guint *cnt_wer, gboolean *can_dissect_further)
1968 {
1969     guint total_payload_len = tvb_captured_length(tvb);
1970     gint start_offset = offset;
1971 
1972     /*first field is Topic length, check if that many bytes are left to process*/
1973     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_PATTERN_LEN)
1974     {
1975         /*stop processing in case not available*/
1976         *can_dissect_further = FALSE;
1977         return 0;
1978     }
1979 
1980     /*add a sub-tree for WER */
1981     proto_item * batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_wer, tvb, offset, -1, "WER");
1982     proto_tree *wer_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_wer);
1983 
1984     proto_tree_add_item(wer_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1985     offset += 2;
1986 
1987     /*first field is Topic length, check if that many bytes are left to process*/
1988     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_PATTERN_LEN)
1989     {
1990         /*stop processing in case not available*/
1991         *can_dissect_further = FALSE;
1992         return (offset - start_offset);
1993     }
1994 
1995     guint8 pattern_len = tvb_get_guint8(tvb, offset);
1996     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_pattern_len, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_PATTERN_LEN, ENC_BIG_ENDIAN);
1997 
1998     offset += L_LBM_SRS_WRCV_END_INFO_T_PATTERN_LEN;
1999 
2000     if ((total_payload_len - offset) < pattern_len)
2001     {
2002         /*stop processing in case not available*/
2003         *can_dissect_further = FALSE;
2004         return (offset - start_offset);
2005     }
2006     gint len;
2007     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
2008     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_pattern, tvb, offset, pattern_len, ENC_ASCII | ENC_NA);
2009     offset += pattern_len;
2010 
2011     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_DOMAIN_ID)
2012     {
2013         /*stop processing in case not available*/
2014         *can_dissect_further = FALSE;
2015         return (offset - start_offset);
2016     }
2017     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_domain_id, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_DOMAIN_ID, ENC_BIG_ENDIAN);
2018     offset += L_LBM_SRS_WRCV_END_INFO_T_DOMAIN_ID;
2019 
2020     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_INSTANCE)
2021     {
2022         /*stop processing in case not available*/
2023         *can_dissect_further = FALSE;
2024         return (offset - start_offset);
2025     }
2026     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_context_instance, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_INSTANCE, ENC_NA);
2027     offset += L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_INSTANCE;
2028 
2029     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_TYPE)
2030     {
2031         /*stop processing in case not available*/
2032         *can_dissect_further = FALSE;
2033         return (offset - start_offset);
2034     }
2035     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_context_type, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
2036     offset += L_LBM_SRS_WRCV_END_INFO_T_CONTEXT_TYPE;
2037 
2038     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_VERSION)
2039     {
2040         /*stop processing in case not available*/
2041         *can_dissect_further = FALSE;
2042         return (offset - start_offset);
2043     }
2044     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_version, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_VERSION, ENC_BIG_ENDIAN);
2045     offset += L_LBM_SRS_WRCV_END_INFO_T_VERSION;
2046 
2047     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_VERSION_FLAGS)
2048     {
2049         /*stop processing in case not available*/
2050         *can_dissect_further = FALSE;
2051         return (offset - start_offset);
2052     }
2053     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_version_flags, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
2054     offset += L_LBM_SRS_WRCV_END_INFO_T_VERSION_FLAGS;
2055 
2056     if ((total_payload_len - offset) < L_LBM_SRS_WRCV_END_INFO_T_RESERVED)
2057     {
2058         /*stop processing in case not available*/
2059         *can_dissect_further = FALSE;
2060         return (offset - start_offset);
2061     }
2062     proto_tree_add_item(wer_tree, hf_lbmsrs_wer_reserved, tvb, offset, L_LBM_SRS_WRCV_END_INFO_T_RESERVED, ENC_BIG_ENDIAN);
2063     offset += L_LBM_SRS_WRCV_END_INFO_T_RESERVED;
2064 
2065     proto_item_set_text(batch_item, "WER:Topic:%s", name);
2066     (*cnt_wer)++;
2067 
2068     proto_item_set_len(batch_item, (offset - start_offset));
2069     return (offset - start_offset);
2070 
2071 }
2072 
2073 static guint dissect_lbmsrs_sli(tvbuff_t * tvb,  proto_tree * tree, guint offset, guint *cnt_sli, gboolean *can_dissect_further)
2074 {
2075     guint total_payload_len = tvb_captured_length(tvb);
2076     guint start_offset = offset;
2077 
2078     /*first filed is OTID, check if that many bytes are left to process*/
2079     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_OTID)
2080     {
2081         /*stop processing in case not available*/
2082         *can_dissect_further = FALSE;
2083         return 0;
2084     }
2085 
2086     proto_item *batch_item = NULL;
2087 
2088     batch_item = proto_tree_add_none_format(tree, hf_lbmsrs_sli, tvb, offset, -1, "SLI");
2089     proto_tree *sli_tree = proto_item_add_subtree(batch_item, ett_lbmsrs_sli);
2090 
2091     proto_tree_add_item(sli_tree, hf_lbmsrs_message_id, tvb, offset, 2, ENC_BIG_ENDIAN);
2092     offset += 2;
2093 
2094     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_otid, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_OTID, ENC_NA);
2095     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_OTID;
2096 
2097     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_TOPIC_LEN)
2098     {
2099         /*stop processing in case not available*/
2100         *can_dissect_further = FALSE;
2101         return (offset - start_offset);
2102     }
2103     guint8 topic_len = tvb_get_guint8(tvb, offset);
2104     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_topic_len, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_TOPIC_LEN, ENC_BIG_ENDIAN);
2105     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_TOPIC_LEN;
2106 
2107     if ((total_payload_len - offset) < topic_len)
2108     {
2109         /*stop processing in case not available*/
2110         *can_dissect_further = FALSE;
2111         return (offset - start_offset);
2112     }
2113     gint len;
2114     char* name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &len, ENC_ASCII);
2115     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_topic, tvb, offset, topic_len, ENC_ASCII | ENC_NA);
2116     offset += topic_len;
2117 
2118     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_SOURCE_LEN)
2119     {
2120         /*stop processing in case not available*/
2121         *can_dissect_further = FALSE;
2122         return (offset - start_offset);
2123     }
2124     guint8 source_len = tvb_get_guint8(tvb, offset);
2125     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_source_len, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_SOURCE_LEN, ENC_BIG_ENDIAN);
2126     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_SOURCE_LEN;
2127 
2128     if ((total_payload_len - offset) < source_len)
2129     {
2130         /*stop processing in case not available*/
2131         *can_dissect_further = FALSE;
2132         return (offset - start_offset);
2133     }
2134     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_source, tvb, offset, source_len, ENC_ASCII | ENC_NA);
2135     offset += source_len;
2136 
2137     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_INSTANCE)
2138     {
2139         /*stop processing in case not available*/
2140         *can_dissect_further = FALSE;
2141         return (offset - start_offset);
2142     }
2143     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_context_instance, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_INSTANCE, ENC_NA);
2144     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_INSTANCE;
2145 
2146     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_TYPE)
2147     {
2148         /*stop processing in case not available*/
2149         *can_dissect_further = FALSE;
2150         return (offset - start_offset);
2151     }
2152     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_context_type, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_TYPE, ENC_BIG_ENDIAN);
2153     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_CONTEXT_TYPE;
2154 
2155 
2156     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION)
2157     {
2158         /*stop processing in case not available*/
2159         *can_dissect_further = FALSE;
2160         return (offset - start_offset);
2161     }
2162     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_version, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION, ENC_BIG_ENDIAN);
2163     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION;
2164 
2165     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION_FLAGS)
2166     {
2167         /*stop processing in case not available*/
2168         *can_dissect_further = FALSE;
2169         return (offset - start_offset);
2170     }
2171     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_version_flags, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION_FLAGS, ENC_BIG_ENDIAN);
2172     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_VERSION_FLAGS;
2173 
2174 
2175     if ((total_payload_len - offset) < L_LBM_SRS_SRC_LEAVE_INFO_T_RESERVED)
2176     {
2177         /*stop processing in case not available*/
2178         *can_dissect_further = FALSE;
2179         return (offset - start_offset);
2180     }
2181     proto_tree_add_item(sli_tree, hf_lbmsrs_sli_reserved, tvb, offset, L_LBM_SRS_SRC_LEAVE_INFO_T_RESERVED, ENC_BIG_ENDIAN);
2182     offset += L_LBM_SRS_SRC_LEAVE_INFO_T_RESERVED;
2183 
2184     proto_item_set_text(batch_item, "SLI:Topic:%s", name);
2185     (*cnt_sli)++;
2186 
2187     proto_item_set_len(batch_item, (offset - start_offset));
2188     return (offset - start_offset);
2189 }
2190 
2191 /*Function to dissect SRS SIR/SER/SDR*/
2192 static guint dissect_lbmsrs_batch(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint offset, guint32 rsocket_payload_len)
2193 {
2194     guint start_offset = offset;
2195     guint total_payload_len = tvb_captured_length(tvb);
2196     guint cnt_sir = 0, cnt_ser = 0, cnt_sdr = 0;
2197     guint cnt_rir = 0, cnt_rer = 0, cnt_rdr = 0;
2198     guint cnt_wir = 0, cnt_wer = 0, cnt_wdr = 0;
2199     guint cnt_sli = 0;
2200 
2201 
2202     col_append_fstr(pinfo->cinfo, COL_INFO, "[");
2203     /*add a sub-tree for the batch */
2204 
2205     proto_item *srs_batch;
2206     proto_tree_add_subtree(tree, tvb, offset, rsocket_payload_len, ett_lbmsrs_details, &srs_batch, "SRS SIR/SER/SDR/RIR/RDR/RER/WIR/WDR/WER");
2207 
2208     /*this is a start of the batch which will contain SIR,SDR,SER*/
2209     while (offset < total_payload_len)
2210     {
2211         /*at least two bytes required to check the message id*/
2212         if ((total_payload_len - offset) < L_LBM_SRS_MESSAGE_ID)
2213         {
2214             col_append_fstr(pinfo->cinfo, COL_INFO, "SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2215                 cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2216             proto_item_set_text(srs_batch, "SRS:[SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2217                 cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2218             proto_item_set_len(srs_batch, (offset - start_offset));
2219             return (offset - start_offset);
2220         }
2221 
2222         guint16 message_id = tvb_get_guint16(tvb, offset, ENC_BIG_ENDIAN);
2223 
2224         /*process the SIR/SDR/SER*/
2225         guint len_dissected = 0;
2226         gboolean can_dissect_further = TRUE;
2227         switch (message_id)
2228         {
2229             case MSG_ID_SOURCE_INFO:
2230             {
2231                 len_dissected = dissect_lbmsrs_sir_ser(tvb,tree, offset, &cnt_sir, &cnt_ser,&can_dissect_further);
2232                 break;
2233             }
2234 
2235             case MSG_ID_SOURCE_DELETE:
2236             {
2237                 len_dissected = dissect_lbmsrs_sdr(tvb, tree, offset, &cnt_sdr, &can_dissect_further);
2238                 break;
2239             }
2240 
2241             case MSG_ID_RCV_INFO:
2242             {
2243                 len_dissected = dissect_lbmsrs_rir(tvb, tree, offset, &cnt_rir, &can_dissect_further);
2244                 break;
2245             }
2246             case MSG_ID_RCV_DELETE:
2247             {
2248                 len_dissected = dissect_lbmsrs_rdr(tvb, tree, offset, &cnt_rdr, &can_dissect_further);
2249                 break;
2250             }
2251             case MSG_ID_RCV_END:
2252             {
2253                 len_dissected = dissect_lbmsrs_rer(tvb, tree, offset, &cnt_rer, &can_dissect_further);
2254                 break;
2255             }
2256             case MSG_ID_WRCV_INFO:
2257             {
2258                 len_dissected = dissect_lbmsrs_wir(tvb, tree, offset, &cnt_wir, &can_dissect_further);
2259                 break;
2260             }
2261             case MSG_ID_WRCV_DELETE:
2262             {
2263                 len_dissected = dissect_lbmsrs_wdr(tvb, tree, offset, &cnt_wdr, &can_dissect_further);
2264                 break;
2265             }
2266             case MSG_ID_WRCV_END:
2267             {
2268                 len_dissected = dissect_lbmsrs_wer(tvb, tree, offset, &cnt_wer, &can_dissect_further);
2269                 break;
2270             }
2271             case MSG_ID_SRC_LEAVE:
2272             {
2273                 len_dissected = dissect_lbmsrs_sli(tvb, tree, offset, &cnt_sli, &can_dissect_further);
2274                 break;
2275             }
2276 
2277             default:
2278                 break;
2279         }
2280 
2281         /*if nothing is dissected then return the current offset*/
2282         if (FALSE == can_dissect_further || len_dissected < 1)
2283         {
2284             col_append_fstr(pinfo->cinfo, COL_INFO, "SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2285                 cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2286             proto_item_set_text(srs_batch, "SRS:[SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2287                 cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2288             proto_item_set_len(srs_batch, (offset - start_offset));
2289             return (offset - start_offset);
2290         }
2291         offset += len_dissected;
2292     }
2293 
2294     col_append_fstr(pinfo->cinfo, COL_INFO, "SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2295         cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2296     proto_item_set_text(srs_batch, "SRS:[SIR:%u SER:%u SDR:%u RIR:%u RER:%u RDR:%u WIR:%u WER:%u WDR:%u SLI:%u]",
2297         cnt_sir, cnt_ser, cnt_sdr, cnt_rir, cnt_rer, cnt_rdr, cnt_wir, cnt_wer, cnt_wdr, cnt_sli);
2298     proto_item_set_len(srs_batch, (offset - start_offset));
2299 
2300     return (offset - start_offset);
2301 }
2302 
2303 static guint dissect_lbmsrs_registration_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint offset, guint32 rsocket_payload_len)
2304 {
2305     guint start_offset = offset;
2306     proto_tree_add_item(tree, hf_lbmsrs_message_id, tvb, offset, L_LBM_SRS_MESSAGE_ID, ENC_BIG_ENDIAN);
2307     offset += L_LBM_SRS_MESSAGE_ID;
2308 
2309     /*reduce by message id field length*/
2310     rsocket_payload_len -= L_LBM_SRS_MESSAGE_ID;
2311     if (L_LBM_SRS_REGISTRATION_REQUEST_INFO_T != rsocket_payload_len)
2312     {
2313         return (offset - start_offset);
2314     }
2315 
2316     col_append_fstr(pinfo->cinfo, COL_INFO, "[SRS REGISTRATION REQUEST]");
2317     /*add a sub-tree for SRS */
2318     proto_item *lbmsrs_details;
2319     proto_tree *lbmsrs_details_tree = proto_tree_add_subtree(tree, tvb, offset, rsocket_payload_len, ett_lbmsrs_details, &lbmsrs_details, "SRS Registration Request");
2320 
2321     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_app_type, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_APP_TYPE, ENC_BIG_ENDIAN);
2322     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_APP_TYPE;
2323     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_client_addr, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_ADDR, ENC_BIG_ENDIAN);
2324     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_ADDR;
2325     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_client_port, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_PORT, ENC_BIG_ENDIAN);
2326     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_CLIENT_PORT;
2327     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_session_id, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_SESSION_ID, ENC_BIG_ENDIAN);
2328     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_SESSION_ID;
2329     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_host_id, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_HOST_ID, ENC_BIG_ENDIAN);
2330     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_HOST_ID;
2331     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_protocol_version, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_PROTOCOL_VERSION, ENC_BIG_ENDIAN);
2332     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_PROTOCOL_VERSION;
2333     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_interest_mode, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_INTEREST_MODE, ENC_BIG_ENDIAN);
2334     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_INTEREST_MODE;
2335     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_req_local_domain_id, tvb, offset, L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_LOCAL_DOMAIN_ID, ENC_BIG_ENDIAN);
2336     offset += L_LBM_SRS_REGISTRATION_REQUEST_INFO_T_LOCAL_DOMAIN_ID;
2337 
2338     return (offset - start_offset); //return the total length dissected
2339 
2340 }
2341 
2342 static guint dissect_lbmsrs_registration_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint offset, guint32 rsocket_payload_len)
2343 {
2344     guint start_offset = offset;
2345     proto_tree_add_item(tree, hf_lbmsrs_message_id, tvb, offset, L_LBM_SRS_MESSAGE_ID, ENC_BIG_ENDIAN);
2346     offset += L_LBM_SRS_MESSAGE_ID;
2347 
2348     /*reduce by message id field length*/
2349     rsocket_payload_len -= L_LBM_SRS_MESSAGE_ID;
2350 
2351     if (L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T != rsocket_payload_len)
2352     {
2353         return (offset - start_offset);
2354     }
2355 
2356     col_append_fstr(pinfo->cinfo, COL_INFO, "[SRS REGISTRATION RESPONSE]");
2357 
2358     /*add a sub-tree for SRS */
2359     proto_item *lbmsrs_details;
2360     proto_tree *lbmsrs_details_tree = proto_tree_add_subtree(tree, tvb, offset, rsocket_payload_len, ett_lbmsrs_details, &lbmsrs_details, "SRS Registration Response");
2361 
2362     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_client_id, tvb, offset, L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_CLIENT_ID, ENC_BIG_ENDIAN);
2363     offset += L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_CLIENT_ID;
2364     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_resp_local_domain_id, tvb, offset, L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_LOCAL_DOMAIN_ID, ENC_BIG_ENDIAN);
2365     offset += L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_LOCAL_DOMAIN_ID;
2366     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_reg_resp_protocol_version, tvb, offset, L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_PROTOCOL_VERSION, ENC_BIG_ENDIAN);
2367     offset += L_LBM_SRS_REGISTRATION_RESPONSE_INFO_T_PROTOCOL_VERSION;
2368 
2369     return (offset - start_offset);
2370 }
2371 
2372 static guint dissect_lbmsrs_stream_request(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint offset, guint32 rsocket_payload_len)
2373 {
2374     guint start_offset = offset;
2375     proto_tree_add_item(tree, hf_lbmsrs_message_id, tvb, offset, L_LBM_SRS_MESSAGE_ID, ENC_BIG_ENDIAN);
2376     offset += L_LBM_SRS_MESSAGE_ID;
2377 
2378     /*reduce by message id field length*/
2379     rsocket_payload_len -= L_LBM_SRS_MESSAGE_ID;
2380 
2381     if (L_LBM_SRS_STREAM_REQUEST_INFO_T != rsocket_payload_len)
2382     {
2383         return (offset - start_offset);
2384     }
2385 
2386     col_append_fstr(pinfo->cinfo, COL_INFO, "[SRS STREAM REQUEST]");
2387 
2388     /*add a sub-tree for SRS */
2389     proto_item *lbmsrs_details;
2390     proto_tree *lbmsrs_details_tree = proto_tree_add_subtree(tree, tvb, offset, rsocket_payload_len, ett_lbmsrs_details, &lbmsrs_details, "SRS Stream Request");
2391 
2392     proto_tree_add_item(lbmsrs_details_tree, hf_lbmsrs_stream_req_unused, tvb, offset, L_LBM_SRS_STREAM_REQUEST_INFO_T_UNUSED, ENC_BIG_ENDIAN);
2393     offset += L_LBM_SRS_STREAM_REQUEST_INFO_T_UNUSED;
2394 
2395     return (offset - start_offset);
2396 }
2397 /*Function to dissect SRS as part of Rsocket payload/metadata*/
2398 static guint dissect_lbmsrs_data(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint offset, guint32 rsocket_payload_len)
2399 {
2400     guint total_payload_len = tvb_captured_length(tvb);
2401     guint len_dissected = 0;
2402 
2403     if ((total_payload_len - offset) < L_LBM_SRS_MESSAGE_ID)
2404     {
2405         return 0;
2406     }
2407 
2408     /*add and get the SRS message id*/
2409     guint16 message_id = tvb_get_guint16(tvb,offset, ENC_BIG_ENDIAN);
2410 
2411     switch (message_id)
2412     {
2413         case MSG_ID_REGISTRATION_REQUEST:
2414         {
2415             len_dissected = dissect_lbmsrs_registration_request(tvb,pinfo,tree,offset,rsocket_payload_len);
2416             break;
2417         }
2418         case MSG_ID_REGISTRATION_RESPONSE:
2419         {
2420             len_dissected = dissect_lbmsrs_registration_response(tvb, pinfo, tree, offset, rsocket_payload_len);
2421             break;
2422         }
2423         case MSG_ID_STREAM_REQUEST:
2424         {
2425             len_dissected = dissect_lbmsrs_stream_request(tvb, pinfo, tree, offset, rsocket_payload_len);
2426             break;
2427         }
2428         case MSG_ID_SOURCE_INFO:
2429         case MSG_ID_SOURCE_DELETE:
2430         case MSG_ID_RCV_INFO:
2431         case MSG_ID_RCV_DELETE:
2432         case MSG_ID_RCV_END:
2433         case MSG_ID_WRCV_INFO:
2434         case MSG_ID_WRCV_DELETE:
2435         case MSG_ID_WRCV_END:
2436         case MSG_ID_SRC_LEAVE:
2437         {
2438             len_dissected = dissect_lbmsrs_batch(tvb, pinfo, tree, offset, rsocket_payload_len);
2439             break;
2440         }
2441 
2442         default:
2443         {
2444             expert_add_info_format(pinfo, tree, &ei_lbmsrs_analysis_invalid_msg_id,
2445                 "Invalid LBMSRS Message Id :%" G_GUINT16_FORMAT, message_id);
2446 
2447         }
2448 
2449     }
2450 
2451     return len_dissected;
2452 }
2453 
2454 /* This is the main dissector function
2455 Return 0 - If the data does not belong to the protocol
2456 Return > 0 - If the data is dissected properly, return the actual length dissected
2457 Return < 0 - If need more data for dissection, return the negative of the length required*/
2458 static int dissect_lbmsrs_pdus(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * user_data _U_)
2459 {
2460     guint offset = 0;
2461     guint tvb_length = tvb_captured_length(tvb);
2462 
2463     if (tvb_length < rsocket_frame_len_field_size)
2464     {
2465         return 0;
2466     }
2467 
2468     /*get the rsocket frame length*/
2469     guint32 rsocket_frame_len = tvb_get_guint24(tvb, offset, ENC_BIG_ENDIAN);
2470     /*adjust the rscoket tree size correctly so as to accomodate
2471     only the available data, its always possible that the rsocket length reported
2472     in the rsocket PDU is more than the data captured in this packet or vice-versa*/
2473     guint32 rsocket_tree_length = rsocket_frame_len;
2474     if (tvb_length < (rsocket_frame_len + rsocket_frame_len_field_size))
2475     {
2476         rsocket_tree_length = tvb_length - rsocket_frame_len_field_size;
2477     }
2478 
2479     /*check if nothing is available to dissect*/
2480     if (rsocket_tree_length <= 0)
2481     {
2482         return 0;
2483     }
2484     /*add the srs subtree, this will allow to use the "srs" filter*/
2485     proto_item *ti = proto_tree_add_item(tree, proto_lbmsrs, tvb, offset, -1, ENC_NA);
2486     proto_tree *srs_tree = proto_item_add_subtree(ti, ett_lbmsrs);
2487 
2488     /*add the rsocket frame length field*/
2489     proto_tree_add_item(srs_tree, hf_lbmsrs_rsocket_frame_len, tvb, offset,
2490         rsocket_frame_len_field_size, ENC_BIG_ENDIAN);
2491     offset += rsocket_frame_len_field_size;
2492 
2493 
2494     /*add the rsocket frame subtree*/
2495     proto_item *rsocket_frame;
2496     proto_tree *rsocket_frame_tree = proto_tree_add_subtree(
2497         srs_tree, tvb, offset, rsocket_tree_length, ett_lbmsrs_rsocket_frame, &rsocket_frame, "RSocket Frame");
2498 
2499     /*add the rocket stream id*/
2500     if ((tvb_length - offset) < rsocket_stream_id_field_size)
2501     {
2502         return offset;
2503     }
2504     proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_stream_id, tvb, offset, 4,
2505         ENC_BIG_ENDIAN);
2506     offset += rsocket_stream_id_field_size;
2507 
2508 
2509     /*read and add the rsocket frame type*/
2510     if ((tvb_length - offset) < 1)
2511     {
2512         return offset;
2513     }
2514     guint64 rsocket_frame_type;
2515     proto_tree_add_bits_ret_val(rsocket_frame_tree, hf_lbmsrs_rsocket_frame_type, tvb,
2516         offset * 8, 6, &rsocket_frame_type, ENC_BIG_ENDIAN);
2517 
2518 
2519     const gchar *frameName = getFrameTypeName(rsocket_frame_type);
2520 
2521     if (frameName) {
2522         col_add_str(pinfo->cinfo, COL_INFO, frameName);
2523     }
2524     else {
2525         col_add_str(pinfo->cinfo, COL_INFO, "UNDEFINED");
2526     }
2527 
2528     /*add the rsocket ignore flag*/
2529     proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_ignore_flag, tvb, offset, 2,
2530         ENC_BIG_ENDIAN);
2531 
2532     /*read the rsocket metadata flag*/
2533     guint8 rsocket_metadata_flag = tvb_get_bits8(tvb, (offset * 8) + 6, 2);
2534     proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_metadata_flag, tvb, offset, 2,
2535         ENC_BIG_ENDIAN);
2536 
2537     /*dissect rsocket frame based on type */
2538     gboolean can_dissect_further = TRUE;
2539     int rsocket_dissected_len  = dissect_rsocket_frame(rsocket_frame_type, rsocket_frame_tree, tvb, offset,&can_dissect_further);
2540     offset += rsocket_dissected_len;
2541 
2542     if (FALSE == can_dissect_further)
2543     {
2544         return (offset - rsocket_frame_len);
2545     }
2546 
2547     /*if rsocket metadata is available add it to the tree*/
2548     if (rsocket_metadata_flag)
2549     {
2550         /*add the rsocket metadata length field*/
2551         if ((tvb_length - offset) < 3)
2552         {
2553             return (offset - rsocket_frame_len);
2554         }
2555         guint32 rsocket_metadata_len;
2556         proto_tree_add_item_ret_uint(rsocket_frame_tree, hf_lbmsrs_rsocket_mdata_len, tvb, offset,3, ENC_BIG_ENDIAN, &rsocket_metadata_len);
2557         offset += 3;
2558 
2559         /*add the rsocket metadata*/
2560         if ((tvb_length - offset) < rsocket_metadata_len)
2561         {
2562             return (offset - rsocket_frame_len);
2563         }
2564         proto_tree_add_item(rsocket_frame_tree, hf_lbmsrs_rsocket_mdata, tvb, offset, rsocket_metadata_len,ENC_ASCII | ENC_NA);
2565         offset += rsocket_metadata_len;
2566     }
2567 
2568     /*get the remaining payload length*/
2569     guint32 rsocket_payload_len = tvb_length - offset;
2570 
2571     /*if payload is available start processing for SRS*/
2572     if (rsocket_payload_len > 0) {
2573         proto_item *lbmsrs_data;
2574         proto_tree *lbmsrs_data_tree = proto_tree_add_subtree(rsocket_frame_tree, tvb, offset, rsocket_payload_len, ett_lbmsrs_data, &lbmsrs_data, "LBMSRS Data");
2575         offset += dissect_lbmsrs_data(tvb, pinfo, lbmsrs_data_tree, offset, rsocket_payload_len);
2576     }
2577 
2578     return (offset - rsocket_frame_len);
2579 }
2580 
2581 /*common dissection function for LBMSRS*/
2582 static guint dissect_lbmsrs_real(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
2583 {
2584     char* tag_name = NULL;
2585     if (lbmsrs_use_tag)
2586     {
2587         tag_name = lbmsrs_tag_find(pinfo);
2588     }
2589     col_clear(pinfo->cinfo, COL_INFO);
2590     if (tag_name != NULL)
2591     {
2592         col_add_fstr(pinfo->cinfo, COL_INFO, "[Tag: %s]", tag_name);
2593     }
2594 
2595     col_set_str(pinfo->cinfo, COL_PROTOCOL, "LBMSRS");
2596     col_set_fence(pinfo->cinfo, COL_INFO);
2597 
2598     tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 3, get_rsocket_frame_len, dissect_lbmsrs_pdus, data);
2599     return tvb_captured_length(tvb);
2600 }
2601 
2602 /*normal dissection function*/
2603 static int dissect_lbmsrs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2604 {
2605     if (!check_lbmsrs_packet(tvb, 0))
2606     {
2607         return 0;
2608     }
2609 
2610     return dissect_lbmsrs_real(tvb,pinfo,tree,data);
2611 }
2612 
2613 /*heuristic dissection function*/
2614 static gboolean test_lbmsrs_packet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * user_data _U_)
2615 {
2616     gboolean valid_packet = FALSE;
2617     lbmsrs_tag_entry_t entry;
2618 
2619     /* Must be a TCP packet. */
2620     if (pinfo->ptype != PT_TCP)
2621     {
2622         return (FALSE);
2623     }
2624 
2625     if (lbmsrs_use_tag)
2626     {
2627         if (lbmsrs_tag_find(pinfo) != NULL)
2628         {
2629             valid_packet = TRUE;
2630         }
2631     }
2632     else
2633     {
2634         entry.name = NULL;
2635         entry.ip_address = LBMSRS_DEFAULT_SOURCE_IP;
2636         if (*global_lbmsrs_source_ip_address == '\0')
2637         {
2638             entry.ip_address = NULL;
2639         }
2640         entry.ip_address_val_h = lbmsrs_source_ip_address;
2641         entry.tcp_port = lbmsrs_source_port;
2642         valid_packet = lbmsrs_match_packet(pinfo, &entry);
2643     }
2644 
2645     if (!check_lbmsrs_packet(tvb, 0))
2646     {
2647         return FALSE;
2648     }
2649 
2650     if (valid_packet)
2651     {
2652         dissect_lbmsrs_real(tvb, pinfo, tree, user_data);
2653         return (TRUE);
2654     }
2655 
2656     return (FALSE);
2657 
2658 }
2659 
2660 void proto_register_lbmsrs(void)
2661 {
2662     static hf_register_info hf[] = {
2663         { &hf_lbmsrs_message_id,
2664         { "Message ID", "lbmsrs.message_id", FT_UINT16, BASE_DEC, VALS(lbmsrsMessageId), 0x0, NULL, HFILL } },
2665         /*rsocket related items start*/
2666         { &hf_lbmsrs_rsocket_frame_len,
2667         { "Frame Length", "lbmsrs.rsocket.frame_len", FT_UINT24, BASE_DEC, NULL, 0x0,NULL, HFILL } },
2668         { &hf_lbmsrs_rsocket_stream_id,
2669         { "Stream ID", "lbmsrs.rsocket.stream_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,HFILL } },
2670         { &hf_lbmsrs_rsocket_frame_type,
2671         { "Frame Type", "lbmsrs.rsocket.frame_type", FT_UINT8, BASE_DEC,VALS(rSocketFrameTypeNames), 0x0, NULL, HFILL } },
2672         { &hf_lbmsrs_rsocket_mdata_len,
2673         { "Metadata Length", "lbmsrs.rsocket.metadata_len", FT_UINT24, BASE_DEC, NULL,0x0, NULL, HFILL } },
2674         { &hf_lbmsrs_rsocket_mdata,
2675         { "Metadata", "lbmsrs.rsocket.metadata", FT_STRING, STR_ASCII, NULL, 0x0, NULL,HFILL } },
2676         { &hf_lbmsrs_rsocket_ignore_flag,
2677         { "Ignore", "lbmsrs.rsocket.flags.ignore", FT_BOOLEAN, 16, NULL, 0x0200, NULL,HFILL } },
2678         { &hf_lbmsrs_rsocket_metadata_flag,
2679         { "Metadata", "lbmsrs.rsocket.flags.metadata", FT_BOOLEAN, 16, NULL, 0x0100,NULL, HFILL } },
2680         { &hf_lbmsrs_rsocket_resume_flag,
2681         { "Resume", "lbmsrs.rsocket.flags.resume", FT_BOOLEAN, 16, NULL, 0x0080, NULL,HFILL } },
2682         { &hf_lbmsrs_rsocket_lease_flag,
2683         { "Lease", "lbmsrs.rsocket.flags.lease", FT_BOOLEAN, 16, NULL, 0x0040, NULL,HFILL } },
2684         { &hf_lbmsrs_rsocket_follows_flag,
2685         { "Follows", "lbmsrs.rsocket.flags.follows", FT_BOOLEAN, 16, NULL, 0x0080, NULL,HFILL } },
2686         { &hf_lbmsrs_rsocket_complete_flag,
2687         { "Complete", "lbmsrs.rsocket.flags.complete", FT_BOOLEAN, 16, NULL, 0x0040,NULL, HFILL } },
2688         { &hf_lbmsrs_rsocket_next_flag,
2689         { "Next", "lbmsrs.rsocket.flags.next", FT_BOOLEAN, 16, NULL, 0x0020, NULL,HFILL } },
2690         { &hf_lbmsrs_rsocket_respond_flag,
2691         { "Respond", "lbmsrs.rsocket.flags.respond", FT_BOOLEAN, 16, NULL, 0x0080, NULL,HFILL } },
2692         { &hf_lbmsrs_rsocket_major_version,
2693         { "Major Version", "lbmsrs.rsocket.version.major", FT_UINT16, BASE_DEC, NULL,0x0, NULL, HFILL } },
2694         { &hf_lbmsrs_rsocket_minor_version,
2695         { "Minor Version", "lbmsrs.rsocket.version.minor", FT_UINT16, BASE_DEC, NULL,0x0, NULL, HFILL } },
2696         { &hf_lbmsrs_rsocket_keepalive_interval,
2697         { "Keepalive Interval", "lbmsrs.rsocket.keepalive.interval", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2698         { &hf_lbmsrs_rsocket_max_lifetime,
2699         { "Max Lifetime", "lbmsrs.rsocket.max_lifetime", FT_UINT32, BASE_DEC, NULL, 0x0,NULL, HFILL } },
2700         { &hf_lbmsrs_rsocket_mdata_mime_length,
2701         { "Metadata MIME Length", "lbmsrs.rsocket.mdata_mime_length", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2702         { &hf_lbmsrs_rsocket_mdata_mime_type,
2703         { "Metadata MIME Type", "lbmsrs.rsocket.mdata_mime_type", FT_STRING, STR_ASCII,NULL, 0x0, NULL, HFILL } },
2704         { &hf_lbmsrs_rsocket_data_mime_length,
2705         { "Data MIME Length", "lbmsrs.rsocket.data_mime_length", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2706         { &hf_lbmsrs_rsocket_data_mime_type,
2707         { "Data MIME Type", "lbmsrs.rsocket.data_mime_type", FT_STRING, STR_ASCII, NULL,0x0, NULL, HFILL } },
2708         { &hf_lbmsrs_rsocket_req_n,
2709         { "Request N", "lbmsrs.rsocket.request_n", FT_UINT32, BASE_DEC, NULL, 0x0, NULL,HFILL } },
2710         { &hf_lbmsrs_rsocket_error_code,
2711         { "Error Code", "lbmsrs.rsocket.error_code", FT_UINT32, BASE_DEC,VALS(rSocketErrorCodeNames), 0x0, NULL, HFILL } },
2712         { &hf_lbmsrs_rsocket_keepalive_last_rcvd_pos,
2713         { "Keepalive Last Received Position","lbmsrs.rsocket.keepalive_last_received_position", FT_UINT64, BASE_DEC, NULL,0x0, NULL, HFILL } },
2714         { &hf_lbmsrs_rsocket_resume_token_len,
2715         { "Resume Token Length", "lbmsrs.rsocket.resume.token.len", FT_UINT16, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2716         { &hf_lbmsrs_rsocket_resume_token,
2717         { "Resume Token", "lbmsrs.rsocket.resume.token", FT_STRING, STR_ASCII, NULL, 0x0,NULL, HFILL } },
2718         /*rsocket related items end*/
2719 
2720         /*SRS Registration Request items start*/
2721         { &hf_lbmsrs_app_type,
2722         { "Application Type", "lbmsrs.registration_request.app_type", FT_UINT8, BASE_DEC,VALS(lbmsrsApplicationType), 0x0, NULL, HFILL } },
2723         { &hf_lbmsrs_client_addr,
2724         { "Client Address", "lbmsrs.registration_request.client_addr", FT_IPv4, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2725         { &hf_lbmsrs_client_port,
2726         { "Client Port", "lbmsrs.registration_request.client_port", FT_UINT16, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2727         { &hf_lbmsrs_session_id,
2728         { "Session ID", "lbmsrs.registration_request.session_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2729         { &hf_lbmsrs_host_id,
2730         { "Host ID", "lbmsrs.registration_request.host_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2731         { &hf_lbmsrs_protocol_version,
2732         { "Protocol Version", "lbmsrs.registration_request.protocol_version", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2733         { &hf_lbmsrs_interest_mode,
2734         { "Interest Mode", "lbmsrs.registration_request.interest_mode", FT_UINT8, BASE_DEC,VALS(lbmsrsInterestMode), 0x0, NULL, HFILL } },
2735         { &hf_lbmsrs_req_local_domain_id,
2736         { "Local Domain ID", "lbmsrs.registration_request.local_domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2737         /*SRS Registration Request items end*/
2738 
2739         /*SRS Registration Response items start*/
2740         { &hf_lbmsrs_client_id,
2741         { "Client ID", "lbmsrs.registration_response.client_id", FT_UINT64, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2742         { &hf_lbmsrs_resp_local_domain_id,
2743         { "Local Domain ID", "lbmsrs.registration_response.local_domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2744         { &hf_lbmsrs_reg_resp_protocol_version,
2745         { "Protocol Version", "lbmsrs.registration_response.protocol_version", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2746         /*SRS Registration Response items end*/
2747 
2748         /*SRS Stream Request items start*/
2749         { &hf_lbmsrs_stream_req_unused,
2750         { "Unused", "lbmsrs.stream_req.unused", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2751         /*SRS Stream Request items end*/
2752 
2753         /*SRS Source Info items start*/
2754         { &hf_lbmsrs_sir,
2755         { "SIR", "lbmsrs.sir", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2756         { &hf_lbmsrs_sir_otid,
2757         { "OTID", "lbmsrs.sir.otid", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2758         { &hf_lbmsrs_sir_topic_len,
2759         { "Topic Length", "lbmsrs.sir.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2760         { &hf_lbmsrs_sir_topic,
2761         { "Topic", "lbmsrs.sir.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2762         { &hf_lbmsrs_sir_source_len,
2763         { "Source Length", "lbmsrs.sir.source_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2764         { &hf_lbmsrs_sir_source,
2765         { "Source", "lbmsrs.sir.source", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2766         { &hf_lbmsrs_sir_host_id,
2767         { "Host ID", "lbmsrs.sir.host_id", FT_UINT32, BASE_DEC_HEX,NULL, 0x0, NULL, HFILL } },
2768         { &hf_lbmsrs_sir_topic_idx,
2769         { "Topic Index", "lbmsrs.sir.topic_idx", FT_UINT32, BASE_DEC_HEX,NULL, 0x0, NULL, HFILL } },
2770         { &hf_lbmsrs_sir_functionality_flags,
2771         { "Functionality Flags", "lbmsrs.sir.functionality_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2772         { &hf_lbmsrs_sir_request_ip,
2773         { "Request IP", "lbmsrs.sir.request_ip", FT_IPv4, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2774         { &hf_lbmsrs_sir_request_port,
2775         { "Request Port", "lbmsrs.sir.request_port", FT_UINT16, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2776         { &hf_lbmsrs_sir_domain_id,
2777         { "Domain ID", "lbmsrs.sir.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2778         { &hf_lbmsrs_sir_encryption,
2779         { "Encryption", "lbmsrs.sir.encryption", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2780         { &hf_lbmsrs_sir_compression,
2781         { "Compression", "lbmsrs.sir.compression", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2782         { &hf_lbmsrs_sir_ulb_src_id,
2783         { "ULB Source ID", "lbmsrs.sir.ulb_src_id", FT_UINT32, BASE_DEC_HEX,NULL, 0x0, NULL, HFILL } },
2784         { &hf_lbmsrs_sir_ulb_queue_id,
2785         { "ULB Queue ID", "lbmsrs.sir.ulb_queue_id", FT_UINT32, BASE_DEC_HEX,NULL, 0x0, NULL, HFILL } },
2786         { &hf_lbmsrs_sir_ulb_reg_id,
2787         { "ULB Registration ID", "lbmsrs.sir.ulb_reg_id", FT_UINT64, BASE_DEC_HEX,NULL, 0x0, NULL, HFILL } },
2788         { &hf_lbmsrs_sir_context_instance,
2789         { "Context Instance", "lbmsrs.sir.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2790         { &hf_lbmsrs_sir_context_type,
2791         { "Context Type", "lbmsrs.sir.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2792         { &hf_lbmsrs_sir_version,
2793         { "Version", "lbmsrs.sir.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2794         { &hf_lbmsrs_sir_version_flags,
2795         { "Version Flags", "lbmsrs.sir.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2796         { &hf_lbmsrs_sir_ttl,
2797         { "TTL", "lbmsrs.sir.ttl", FT_UINT16, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2798         { &hf_lbmsrs_sir_cost,
2799         { "Cost", "lbmsrs.sir.cost", FT_INT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2800         /*SRS Source Info items end*/
2801 
2802         /*SRS Source Delete items start*/
2803         { &hf_lbmsrs_sdr,
2804         { "SDR", "lbmsrs.sdr", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2805         { &hf_lbmsrs_sdr_otid,
2806         { "OTID", "lbmsrs.sdr.otid", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2807         { &hf_lbmsrs_sdr_topic_len,
2808         { "Topic Length", "lbmsrs.sdr.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2809         { &hf_lbmsrs_sdr_topic,
2810         { "Topic", "lbmsrs.sdr.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2811         /*SRS Source Delete items end*/
2812 
2813         /*SRS Receiver Info items start*/
2814         { &hf_lbmsrs_rir,
2815         { "RIR", "lbmsrs.rir", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2816         { &hf_lbmsrs_rir_topic_len,
2817         { "Topic Length", "lbmsrs.rir.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2818         { &hf_lbmsrs_rir_topic,
2819         { "Topic", "lbmsrs.rir.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2820         { &hf_lbmsrs_rir_domain_id,
2821         { "Domain ID", "lbmsrs.rir.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2822         { &hf_lbmsrs_rir_context_instance,
2823         { "Context Instance", "lbmsrs.rir.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2824         { &hf_lbmsrs_rir_context_type,
2825         { "Context Type", "lbmsrs.rir.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2826         { &hf_lbmsrs_rir_version,
2827         { "Version", "lbmsrs.rir.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2828         { &hf_lbmsrs_rir_version_flags,
2829         { "Version Flags", "lbmsrs.rir.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2830         { &hf_lbmsrs_rir_reserved,
2831         { "Reserved", "lbmsrs.rir.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2832         /*SRS Receiver Info items end*/
2833 
2834         /*SRS Receiver Delete Info items start*/
2835         { &hf_lbmsrs_rdr,
2836         { "RDR", "lbmsrs.rdr", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2837         { &hf_lbmsrs_rdr_topic_len,
2838         { "Topic Length", "lbmsrs.rdr.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2839         { &hf_lbmsrs_rdr_topic,
2840         { "Topic", "lbmsrs.rdr.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2841         { &hf_lbmsrs_rdr_domain_id,
2842         { "Domain ID", "lbmsrs.rdr.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2843         { &hf_lbmsrs_rdr_context_instance,
2844         { "Context Instance", "lbmsrs.rdr.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2845         { &hf_lbmsrs_rdr_context_type,
2846         { "Context Type", "lbmsrs.rdr.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2847         { &hf_lbmsrs_rdr_version,
2848         { "Version", "lbmsrs.rdr.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2849         { &hf_lbmsrs_rdr_version_flags,
2850         { "Version Flags", "lbmsrs.rdr.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2851         { &hf_lbmsrs_rdr_reserved,
2852         { "Reserved", "lbmsrs.rdr.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2853         /*SRS Receiver Delete items end*/
2854 
2855         /*SRS Receiver End Info items start*/
2856         { &hf_lbmsrs_rer,
2857         { "RER", "lbmsrs.rer", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2858         { &hf_lbmsrs_rer_topic_len,
2859         { "Topic Length", "lbmsrs.rer.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2860         { &hf_lbmsrs_rer_topic,
2861         { "Topic", "lbmsrs.rer.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2862         { &hf_lbmsrs_rer_domain_id,
2863         { "Domain ID", "lbmsrs.rer.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2864         { &hf_lbmsrs_rer_context_instance,
2865         { "Context Instance", "lbmsrs.rer.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2866         { &hf_lbmsrs_rer_context_type,
2867         { "Context Type", "lbmsrs.rer.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2868         { &hf_lbmsrs_rer_version,
2869         { "Version", "lbmsrs.rer.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2870         { &hf_lbmsrs_rer_version_flags,
2871         { "Version Flags", "lbmsrs.rer.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2872         { &hf_lbmsrs_rer_reserved,
2873         { "Reserved", "lbmsrs.rer.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2874         /*SRS Receiver End items end*/
2875 
2876 
2877         /*SRS Wildcard Receiver Info items start*/
2878         { &hf_lbmsrs_wir,
2879         { "WIR", "lbmsrs.wir", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2880         { &hf_lbmsrs_wir_pattern_len,
2881         { "Topic Length", "lbmsrs.wir.pattern_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2882         { &hf_lbmsrs_wir_pattern,
2883         { "Topic", "lbmsrs.wir.pattern", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2884         { &hf_lbmsrs_wir_domain_id,
2885         { "Domain ID", "lbmsrs.wir.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2886         { &hf_lbmsrs_wir_context_instance,
2887         { "Context Instance", "lbmsrs.wir.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2888         { &hf_lbmsrs_wir_context_type,
2889         { "Context Type", "lbmsrs.wir.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2890         { &hf_lbmsrs_wir_version,
2891         { "Version", "lbmsrs.wir.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2892         { &hf_lbmsrs_wir_version_flags,
2893         { "Version Flags", "lbmsrs.wir.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2894         { &hf_lbmsrs_wir_reserved,
2895         { "Reserved", "lbmsrs.wir.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2896         /*SRS Wildcard Receiver Info items end*/
2897 
2898         /*SRS Wildcard Receiver Delete Info items start*/
2899         { &hf_lbmsrs_wdr,
2900         { "WDR", "lbmsrs.wdr", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2901         { &hf_lbmsrs_wdr_pattern_len,
2902         { "Topic Length", "lbmsrs.wdr.pattern_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2903         { &hf_lbmsrs_wdr_pattern,
2904         { "Topic", "lbmsrs.wdr.pattern", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2905         { &hf_lbmsrs_wdr_domain_id,
2906         { "Domain ID", "lbmsrs.wdr.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2907         { &hf_lbmsrs_wdr_context_instance,
2908         { "Context Instance", "lbmsrs.wdr.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2909         { &hf_lbmsrs_wdr_context_type,
2910         { "Context Type", "lbmsrs.wdr.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2911         { &hf_lbmsrs_wdr_version,
2912         { "Version", "lbmsrs.wdr.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2913         { &hf_lbmsrs_wdr_version_flags,
2914         { "Version Flags", "lbmsrs.wdr.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2915         { &hf_lbmsrs_wdr_reserved,
2916         { "Reserved", "lbmsrs.wdr.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2917         /*SRS Wildcard Receiver Delete items end*/
2918 
2919         /*SRS Wildcard Receiver End Info items start*/
2920         { &hf_lbmsrs_wer,
2921         { "WER", "lbmsrs.wer", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2922         { &hf_lbmsrs_wer_pattern_len,
2923         { "Topic Length", "lbmsrs.wer.pattern_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2924         { &hf_lbmsrs_wer_pattern,
2925         { "Topic", "lbmsrs.wer.pattern", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2926         { &hf_lbmsrs_wer_domain_id,
2927         { "Domain ID", "lbmsrs.wer.domain_id", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2928         { &hf_lbmsrs_wer_context_instance,
2929         { "Context Instance", "lbmsrs.wer.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2930         { &hf_lbmsrs_wer_context_type,
2931         { "Context Type", "lbmsrs.wer.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2932         { &hf_lbmsrs_wer_version,
2933         { "Version", "lbmsrs.wer.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2934         { &hf_lbmsrs_wer_version_flags,
2935         { "Version Flags", "lbmsrs.wer.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2936         { &hf_lbmsrs_wer_reserved,
2937         { "Reserved", "lbmsrs.wer.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2938         /*SRS Wildcard Receiver End items end*/
2939 
2940         /*SRS Source Leave Info items start*/
2941         { &hf_lbmsrs_sli,
2942         { "SLI", "lbmsrs.sli", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
2943         { &hf_lbmsrs_sli_otid,
2944         { "OTID", "lbmsrs.sli.otid", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2945         { &hf_lbmsrs_sli_topic_len,
2946         { "Topic Length", "lbmsrs.sli.topic_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2947         { &hf_lbmsrs_sli_topic,
2948         { "Topic", "lbmsrs.sli.topic", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2949         { &hf_lbmsrs_sli_source_len,
2950         { "Source Length", "lbmsrs.sli.source_len", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2951         { &hf_lbmsrs_sli_source,
2952         { "Source", "lbmsrs.sli.source", FT_STRING, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2953         { &hf_lbmsrs_sli_context_instance,
2954         { "Context Instance", "lbmsrs.sli.context_instance", FT_BYTES, BASE_NONE,NULL, 0x0, NULL, HFILL } },
2955         { &hf_lbmsrs_sli_context_type,
2956         { "Context Type", "lbmsrs.sli.context_type", FT_UINT8, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2957         { &hf_lbmsrs_sli_version,
2958         { "Version", "lbmsrs.sli.version", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2959         { &hf_lbmsrs_sli_version_flags,
2960         { "Version Flags", "lbmsrs.sli.version_flags", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } },
2961         { &hf_lbmsrs_sli_reserved,
2962         { "Reserved", "lbmsrs.sli.reserved", FT_UINT32, BASE_DEC,NULL, 0x0, NULL, HFILL } }
2963         /*SRS Source Leave Info items end*/
2964     };
2965 
2966     static gint *ett[] =
2967     {
2968         &ett_lbmsrs,
2969         &ett_lbmsrs_rsocket_frame,
2970         &ett_lbmsrs_data,
2971         &ett_lbmsrs_details,
2972         &ett_lbmsrs_sir,
2973         &ett_lbmsrs_sdr,
2974         &ett_lbmsrs_ser,
2975         &ett_lbmsrs_rir,
2976         &ett_lbmsrs_rdr,
2977         &ett_lbmsrs_rer,
2978         &ett_lbmsrs_wir,
2979         &ett_lbmsrs_wdr,
2980         &ett_lbmsrs_wer,
2981         &ett_lbmsrs_sli
2982     };
2983 
2984     static ei_register_info ei[] =
2985     {
2986         { &ei_lbmsrs_analysis_invalid_msg_id, { "lbmsrs.analysis.invalid_msg_id", PI_MALFORMED, PI_ERROR, "Invalid LBMSRS Message Id", EXPFILL } }
2987     };
2988     proto_lbmsrs = proto_register_protocol("LBM Stateful Resolution Service Protocol", "LBMSRS", "lbmsrs");
2989     proto_register_field_array(proto_lbmsrs, hf, array_length(hf));
2990     proto_register_subtree_array(ett, array_length(ett));
2991 
2992     expert_module_t *expert_lbmsrs = expert_register_protocol(proto_lbmsrs);
2993     expert_register_field_array(expert_lbmsrs, ei, array_length(ei));
2994 
2995     /*Set the preference menu items*/
2996     module_t* lbmsrs_module = prefs_register_protocol_subtree("29West", proto_lbmsrs, proto_reg_handoff_lbmsrs);
2997 
2998     guint32 addr;
2999     ws_inet_pton4(LBMSRS_DEFAULT_SOURCE_IP, &addr);
3000     lbmsrs_source_ip_address = g_ntohl(addr);
3001     prefs_register_string_preference(lbmsrs_module,
3002         "source_ip_address",
3003         "Source IP address (default " LBMSRS_DEFAULT_SOURCE_IP ")",
3004         "Set the LBMSRS IP Address",
3005         &global_lbmsrs_source_ip_address);
3006 
3007     prefs_register_uint_preference(lbmsrs_module,
3008         "source_port",
3009         "Source port (default " MAKESTRING(LBMSRS_DEFAULT_SOURCE_PORT)")",
3010         "Set the source TCP port",
3011         10,
3012         &global_lbmsrs_source_port);
3013 
3014     prefs_register_bool_preference(lbmsrs_module,
3015         "use_lbmsrs_domain",
3016         "Use LBMSRS tag table",
3017         "Use table of LBMSRS tags to decode the packet instead of above values",
3018         &global_lbmsrs_use_tag);
3019 
3020     uat_t *tag_uat = uat_new("LBMSRS tag definitions",
3021         sizeof(lbmsrs_tag_entry_t),
3022         "lbmsrs_domains",
3023         TRUE,
3024         (void * *)&lbmsrs_tag_entry,
3025         &lbmsrs_tag_count,
3026         UAT_AFFECTS_DISSECTION,
3027         NULL,
3028         lbmsrs_tag_copy_cb,
3029         lbmsrs_tag_update_cb,
3030         lbmsrs_tag_free_cb,
3031         NULL,
3032         NULL,
3033         lbmsrs_tag_array);
3034 
3035     /*add the tag edit table*/
3036     prefs_register_uat_preference(lbmsrs_module,
3037         "tnw_lbmsrs_tags",
3038         "LBMSRS Tags",
3039         "A table to define LBMSRS tags",
3040         tag_uat);
3041 }
3042 
3043 void proto_reg_handoff_lbmsrs(void)
3044 {
3045     static gboolean already_registered = FALSE;
3046     guint32 addr;
3047 
3048     if (!already_registered)
3049     {
3050         lbmsrs_dissector_handle = create_dissector_handle(dissect_lbmsrs, proto_lbmsrs);
3051         dissector_add_for_decode_as_with_preference("tcp.port", lbmsrs_dissector_handle);
3052         heur_dissector_add("tcp", test_lbmsrs_packet, "LBM Stateful Resolution Service over RSocket", "lbmsrs_tcp", proto_lbmsrs, HEURISTIC_ENABLE);
3053     }
3054 
3055     ws_inet_pton4(global_lbmsrs_source_ip_address, &addr);
3056     lbmsrs_source_ip_address = g_ntohl(addr);
3057     lbmsrs_source_port = global_lbmsrs_source_port;
3058     lbmsrs_use_tag = global_lbmsrs_use_tag;
3059     already_registered = TRUE;
3060 }
3061 /*
3062  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
3063  *
3064  * Local variables:
3065  * c-basic-offset: 4
3066  * tab-width: 8
3067  * indent-tabs-mode: nil
3068  * End:
3069  *
3070  * vi: set shiftwidth=4 tabstop=8 expandtab:
3071  * :indentSize=4:tabSize=8:noTabs=true:
3072  */
3073