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