Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-sasp.c
blob2869e33b8295b05531cd9d9a3cc2122f69bcb721
1 /* packet-sasp.c
2 * Routines for sasp packet dissection
3 * Copyright 2010, Venkateshwaran Dorai<venkateshwaran.d@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
16 #include <epan/expert.h>
17 #include <epan/prefs.h>
18 #include <epan/to_str.h>
19 #include "packet-tcp.h"
21 /* forward reference */
22 void proto_register_sasp(void);
23 void proto_reg_handoff_sasp(void);
25 static dissector_handle_t sasp_handle;
27 static void dissect_reg_req(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
28 static void dissect_dereg_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint32_t offset);
29 static void dissect_reg_rep(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
30 static void dissect_dereg_rep(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
31 static void dissect_sendwt(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
32 static void dissect_setmemstate_req(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
33 static void dissect_setmemstate_rep(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
34 static void dissect_setlbstate_req(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
35 static void dissect_setlbstate_rep(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
36 static void dissect_wt_req(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
37 static void dissect_wt_rep(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
38 static uint32_t dissect_memdatacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset, proto_tree **mdct_p);
39 static uint32_t dissect_grpdatacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
40 static uint32_t dissect_grp_memdatacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
41 static uint32_t dissect_grp_memstatedatacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
42 static uint32_t dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
43 static uint32_t dissect_weight_entry_data_comp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset);
44 static uint32_t dissect_grp_wt_entry_datacomp(tvbuff_t *tvb, proto_tree *tree, uint32_t offset);
46 /* Initialize the protocol and registered fields */
47 static int proto_sasp;
48 static int hf_sasp_type;
49 static int hf_sasp_length;
50 static int hf_sasp_vrsn;
51 static int hf_msg_len;
52 static int hf_msg_id;
53 static int hf_msg_type;
55 /*reg reply*/
56 static int hf_sasp_reg_rep_rcode;
57 static int hf_sasp_reg_rep_sz;
59 /*reg req*/
60 static int hf_sasp_reg_req_sz;
61 static int hf_reg_req_lbflag;
62 static int hf_sasp_gmd_cnt;
64 /*dereg req*/
65 static int hf_sasp_dereg_req_sz;
66 static int hf_dereg_req_lbflag;
67 /* static int hf_dereg_req_reason; */
68 static int hf_dereg_req_reason_flag;
70 /*dereg reply*/
71 static int hf_sasp_dereg_rep_rcode;
72 static int hf_sasp_dereg_rep_sz;
74 /*send wt*/
75 static int hf_sasp_sendwt_gwedcnt;
76 static int hf_sasp_sendwt_sz;
78 /*setmemstate req*/
79 static int hf_sasp_setmemstate_req_sz;
80 static int hf_setmemstate_req_lbflag;
81 /*static int hf_sasp_setmemstate_req_data;*/
82 static int hf_sasp_setmemstate_req_gmsd_cnt;
84 /*setmemstate reply*/
85 /* static int hf_sasp_setmemstate_rep; */
86 static int hf_sasp_setmemstate_rep_rcode;
87 static int hf_sasp_setmemstate_rep_sz;
89 /*mem data comp */
90 static int hf_sasp_memdatacomp_type;
91 static int hf_sasp_memdatacomp_sz;
92 static int hf_sasp_memdatacomp_protocol;
93 static int hf_sasp_memdatacomp_port;
94 static int hf_sasp_memdatacomp_ip;
95 static int hf_sasp_memdatacomp_lab_len;
96 static int hf_sasp_memdatacomp_label;
98 /*grp data comp */
99 static int hf_sasp_grpdatacomp;
100 static int hf_sasp_grpdatacomp_sz;
101 static int hf_sasp_grpdatacomp_LB_uid_len;
102 static int hf_sasp_grpdatacomp_LB_uid;
103 static int hf_sasp_grpdatacomp_grp_name_len;
104 static int hf_sasp_grpdatacomp_grp_name;
106 /*grp mem data comp */
107 static int hf_sasp_grp_memdatacomp;
108 static int hf_sasp_grp_memdatacomp_sz;
109 static int hf_sasp_grp_memdatacomp_cnt;
111 /*weight req*/
112 static int hf_sasp_wt_req_sz;
113 static int hf_sasp_wt_req_gd_cnt;
115 /*weight rep*/
116 static int hf_sasp_wt_rep_sz;
117 static int hf_sasp_wt_rep_rcode;
118 static int hf_sasp_wt_rep_interval;
119 static int hf_sasp_wt_rep_gwed_cnt;
121 /*setlbstate req*/
122 static int hf_sasp_setlbstate_req_sz;
123 static int hf_sasp_setlbstate_req_LB_uid_len;
124 static int hf_sasp_setlbstate_req_LB_uid;
125 static int hf_sasp_setlbstate_req_LB_health;
126 /*static int hf_sasp_setlbstate_req_LB_flag;*/
127 /* static int hf_lbstate_flag; */
128 static int hf_sasp_pushflag;
129 static int hf_sasp_trustflag;
130 static int hf_sasp_nochangeflag;
132 /*setlbstate reply*/
133 /* static int hf_sasp_setlbstate_rep; */
134 static int hf_sasp_setlbstate_rep_rcode;
135 static int hf_sasp_setlbstate_rep_sz;
137 /*grp mem state data*/
138 static int hf_sasp_grp_memstatedatacomp;
139 static int hf_sasp_grp_memstatedatacomp_sz;
140 static int hf_sasp_grp_memstatedatacomp_cnt;
142 /*mem state data comp*/
143 static int hf_sasp_memstatedatacomp_instance;
144 static int hf_sasp_memstatedatacomp_sz;
145 static int hf_sasp_memstatedatacomp_state;
146 static int hf_sasp_memstatedatacomp_quiesce_flag;
148 /*wt entry dat comp*/
149 static int hf_sasp_weight_entry_data_comp_type;
150 static int hf_sasp_weight_entry_data_comp_sz;
151 static int hf_sasp_weight_entry_data_comp_state;
152 /* static int hf_wtstate_flag; */
153 static int hf_sasp_wed_contactsuccess_flag;
154 static int hf_sasp_wed_quiesce_flag;
155 static int hf_sasp_wed_registration_flag;
156 static int hf_sasp_wed_confident_flag;
157 static int hf_sasp_weight_entry_data_comp_weight;
159 /*grp wt entry data comp */
160 static int hf_sasp_grp_wt_entry_datacomp_type;
161 static int hf_sasp_grp_wt_entry_datacomp_sz;
162 static int hf_sasp_grp_wt_entry_datacomp_cnt;
164 /* Initialize the subtree pointers */
165 static int ett_sasp_data;
166 static int ett_sasp_header;
167 static int ett_sasp_msg;
168 static int ett_sasp_payload;
169 static int ett_sasp_reg_req;
170 static int ett_sasp_reg_rep;
171 static int ett_sasp_reg_req_sz;
172 static int ett_sasp_dereg_req_sz;
173 static int ett_sasp_dereg_rep;
174 static int ett_sasp_sendwt;
175 static int ett_sasp_setmemstate_rep;
176 static int ett_sasp_memdatacomp;
177 static int ett_sasp_grpdatacomp;
178 static int ett_sasp_grp_memdatacomp;
179 static int ett_sasp_setlbstate_req;
180 static int ett_sasp_setlbstate_rep;
181 static int ett_sasp_getwt;
182 static int ett_sasp_setmemstate_req;
183 static int ett_setlbstate_req_lbflag;
184 static int ett_sasp_grp_memstatedatacomp;
185 static int ett_sasp_memstatedatacomp;
186 /*static int ett_dereg_req_reason_flag;*/
187 static int ett_sasp_grp_wt_entry_datacomp;
188 static int ett_sasp_weight_entry_data_comp;
189 static int ett_wt_entry_data_flag;
190 static int ett_sasp_wt_rep;
192 static expert_field ei_msg_type_invalid;
194 /* desegmentation of SASP over TCP */
195 static bool sasp_desegment = true;
197 static const value_string msg_table[] = {
198 { 0x1010, "Registration Request" },
199 { 0x1015, "Registration Reply"},
200 { 0x1020, "DeRegistration Request"},
201 { 0x1025, "DeRegistration Reply"},
202 { 0x1030, "Get Weights Request"},
203 { 0x1035, "Get Weights Reply" },
204 { 0x1040, "Send Weights"},
205 { 0x1050, "Set LB State Request"},
206 { 0x1055, "Set LB State Reply"},
207 { 0x1060, "Set Member State Request"},
208 { 0x1065, "Set Member State Reply"},
209 { 0x3010, "Member Data Component"},
210 { 0x3011, "Group Data Component"},
211 { 0x3012, "Weight Entry Data Component"},
212 { 0x3013, "Member State Instance"},
213 { 0x4010, "Group of Member Data"},
214 { 0x4011, "Group of Weight Entry Data" },
215 { 0x4012, "Group of Member State Data" },
216 { 0, NULL }
218 static value_string_ext msg_table_ext = VALUE_STRING_EXT_INIT(msg_table);
220 static const value_string protocol_table[] = {
221 { 0x06, "TCP" },
222 { 0x11, "UDP" },
223 { 0, NULL }
226 static const value_string lbstate_healthtable[] = {
227 { 0x00, "Least Healthy" },
228 { 0x7f, "Most Healthy" },
229 { 0, NULL }
232 static const value_string reg_reply_response_code[] = {
233 { 0x00, "Successful" },
234 { 0x10, "Message not understood" },
235 { 0x11, "GWM will not accept this message from the sender" },
236 { 0x40, "Member already registered" },
237 { 0x44, "Duplicate Member in Request" },
238 { 0x45, "Invalid Group (determined by the GWM)"},
239 { 0x50, "Invalid Group Name Size (size == 0)"},
240 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
241 { 0x61, "Member is registering itself, but LB hasn't yet contacted the GWM."
242 " This registration will not be processed."},
243 { 0, NULL }
246 static const value_string dereg_reply_response_code[] = {
247 { 0x00, "Successful" },
248 { 0x10, "Message not understood" },
249 { 0x11, "GWM will not accept this message from the sender" },
250 { 0x41, "Application or System not registered" },
251 { 0x42, "Unknown Group Name" },
252 { 0x43, "Unknown LB uid" },
253 { 0x44, "Duplicate Member in Request"},
254 { 0x46, "Duplicate Group in Request (for remove all members/groups requests)"},
255 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
256 { 0x61, "Member is deregistering itself, but LB hasn't yet contacted the GWM."
257 " This deregistration will not be processed."},
258 { 0, NULL }
261 static const value_string get_weights_reply_response_code[] = {
262 { 0x00, "Successful" },
263 { 0x10, "Message not understood" },
264 { 0x11, "GWM will not accept this message from the sender" },
265 { 0x42, "Unknown Group Name" },
266 { 0x43, "Unknown LB uid" },
267 { 0x46, "Duplicate Group in Request"},
268 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
269 { 0, NULL }
272 static const value_string set_lb_state_reply_response_code[] = {
273 { 0x00, "Successful" },
274 { 0x10, "Message not understood" },
275 { 0x11, "GWM will not accept this message from the sender" },
276 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
277 { 0, NULL }
280 static const value_string set_mem_state_reply_response_code[] = {
281 { 0x00, "Successful" },
282 { 0x10, "Message not understood" },
283 { 0x11, "GWM will not accept this message from the sender" },
284 { 0x41, "Application or System not registered" },
285 { 0x42, "Unknown Group Name" },
286 { 0x43, "Unknown LB uid" },
287 { 0x44, "Duplicate Member in Request"},
288 { 0x46, "Duplicate Group in Request (for remove all members/groups requests)"},
289 { 0x50, "Invalid Group Name Size (size == 0)"},
290 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
291 { 0, NULL }
295 #define SASP_GLOBAL_PORT 3860
296 #define SASP_MIN_PACKET_LEN 13
298 #define SASP_DEREG_REQ_REASON_LEARNED 0x01
299 #define SASP_DEREG_REQ_NOREASON_FLAG 0x00
300 #define SASP_HDR_TYPE 0x2010
301 #define SASP_WED_CONTACT_SUCCESS_FLAG 0x01
302 #define SASP_WED_QUIESCE_FLAG 0x02
303 #define SASP_WED_REG_FLAG 0x04
304 #define SASP_WED_CONF_FLAG 0x08
305 #define SASP_PUSH_FLAG 0x01
306 #define SASP_TRUST_FLAG 0x02
307 #define SASP_NOCHANGE_FLAG 0x04
308 #define SASP_QUIESCE_FLAG 0x01
311 static unsigned
312 get_sasp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
314 /* Get the length of the SASP packet. */
315 return tvb_get_ntohl(tvb, offset + 5);
318 /* Called from tcp_dissect_pdus with a complete SASP pdu */
319 static int
320 dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
322 /* Set up structures needed to add the protocol subtree and manage it */
323 proto_item *ti;
324 proto_item *hti;
325 proto_item *mti;
326 proto_tree *sasp_tree;
327 proto_tree *msg_tree;
328 proto_tree *pay_load;
329 uint16_t msg_type;
330 uint16_t hdr_type;
331 uint32_t offset = 0;
333 /*protocol is being displayed*/
335 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SASP");
336 col_clear(pinfo->cinfo, COL_INFO);
338 ti = proto_tree_add_item(tree, proto_sasp, tvb, offset, -1, ENC_NA);
339 sasp_tree = proto_item_add_subtree(ti, ett_sasp_header);
341 hdr_type = tvb_get_ntohs(tvb, offset);
342 hti = proto_tree_add_uint_format_value(sasp_tree, hf_sasp_type, tvb, offset, 2, hdr_type,
343 "%s", (hdr_type == SASP_HDR_TYPE) ? "SASP" : "[Invalid]");
344 if (hdr_type != SASP_HDR_TYPE)
346 expert_add_info_format(pinfo, hti, &ei_msg_type_invalid,
347 "Invalid SASP Header Type [0x%04x]", hdr_type);
348 /* XXX: The following should actually happen automatically ? */
349 col_set_str(pinfo->cinfo, COL_INFO, "[Malformed: Invalid SASP Header Type]");
350 return tvb_reported_length(tvb);
352 offset += 2;
354 /*length*/
355 proto_tree_add_item(sasp_tree, hf_sasp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
356 offset += 2;
358 /*Header Version */
359 proto_tree_add_item(sasp_tree, hf_sasp_vrsn, tvb, offset, 1, ENC_BIG_ENDIAN);
360 offset += 1;
362 /*Message*/
363 msg_tree = proto_item_add_subtree(ti, ett_sasp_msg);
365 /*Message Len*/
366 proto_tree_add_item(msg_tree, hf_msg_len, tvb, offset, 4, ENC_BIG_ENDIAN);
367 offset += 4;
369 /*Message Id*/
370 proto_tree_add_item(msg_tree, hf_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
371 offset += 4;
373 /*Message Type*/
374 msg_type = tvb_get_ntohs(tvb, offset);
375 mti = proto_tree_add_item(msg_tree, hf_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN);
376 pay_load = proto_item_add_subtree(ti, ett_sasp_payload);
377 offset += 2;
379 switch(msg_type)
381 case 0x1010:
382 /* Registration Request */
383 col_set_str(pinfo->cinfo, COL_INFO, "Registration Request");
384 dissect_reg_req(tvb, pay_load, offset);
385 break;
387 case 0x1015:
388 /* Registration Reply */
389 col_set_str(pinfo->cinfo, COL_INFO, "Registration Reply");
390 dissect_reg_rep(tvb, pay_load, offset);
391 break;
393 case 0x1020:
394 /* Deregistration Request */
395 col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Request");
396 dissect_dereg_req(tvb, pinfo, pay_load, offset);
397 break;
399 case 0x1025:
400 /* Deregistration Reply */
401 col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Reply");
402 dissect_dereg_rep(tvb, pay_load, offset);
403 break;
405 case 0x1030:
406 /* Get Weights Request */
407 col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Request");
408 dissect_wt_req(tvb, pay_load, offset);
409 break;
411 case 0x1035:
412 /* Get Weights Response */
413 col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Response");
414 dissect_wt_rep(tvb, pay_load, offset);
415 break;
417 case 0x1040:
418 /* Send Weights Request */
419 col_set_str(pinfo->cinfo, COL_INFO, "Send Weights Request");
420 dissect_sendwt(tvb, pay_load, offset);
421 break;
423 case 0x1050:
424 /* Set LB State Request */
425 col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Request");
426 dissect_setlbstate_req(tvb, pay_load, offset);
427 break;
429 case 0x1055:
430 /* Set LB state Reply */
431 col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Reply");
432 dissect_setlbstate_rep(tvb, pay_load, offset);
433 break;
435 case 0x1060:
436 /* Set Member State Request*/
437 col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Request");
438 dissect_setmemstate_req(tvb, pay_load, offset);
439 break;
441 case 0x1065:
442 /* Set Member State Reply */
443 col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Reply");
444 dissect_setmemstate_rep(tvb, pay_load, offset);
445 break;
447 default:
448 /* Unknown SASP Message Type */
449 col_add_fstr(pinfo->cinfo, COL_INFO,
450 "[Malformed: Unknown Message Type [0x%04x]", msg_type);
451 expert_add_info_format(pinfo, mti, &ei_msg_type_invalid,
452 "Unknown SASP Message Type: 0x%4x", msg_type);
453 break;
455 return tvb_reported_length(tvb);
459 static int
460 dissect_sasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
462 tcp_dissect_pdus(tvb, pinfo, tree, sasp_desegment, SASP_MIN_PACKET_LEN, get_sasp_pdu_len,
463 dissect_sasp_pdu, data);
464 return tvb_reported_length(tvb);
468 static void dissect_reg_req(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
470 proto_tree *reg_req_data;
471 uint16_t gmd_cnt, i;
473 reg_req_data = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_reg_req_sz, NULL, "Reg Request");
475 /* Reg Req Size */
476 proto_tree_add_item(reg_req_data, hf_sasp_reg_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
477 offset += 2;
479 /* Reg Req LB Flag */
480 proto_tree_add_item(reg_req_data, hf_reg_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
481 offset += 1;
483 gmd_cnt = tvb_get_ntohs(tvb, offset);
485 /* Group MEM Data Count */
486 proto_tree_add_item(reg_req_data, hf_sasp_gmd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
487 offset += 2;
489 for (i=0; i<gmd_cnt; i++)
490 offset = dissect_grp_memdatacomp(tvb, reg_req_data, offset);
494 static void dissect_reg_rep(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
496 proto_tree *reg_rep_tree;
498 reg_rep_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1 , ett_sasp_reg_rep, NULL, "Reg Reply");
500 /* Size */
501 proto_tree_add_item(reg_rep_tree, hf_sasp_reg_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
502 offset += 2;
504 /* Response Code */
505 proto_tree_add_item(reg_rep_tree, hf_sasp_reg_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
509 static void dissect_dereg_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pay_load, uint32_t offset)
511 /*proto_item *dereg_req_reason_flag;*/
512 /*proto_tree *dereg_req_reason_flag_tree;*/
513 uint16_t gmd_cnt, i;
514 proto_tree *dereg_req_data;
515 uint8_t reason_flag;
516 static bool first_flag = true;
517 wmem_strbuf_t *reasonflags_strbuf = wmem_strbuf_create(pinfo->pool);
518 static const char *fstr[] = {"No Reason", "Learned & Purposeful" };
520 dereg_req_data = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_dereg_req_sz, NULL, "DeReg Request");
522 /* Size */
523 proto_tree_add_item(dereg_req_data, hf_sasp_dereg_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
524 offset += 2;
526 /* LB Flag */
527 proto_tree_add_item(dereg_req_data, hf_dereg_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
528 offset += 1;
530 /* Reason */
531 wmem_strbuf_truncate(reasonflags_strbuf, 0);
532 reason_flag = tvb_get_uint8(tvb, offset);
534 if ((reason_flag & SASP_DEREG_REQ_REASON_LEARNED) == 0)
535 wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[0]);
536 else
537 wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[1]);
538 first_flag = false;
540 /*dereg_req_reason_flag =*/
541 proto_tree_add_uint_format(dereg_req_data, hf_dereg_req_reason_flag, tvb,
542 offset, 1, reason_flag, "Reason: 0x%02x (%s)", reason_flag,
543 wmem_strbuf_get_str(reasonflags_strbuf));
544 #if 0 /* XXX: ToDo?? Flags to be displayed under a subtree ? */
545 dereg_req_reason_flag_tree = proto_item_add_subtree(dereg_req_reason_flag, ett_dereg_req_reason_flag);
546 #endif
547 offset += 1;
549 gmd_cnt = tvb_get_ntohs(tvb, offset);
551 /* Group Mem Data Count */
552 proto_tree_add_item(dereg_req_data, hf_sasp_gmd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
553 offset += 2;
555 /*Group Mem Data */
556 for (i=0; i<gmd_cnt; i++)
557 offset = dissect_grp_memdatacomp(tvb, dereg_req_data, offset);
561 static void dissect_dereg_rep(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
563 proto_tree *dereg_rep_tree;
565 dereg_rep_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_dereg_rep, NULL, "Dereg Reply");
567 /* Size */
568 proto_tree_add_item(dereg_rep_tree, hf_sasp_dereg_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
569 offset += 2;
571 /* Return Code */
572 proto_tree_add_item(dereg_rep_tree, hf_sasp_dereg_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
576 static void dissect_sendwt(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
578 proto_tree *sendwt_tree;
579 uint16_t gwed_cnt, i;
581 sendwt_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_sendwt, NULL, "Send Weight");
583 /* Size */
584 proto_tree_add_item(sendwt_tree, hf_sasp_sendwt_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
585 offset += 2;
587 gwed_cnt = tvb_get_ntohs(tvb, offset);
589 /* Group Wt Entry Data Count */
590 proto_tree_add_item(sendwt_tree, hf_sasp_sendwt_gwedcnt, tvb, offset, 2, ENC_BIG_ENDIAN);
591 offset += 2;
593 for (i=0; i<gwed_cnt; i++)
594 offset = dissect_grp_wt_entry_datacomp(tvb, sendwt_tree, offset);
598 static void dissect_setmemstate_req(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
600 proto_tree *setmemstate_req_data;
601 uint16_t gmsd_cnt, i;
603 setmemstate_req_data = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_setmemstate_req, NULL, "Set Mem State Request");
605 /* Size */
606 proto_tree_add_item(setmemstate_req_data, hf_sasp_setmemstate_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
607 offset += 2;
609 /*LB Flag*/
610 proto_tree_add_item(setmemstate_req_data, hf_setmemstate_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
611 offset += 1;
613 /*Group Data Count*/
614 gmsd_cnt = tvb_get_ntohs(tvb, offset);
615 proto_tree_add_item(setmemstate_req_data, hf_sasp_setmemstate_req_gmsd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
616 offset += 2;
618 for (i=0; i<gmsd_cnt; i++)
619 offset = dissect_grp_memstatedatacomp(tvb, setmemstate_req_data, offset);
622 static void dissect_setmemstate_rep(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
624 proto_tree *setmemstate_rep_tree;
626 setmemstate_rep_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_setmemstate_rep, NULL, "Set Mem State Reply");
628 /* Size */
629 proto_tree_add_item(setmemstate_rep_tree, hf_sasp_setmemstate_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
630 offset += 2;
632 /* Response Code */
633 proto_tree_add_item(setmemstate_rep_tree, hf_sasp_setmemstate_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
637 static uint32_t dissect_memdatacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset, proto_tree **mdct_p)
639 proto_item *memdatacomp;
640 proto_tree *memdatacomp_tree;
641 uint8_t lab_len;
642 const char *ip_str;
643 ws_in6_addr ipv6_address;
645 tvb_get_ipv6(tvb, offset+7, &ipv6_address);
646 ip_str = tvb_ip6_to_str(wmem_packet_scope(), tvb, offset+7);
648 lab_len = tvb_get_uint8(tvb, offset+23);
650 memdatacomp = proto_tree_add_ipv6_format(pay_load, hf_sasp_memdatacomp_ip,
651 tvb, offset, 24+lab_len, &ipv6_address,
652 "Member Data Comp (%s)", ip_str);
654 memdatacomp_tree = proto_item_add_subtree(memdatacomp, ett_sasp_memdatacomp);
656 /* Message Type */
657 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_type, tvb, offset, 2, ENC_BIG_ENDIAN);
658 offset += 2;
660 /* Size */
661 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
662 offset += 2;
664 /* Protocol */
665 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
666 offset += 1;
668 /* Port */
669 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
670 offset += 2;
672 /*Ip*/
673 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_ip, tvb, offset, 16, ENC_NA);
674 offset += 16;
676 /*Label Len*/
677 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_lab_len, tvb, offset, 1, ENC_BIG_ENDIAN);
678 offset += 1;
680 /*Label*/
681 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_label, tvb, offset, lab_len, ENC_ASCII);
682 offset += lab_len;
684 if (mdct_p != NULL)
685 *mdct_p = memdatacomp_tree;
687 return offset;
691 static uint32_t dissect_grpdatacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
693 proto_tree *grpdatacomp_tree;
694 uint8_t LB_uid_len;
695 uint8_t grp_name_len;
697 grpdatacomp_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_grpdatacomp, NULL, "Group Data Component");
699 /*Type*/
700 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp, tvb, offset, 2, ENC_BIG_ENDIAN);
701 offset += 2;
703 /*Size*/
704 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
705 offset += 2;
707 LB_uid_len = tvb_get_uint8(tvb, offset);
709 /* LB UID Len*/
710 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_LB_uid_len,
711 tvb, offset, 1, ENC_BIG_ENDIAN);
712 offset += 1;
714 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_LB_uid,
715 tvb, offset, LB_uid_len, ENC_ASCII);
716 offset += (uint8_t)LB_uid_len;
718 grp_name_len = tvb_get_uint8(tvb, offset);
720 /*Group Name Len */
721 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_grp_name_len,
722 tvb, offset, 1, ENC_BIG_ENDIAN);
723 offset += 1;
725 /*Group Name*/
726 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_grp_name,
727 tvb, offset, grp_name_len, ENC_ASCII);
728 offset += grp_name_len;
730 return offset;
734 static uint32_t dissect_grp_memdatacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
736 proto_tree *grp_memdatacomp_tree;
737 uint16_t mem_cnt;
738 uint16_t i;
740 grp_memdatacomp_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_grp_memdatacomp, NULL, "Group Of Member Data");
742 /* Group MEM Data */
743 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp, tvb, offset, 2, ENC_BIG_ENDIAN);
744 offset += 2;
746 /* Group MEM Data Size*/
747 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
748 offset += 2;
750 mem_cnt = tvb_get_ntohs(tvb, offset);
752 /* Group MEM Data Count*/
753 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
754 offset += 2;
756 offset = dissect_grpdatacomp(tvb, grp_memdatacomp_tree, offset);
758 /* array of memdata */
759 for (i=0; i<mem_cnt; i++)
760 offset = dissect_memdatacomp(tvb, grp_memdatacomp_tree, offset, NULL);
762 return offset;
766 static void dissect_wt_req(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
768 proto_tree *get_wt_tree;
769 uint16_t gd_cnt, i;
771 get_wt_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_getwt, NULL, "Get Wt Req");
773 /* Size */
774 proto_tree_add_item(get_wt_tree, hf_sasp_wt_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
775 offset += 2;
777 gd_cnt = tvb_get_ntohs(tvb, offset);
779 /* Group Data Count */
780 proto_tree_add_item(get_wt_tree, hf_sasp_wt_req_gd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
781 offset += 2;
783 for (i=0; i<gd_cnt; i++)
784 offset = dissect_grpdatacomp(tvb, get_wt_tree, offset);
788 static void dissect_wt_rep(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
790 proto_tree *wt_rep_tree;
791 uint16_t gwed_cnt, i;
793 wt_rep_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_wt_rep, NULL, "Get Weights Reply");
795 /* Size */
796 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
797 offset += 2;
799 /* Response Code */
800 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
801 offset += 1;
803 /* Interval */
804 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_interval, tvb, offset, 2, ENC_BIG_ENDIAN);
805 offset += 2;
807 gwed_cnt = tvb_get_ntohs(tvb, offset);
809 /* Count of Group of Wt Entry Data */
810 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_gwed_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
811 offset += 2;
813 for (i=0; i<gwed_cnt; i++)
814 offset = dissect_grp_wt_entry_datacomp(tvb, wt_rep_tree, offset);
818 static void dissect_setlbstate_req(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
820 uint8_t LB_uid_len;
822 static int * const lbflags[] = {
823 &hf_sasp_pushflag,
824 &hf_sasp_trustflag,
825 &hf_sasp_nochangeflag,
826 NULL
829 proto_tree *setlbstate_req_tree;
831 setlbstate_req_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_setlbstate_req, NULL, "Set LB State Req");
833 /* Size*/
834 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_sz,
835 tvb, offset, 2, ENC_BIG_ENDIAN);
836 offset += 2;
838 LB_uid_len = tvb_get_uint8(tvb, offset);
840 /* LB UID Len */
841 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_uid_len,
842 tvb, offset, 1, ENC_BIG_ENDIAN);
843 offset += 1;
845 /*LB UID*/
846 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_uid,
847 tvb, offset, LB_uid_len, ENC_ASCII);
848 offset += (uint8_t)LB_uid_len;
850 /*LB Health*/
851 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_health,
852 tvb, offset, 1, ENC_BIG_ENDIAN);
853 offset += 1;
855 proto_tree_add_bitmask_text(setlbstate_req_tree, tvb, offset, 1, "LB Flags:", NULL,
856 ett_setlbstate_req_lbflag, lbflags, ENC_BIG_ENDIAN, 0);
860 static void dissect_setlbstate_rep(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
862 proto_tree *setlbstate_rep_tree;
864 setlbstate_rep_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_setlbstate_rep, NULL, "Set LB State Rep");
866 /* Size */
867 proto_tree_add_item(setlbstate_rep_tree, hf_sasp_setlbstate_rep_sz,
868 tvb, offset, 2, ENC_BIG_ENDIAN);
869 offset += 2;
871 /* Response Code */
872 proto_tree_add_item(setlbstate_rep_tree, hf_sasp_setlbstate_rep_rcode,
873 tvb, offset, 1, ENC_BIG_ENDIAN);
877 static uint32_t dissect_grp_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
879 proto_tree *grp_memstatedatacomp_tree;
880 uint16_t mem_cnt;
881 uint16_t i;
883 grp_memstatedatacomp_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1,
884 ett_sasp_grp_memstatedatacomp, NULL, "Group Mem State Comp");
886 /* Type */
887 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp,
888 tvb, offset, 2, ENC_BIG_ENDIAN);
889 offset += 2;
891 /* Size */
892 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp_sz,
893 tvb, offset, 2, ENC_BIG_ENDIAN);
894 offset += 2;
896 mem_cnt = tvb_get_ntohs(tvb, offset);
898 /* Count */
899 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp_cnt,
900 tvb, offset, 2, ENC_BIG_ENDIAN);
901 offset += 2;
903 /* Group Data TLV */
904 offset = dissect_grpdatacomp(tvb, grp_memstatedatacomp_tree, offset);
906 /* Array of Mem State Data */
907 for (i=0; i<mem_cnt; i++)
908 offset = dissect_memstatedatacomp(tvb, grp_memstatedatacomp_tree, offset);
910 return offset;
914 static uint32_t dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
916 proto_tree *memstatedatacomp_tree;
917 proto_tree *memdatacomp_tree;
919 offset = dissect_memdatacomp(tvb, pay_load, offset, &memdatacomp_tree);
921 memstatedatacomp_tree = proto_tree_add_subtree(memdatacomp_tree, tvb, offset, -1, ett_sasp_memstatedatacomp, NULL, "Member State Data");
923 /* Type */
924 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_instance,
925 tvb, offset, 2, ENC_BIG_ENDIAN);
926 offset += 2;
928 /* Size */
929 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_sz,
930 tvb, offset, 2, ENC_BIG_ENDIAN);
931 offset += 2;
933 /* State */
934 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_state,
935 tvb, offset, 1, ENC_BIG_ENDIAN);
936 offset += 1;
938 /* Quiesce flag*/
939 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_quiesce_flag,
940 tvb, offset, 1, ENC_NA);
941 offset += 1;
943 return offset;
947 static uint32_t dissect_weight_entry_data_comp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
949 proto_tree *weight_entry_data_comp_tree;
951 static int * const wtflags[] = {
952 &hf_sasp_wed_contactsuccess_flag,
953 &hf_sasp_wed_quiesce_flag,
954 &hf_sasp_wed_registration_flag,
955 &hf_sasp_wed_confident_flag,
956 NULL
959 offset = dissect_memdatacomp(tvb, pay_load, offset, NULL);
961 weight_entry_data_comp_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1,
962 ett_sasp_weight_entry_data_comp, NULL, "Weight Entry Data");
964 /* Type */
965 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_type,
966 tvb, offset, 2, ENC_BIG_ENDIAN);
967 offset += 2;
969 /* Size */
970 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_sz,
971 tvb, offset, 2, ENC_BIG_ENDIAN);
972 offset += 2;
974 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_state,
975 tvb, offset, 1, ENC_BIG_ENDIAN);
976 offset += 1;
978 proto_tree_add_bitmask_text(weight_entry_data_comp_tree, tvb, offset, 1, "Flags:", NULL,
979 ett_wt_entry_data_flag, wtflags, ENC_BIG_ENDIAN, 0);
980 offset += 1;
982 /* Weight */
983 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_weight,
984 tvb, offset, 2, ENC_BIG_ENDIAN);
985 offset += 2;
987 return offset;
991 static uint32_t dissect_grp_wt_entry_datacomp(tvbuff_t *tvb, proto_tree *pay_load, uint32_t offset)
993 proto_tree *grp_wt_entry_datacomp_tree;
994 uint16_t wt_entry_cnt;
995 uint16_t i;
997 grp_wt_entry_datacomp_tree = proto_tree_add_subtree(pay_load, tvb, offset, -1, ett_sasp_grp_wt_entry_datacomp, NULL, "Group of Wt Entry Data");
999 /* Type */
1000 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_type,
1001 tvb, offset, 2, ENC_BIG_ENDIAN);
1002 offset += 2;
1004 /* Size */
1005 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_sz,
1006 tvb, offset, 2, ENC_BIG_ENDIAN);
1007 offset += 2;
1009 wt_entry_cnt = tvb_get_ntohs(tvb, offset);
1011 /* Wt Entry Count*/
1012 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_cnt,
1013 tvb, offset, 2, ENC_BIG_ENDIAN);
1014 offset += 2;
1016 /* Group Data */
1017 offset = dissect_grpdatacomp(tvb, grp_wt_entry_datacomp_tree, offset);
1019 /* Member Data */
1020 for (i=0; i<wt_entry_cnt; i++)
1021 offset = dissect_weight_entry_data_comp(tvb, grp_wt_entry_datacomp_tree, offset);
1023 return offset;
1027 /* sasp protocol register */
1028 void proto_register_sasp(void)
1030 static hf_register_info hf[] = {
1031 /*SASP Header */
1032 { &hf_sasp_type,
1033 { "Type", "sasp.type",
1034 FT_UINT16, BASE_HEX, NULL, 0x0,
1035 "SASP Header", HFILL }
1038 { &hf_sasp_length,
1039 { "Length", "sasp.header.Len",
1040 FT_UINT16, BASE_DEC, NULL, 0x0,
1041 "SASP Header Length", HFILL }
1044 { &hf_sasp_vrsn,
1045 { "Version", "sasp.version",
1046 FT_UINT8, BASE_DEC, NULL, 0x0,
1047 "SASP Version", HFILL }
1050 { &hf_msg_len,
1051 { "Message Len", "sasp.msg.len",
1052 FT_UINT32, BASE_DEC, NULL, 0x0,
1053 "SASP Msg Len", HFILL }
1056 { &hf_msg_id,
1057 { "Message Id", "sasp.msg.id",
1058 FT_UINT32, BASE_DEC, NULL, 0x0,
1059 "SASP Msg Id", HFILL }
1062 /*Message Type*/
1063 { &hf_msg_type,
1064 { "Message Type", "sasp.msg.type",
1065 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1066 "SASP Msg Type", HFILL }
1069 /*Reg Request*/
1070 { &hf_sasp_reg_req_sz,
1071 { "Reg Req-Size", "sasp.reg-req.size",
1072 FT_UINT32, BASE_DEC, NULL, 0x0,
1073 "SASP Reg Req Size", HFILL }
1076 { &hf_reg_req_lbflag,
1077 { "Reg Req-LB Flag", "sasp.reg-req.lbflag",
1078 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1079 "SASP Reg Req LB Flag", HFILL } },
1081 { &hf_sasp_gmd_cnt,
1082 { "Grp Mem Data-Count", "sasp.grp-mem-data.count",
1083 FT_UINT16, BASE_DEC, NULL, 0x0,
1084 "SASP Grp Mem Data Count", HFILL } },
1086 /* Reg Reply */
1088 { &hf_sasp_reg_rep_sz,
1089 { "Reg Reply-Size", "sasp.reg-rep.size",
1090 FT_UINT16, BASE_DEC, NULL, 0x0,
1091 "SASP Reg Reply size", HFILL } },
1093 { &hf_sasp_reg_rep_rcode,
1094 { "Reg Reply-Return Code", "sasp.reg-rep.retcode",
1095 FT_UINT8, BASE_HEX, VALS(reg_reply_response_code), 0x0,
1096 "SASP Reg Rep Return Code", HFILL } },
1098 /* Dereg Req */
1099 { &hf_sasp_dereg_req_sz,
1100 { "Dereg Req-Size", "sasp.dereg-req.size",
1101 FT_UINT32, BASE_DEC, NULL, 0x0,
1102 "SASP Dereg Req Size", HFILL } },
1104 { &hf_dereg_req_lbflag,
1105 { "Dereg Req-LB Flag", "sasp.dereg-req.lbflag",
1106 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1107 "SASP Dereg Req LB Flag", HFILL } },
1109 { &hf_dereg_req_reason_flag,
1110 { "Reason Flags", "sasp.flags.reason",
1111 FT_UINT8, BASE_HEX, NULL, 0x0,
1112 NULL, HFILL } },
1114 #if 0
1115 { &hf_dereg_req_reason,
1116 { "Dereg Req-Reason", "sasp.dereg-req.reason",
1117 FT_UINT8, BASE_HEX, NULL, 0x0,
1118 "SASP Dereg Req Reason", HFILL } },
1119 #endif
1121 /* Dereg Rep */
1122 { &hf_sasp_dereg_rep_sz,
1123 { "Dereg Rep-Size", "sasp.dereg-rep.size",
1124 FT_UINT16, BASE_DEC, NULL, 0x0,
1125 "SASP Dereg Rep Size", HFILL } },
1127 { &hf_sasp_dereg_rep_rcode,
1128 { "Dereg Rep-Return Code", "sasp.dereg-rep.retcode",
1129 FT_UINT8, BASE_HEX, VALS(dereg_reply_response_code), 0x0,
1130 "SASP Dereg Rep Return Code", HFILL } },
1132 /* Send weight */
1134 { &hf_sasp_sendwt_sz,
1135 { "Sendwt-Size", "sasp.sendwt.size",
1136 FT_UINT16, BASE_DEC, NULL, 0x0,
1137 "SASP Sendwt-Size", HFILL } },
1139 { &hf_sasp_sendwt_gwedcnt,
1140 { "Sendwt-Grp Wt EntryData Count", "sasp.sendwt-grp-wtentrydata.count",
1141 FT_UINT16, BASE_DEC, NULL, 0x0,
1142 "SASP Sendwt Grp Wt Entry Data Count", HFILL } },
1144 /*Set Mem State Req*/
1146 { &hf_sasp_setmemstate_req_sz,
1147 { "Set Memstate Req-Size", "sasp.setmemstate-req.size",
1148 FT_UINT16, BASE_DEC, NULL, 0x0,
1149 "SASP Set Memstate Req Size", HFILL } },
1151 { &hf_setmemstate_req_lbflag,
1152 { "Set Memstate Req-LB Flag", "sasp.setmemstate-req.lbflag",
1153 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1154 "SASP Set Memstate Req LB Flag", HFILL } },
1156 { &hf_sasp_setmemstate_req_gmsd_cnt,
1157 { "Set Memstate Req-Gmsd Count", "sasp.group-memstate.count",
1158 FT_UINT16, BASE_DEC, NULL, 0x0,
1159 "Group Of Member State Data Count", HFILL } },
1161 /* Set Mem State Reply */
1162 #if 0
1163 { &hf_sasp_setmemstate_rep,
1164 { "Set Memstate Reply", "sasp.setmemstate-rep",
1165 FT_UINT32, BASE_HEX, NULL, 0x0,
1166 "SASP Set Memstate Reply", HFILL } },
1167 #endif
1169 { &hf_sasp_setmemstate_rep_sz,
1170 { "Set Memstate Rep-Size", "sasp.setmemstate-rep.size",
1171 FT_UINT16, BASE_DEC, NULL, 0x0,
1172 "SASP Set Memstate Rep Size", HFILL } },
1174 { &hf_sasp_setmemstate_rep_rcode,
1175 { "Set Memstate Rep-Return Code", "sasp.setmemstate-rep.retcode",
1176 FT_UINT8, BASE_HEX, VALS(set_mem_state_reply_response_code), 0x0,
1177 "SASP Set Memstate Rep Return Code", HFILL } },
1179 /*Mem Data Component*/
1181 { &hf_sasp_memdatacomp_type,
1182 { "Message Type", "sasp.msg.type",
1183 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1184 "SASP Mem Data Comp", HFILL } },
1186 { &hf_sasp_memdatacomp_sz,
1187 { "Mem Data Comp-Size", "sasp.memdatacomp.size",
1188 FT_UINT16, BASE_DEC, NULL, 0x0,
1189 "SASP Mem Data Comp Size", HFILL } },
1191 { &hf_sasp_memdatacomp_protocol,
1192 { "Mem Data Comp-Protocol", "sasp.memdatacomp.protocol",
1193 FT_UINT8, BASE_HEX, VALS(protocol_table), 0x0,
1194 "SASP Mem Data Comp Protocol", HFILL } },
1196 { &hf_sasp_memdatacomp_port,
1197 { "Mem Data Comp-Port", "sasp.memdatacomp.port",
1198 FT_UINT16, BASE_DEC, NULL, 0x0,
1199 "SASP Mem Data Comp Port", HFILL } },
1201 { &hf_sasp_memdatacomp_ip,
1202 { "Mem Data Comp-Ip", "sasp.memdatacomp.ip",
1203 FT_IPv6, BASE_NONE, NULL, 0x0,
1204 "SASP Mem Data Comp Ip", HFILL } },
1206 { &hf_sasp_memdatacomp_lab_len,
1207 { "Mem Data Comp-Label Len", "sasp.memdatacomp.label.len",
1208 FT_UINT8, BASE_DEC, NULL, 0x0,
1209 "SASP Mem Data Comp Label Length", HFILL } },
1211 { &hf_sasp_memdatacomp_label,
1212 { "Mem Data Comp-Label", "sasp.memdatacomp.label",
1213 FT_STRING, BASE_NONE, NULL, 0x0,
1214 "SASP Mem Data Comp Label", HFILL } },
1216 /*Get Weight Request*/
1218 { &hf_sasp_wt_req_sz,
1219 { "Get Wt Req-Size", "sasp.getwt.req.size",
1220 FT_UINT16, BASE_DEC, NULL, 0x0,
1221 "SASP Get Wt Req Size", HFILL } },
1223 { &hf_sasp_wt_req_gd_cnt,
1224 { "Get Wt Req-Grp Data Count", "sasp.getwt-req-grpdata.count",
1225 FT_UINT16, BASE_DEC, NULL, 0x0,
1226 "SASP Get Wt Grp Data Count", HFILL } },
1228 /*Get Weight Reply*/
1230 { &hf_sasp_wt_rep_sz,
1231 { "Get Wt Rep-Size", "sasp.getwt.rep.size",
1232 FT_UINT16, BASE_DEC, NULL, 0x0,
1233 "SASP Get Wt Rep Size", HFILL } },
1235 { &hf_sasp_wt_rep_rcode,
1236 { "Get Wt Rep-Return Code", "sasp.getwt-rep.retcode",
1237 FT_UINT8, BASE_HEX, VALS(get_weights_reply_response_code), 0x0,
1238 "SASP Get Wt Rep Return Code", HFILL } },
1240 { &hf_sasp_wt_rep_interval,
1241 { "Get Wt Rep-Interval", "sasp.getwt-rep.interval",
1242 FT_UINT16, BASE_DEC, NULL, 0x0,
1243 "SASP Get Wt Rep Interval", HFILL } },
1245 { &hf_sasp_wt_rep_gwed_cnt,
1246 { "Get Wt Rep-Grp WtEntry Data Cnt", "sasp.getwt-rep-grpwtentrydata.count",
1247 FT_UINT16, BASE_DEC, NULL, 0x0,
1248 "SASP Get Wt Rep Grp Wt Entry Data Cnt", HFILL } },
1250 /*Set LB State Rep */
1252 #if 0
1253 { &hf_sasp_setlbstate_rep,
1254 { "Set Lbstate Rep", "sasp.msg.type",
1255 FT_UINT32, BASE_HEX, NULL, 0x0,
1256 "SASP Set Lbstate Rep", HFILL } },
1257 #endif
1259 { &hf_sasp_setlbstate_rep_sz,
1260 { "Set Lbstate Rep-Size", "sasp.setlbstate-rep.size",
1261 FT_UINT16, BASE_DEC, NULL, 0x0,
1262 "SASP Set Lbstate Rep Size", HFILL } },
1264 { &hf_sasp_setlbstate_rep_rcode,
1265 { "Set Lbstate Rep-Return Code", "sasp.setlbstate-rep.retcode",
1266 FT_UINT8, BASE_HEX, VALS(set_lb_state_reply_response_code), 0x0,
1267 "SASP Set Lbstate Rep Return Code", HFILL } },
1270 /*grp data comp */
1272 { &hf_sasp_grpdatacomp,
1273 { "Message Type", "sasp.msg.type",
1274 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1275 "SASP Grp Data Comp", HFILL } },
1277 { &hf_sasp_grpdatacomp_sz,
1278 { "Grp Data Comp-Size", "sasp.grpdatacomp.size",
1279 FT_UINT16, BASE_DEC, NULL, 0x0,
1280 "SASP Grp Data Comp size", HFILL } },
1282 { &hf_sasp_grpdatacomp_LB_uid_len,
1283 { "Grp Data Comp-Label UID Len", "sasp.grpdatacomp.label.uid.len",
1284 FT_UINT8, BASE_DEC, NULL, 0x0,
1285 "SASP Grp Data Comp Label Uid Len", HFILL } },
1287 { &hf_sasp_grpdatacomp_LB_uid,
1288 { "Grp Data Comp-Label UID", "sasp.grpdatacomp.label.uid",
1289 FT_STRING, BASE_NONE, NULL, 0x0,
1290 "SASP Grp Data Comp Label Uid", HFILL } },
1292 { &hf_sasp_grpdatacomp_grp_name_len,
1293 { "Grp Data Comp-Grp Name Len", "sasp.grpdatacomp.grpname.len",
1294 FT_UINT8, BASE_DEC, NULL, 0x0,
1295 "SASP Grp Data Comp Grp Name Len", HFILL } },
1297 { &hf_sasp_grpdatacomp_grp_name,
1298 { "Grp Data Comp-Grp Name", "sasp.grpdatacomp.grpname",
1299 FT_STRING, BASE_NONE, NULL, 0x0,
1300 "SASP Grp Data Comp Grp Name", HFILL } },
1302 /*grp mem data comp */
1304 { &hf_sasp_grp_memdatacomp,
1305 { "Message Type", "sasp.msg.type",
1306 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1307 "SASP Grp Mem Data Comp", HFILL } },
1310 { &hf_sasp_grp_memdatacomp_sz,
1311 { "Grp Mem Data Comp-Size", "sasp.grp-memdatacomp.size",
1312 FT_UINT16, BASE_DEC, NULL, 0x0,
1313 "SASP Grp Mem Data Comp Size", HFILL } },
1315 { &hf_sasp_grp_memdatacomp_cnt,
1316 { "Grp Mem Data Comp-Count", "sasp.grp.memdatacomp.count",
1317 FT_UINT16, BASE_DEC, NULL, 0x0,
1318 "SASP Grp Mem Data Comp Cnt", HFILL } },
1321 /*set LB state req*/
1323 { &hf_sasp_setlbstate_req_sz,
1324 { "Set LB State Req-Size", "sasp.setlbstate-req.size",
1325 FT_UINT16, BASE_DEC, NULL, 0x0,
1326 "SASP Set LB State Req Size", HFILL } },
1328 { &hf_sasp_setlbstate_req_LB_uid_len,
1329 { "Set LB State Req-LB UID Len", "sasp.setlbstate-req.lbuid.len",
1330 FT_UINT8, BASE_DEC, NULL, 0x0,
1331 "SASP Set LB State Req LB Uid Len", HFILL } },
1333 { &hf_sasp_setlbstate_req_LB_uid,
1334 { "Set LB State Req-LB UID", "sasp.setlbstate-req.lbuid",
1335 FT_STRING, BASE_NONE, NULL, 0x0,
1336 "SASP Set LB State Req LB UID", HFILL } },
1338 { &hf_sasp_setlbstate_req_LB_health,
1339 { "Set LB State Req-LB Health", "sasp.setlbstate-req.lbhealth",
1340 FT_UINT8, BASE_HEX, VALS(lbstate_healthtable), 0x0,
1341 "SASP Set LB State Req LB Health", HFILL } },
1343 #if 0
1344 { &hf_lbstate_flag,
1345 { "Flags", "sasp.flags.lbstate",
1346 FT_UINT8, BASE_HEX, NULL, 0x0,
1347 NULL, HFILL } },
1348 #endif
1350 { &hf_sasp_pushflag,
1351 { "PUSH", "sasp.flags.push",
1352 FT_BOOLEAN, 8, NULL, SASP_PUSH_FLAG,
1353 "SASP Push Flag", HFILL } },
1355 { &hf_sasp_trustflag,
1356 { "TRUST", "sasp.flags.trust",
1357 FT_BOOLEAN, 8, NULL, SASP_TRUST_FLAG,
1358 "SASP Trust Flag", HFILL } },
1360 { &hf_sasp_nochangeflag,
1361 { "NOCHANGE", "sasp.flags.nochange",
1362 FT_BOOLEAN, 8, NULL, SASP_NOCHANGE_FLAG,
1363 "SASP Nochange Flag", HFILL } },
1365 /*grp mem state data comp */
1367 { &hf_sasp_grp_memstatedatacomp,
1368 { "Message Type", "sasp.msg.type",
1369 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1370 "SASP Message Type", HFILL } },
1373 { &hf_sasp_grp_memstatedatacomp_sz,
1374 { "Grp Mem State-Size", "sasp.grp.memstate.size",
1375 FT_UINT16, BASE_DEC, NULL, 0x0,
1376 "SASP Grp Mem State Data Comp Size", HFILL } },
1378 { &hf_sasp_grp_memstatedatacomp_cnt,
1379 { "Grp Mem State-Count", "sasp.grp.memstate.count",
1380 FT_UINT16, BASE_DEC, NULL, 0x0,
1381 "SASP Grp Mem State Data Comp Count", HFILL } },
1383 /*mem state instance */
1385 { &hf_sasp_memstatedatacomp_instance,
1386 { "Message Type", "sasp.msg.type",
1387 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1388 "SASP Message Type", HFILL } },
1391 { &hf_sasp_memstatedatacomp_sz,
1392 { "Mem State-Size", "sasp.memstate.size",
1393 FT_UINT16, BASE_DEC, NULL, 0x0,
1394 "SASP Mem State Data Comp Size", HFILL } },
1396 { &hf_sasp_memstatedatacomp_state,
1397 { "Mem State-State", "sasp.memstate.state",
1398 FT_UINT8, BASE_HEX, NULL, 0x0,
1399 "SASP Mem State Data Comp State", HFILL } },
1401 { &hf_sasp_memstatedatacomp_quiesce_flag,
1402 { "Mem State-Quiesce Flag", "sasp.flags.quiesce",
1403 FT_BOOLEAN, 8, NULL, SASP_QUIESCE_FLAG,
1404 "SASP Quiesce Flag", HFILL } },
1406 /*weight entry data comp*/
1408 { &hf_sasp_weight_entry_data_comp_type,
1409 { "Wt Entry Data Comp", "sasp.wtentry.datacomp",
1410 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1411 "SASP Wt Entry Data Comp", HFILL } },
1413 { &hf_sasp_weight_entry_data_comp_sz,
1414 { "Wt Entry Data Comp-Size", "sasp.wtentry.size",
1415 FT_UINT16, BASE_DEC, NULL, 0x0,
1416 "SASP Wt Entry Data Comp Size", HFILL } },
1418 { &hf_sasp_weight_entry_data_comp_state,
1419 { "Wt Entry Data Comp-state", "sasp.wtentry.state",
1420 FT_UINT8, BASE_HEX, NULL, 0x0,
1421 "SASP Wt Entry Data Comp State", HFILL } },
1423 #if 0
1424 { &hf_wtstate_flag,
1425 { "Flags", "sasp.flags.wtstate",
1426 FT_UINT8, BASE_HEX, NULL, 0x0,
1427 NULL, HFILL } },
1428 #endif
1430 { &hf_sasp_wed_contactsuccess_flag,
1431 { "Contact Success", "sasp.flags.contactsuccess",
1432 FT_BOOLEAN, 8, NULL, SASP_WED_CONTACT_SUCCESS_FLAG,
1433 "SASP Contact Success Flag", HFILL } },
1435 { &hf_sasp_wed_quiesce_flag,
1436 { "Quiesce", "sasp.flags.quiesce",
1437 FT_BOOLEAN, 8, NULL, SASP_WED_QUIESCE_FLAG,
1438 "SASP Quiesce Flag", HFILL } },
1440 { &hf_sasp_wed_registration_flag,
1441 { "Registration", "sasp.flags.registration",
1442 FT_BOOLEAN, 8, NULL, SASP_WED_REG_FLAG,
1443 "SASP Registration Flag", HFILL } },
1445 { &hf_sasp_wed_confident_flag,
1446 { "Confident", "sasp.flags.confident",
1447 FT_BOOLEAN, 8, NULL, SASP_WED_CONF_FLAG,
1448 "SASP Confident Flag", HFILL } },
1450 { &hf_sasp_weight_entry_data_comp_weight,
1451 { "Wt Entry Data Comp-weight", "sasp.wtentrydatacomp.weight",
1452 FT_UINT16, BASE_DEC, NULL, 0x0,
1453 "SASP Wt Entry Data Comp weight", HFILL } },
1456 /*grp wt entry data comp */
1458 { &hf_sasp_grp_wt_entry_datacomp_type,
1459 { "Grp Wt Entry Data Comp", "sasp.msg.type",
1460 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1461 "SASP Grp Wt Entry Data Comp", HFILL } },
1463 { &hf_sasp_grp_wt_entry_datacomp_sz,
1464 { "Grp Wt Entry Data Comp Size", "sasp.grp-wtentrydata.size",
1465 FT_UINT16, BASE_DEC, NULL, 0x0,
1466 "SASP Grp Wt Entry Data Comp Size", HFILL } },
1468 { &hf_sasp_grp_wt_entry_datacomp_cnt,
1469 { "Grp Wt Entry Data Comp Cnt", "sasp.grp-wtentrydata.count",
1470 FT_UINT16, BASE_DEC, NULL, 0x0,
1471 "SASP Grp Wt Entry Data Comp Cnt", HFILL } }
1474 /* Setup protocol subtree array */
1476 static int *ett[] = {
1477 &ett_sasp_data,
1478 &ett_sasp_header,
1479 &ett_sasp_msg,
1480 &ett_sasp_payload,
1481 &ett_sasp_reg_req,
1482 &ett_sasp_reg_rep,
1483 &ett_sasp_reg_req_sz,
1484 &ett_sasp_dereg_req_sz,
1485 &ett_sasp_dereg_rep,
1486 &ett_sasp_sendwt,
1487 &ett_sasp_setmemstate_req,
1488 &ett_sasp_setmemstate_rep,
1489 &ett_sasp_memdatacomp,
1490 &ett_sasp_grpdatacomp,
1491 &ett_sasp_grp_memdatacomp,
1492 &ett_sasp_setlbstate_req,
1493 &ett_sasp_setlbstate_rep,
1494 &ett_sasp_getwt,
1495 &ett_setlbstate_req_lbflag,
1496 &ett_sasp_grp_memstatedatacomp,
1497 &ett_sasp_memstatedatacomp,
1498 /* &ett_dereg_req_reason_flag, */
1499 &ett_sasp_grp_wt_entry_datacomp,
1500 &ett_sasp_weight_entry_data_comp,
1501 &ett_wt_entry_data_flag,
1502 &ett_sasp_wt_rep
1505 static ei_register_info ei[] = {
1506 { &ei_msg_type_invalid, { "sasp.msg.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid Type", EXPFILL }}
1509 module_t *sasp_module;
1510 expert_module_t* expert_sasp;
1512 proto_sasp = proto_register_protocol("Server/Application State Protocol", "SASP", "sasp");
1513 sasp_handle = register_dissector("sasp", dissect_sasp, proto_sasp);
1515 proto_register_field_array(proto_sasp, hf, array_length(hf));
1516 proto_register_subtree_array(ett, array_length(ett));
1517 expert_sasp = expert_register_protocol(proto_sasp);
1518 expert_register_field_array(expert_sasp, ei, array_length(ei));
1520 sasp_module = prefs_register_protocol(proto_sasp, NULL);
1521 prefs_register_bool_preference(sasp_module, "desegment_sasp_messages",
1522 "Reassemble SASP messages spanning multiple TCP segments",
1523 "Whether the SASP dissector should reassemble messages"
1524 " spanning multiple TCP segments."
1525 " To use this option, you must also enable"
1526 " \"Allow subdissectors to reassemble TCP streams\""
1527 " in the TCP protocol settings.",
1528 &sasp_desegment);
1532 /* Handing off to TCP */
1533 void
1534 proto_reg_handoff_sasp(void)
1536 dissector_add_uint_with_preference("tcp.port", SASP_GLOBAL_PORT, sasp_handle);
1540 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1542 * Local variables:
1543 * c-basic-offset: 4
1544 * tab-width: 8
1545 * indent-tabs-mode: nil
1546 * End:
1548 * vi: set shiftwidth=4 tabstop=8 expandtab:
1549 * :indentSize=4:tabSize=8:noTabs=true: