MSWSP: add two more Property Sets
[wireshark-wip.git] / epan / dissectors / packet-sasp.c
blobb5a1d5e0d9b48ad0de08ec0a8404d9f1c077c82f
1 /* packet-sasp.c
2 * Routines for sasp packet dissection
3 * Copyright 2010, Venkateshwaran Dorai<venkateshwaran.d@gmail.com>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "config.h"
28 #include <glib.h>
29 #include <epan/wmem/wmem.h>
30 #include <epan/packet.h>
31 #include <epan/expert.h>
32 #include "packet-tcp.h"
33 #include <epan/prefs.h>
35 /* forward reference */
36 static void dissect_reg_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
37 static void dissect_dereg_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
38 static void dissect_reg_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
39 static void dissect_dereg_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
40 static void dissect_sendwt(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
41 static void dissect_setmemstate_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
42 static void dissect_setmemstate_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
43 static void dissect_setlbstate_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
44 static void dissect_setlbstate_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
45 static void dissect_wt_req(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
46 static void dissect_wt_rep(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
47 static guint32 dissect_memdatacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset, proto_tree **mdct_p);
48 static guint32 dissect_grpdatacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
49 static guint32 dissect_grp_memdatacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
50 static guint32 dissect_grp_memstatedatacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
51 static guint32 dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
52 static guint32 dissect_weight_entry_data_comp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset);
53 static guint32 dissect_grp_wt_entry_datacomp(tvbuff_t *tvb, proto_tree *tree, guint32 offset);
55 /* Initialize the protocol and registered fields */
56 static int proto_sasp = -1;
57 static int hf_sasp_type = -1;
58 static int hf_sasp_length = -1;
59 static int hf_sasp_vrsn = -1;
60 static int hf_msg_len = -1;
61 static int hf_msg_id = -1;
62 static int hf_msg_type = -1;
64 /*reg reply*/
65 static int hf_sasp_reg_rep_rcode = -1;
66 static int hf_sasp_reg_rep_sz = -1;
68 /*reg req*/
69 static int hf_sasp_reg_req_sz = -1;
70 static int hf_reg_req_lbflag = -1;
71 static int hf_sasp_gmd_cnt = -1;
73 /*dereg req*/
74 static int hf_sasp_dereg_req_sz = -1;
75 static int hf_dereg_req_lbflag = -1;
76 /* static int hf_dereg_req_reason = -1; */
77 static int hf_dereg_req_reason_flag = -1;
79 /*dereg reply*/
80 static int hf_sasp_dereg_rep_rcode = -1;
81 static int hf_sasp_dereg_rep_sz = -1;
83 /*send wt*/
84 static int hf_sasp_sendwt_gwedcnt = -1;
85 static int hf_sasp_sendwt_sz = -1;
87 /*setmemstate req*/
88 static int hf_sasp_setmemstate_req_sz = -1;
89 static int hf_setmemstate_req_lbflag = -1;
90 /*static int hf_sasp_setmemstate_req_data = -1;*/
91 static int hf_sasp_setmemstate_req_gmsd_cnt = -1;
93 /*setmemstate reply*/
94 /* static int hf_sasp_setmemstate_rep = -1; */
95 static int hf_sasp_setmemstate_rep_rcode = -1;
96 static int hf_sasp_setmemstate_rep_sz = -1;
98 /*mem data comp */
99 static int hf_sasp_memdatacomp_type = -1;
100 static int hf_sasp_memdatacomp_sz = -1;
101 static int hf_sasp_memdatacomp_protocol = -1;
102 static int hf_sasp_memdatacomp_port = -1;
103 static int hf_sasp_memdatacomp_ip = -1;
104 static int hf_sasp_memdatacomp_lab_len = -1;
105 static int hf_sasp_memdatacomp_label = -1;
107 /*grp data comp */
108 static int hf_sasp_grpdatacomp = -1;
109 static int hf_sasp_grpdatacomp_sz = -1;
110 static int hf_sasp_grpdatacomp_LB_uid_len = -1;
111 static int hf_sasp_grpdatacomp_LB_uid = -1;
112 static int hf_sasp_grpdatacomp_grp_name_len = -1;
113 static int hf_sasp_grpdatacomp_grp_name = -1;
115 /*grp mem data comp */
116 static int hf_sasp_grp_memdatacomp = -1;
117 static int hf_sasp_grp_memdatacomp_sz = -1;
118 static int hf_sasp_grp_memdatacomp_cnt = -1;
120 /*weight req*/
121 static int hf_sasp_wt_req_sz = -1;
122 static int hf_sasp_wt_req_gd_cnt = -1;
124 /*weight rep*/
125 static int hf_sasp_wt_rep_sz = -1;
126 static int hf_sasp_wt_rep_rcode = -1;
127 static int hf_sasp_wt_rep_interval = -1;
128 static int hf_sasp_wt_rep_gwed_cnt = -1;
130 /*setlbstate req*/
131 static int hf_sasp_setlbstate_req_sz = -1;
132 static int hf_sasp_setlbstate_req_LB_uid_len = -1;
133 static int hf_sasp_setlbstate_req_LB_uid = -1;
134 static int hf_sasp_setlbstate_req_LB_health = -1;
135 /*static int hf_sasp_setlbstate_req_LB_flag = -1;*/
136 /* static int hf_lbstate_flag = -1; */
137 static int hf_sasp_pushflag = -1;
138 static int hf_sasp_trustflag = -1;
139 static int hf_sasp_nochangeflag = -1;
141 /*setlbstate reply*/
142 /* static int hf_sasp_setlbstate_rep = -1; */
143 static int hf_sasp_setlbstate_rep_rcode = -1;
144 static int hf_sasp_setlbstate_rep_sz = -1;
146 /*grp mem state data*/
147 static int hf_sasp_grp_memstatedatacomp = -1;
148 static int hf_sasp_grp_memstatedatacomp_sz = -1;
149 static int hf_sasp_grp_memstatedatacomp_cnt = -1;
151 /*mem state data comp*/
152 static int hf_sasp_memstatedatacomp_instance = -1;
153 static int hf_sasp_memstatedatacomp_sz = -1;
154 static int hf_sasp_memstatedatacomp_state = -1;
155 static int hf_sasp_memstatedatacomp_quiesce_flag = -1;
157 /*wt entry dat comp*/
158 static int hf_sasp_weight_entry_data_comp_type = -1;
159 static int hf_sasp_weight_entry_data_comp_sz = -1;
160 static int hf_sasp_weight_entry_data_comp_state = -1;
161 /* static int hf_wtstate_flag = -1; */
162 static int hf_sasp_wed_contactsuccess_flag = -1;
163 static int hf_sasp_wed_quiesce_flag = -1;
164 static int hf_sasp_wed_registration_flag = -1;
165 static int hf_sasp_wed_confident_flag = -1;
166 static int hf_sasp_weight_entry_data_comp_weight = -1;
168 /*grp wt entry data comp */
169 static int hf_sasp_grp_wt_entry_datacomp_type = -1;
170 static int hf_sasp_grp_wt_entry_datacomp_sz = -1;
171 static int hf_sasp_grp_wt_entry_datacomp_cnt = -1;
173 /* Initialize the subtree pointers */
174 static gint ett_sasp_data = -1;
175 static gint ett_sasp_header = -1;
176 static gint ett_sasp_msg = -1;
177 static gint ett_sasp_payload = -1;
178 static gint ett_sasp_reg_req = -1;
179 static gint ett_sasp_reg_rep = -1;
180 static gint ett_sasp_reg_req_sz = -1;
181 static gint ett_sasp_dereg_req_sz= -1;
182 static gint ett_sasp_dereg_rep = -1;
183 static gint ett_sasp_sendwt = -1;
184 static gint ett_sasp_setmemstate_rep = -1;
185 static gint ett_sasp_memdatacomp = -1;
186 static gint ett_sasp_grpdatacomp = -1;
187 static gint ett_sasp_grp_memdatacomp = -1;
188 static gint ett_sasp_setlbstate_req = -1;
189 static gint ett_sasp_setlbstate_rep = -1;
190 static gint ett_sasp_getwt= -1;
191 static gint ett_sasp_setmemstate_req = -1;
192 static gint ett_setlbstate_req_lbflag = -1;
193 static gint ett_sasp_grp_memstatedatacomp = -1;
194 static gint ett_sasp_memstatedatacomp = -1;
195 /*static gint ett_dereg_req_reason_flag = -1;*/
196 static gint ett_sasp_grp_wt_entry_datacomp = -1;
197 static gint ett_sasp_weight_entry_data_comp = -1;
198 static gint ett_wt_entry_data_flag = -1;
199 static gint ett_sasp_wt_rep = -1;
201 static expert_field ei_msg_type_invalid = EI_INIT;
203 /* desegmentation of SASP over TCP */
204 static gboolean sasp_desegment = TRUE;
206 static const value_string msg_table[] = {
207 { 0x1010, "Registration Request" },
208 { 0x1015, "Registration Reply"},
209 { 0x1020, "DeRegistration Request"},
210 { 0x1025, "DeRegistration Reply"},
211 { 0x1030, "Get Weights Request"},
212 { 0x1035, "Get Weights Reply" },
213 { 0x1040, "Send Weights"},
214 { 0x1050, "Set LB State Request"},
215 { 0x1055, "Set LB State Reply"},
216 { 0x1060, "Set Member State Request"},
217 { 0x1065, "Set Member State Reply"},
218 { 0x3010, "Member Data Component"},
219 { 0x3011, "Group Data Component"},
220 { 0x3012, "Weight Entry Data Component"},
221 { 0x3013, "Member State Instance"},
222 { 0x4010, "Group of Member Data"},
223 { 0x4011, "Group of Weight Entry Data" },
224 { 0x4012, "Group of Member State Data" },
225 { 0, NULL }
227 static value_string_ext msg_table_ext = VALUE_STRING_EXT_INIT(msg_table);
229 static const value_string protocol_table[] = {
230 { 0x06, "TCP" },
231 { 0x11, "UDP" },
232 { 0, NULL }
235 static const value_string lbstate_healthtable[] = {
236 { 0x00, "Least Healthy" },
237 { 0x7f, "Most Healthy" },
238 { 0, NULL }
241 static const value_string reg_reply_response_code[] = {
242 { 0x00, "Successful" },
243 { 0x10, "Message not understood" },
244 { 0x11, "GWM will not accept this message from the sender" },
245 { 0x40, "Member already registered" },
246 { 0x44, "Duplicate Member in Request" },
247 { 0x45, "Invalid Group (determined by the GWM)"},
248 { 0x50, "Invalid Group Name Size (size == 0)"},
249 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
250 { 0x61, "Member is registering itself, but LB hasn't yet contacted the GWM."
251 " This registration will not be processed."},
252 { 0, NULL }
255 static const value_string dereg_reply_response_code[] = {
256 { 0x00, "Successful" },
257 { 0x10, "Message not understood" },
258 { 0x11, "GWM will not accept this message from the sender" },
259 { 0x41, "Application or System not registered" },
260 { 0x42, "Unknown Group Name" },
261 { 0x43, "Unknown LB uid" },
262 { 0x44, "Duplicate Member in Request"},
263 { 0x46, "Duplicate Group in Request (for remove all members/groups requests)"},
264 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
265 { 0x61, "Member is deregistering itself, but LB hasn't yet contacted the GWM."
266 " This deregistration will not be processed."},
267 { 0, NULL }
270 static const value_string get_weights_reply_response_code[] = {
271 { 0x00, "Successful" },
272 { 0x10, "Message not understood" },
273 { 0x11, "GWM will not accept this message from the sender" },
274 { 0x42, "Unknown Group Name" },
275 { 0x43, "Unknown LB uid" },
276 { 0x46, "Duplicate Group in Request"},
277 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
278 { 0, NULL }
281 static const value_string set_lb_state_reply_response_code[] = {
282 { 0x00, "Successful" },
283 { 0x10, "Message not understood" },
284 { 0x11, "GWM will not accept this message from the sender" },
285 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
286 { 0, NULL }
289 static const value_string set_mem_state_reply_response_code[] = {
290 { 0x00, "Successful" },
291 { 0x10, "Message not understood" },
292 { 0x11, "GWM will not accept this message from the sender" },
293 { 0x41, "Application or System not registered" },
294 { 0x42, "Unknown Group Name" },
295 { 0x43, "Unknown LB uid" },
296 { 0x44, "Duplicate Member in Request"},
297 { 0x46, "Duplicate Group in Request (for remove all members/groups requests)"},
298 { 0x50, "Invalid Group Name Size (size == 0)"},
299 { 0x51, "Invalid LB uid Size (size == 0 or > max)"},
300 { 0, NULL }
304 #define SASP_GLOBAL_PORT 3860
305 #define SASP_MIN_PACKET_LEN 13
307 #define SASP_DEREG_REQ_REASON_LEARNED 0x01
308 #define SASP_DEREG_REQ_NOREASON_FLAG 0x00
309 #define SASP_HDR_TYPE 0x2010
310 #define SASP_WED_CONTACT_SUCCESS_FLAG 0x01
311 #define SASP_WED_QUIESCE_FLAG 0x02
312 #define SASP_WED_REG_FLAG 0x04
313 #define SASP_WED_CONF_FLAG 0x08
314 #define SASP_PUSH_FLAG 0x01
315 #define SASP_TRUST_FLAG 0x02
316 #define SASP_NOCHANGE_FLAG 0x04
317 #define SASP_QUIESCE_FLAG 0x01
320 static guint
321 get_sasp_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
323 /* Get the length of the SASP packet. */
324 return tvb_get_ntohl(tvb, offset + 5);
327 /* Called from tcp_dissect_pdus with a complete SASP pdu */
328 static int
329 dissect_sasp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
331 /* Set up structures needed to add the protocol subtree and manage it */
332 proto_item *ti;
333 proto_item *hti;
334 proto_item *mti;
335 proto_tree *sasp_tree;
336 proto_tree *msg_tree;
337 proto_tree *pay_load;
338 guint16 msg_type;
339 guint16 hdr_type;
340 guint32 offset = 0;
342 /*protocol is being displayed*/
344 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SASP");
345 col_clear(pinfo->cinfo, COL_INFO);
347 ti = proto_tree_add_item(tree, proto_sasp, tvb, offset, -1, ENC_NA);
348 sasp_tree = proto_item_add_subtree(ti, ett_sasp_header);
350 hdr_type = tvb_get_ntohs(tvb, offset);
351 hti = proto_tree_add_uint_format_value(sasp_tree, hf_sasp_type, tvb, offset, 2, hdr_type,
352 "%s", (hdr_type == SASP_HDR_TYPE) ? "SASP" : "[Invalid]");
353 if (hdr_type != SASP_HDR_TYPE)
355 expert_add_info_format(pinfo, hti, &ei_msg_type_invalid,
356 "Invalid SASP Header Type [0x%04x]", hdr_type);
357 /* XXX: The folowing should actually happen automatically ? */
358 col_set_str(pinfo->cinfo, COL_INFO, "[Malformed: Invalid SASP Header Type]");
359 return tvb_length(tvb);
361 offset += 2;
363 /*length*/
364 proto_tree_add_item(sasp_tree, hf_sasp_length, tvb, offset, 2, ENC_BIG_ENDIAN);
365 offset += 2;
367 /*Header Version */
368 proto_tree_add_item(sasp_tree, hf_sasp_vrsn, tvb, offset, 1, ENC_BIG_ENDIAN);
369 offset += 1;
371 /*Message*/
372 msg_tree = proto_item_add_subtree(ti, ett_sasp_msg);
374 /*Message Len*/
375 proto_tree_add_item(msg_tree, hf_msg_len, tvb, offset, 4, ENC_BIG_ENDIAN);
376 offset += 4;
378 /*Message Id*/
379 proto_tree_add_item(msg_tree, hf_msg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
380 offset += 4;
382 /*Message Type*/
383 msg_type = tvb_get_ntohs(tvb, offset);
384 mti = proto_tree_add_item(msg_tree, hf_msg_type, tvb, offset, 2, ENC_BIG_ENDIAN);
385 pay_load = proto_item_add_subtree(ti, ett_sasp_payload);
386 offset += 2;
388 switch(msg_type)
390 case 0x1010:
391 /* Registration Request */
392 col_set_str(pinfo->cinfo, COL_INFO, "Registration Request");
393 dissect_reg_req(tvb, pay_load, offset);
394 break;
396 case 0x1015:
397 /* Registration Reply */
398 col_set_str(pinfo->cinfo, COL_INFO, "Registration Reply");
399 dissect_reg_rep(tvb, pay_load, offset);
400 break;
402 case 0x1020:
403 /* Deregistration Request */
404 col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Request");
405 dissect_dereg_req(tvb, pay_load, offset);
406 break;
408 case 0x1025:
409 /* Deregistration Reply */
410 col_set_str(pinfo->cinfo, COL_INFO, "Deregistration Reply");
411 dissect_dereg_rep(tvb, pay_load, offset);
412 break;
414 case 0x1030:
415 /* Get Weights Request */
416 col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Request");
417 dissect_wt_req(tvb, pay_load, offset);
418 break;
420 case 0x1035:
421 /* Get Weights Response */
422 col_set_str(pinfo->cinfo, COL_INFO, "Get Weights Response");
423 dissect_wt_rep(tvb, pay_load, offset);
424 break;
426 case 0x1040:
427 /* Send Weights Request */
428 col_set_str(pinfo->cinfo, COL_INFO, "Send Weights Request");
429 dissect_sendwt(tvb, pay_load, offset);
430 break;
432 case 0x1050:
433 /* Set LB State Request */
434 col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Request");
435 dissect_setlbstate_req(tvb, pay_load, offset);
436 break;
438 case 0x1055:
439 /* Set LB state Reply */
440 col_set_str(pinfo->cinfo, COL_INFO, "Set LB State Reply");
441 dissect_setlbstate_rep(tvb, pay_load, offset);
442 break;
444 case 0x1060:
445 /* Set Member State Request*/
446 col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Request");
447 dissect_setmemstate_req(tvb, pay_load, offset);
448 break;
450 case 0x1065:
451 /* Set Member State Reply */
452 col_set_str(pinfo->cinfo, COL_INFO, "Set Member State Reply");
453 dissect_setmemstate_rep(tvb, pay_load, offset);
454 break;
456 default:
457 /* Unknown SASP Message Type */
458 col_add_fstr(pinfo->cinfo, COL_INFO,
459 "[Malformed: Unknown Message Type [0x%04x]", msg_type);
460 expert_add_info_format(pinfo, mti, &ei_msg_type_invalid,
461 "Unknown SASP Message Type: 0x%4x", msg_type);
462 break;
464 return tvb_length(tvb);
468 static int
469 dissect_sasp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
471 tcp_dissect_pdus(tvb, pinfo, tree, sasp_desegment, SASP_MIN_PACKET_LEN, get_sasp_pdu_len,
472 dissect_sasp_pdu, data);
473 return tvb_length(tvb);
477 static void dissect_reg_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
479 proto_item *reg_tree;
480 proto_tree *reg_req_data;
481 guint16 gmd_cnt, i;
483 reg_tree = proto_tree_add_text(pay_load, tvb, offset, -1, "Reg Request");
484 reg_req_data = proto_item_add_subtree(reg_tree, ett_sasp_reg_req_sz);
486 /* Reg Req Size */
487 proto_tree_add_item(reg_req_data, hf_sasp_reg_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
488 offset += 2;
490 /* Reg Req LB Flag */
491 proto_tree_add_item(reg_req_data, hf_reg_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
492 offset += 1;
494 gmd_cnt = tvb_get_ntohs(tvb, offset);
496 /* Group MEM Data Count */
497 proto_tree_add_item(reg_req_data, hf_sasp_gmd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
498 offset += 2;
500 for (i=0; i<gmd_cnt; i++)
501 offset = dissect_grp_memdatacomp(tvb, reg_req_data, offset);
505 static void dissect_reg_rep(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
507 proto_item *reg_rep;
508 proto_tree *reg_rep_tree;
510 reg_rep = proto_tree_add_text(pay_load, tvb, offset, -1 , "Reg Reply");
511 reg_rep_tree = proto_item_add_subtree(reg_rep, ett_sasp_reg_rep);
513 /* Size */
514 proto_tree_add_item(reg_rep_tree, hf_sasp_reg_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
515 offset += 2;
517 /* Response Code */
518 proto_tree_add_item(reg_rep_tree, hf_sasp_reg_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
522 static void dissect_dereg_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
524 /*proto_item *dereg_req_reason_flag;*/
525 /*proto_tree *dereg_req_reason_flag_tree;*/
526 guint16 gmd_cnt, i;
527 proto_item *dereg_tree;
528 proto_tree *dereg_req_data;
529 guint8 reason_flag;
530 static gboolean first_flag = TRUE;
531 wmem_strbuf_t *reasonflags_strbuf = wmem_strbuf_new_label(wmem_packet_scope());
532 static const gchar *fstr[] = {"No Reason", "Learned & Purposeful" };
534 dereg_tree = proto_tree_add_text(pay_load, tvb, offset, -1 , "DeReg Request");
535 dereg_req_data = proto_item_add_subtree(dereg_tree, ett_sasp_dereg_req_sz);
537 /* Size */
538 proto_tree_add_item(dereg_req_data, hf_sasp_dereg_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
539 offset += 2;
541 /* LB Flag */
542 proto_tree_add_item(dereg_req_data, hf_dereg_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
543 offset += 1;
545 /* Reason */
546 wmem_strbuf_truncate(reasonflags_strbuf, 0);
547 reason_flag = tvb_get_guint8(tvb, offset);
549 if ((reason_flag & SASP_DEREG_REQ_REASON_LEARNED) == 0)
550 wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[0]);
551 else
552 wmem_strbuf_append_printf(reasonflags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[1]);
553 first_flag = FALSE;
555 /*dereg_req_reason_flag =*/
556 proto_tree_add_uint_format(dereg_req_data, hf_dereg_req_reason_flag, tvb,
557 offset, 1, reason_flag, "Reason: 0x%02x (%s)", reason_flag,
558 wmem_strbuf_get_str(reasonflags_strbuf));
559 #if 0 /* XXX: ToDo?? Flags to be displayed under a subtree ? */
560 dereg_req_reason_flag_tree = proto_item_add_subtree(dereg_req_reason_flag, ett_dereg_req_reason_flag);
561 #endif
562 offset += 1;
564 gmd_cnt = tvb_get_ntohs(tvb, offset);
566 /* Group Mem Data Count */
567 proto_tree_add_item(dereg_req_data, hf_sasp_gmd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
568 offset += 2;
570 /*Group Mem Data */
571 for (i=0; i<gmd_cnt; i++)
572 offset = dissect_grp_memdatacomp(tvb, dereg_req_data, offset);
576 static void dissect_dereg_rep(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
578 proto_item *dereg_rep;
579 proto_tree *dereg_rep_tree;
581 dereg_rep = proto_tree_add_text(pay_load, tvb, offset, -1 , "Dereg Reply");
582 dereg_rep_tree = proto_item_add_subtree(dereg_rep, ett_sasp_dereg_rep);
584 /* Size */
585 proto_tree_add_item(dereg_rep_tree, hf_sasp_dereg_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
586 offset += 2;
588 /* Return Code */
589 proto_tree_add_item(dereg_rep_tree, hf_sasp_dereg_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
593 static void dissect_sendwt(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
595 proto_item *sendwt;
596 proto_tree *sendwt_tree;
597 guint16 gwed_cnt, i;
599 sendwt = proto_tree_add_text(pay_load, tvb, offset, -1 , "Send Weight");
600 sendwt_tree = proto_item_add_subtree(sendwt, ett_sasp_sendwt);
602 /* Size */
603 proto_tree_add_item(sendwt_tree, hf_sasp_sendwt_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
604 offset += 2;
606 gwed_cnt = tvb_get_ntohs(tvb, offset);
608 /* Group Wt Entry Data Count */
609 proto_tree_add_item(sendwt_tree, hf_sasp_sendwt_gwedcnt, tvb, offset, 2, ENC_BIG_ENDIAN);
610 offset += 2;
612 for (i=0; i<gwed_cnt; i++)
613 offset = dissect_grp_wt_entry_datacomp(tvb, sendwt_tree, offset);
617 static void dissect_setmemstate_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
619 proto_item *setmemstate;
620 proto_tree *setmemstate_req_data;
621 guint16 gmsd_cnt, i;
623 setmemstate = proto_tree_add_text(pay_load, tvb, offset, -1 , "Set Mem State Request");
624 setmemstate_req_data = proto_item_add_subtree(setmemstate, ett_sasp_setmemstate_req);
626 /* Size */
627 proto_tree_add_item(setmemstate_req_data, hf_sasp_setmemstate_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
628 offset += 2;
630 /*LB Flag*/
631 proto_tree_add_item(setmemstate_req_data, hf_setmemstate_req_lbflag, tvb, offset, 1, ENC_BIG_ENDIAN);
632 offset += 1;
634 /*Group Data Count*/
635 gmsd_cnt = tvb_get_ntohs(tvb, offset);
636 proto_tree_add_item(setmemstate_req_data, hf_sasp_setmemstate_req_gmsd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
637 offset += 2;
639 for (i=0; i<gmsd_cnt; i++)
640 offset = dissect_grp_memstatedatacomp(tvb, setmemstate_req_data, offset);
643 static void dissect_setmemstate_rep(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
645 proto_item *setmemstate_rep;
646 proto_tree *setmemstate_rep_tree;
648 setmemstate_rep = proto_tree_add_text(pay_load, tvb, offset, -1 , "Set Mem State Reply");
649 setmemstate_rep_tree = proto_item_add_subtree(setmemstate_rep, ett_sasp_setmemstate_rep);
651 /* Size */
652 proto_tree_add_item(setmemstate_rep_tree, hf_sasp_setmemstate_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
653 offset += 2;
655 /* Response Code */
656 proto_tree_add_item(setmemstate_rep_tree, hf_sasp_setmemstate_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
660 static guint32 dissect_memdatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset, proto_tree **mdct_p)
662 proto_item *memdatacomp;
663 proto_tree *memdatacomp_tree;
664 guint8 lab_len;
665 struct e_in6_addr ipv6_address;
666 const gchar *ip_str;
668 tvb_get_ipv6(tvb, offset+7, &ipv6_address);
669 ip_str = ip6_to_str(&ipv6_address);
671 lab_len = tvb_get_guint8(tvb, offset+23);
673 memdatacomp = proto_tree_add_ipv6_format(pay_load, hf_sasp_memdatacomp_ip,
674 tvb, offset, 24+lab_len, (guint8*)&ipv6_address,
675 "Member Data Comp (%s)", ip_str);
677 memdatacomp_tree = proto_item_add_subtree(memdatacomp, ett_sasp_memdatacomp);
679 /* Message Type */
680 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_type, tvb, offset, 2, ENC_BIG_ENDIAN);
681 offset += 2;
683 /* Size */
684 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
685 offset += 2;
687 /* Protocol */
688 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
689 offset += 1;
691 /* Port */
692 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
693 offset += 2;
695 /*Ip*/
696 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_ip, tvb, offset, 16, ENC_NA);
697 offset += 16;
699 /*Label Len*/
700 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_lab_len, tvb, offset, 1, ENC_BIG_ENDIAN);
701 offset += 1;
703 /*Label*/
704 proto_tree_add_item(memdatacomp_tree, hf_sasp_memdatacomp_label, tvb, offset, lab_len, ENC_ASCII|ENC_NA);
705 offset += lab_len;
707 if (mdct_p != NULL)
708 *mdct_p = memdatacomp_tree;
710 return offset;
714 static guint32 dissect_grpdatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
716 proto_item *grpdatacomp;
717 proto_tree *grpdatacomp_tree;
718 guint8 LB_uid_len;
719 guint8 grp_name_len;
721 grpdatacomp = proto_tree_add_text(pay_load, tvb, offset, -1 , "Group Data Component");
722 grpdatacomp_tree = proto_item_add_subtree(grpdatacomp, ett_sasp_grpdatacomp);
724 /*Type*/
725 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp, tvb, offset, 2, ENC_BIG_ENDIAN);
726 offset += 2;
728 /*Size*/
729 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
730 offset += 2;
732 LB_uid_len = tvb_get_guint8(tvb, offset);
734 /* LB UID Len*/
735 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_LB_uid_len,
736 tvb, offset, 1, ENC_BIG_ENDIAN);
737 offset += 1;
739 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_LB_uid,
740 tvb, offset, LB_uid_len, ENC_ASCII|ENC_NA);
741 offset += (guint8)LB_uid_len;
743 grp_name_len = tvb_get_guint8(tvb, offset);
745 /*Group Name Len */
746 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_grp_name_len,
747 tvb, offset, 1, ENC_BIG_ENDIAN);
748 offset += 1;
750 /*Group Name*/
751 proto_tree_add_item(grpdatacomp_tree, hf_sasp_grpdatacomp_grp_name,
752 tvb, offset, grp_name_len, ENC_ASCII|ENC_NA);
753 offset += grp_name_len;
755 return offset;
759 static guint32 dissect_grp_memdatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
761 proto_item *grp_memdatacomp;
762 proto_tree *grp_memdatacomp_tree;
763 guint16 mem_cnt;
764 guint16 i;
766 grp_memdatacomp = proto_tree_add_text(pay_load, tvb, offset, -1 , "Group Of Member Data");
767 grp_memdatacomp_tree = proto_item_add_subtree(grp_memdatacomp, ett_sasp_grp_memdatacomp);
769 /* Group MEM Data */
770 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp, tvb, offset, 2, ENC_BIG_ENDIAN);
771 offset += 2;
773 /* Group MEM Data Size*/
774 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
775 offset += 2;
777 mem_cnt = tvb_get_ntohs(tvb, offset);
779 /* Group MEM Data Count*/
780 proto_tree_add_item(grp_memdatacomp_tree, hf_sasp_grp_memdatacomp_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
781 offset += 2;
783 offset = dissect_grpdatacomp(tvb, grp_memdatacomp_tree, offset);
785 /* array of memdata */
786 for (i=0; i<mem_cnt; i++)
787 offset = dissect_memdatacomp(tvb, grp_memdatacomp_tree, offset, NULL);
789 return offset;
793 static void dissect_wt_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
795 proto_item *get_wt_data;
796 proto_tree *get_wt_tree;
797 guint16 gd_cnt, i;
799 get_wt_data = proto_tree_add_text(pay_load, tvb, offset, -1 , "Get Wt Req");
800 get_wt_tree = proto_item_add_subtree(get_wt_data, ett_sasp_getwt);
802 /* Size */
803 proto_tree_add_item(get_wt_tree, hf_sasp_wt_req_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
804 offset += 2;
806 gd_cnt = tvb_get_ntohs(tvb, offset);
808 /* Group Data Count */
809 proto_tree_add_item(get_wt_tree, hf_sasp_wt_req_gd_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
810 offset += 2;
812 for (i=0; i<gd_cnt; i++)
813 offset = dissect_grpdatacomp(tvb, get_wt_tree, offset);
817 static void dissect_wt_rep(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
819 proto_item *wt_rep;
820 proto_tree *wt_rep_tree;
821 guint16 gwed_cnt, i;
823 wt_rep = proto_tree_add_text(pay_load, tvb, offset, -1 , "Get Weights Reply");
824 wt_rep_tree = proto_item_add_subtree(wt_rep, ett_sasp_wt_rep);
826 /* Size */
827 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
828 offset += 2;
830 /* Response Code */
831 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_rcode, tvb, offset, 1, ENC_BIG_ENDIAN);
832 offset += 1;
834 /* Interval */
835 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_interval, tvb, offset, 2, ENC_BIG_ENDIAN);
836 offset += 2;
838 gwed_cnt = tvb_get_ntohs(tvb, offset);
840 /* Count of Group of Wt Entry Data */
841 proto_tree_add_item(wt_rep_tree, hf_sasp_wt_rep_gwed_cnt, tvb, offset, 2, ENC_BIG_ENDIAN);
842 offset += 2;
844 for (i=0; i<gwed_cnt; i++)
845 offset = dissect_grp_wt_entry_datacomp(tvb, wt_rep_tree, offset);
849 static void dissect_setlbstate_req(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
851 guint8 LB_uid_len;
853 static const int *lbflags[] = {
854 &hf_sasp_pushflag,
855 &hf_sasp_trustflag,
856 &hf_sasp_nochangeflag,
857 NULL
860 proto_item *setlbstate_req;
861 proto_tree *setlbstate_req_tree;
863 setlbstate_req = proto_tree_add_text(pay_load, tvb, offset, -1 , "Set LB State Req");
864 setlbstate_req_tree = proto_item_add_subtree(setlbstate_req, ett_sasp_setlbstate_req);
866 /* Size*/
867 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_sz,
868 tvb, offset, 2, ENC_BIG_ENDIAN);
869 offset += 2;
871 LB_uid_len = tvb_get_guint8(tvb, offset);
873 /* LB UID Len */
874 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_uid_len,
875 tvb, offset, 1, ENC_BIG_ENDIAN);
876 offset += 1;
878 /*LB UID*/
879 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_uid,
880 tvb, offset, LB_uid_len, ENC_ASCII|ENC_NA);
881 offset += (guint8)LB_uid_len;
883 /*LB Health*/
884 proto_tree_add_item(setlbstate_req_tree, hf_sasp_setlbstate_req_LB_health,
885 tvb, offset, 1, ENC_BIG_ENDIAN);
886 offset += 1;
888 proto_tree_add_bitmask_text(setlbstate_req_tree, tvb, offset, 1, "LB Flags:", NULL,
889 ett_setlbstate_req_lbflag, lbflags, ENC_BIG_ENDIAN, 0);
893 static void dissect_setlbstate_rep(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
895 proto_item *setlbstate_rep;
896 proto_tree *setlbstate_rep_tree;
898 setlbstate_rep = proto_tree_add_text(pay_load, tvb, offset, -1 , "Set LB State Rep");
899 setlbstate_rep_tree = proto_item_add_subtree(setlbstate_rep, ett_sasp_setlbstate_rep);
901 /* Size */
902 proto_tree_add_item(setlbstate_rep_tree, hf_sasp_setlbstate_rep_sz,
903 tvb, offset, 2, ENC_BIG_ENDIAN);
904 offset += 2;
906 /* Response Code */
907 proto_tree_add_item(setlbstate_rep_tree, hf_sasp_setlbstate_rep_rcode,
908 tvb, offset, 1, ENC_BIG_ENDIAN);
912 static guint32 dissect_grp_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
914 proto_item *grp_memstatedatacomp;
915 proto_tree *grp_memstatedatacomp_tree;
916 guint16 mem_cnt;
917 guint16 i;
919 grp_memstatedatacomp = proto_tree_add_text(pay_load, tvb, offset, -1 , "Group Mem State Comp");
920 grp_memstatedatacomp_tree = proto_item_add_subtree(grp_memstatedatacomp,
921 ett_sasp_grp_memstatedatacomp);
923 /* Type */
924 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp,
925 tvb, offset, 2, ENC_BIG_ENDIAN);
926 offset += 2;
928 /* Size */
929 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp_sz,
930 tvb, offset, 2, ENC_BIG_ENDIAN);
931 offset += 2;
933 mem_cnt = tvb_get_ntohs(tvb, offset);
935 /* Count */
936 proto_tree_add_item(grp_memstatedatacomp_tree, hf_sasp_grp_memstatedatacomp_cnt,
937 tvb, offset, 2, ENC_BIG_ENDIAN);
938 offset += 2;
940 /* Group Data TLV */
941 offset = dissect_grpdatacomp(tvb, grp_memstatedatacomp_tree, offset);
943 /* Array of Mem State Data */
944 for (i=0; i<mem_cnt; i++)
945 offset = dissect_memstatedatacomp(tvb, grp_memstatedatacomp_tree, offset);
947 return offset;
951 static guint32 dissect_memstatedatacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
953 proto_tree *memstatedatacomp_tree;
954 proto_item *memstatedatacomp;
955 proto_tree *memdatacomp_tree;
956 guint8 memstate_flag;
958 offset = dissect_memdatacomp(tvb, pay_load, offset, &memdatacomp_tree);
960 memstatedatacomp = proto_tree_add_text(memdatacomp_tree, tvb, offset, -1 , "Member State Data");
961 memstatedatacomp_tree = proto_item_add_subtree(memstatedatacomp, ett_sasp_memstatedatacomp);
963 /* Type */
964 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_instance,
965 tvb, offset, 2, ENC_BIG_ENDIAN);
966 offset += 2;
968 /* Size */
969 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_sz,
970 tvb, offset, 2, ENC_BIG_ENDIAN);
971 offset += 2;
973 /* State */
974 proto_tree_add_item(memstatedatacomp_tree, hf_sasp_memstatedatacomp_state,
975 tvb, offset, 1, ENC_BIG_ENDIAN);
976 offset += 1;
978 /* Quiesce flag*/
979 memstate_flag = tvb_get_guint8(tvb, offset);
980 proto_tree_add_boolean(memstatedatacomp_tree, hf_sasp_memstatedatacomp_quiesce_flag,
981 tvb, offset, 1, memstate_flag);
982 offset += 1;
984 return offset;
988 static guint32 dissect_weight_entry_data_comp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
990 proto_tree *weight_entry_data_comp_tree;
991 proto_item *weight_entry_data_comp;
993 static const int *wtflags[] = {
994 &hf_sasp_wed_contactsuccess_flag,
995 &hf_sasp_wed_quiesce_flag,
996 &hf_sasp_wed_registration_flag,
997 &hf_sasp_wed_confident_flag,
998 NULL
1001 offset = dissect_memdatacomp(tvb, pay_load, offset, NULL);
1003 weight_entry_data_comp = proto_tree_add_text(pay_load, tvb, offset, -1 , "Weight Entry Data");
1004 weight_entry_data_comp_tree = proto_item_add_subtree(weight_entry_data_comp,
1005 ett_sasp_weight_entry_data_comp);
1007 /* Type */
1008 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_type,
1009 tvb, offset, 2, ENC_BIG_ENDIAN);
1010 offset += 2;
1012 /* Size */
1013 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_sz,
1014 tvb, offset, 2, ENC_BIG_ENDIAN);
1015 offset += 2;
1017 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_state,
1018 tvb, offset, 1, ENC_BIG_ENDIAN);
1019 offset += 1;
1021 proto_tree_add_bitmask_text(weight_entry_data_comp_tree, tvb, offset, 1, "Flags:", NULL,
1022 ett_wt_entry_data_flag, wtflags, ENC_BIG_ENDIAN, 0);
1023 offset += 1;
1025 /* Weight */
1026 proto_tree_add_item(weight_entry_data_comp_tree, hf_sasp_weight_entry_data_comp_weight,
1027 tvb, offset, 2, ENC_BIG_ENDIAN);
1028 offset += 2;
1030 return offset;
1034 static guint32 dissect_grp_wt_entry_datacomp(tvbuff_t *tvb, proto_tree *pay_load, guint32 offset)
1036 proto_item *grp_wt_entry_datacomp;
1037 proto_tree *grp_wt_entry_datacomp_tree;
1038 guint16 wt_entry_cnt;
1039 guint16 i;
1041 grp_wt_entry_datacomp = proto_tree_add_text(pay_load, tvb, offset, -1 , "Group of Wt Entry Data");
1042 grp_wt_entry_datacomp_tree = proto_item_add_subtree(grp_wt_entry_datacomp,
1043 ett_sasp_grp_wt_entry_datacomp);
1045 /* Type */
1046 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_type,
1047 tvb, offset, 2, ENC_BIG_ENDIAN);
1048 offset += 2;
1050 /* Size */
1051 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_sz,
1052 tvb, offset, 2, ENC_BIG_ENDIAN);
1053 offset += 2;
1055 wt_entry_cnt = tvb_get_ntohs(tvb, offset);
1057 /* Wt Entry Count*/
1058 proto_tree_add_item(grp_wt_entry_datacomp_tree, hf_sasp_grp_wt_entry_datacomp_cnt,
1059 tvb, offset, 2, ENC_BIG_ENDIAN);
1060 offset += 2;
1062 /* Group Data */
1063 offset = dissect_grpdatacomp(tvb, grp_wt_entry_datacomp_tree, offset);
1065 /* Member Data */
1066 for (i=0; i<wt_entry_cnt; i++)
1067 offset = dissect_weight_entry_data_comp(tvb, grp_wt_entry_datacomp_tree, offset);
1069 return offset;
1073 /* sasp protocol register */
1074 void proto_register_sasp(void)
1076 static hf_register_info hf[] = {
1077 /*SASP Header */
1078 { &hf_sasp_type,
1079 { "Type", "sasp.msg.type",
1080 FT_UINT16, BASE_HEX, NULL, 0x0,
1081 "SASP Header", HFILL }
1084 { &hf_sasp_length,
1085 { "Length", "sasp.header.Len",
1086 FT_UINT16, BASE_DEC, NULL, 0x0,
1087 "SASP Header Length", HFILL }
1090 { &hf_sasp_vrsn,
1091 { "Version", "sasp.version",
1092 FT_UINT8, BASE_DEC, NULL, 0x0,
1093 "SASP Version", HFILL }
1096 { &hf_msg_len,
1097 { "Message Len", "sasp.msg.len",
1098 FT_UINT32, BASE_DEC, NULL, 0x0,
1099 "SASP Msg Len", HFILL }
1102 { &hf_msg_id,
1103 { "Message Id", "sasp.msg.id",
1104 FT_UINT32, BASE_DEC, NULL, 0x0,
1105 "SASP Msg Id", HFILL }
1108 /*Message Type*/
1109 { &hf_msg_type,
1110 { "Message Type", "sasp.msg.type",
1111 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1112 "SASP Msg Type", HFILL }
1115 /*Reg Request*/
1116 { &hf_sasp_reg_req_sz,
1117 { "Reg Req-Size", "sasp.reg-req.size",
1118 FT_UINT32, BASE_DEC, NULL, 0x0,
1119 "SASP Reg Req Size", HFILL }
1122 { &hf_reg_req_lbflag,
1123 { "Reg Req-LB Flag", "sasp.reg-req.lbflag",
1124 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1125 "SASP Reg Req LB Flag", HFILL } },
1127 { &hf_sasp_gmd_cnt,
1128 { "Grp Mem Data-Count", "sasp.grp-mem-data.count",
1129 FT_UINT16, BASE_DEC, NULL, 0x0,
1130 "SASP Grp Mem Data Count", HFILL } },
1132 /* Reg Reply */
1134 { &hf_sasp_reg_rep_sz,
1135 { "Reg Reply-Size", "sasp.reg-rep.size",
1136 FT_UINT16, BASE_DEC, NULL, 0x0,
1137 "SASP Reg Reply size", HFILL } },
1139 { &hf_sasp_reg_rep_rcode,
1140 { "Reg Reply-Return Code", "sasp.reg-rep.retcode",
1141 FT_UINT8, BASE_HEX, VALS(reg_reply_response_code), 0x0,
1142 "SASP Reg Rep Return Code", HFILL } },
1144 /* Dereg Req */
1145 { &hf_sasp_dereg_req_sz,
1146 { "Dereg Req-Size", "sasp.dereg-req.size",
1147 FT_UINT32, BASE_DEC, NULL, 0x0,
1148 "SASP Dereg Req Size", HFILL } },
1150 { &hf_dereg_req_lbflag,
1151 { "Dereg Req-LB Flag", "sasp.dereg-req.lbflag",
1152 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1153 "SASP Dereg Req LB Flag", HFILL } },
1155 { &hf_dereg_req_reason_flag,
1156 { "Reason Flags", "sasp.flags.reason",
1157 FT_UINT8, BASE_HEX, NULL, 0x0,
1158 NULL, HFILL } },
1160 #if 0
1161 { &hf_dereg_req_reason,
1162 { "Dereg Req-Reason", "sasp.dereg-req.reason",
1163 FT_UINT8, BASE_HEX, NULL, 0x0,
1164 "SASP Dereg Req Reason", HFILL } },
1165 #endif
1167 /* Dereg Rep */
1168 { &hf_sasp_dereg_rep_sz,
1169 { "Dereg Rep-Size", "sasp.dereg-rep.size",
1170 FT_UINT16, BASE_DEC, NULL, 0x0,
1171 "SASP Dereg Rep Size", HFILL } },
1173 { &hf_sasp_dereg_rep_rcode,
1174 { "Dereg Rep-Return Code", "sasp.dereg-rep.retcode",
1175 FT_UINT8, BASE_HEX, VALS(dereg_reply_response_code), 0x0,
1176 "SASP Dereg Rep Return Code", HFILL } },
1178 /* Send weight */
1180 { &hf_sasp_sendwt_sz,
1181 { "Sendwt-Size", "sasp.sendwt.size",
1182 FT_UINT16, BASE_DEC, NULL, 0x0,
1183 "SASP Sendwt-Size", HFILL } },
1185 { &hf_sasp_sendwt_gwedcnt,
1186 { "Sendwt-Grp Wt EntryData Count", "sasp.sendwt-grp-wtentrydata.count",
1187 FT_UINT16, BASE_DEC, NULL, 0x0,
1188 "SASP Sendwt Grp Wt Entry Data Count", HFILL } },
1190 /*Set Mem State Req*/
1192 { &hf_sasp_setmemstate_req_sz,
1193 { "Set Memstate Req-Size", "sasp.setmemstate-req.size",
1194 FT_UINT16, BASE_DEC, NULL, 0x0,
1195 "SASP Set Memstate Req Size", HFILL } },
1197 { &hf_setmemstate_req_lbflag,
1198 { "Set Memstate Req-LB Flag", "sasp.setmemstate-req.lbflag",
1199 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
1200 "SASP Set Memstate Req LB Flag", HFILL } },
1202 { &hf_sasp_setmemstate_req_gmsd_cnt,
1203 { "Set Memstate Req-Gmsd Count", "sasp.group-memstate.count",
1204 FT_UINT16, BASE_DEC, NULL, 0x0,
1205 "Group Of Member State Data Count", HFILL } },
1207 /* Set Mem State Reply */
1208 #if 0
1209 { &hf_sasp_setmemstate_rep,
1210 { "Set Memstate Reply", "sasp.setmemstate-rep",
1211 FT_UINT32, BASE_HEX, NULL, 0x0,
1212 "SASP Set Memstate Reply", HFILL } },
1213 #endif
1215 { &hf_sasp_setmemstate_rep_sz,
1216 { "Set Memstate Rep-Size", "sasp.setmemstate-rep.size",
1217 FT_UINT16, BASE_DEC, NULL, 0x0,
1218 "SASP Set Memstate Rep Size", HFILL } },
1220 { &hf_sasp_setmemstate_rep_rcode,
1221 { "Set Memstate Rep-Return Code", "sasp.setmemstate-rep.retcode",
1222 FT_UINT8, BASE_HEX, VALS(set_mem_state_reply_response_code), 0x0,
1223 "SASP Set Memstate Rep Return Code", HFILL } },
1225 /*Mem Data Component*/
1227 { &hf_sasp_memdatacomp_type,
1228 { "Message Type", "sasp.msg.type",
1229 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1230 "SASP Mem Data Comp", HFILL } },
1232 { &hf_sasp_memdatacomp_sz,
1233 { "Mem Data Comp-Size", "sasp.memdatacomp.size",
1234 FT_UINT16, BASE_DEC, NULL, 0x0,
1235 "SASP Mem Data Comp Size", HFILL } },
1237 { &hf_sasp_memdatacomp_protocol,
1238 { "Mem Data Comp-Protocol", "sasp.memdatacomp.protocol",
1239 FT_UINT8, BASE_HEX, VALS(protocol_table), 0x0,
1240 "SASP Mem Data Comp Protocol", HFILL } },
1242 { &hf_sasp_memdatacomp_port,
1243 { "Mem Data Comp-Port", "sasp.memdatacomp.port",
1244 FT_UINT16, BASE_DEC, NULL, 0x0,
1245 "SASP Mem Data Comp Port", HFILL } },
1247 { &hf_sasp_memdatacomp_ip,
1248 { "Mem Data Comp-Ip", "sasp.memdatacomp.ip",
1249 FT_IPv6, BASE_NONE, NULL, 0x0,
1250 "SASP Mem Data Comp Ip", HFILL } },
1252 { &hf_sasp_memdatacomp_lab_len,
1253 { "Mem Data Comp-Label Len", "sasp.memdatacomp.label.len",
1254 FT_UINT8, BASE_DEC, NULL, 0x0,
1255 "SASP Mem Data Comp Label Length", HFILL } },
1257 { &hf_sasp_memdatacomp_label,
1258 { "Mem Data Comp-Label", "sasp.memdatacomp.label",
1259 FT_STRING, BASE_NONE, NULL, 0x0,
1260 "SASP Mem Data Comp Label", HFILL } },
1262 /*Get Weight Request*/
1264 { &hf_sasp_wt_req_sz,
1265 { "Get Wt Req-Size", "sasp.getwt.req.size",
1266 FT_UINT16, BASE_DEC, NULL, 0x0,
1267 "SASP Get Wt Req Size", HFILL } },
1269 { &hf_sasp_wt_req_gd_cnt,
1270 { "Get Wt Req-Grp Data Count", "sasp.getwt-req-grpdata.count",
1271 FT_UINT16, BASE_DEC, NULL, 0x0,
1272 "SASP Get Wt Grp Data Count", HFILL } },
1274 /*Get Weight Reply*/
1276 { &hf_sasp_wt_rep_sz,
1277 { "Get Wt Rep-Size", "sasp.getwt.rep.size",
1278 FT_UINT16, BASE_DEC, NULL, 0x0,
1279 "SASP Get Wt Rep Size", HFILL } },
1281 { &hf_sasp_wt_rep_rcode,
1282 { "Get Wt Rep-Return Code", "sasp.getwt-rep.retcode",
1283 FT_UINT8, BASE_HEX, VALS(get_weights_reply_response_code), 0x0,
1284 "SASP Get Wt Rep Return Code", HFILL } },
1286 { &hf_sasp_wt_rep_interval,
1287 { "Get Wt Rep-Interval", "sasp.getwt-rep.interval",
1288 FT_UINT8, BASE_DEC, NULL, 0x0,
1289 "SASP Get Wt Rep Interval", HFILL } },
1291 { &hf_sasp_wt_rep_gwed_cnt,
1292 { "Get Wt Rep-Grp WtEntry Data Cnt", "sasp.getwt-rep-grpwtentrydata.count",
1293 FT_UINT16, BASE_DEC, NULL, 0x0,
1294 "SASP Get Wt Rep Grp Wt Entry Data Cnt", HFILL } },
1296 /*Set LB State Rep */
1298 #if 0
1299 { &hf_sasp_setlbstate_rep,
1300 { "Set Lbstate Rep", "sasp.msg.type",
1301 FT_UINT32, BASE_HEX, NULL, 0x0,
1302 "SASP Set Lbstate Rep", HFILL } },
1303 #endif
1305 { &hf_sasp_setlbstate_rep_sz,
1306 { "Set Lbstate Rep-Size", "sasp.setlbstate-rep.size",
1307 FT_UINT16, BASE_DEC, NULL, 0x0,
1308 "SASP Set Lbstate Rep Size", HFILL } },
1310 { &hf_sasp_setlbstate_rep_rcode,
1311 { "Set Lbstate Rep-Return Code", "sasp.setlbstate-rep.retcode",
1312 FT_UINT8, BASE_HEX, VALS(set_lb_state_reply_response_code), 0x0,
1313 "SASP Set Lbstate Rep Return Code", HFILL } },
1316 /*grp data comp */
1318 { &hf_sasp_grpdatacomp,
1319 { "Message Type", "sasp.msg.type",
1320 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1321 "SASP Grp Data Comp", HFILL } },
1323 { &hf_sasp_grpdatacomp_sz,
1324 { "Grp Data Comp-Size", "sasp.grpdatacomp.size",
1325 FT_UINT16, BASE_DEC, NULL, 0x0,
1326 "SASP Grp Data Comp size", HFILL } },
1328 { &hf_sasp_grpdatacomp_LB_uid_len,
1329 { "Grp Data Comp-Label UID Len", "sasp.grpdatacomp.label.uid.len",
1330 FT_UINT8, BASE_DEC, NULL, 0x0,
1331 "SASP Grp Data Comp Label Uid Len", HFILL } },
1333 { &hf_sasp_grpdatacomp_LB_uid,
1334 { "Grp Data Comp-Label UID", "sasp.grpdatacomp.label.uid",
1335 FT_STRING, BASE_NONE, NULL, 0x0,
1336 "SASP Grp Data Comp Label Uid", HFILL } },
1338 { &hf_sasp_grpdatacomp_grp_name_len,
1339 { "Grp Data Comp-Grp Name Len", "sasp.grpdatacomp.grpname.len",
1340 FT_UINT8, BASE_DEC, NULL, 0x0,
1341 "SASP Grp Data Comp Grp Name Len", HFILL } },
1343 { &hf_sasp_grpdatacomp_grp_name,
1344 { "Grp Data Comp-Grp Name", "sasp.grpdatacomp.grpname",
1345 FT_STRING, BASE_NONE, NULL, 0x0,
1346 "SASP Grp Data Comp Grp Name", HFILL } },
1348 /*grp mem data comp */
1350 { &hf_sasp_grp_memdatacomp,
1351 { "Message Type", "sasp.msg.type",
1352 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1353 "SASP Grp Mem Data Comp", HFILL } },
1356 { &hf_sasp_grp_memdatacomp_sz,
1357 { "Grp Mem Data Comp-Size", "sasp.grp-memdatacomp.size",
1358 FT_UINT16, BASE_DEC, NULL, 0x0,
1359 "SASP Grp Mem Data Comp Size", HFILL } },
1361 { &hf_sasp_grp_memdatacomp_cnt,
1362 { "Grp Mem Data Comp-Count", "sasp.grp.memdatacomp.count",
1363 FT_UINT16, BASE_DEC, NULL, 0x0,
1364 "SASP Grp Mem Data Comp Cnt", HFILL } },
1367 /*set LB state req*/
1369 { &hf_sasp_setlbstate_req_sz,
1370 { "Set LB State Req-Size", "sasp.setlbstate-req.size",
1371 FT_UINT16, BASE_DEC, NULL, 0x0,
1372 "SASP Set LB State Req Size", HFILL } },
1374 { &hf_sasp_setlbstate_req_LB_uid_len,
1375 { "Set LB State Req-LB UID Len", "sasp.setlbstate-req.lbuid.len",
1376 FT_UINT8, BASE_DEC, NULL, 0x0,
1377 "SASP Set LB State Req LB Uid Len", HFILL } },
1379 { &hf_sasp_setlbstate_req_LB_uid,
1380 { "Set LB State Req-LB UID", "sasp.setlbstate-req.lbuid",
1381 FT_STRING, BASE_NONE, NULL, 0x0,
1382 "SASP Set LB State Req LB UID", HFILL } },
1384 { &hf_sasp_setlbstate_req_LB_health,
1385 { "Set LB State Req-LB Health", "sasp.setlbstate-req.lbhealth",
1386 FT_UINT8, BASE_HEX, VALS(lbstate_healthtable), 0x0,
1387 "SASP Set LB State Req LB Health", HFILL } },
1389 #if 0
1390 { &hf_lbstate_flag,
1391 { "Flags", "sasp.flags.lbstate",
1392 FT_UINT8, BASE_HEX, NULL, 0x0,
1393 NULL, HFILL } },
1394 #endif
1396 { &hf_sasp_pushflag,
1397 { "PUSH", "sasp.flags.push",
1398 FT_BOOLEAN, 8, NULL, SASP_PUSH_FLAG,
1399 "SASP Push Flag", HFILL } },
1401 { &hf_sasp_trustflag,
1402 { "TRUST", "sasp.flags.trust",
1403 FT_BOOLEAN, 8, NULL, SASP_TRUST_FLAG,
1404 "SASP Trust Flag", HFILL } },
1406 { &hf_sasp_nochangeflag,
1407 { "NOCHANGE", "sasp.flags.nochange",
1408 FT_BOOLEAN, 8, NULL, SASP_NOCHANGE_FLAG,
1409 "SASP Nochange Flag", HFILL } },
1411 /*grp mem state data comp */
1413 { &hf_sasp_grp_memstatedatacomp,
1414 { "Message Type", "sasp.msg.type",
1415 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1416 "SASP Message Type", HFILL } },
1419 { &hf_sasp_grp_memstatedatacomp_sz,
1420 { "Grp Mem State-Size", "sasp.grp.memstate.size",
1421 FT_UINT16, BASE_DEC, NULL, 0x0,
1422 "SASP Grp Mem State Data Comp Size", HFILL } },
1424 { &hf_sasp_grp_memstatedatacomp_cnt,
1425 { "Grp Mem State-Count", "sasp.grp.memstate.count",
1426 FT_UINT16, BASE_DEC, NULL, 0x0,
1427 "SASP Grp Mem State Data Comp Count", HFILL } },
1429 /*mem state instance */
1431 { &hf_sasp_memstatedatacomp_instance,
1432 { "Message Type", "sasp.msg.type",
1433 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1434 "SASP Message Type", HFILL } },
1437 { &hf_sasp_memstatedatacomp_sz,
1438 { "Mem State-Size", "sasp.memstate.size",
1439 FT_UINT16, BASE_DEC, NULL, 0x0,
1440 "SASP Mem State Data Comp Size", HFILL } },
1442 { &hf_sasp_memstatedatacomp_state,
1443 { "Mem State-State", "sasp.memstate.state",
1444 FT_UINT8, BASE_HEX, NULL, 0x0,
1445 "SASP Mem State Data Comp State", HFILL } },
1447 { &hf_sasp_memstatedatacomp_quiesce_flag,
1448 { "Mem State-Quiesce Flag", "sasp.flags.quiesce",
1449 FT_BOOLEAN, 8, NULL, SASP_QUIESCE_FLAG,
1450 "SASP Quiesce Flag", HFILL } },
1452 /*weight entry data comp*/
1454 { &hf_sasp_weight_entry_data_comp_type,
1455 { "Wt Entry Data Comp", "sasp.msg.type",
1456 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1457 "SASP Wt Entry Data Comp", HFILL } },
1459 { &hf_sasp_weight_entry_data_comp_sz,
1460 { "Wt Entry Data Comp-Size", "sasp.wtentry.size",
1461 FT_UINT16, BASE_DEC, NULL, 0x0,
1462 "SASP Wt Entry Data Comp Size", HFILL } },
1464 { &hf_sasp_weight_entry_data_comp_state,
1465 { "Wt Entry Data Comp-state", "sasp.wtentry.state",
1466 FT_UINT8, BASE_HEX, NULL, 0x0,
1467 "SASP Wt Entry Data Comp State", HFILL } },
1469 #if 0
1470 { &hf_wtstate_flag,
1471 { "Flags", "sasp.flags.wtstate",
1472 FT_UINT8, BASE_HEX, NULL, 0x0,
1473 NULL, HFILL } },
1474 #endif
1476 { &hf_sasp_wed_contactsuccess_flag,
1477 { "Contact Success", "sasp.flags.contactsuccess",
1478 FT_BOOLEAN, 8, NULL, SASP_WED_CONTACT_SUCCESS_FLAG,
1479 "SASP Contact Success Flag", HFILL } },
1481 { &hf_sasp_wed_quiesce_flag,
1482 { "Quiesce", "sasp.flags.quiesce",
1483 FT_BOOLEAN, 8, NULL, SASP_WED_QUIESCE_FLAG,
1484 "SASP Quiesce Flag", HFILL } },
1486 { &hf_sasp_wed_registration_flag,
1487 { "Registration", "sasp.flags.registration",
1488 FT_BOOLEAN, 8, NULL, SASP_WED_REG_FLAG,
1489 "SASP Registration Flag", HFILL } },
1491 { &hf_sasp_wed_confident_flag,
1492 { "Confident", "sasp.flags.confident",
1493 FT_BOOLEAN, 8, NULL, SASP_WED_CONF_FLAG,
1494 "SASP Confident Flag", HFILL } },
1496 { &hf_sasp_weight_entry_data_comp_weight,
1497 { "Wt Entry Data Comp-weight", "sasp.wtentrydatacomp.weight",
1498 FT_UINT16, BASE_DEC, NULL, 0x0,
1499 "SASP Wt Entry Data Comp weight", HFILL } },
1502 /*grp wt entry data comp */
1504 { &hf_sasp_grp_wt_entry_datacomp_type,
1505 { "Grp Wt Entry Data Comp", "sasp.msg.type",
1506 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &msg_table_ext, 0x0,
1507 "SASP Grp Wt Entry Data Comp", HFILL } },
1509 { &hf_sasp_grp_wt_entry_datacomp_sz,
1510 { "Grp Wt Entry Data Comp Size", "sasp.grp-wtentrydata.size",
1511 FT_UINT16, BASE_DEC, NULL, 0x0,
1512 "SASP Grp Wt Entry Data Comp Size", HFILL } },
1514 { &hf_sasp_grp_wt_entry_datacomp_cnt,
1515 { "Grp Wt Entry Data Comp Cnt", "sasp.grp-wtentrydata.count",
1516 FT_UINT16, BASE_DEC, NULL, 0x0,
1517 "SASP Grp Wt Entry Data Comp Cnt", HFILL } }
1520 /* Setup protocol subtree array */
1522 static gint *ett[] = {
1523 &ett_sasp_data,
1524 &ett_sasp_header,
1525 &ett_sasp_msg,
1526 &ett_sasp_payload,
1527 &ett_sasp_reg_req,
1528 &ett_sasp_reg_rep,
1529 &ett_sasp_reg_req_sz,
1530 &ett_sasp_dereg_req_sz,
1531 &ett_sasp_dereg_rep,
1532 &ett_sasp_sendwt,
1533 &ett_sasp_setmemstate_req,
1534 &ett_sasp_setmemstate_rep,
1535 &ett_sasp_memdatacomp,
1536 &ett_sasp_grpdatacomp,
1537 &ett_sasp_grp_memdatacomp,
1538 &ett_sasp_setlbstate_req,
1539 &ett_sasp_setlbstate_rep,
1540 &ett_sasp_getwt,
1541 &ett_setlbstate_req_lbflag,
1542 &ett_sasp_grp_memstatedatacomp,
1543 &ett_sasp_memstatedatacomp,
1544 /* &ett_dereg_req_reason_flag, */
1545 &ett_sasp_grp_wt_entry_datacomp,
1546 &ett_sasp_weight_entry_data_comp,
1547 &ett_wt_entry_data_flag,
1548 &ett_sasp_wt_rep
1551 static ei_register_info ei[] = {
1552 { &ei_msg_type_invalid, { "sasp.msg.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid Type", EXPFILL }}
1555 module_t *sasp_module;
1556 expert_module_t* expert_sasp;
1558 proto_sasp = proto_register_protocol("Server/Application State Protocol", "SASP", "sasp");
1560 proto_register_field_array(proto_sasp, hf, array_length(hf));
1561 proto_register_subtree_array(ett, array_length(ett));
1562 expert_sasp = expert_register_protocol(proto_sasp);
1563 expert_register_field_array(expert_sasp, ei, array_length(ei));
1565 sasp_module = prefs_register_protocol(proto_sasp, NULL);
1566 prefs_register_bool_preference(sasp_module, "desegment_sasp_messages",
1567 "Reassemble SASP messages spanning multiple TCP segments",
1568 "Whether the SASP dissector should reassemble messages"
1569 " spanning multiple TCP segments."
1570 " To use this option, you must also enable"
1571 " \"Allow subdissectors to reassemble TCP streams\""
1572 " in the TCP protocol settings.",
1573 &sasp_desegment);
1577 /* Handing off to TCP */
1578 void
1579 proto_reg_handoff_sasp(void)
1581 dissector_handle_t sasp_handle;
1583 sasp_handle = new_create_dissector_handle(dissect_sasp, proto_sasp);
1584 dissector_add_uint("tcp.port", SASP_GLOBAL_PORT, sasp_handle);
1588 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1590 * Local variables:
1591 * c-basic-offset: 4
1592 * tab-width: 4
1593 * indent-tabs-mode: t
1594 * End:
1596 * vi: set shiftwidth=4 tabstop=8 noexpandtab:
1597 * :indentSize=4:tabSize=8:noTabs=false: