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