Fix some cut-and-pasteos and other typoes.
[metze/wireshark/wip.git] / plugins / unistim / packet-unistim.c
1 /* packet-unistim.c
2   * Routines for unistim packet dissection
3   * Copyright 2007 Don Newton <dnewton@cypresscom.net>
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
12   * modify it under the terms of the GNU General Public License
13   * as published by the Free Software Foundation; either version 2
14   * of the License, or (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
22   * along with this program; if not, write to the Free Software
23   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 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/tap.h>
34 #include <epan/emem.h>
35 #include <epan/expert.h>
36 #include <epan/address.h>
37 #include <epan/prefs.h>
38 #include <epan/dissectors/packet-rtp.h>
39 #include <epan/dissectors/packet-rtcp.h>
40 #include <string.h>
41 #include "packet-unistim.h"
42 #include "defines.h"
43 #include "audio.h"
44 #include "basic.h"
45 #include "display.h"
46 #include "network.h"
47 #include "key.h"
48 #include "broadcast.h"
49 #include "uftp.h"
50 #include "expansion.h"
51
52 /* Don't set this to 5000 until this dissector is made a heuristic one!
53    It collides (at least) with tapa.
54    static guint global_unistim_port = 5000; */
55 static guint global_unistim_port = 0;
56
57 static unistim_info_t *uinfo;
58 static int unistim_tap = -1;
59
60 void proto_reg_handoff_unistim(void);
61 static void dissect_payload(proto_tree *unistim_tree,tvbuff_t *tvb,gint offset, packet_info *pinfo);
62 static int dissect_unistim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
63
64 static gint dissect_broadcast_switch(proto_tree *msg_tree,
65                                      tvbuff_t *tvb,gint offset,guint msg_len);
66 static gint dissect_audio_switch(proto_tree *msg_tree,packet_info *pinfo,
67                                    tvbuff_t *tvb,gint offset,guint msg_len);
68 static gint dissect_expansion_switch(proto_tree *msg_tree,
69                                    tvbuff_t *tvb,gint offset,guint msg_len);
70 static gint dissect_display_switch(proto_tree *msg_tree,
71                                    tvbuff_t *tvb,gint offset,guint msg_len);
72 static gint dissect_key_indicator_switch(proto_tree *msg_tree,
73                                    tvbuff_t *tvb,gint offset,guint msg_len);
74 static gint dissect_basic_switch(proto_tree *msg_tree,
75                                    tvbuff_t *tvb,gint offset,guint msg_len);
76 static gint dissect_network_switch(proto_tree *msg_tree,
77                                    tvbuff_t *tvb,gint offset,guint msg_len);
78 static gint dissect_broadcast_phone(proto_tree *msg_tree,
79                                    tvbuff_t *tvb,gint offset,guint msg_len);
80 static gint dissect_audio_phone(proto_tree *msg_tree,
81                                    tvbuff_t *tvb,gint offset,guint msg_len);
82 static gint dissect_expansion_phone(proto_tree *msg_tree,
83                                    tvbuff_t *tvb,gint offset,guint msg_len);
84 static gint dissect_display_phone(proto_tree *msg_tree,
85                                    tvbuff_t *tvb,gint offset,guint msg_len);
86 static gint dissect_key_indicator_phone(proto_tree *msg_tree,
87                                    tvbuff_t *tvb,gint offset,guint msg_len);
88 static gint dissect_basic_phone(proto_tree *msg_tree,
89                                    tvbuff_t *tvb,gint offset,guint msg_len);
90 static gint dissect_network_phone(proto_tree *msg_tree,
91                                    tvbuff_t *tvb,gint offset,guint msg_len);
92 static gint dissect_unistim_message(proto_tree *unistim_tree, packet_info *pinfo,
93                                    tvbuff_t *tvb,gint offset);
94 static gint dissect_uftp_message(proto_tree *unistim_tree, packet_info *pinfo,
95                                    tvbuff_t *tvb,gint offset);
96
97
98 static void set_ascii_item(proto_tree *unistim_tree, tvbuff_t *tvb,
99                            gint offset,guint msg_len);
100
101
102 static int proto_unistim = -1;
103 static int hf_unistim_seq_nu = -1;
104 static int hf_unistim_packet_type = -1;
105 static int hf_unistim_payload = -1;
106 static int hf_unistim_cmd_add = -1;
107 static int hf_unistim_len =-1;
108 static int hf_terminal_id=-1;
109 static int hf_basic_bit_field=-1;
110 static const true_false_string basic_bit_yn={
111    "For Following Byte",
112    "For Following Byte"
113 };
114
115 static int hf_basic_switch_cmd=-1;
116 static int hf_basic_phone_cmd=-1;
117 static int hf_broadcast_switch_cmd=-1;
118 static int hf_broadcast_phone_cmd=-1;
119 static int hf_audio_switch_cmd=-1;
120 static int hf_audio_phone_cmd=-1;
121 static int hf_display_switch_cmd=-1;
122 static int hf_display_phone_cmd=-1;
123 static int hf_key_switch_cmd=-1;
124 static int hf_key_phone_cmd=-1;
125 static int hf_network_switch_cmd=-1;
126 static int hf_network_phone_cmd=-1;
127 static int hf_expansion_switch_cmd=-1;
128 static int hf_expansion_phone_cmd=-1;
129
130 static int hf_generic_data=-1;
131 static int hf_generic_string=-1;
132
133 static gint ett_unistim = -1;
134
135 static const value_string packet_names[]={
136    {0,"NAK"},
137    {1,"ACK"},
138    {2,"Payload"},
139    {0,NULL}
140 };
141
142 static const value_string payload_names[]={
143    {0x00,"NULL Protocol"},
144    {0x01,"Aggregate Unistim"},
145    {0x02,"Aggregate Unistim with Terminal ID"},
146    {0x03,"UFTP"},
147    {0xff,"Free Form Protocol"},
148    {0,NULL}
149 };
150
151 static const range_string sequence_numbers[]={
152    {0x00,0xFFFFFFFE,"Normal Sequence Number"},
153    {0xFFFFFFFF,0xFFFFFFFF, "RESET Sequence Number"},
154    {0,0,NULL}
155 };
156
157 static const value_string command_address[]={
158    {0x09,"Expansion Module-1 Manager Switch"},
159    {0x0A,"Expansion Module-2 Manager Switch"},
160    {0x0B,"Expansion Module-3 Manager Switch"},
161    {0x0C,"Expansion Module-4 Manager Switch"},
162    {0x0D,"Expansion Module-5 Manager Switch"},
163    {0x0E,"Expansion Module-6 Manager Switch"},
164    {0x10,"Expansion Module Manager Phone"},
165    {0x11,"Broadcast Manager Switch"},
166    {0x16,"Audio Manager Switch"},
167    {0x17,"Display Manager Switch"},
168    {0x19,"Key/Indicator Manager Switch"},
169    {0x1a,"Basic Manager Switch"},
170    {0x1e,"Network Manager Switch"},
171    {0x89,"Expansion Module-1 Manager Phone"},
172    {0x8A,"Expansion Module-2 Manager Phone"},
173    {0x8B,"Expansion Module-3 Manager Phone"},
174    {0x8C,"Expansion Module-4 Manager Phone"},
175    {0x8D,"Expansion Module-5 Manager Phone"},
176    {0x8E,"Expansion Module-6 Manager Phone"},
177    {0x91,"Broadcast Manager Phone"},
178    {0x96,"Audio Manager Phone"},
179    {0x97,"Display Manager Phone"},
180    {0x99,"Key/Indicator Manager Phone"},
181    {0x9a,"Basic Manager Phone"},
182    {0x9e,"Network Manager Phone"},
183    {0,NULL}
184 };
185
186 static int
187 dissect_unistim(tvbuff_t *tvb,packet_info *pinfo,proto_tree *tree){
188    gint offset=0;
189    proto_item *ti= NULL;
190    proto_item *ti1= NULL;
191    proto_tree *overall_unistim_tree = NULL;
192    proto_tree *rudpm_tree=NULL;
193    gint size;
194
195    /* heuristic*/
196    switch(tvb_get_guint8(tvb,offset+4)) {/*rudp packet type 0,1,2 only */
197       case 0x0:/*NAK*/
198       case 0x1:/*ACK*/
199          break;
200       case 0x2:/*PAYLOAD*/
201          switch(tvb_get_guint8(tvb,offset+5)){/*payload type 0,1,2,3,ff only */
202             case 0x0: /*NULL*/
203             case 0x1: /*UNISTIM*/
204             case 0x2: /*UNISTIM WITH TERM ID*/
205             case 0x3: /*UFTP*/
206             case 0xff:/*UNKNOWN BUT VALID*/
207                break;
208             default:
209                return 0;
210          }
211          break;
212       default:
213          return 0;
214    }
215
216
217    size=tvb_length_remaining(tvb, offset);
218    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNISTIM");
219    /* Clear out stuff in the info column */
220    col_clear(pinfo->cinfo, COL_INFO);
221    ti = proto_tree_add_item(tree,proto_unistim,tvb,offset,-1,FALSE);
222    overall_unistim_tree = proto_item_add_subtree(ti,ett_unistim);
223    ti1=proto_tree_add_text(overall_unistim_tree,tvb,offset,5,"Reliable UDP");
224    rudpm_tree=proto_item_add_subtree(ti1,ett_unistim);
225
226    proto_tree_add_item(rudpm_tree,hf_unistim_seq_nu,tvb,offset,4,FALSE);
227
228    /* Allocate new mem for queueing */
229    uinfo = (unistim_info_t *)se_alloc(sizeof(unistim_info_t));
230
231    /* Clear tap struct */
232    uinfo->rudp_type = 0;
233    uinfo->payload_type = 0;
234    uinfo->sequence = tvb_get_ntohl(tvb,offset);
235    uinfo->termid = 0;
236    uinfo->key_val = -1;
237    uinfo->key_state = -1;
238    uinfo->hook_state = -1;
239    uinfo->stream_connect = -1;
240    uinfo->trans_connect = -1;
241    uinfo->set_termid = -1;
242    uinfo->string_data = NULL;
243    uinfo->key_buffer = NULL;
244    SET_ADDRESS(&uinfo->it_ip, AT_NONE, 0, NULL);
245    SET_ADDRESS(&uinfo->ni_ip, AT_NONE, 0, NULL);
246    uinfo->it_port = 0;
247
248    offset+=4;
249    proto_tree_add_item(rudpm_tree,hf_unistim_packet_type,tvb,offset,1,FALSE);
250    uinfo->rudp_type = tvb_get_guint8(tvb,offset);
251
252    switch(tvb_get_guint8(tvb,offset)) {
253       case 0x00:
254          /*NAK*/
255          col_add_fstr(pinfo->cinfo, COL_INFO, "NAK for seq -   0x%X",
256                       tvb_get_ntohl(tvb, offset-4));
257          break;
258       case 0x01:
259          /*ACK*/
260          col_add_fstr(pinfo->cinfo, COL_INFO, "ACK for seq -   0x%X",
261                       tvb_get_ntohl(tvb, offset-4));
262          break;
263       case 0x02:
264          col_add_fstr(pinfo->cinfo, COL_INFO, "Payload seq -   0x%X",
265                       tvb_get_ntohl(tvb, offset-4));
266          offset+=1;
267          dissect_payload(overall_unistim_tree,tvb,offset,pinfo);
268          break;
269       default:
270          return 0;
271          break;
272    }
273
274    /* Queue packet for tap */
275    tap_queue_packet(unistim_tap, pinfo, uinfo);
276    return size;
277 }
278
279 static void
280 dissect_payload(proto_tree *overall_unistim_tree,tvbuff_t *tvb, gint offset, packet_info *pinfo){
281    proto_item *ti;
282    proto_tree *unistim_tree;
283    guint payload_proto=tvb_get_guint8(tvb,offset);
284
285    /* Payload type for tap */
286    uinfo->payload_type = payload_proto;
287
288    ti=proto_tree_add_item(overall_unistim_tree,hf_unistim_payload,
289                           tvb,offset,1,FALSE);
290    offset+=1;
291    unistim_tree=proto_item_add_subtree(ti,ett_unistim);
292
293    switch(payload_proto){
294       case 0x00:
295    /*NULL PROTO - NOTHING LEFT TO DO*/
296          return;
297       case 0x01:
298    /*UNISTIM only so no term id but further payload work*/
299          /* Collect info for tap */
300          /* If no term id then packet sourced from NI */
301          COPY_ADDRESS(&(uinfo->ni_ip), &(pinfo->src));
302          COPY_ADDRESS(&(uinfo->it_ip), &(pinfo->dst));
303          uinfo->it_port = pinfo->destport;
304          break;
305       case 0x02:
306    /*UNISTIM with term id*/
307          /* Termid packs are always sourced from the it, so collect relevant infos */
308          COPY_ADDRESS(&(uinfo->ni_ip),&(pinfo->dst));
309          COPY_ADDRESS(&(uinfo->it_ip),&(pinfo->src));
310          uinfo->it_port = pinfo->srcport;
311          uinfo->termid = tvb_get_ntohl(tvb,offset);
312
313          proto_tree_add_item(unistim_tree,hf_terminal_id,tvb,offset,4,FALSE);
314          offset+=4;
315          break;
316       case 0x03:
317    /* UFTP */
318          offset = dissect_uftp_message(unistim_tree,pinfo,tvb,offset);
319          break;
320       case 0xff:
321    /*TODO flesh this out probably only for init*/
322          break;
323    }
324
325    /* Handle UFTP seperately because it is significantly different
326       than standard UNISTIM */
327    while (tvb_length_remaining(tvb, offset) > 0)
328       offset = dissect_unistim_message(unistim_tree,pinfo,tvb,offset);
329
330 }
331
332 static gint
333 dissect_uftp_message(proto_tree *unistim_tree,packet_info *pinfo _U_,tvbuff_t *tvb,gint offset){
334
335    guint command;
336    guint str_len;
337    guint dat_len;
338    proto_item *ti;
339    proto_tree *msg_tree;
340
341    ti = proto_tree_add_text(unistim_tree,tvb,offset,-1,"UFTP CMD");
342
343    msg_tree = proto_item_add_subtree(ti,ett_unistim);
344
345    command=tvb_get_guint8(tvb,offset);
346
347    proto_tree_add_item(msg_tree,hf_uftp_command,tvb,offset,1,FALSE);
348
349    offset += 1;
350
351    switch(command)
352    {
353       case 0x80:
354          /* Connection request */
355          /* Nothing to do */
356          break;
357
358       case 0x81:
359          /* Connection Details */
360          /* Get datablock size */
361          proto_tree_add_item(msg_tree,hf_uftp_datablock_size,tvb,offset,2,FALSE);
362          offset+=2;
363          /* Get datablock limit b4 flow control */
364          proto_tree_add_item(msg_tree,hf_uftp_datablock_limit,tvb,offset,1,FALSE);
365          offset+=1;
366          /* Get filename */
367          str_len = tvb_length_remaining(tvb, offset);
368          proto_tree_add_item(msg_tree,hf_uftp_filename,tvb,offset,str_len,FALSE);
369          offset += str_len;
370          break;
371
372       case 0x82:
373          /* Flow Control off */
374          /* Nothing to do */
375          break;
376
377       case 0x00:
378          /* Connection Granted */
379          /* Nothing to do */
380          break;
381
382       case 0x01:
383          /* Connection Denied */
384          /* Nothing to do */
385          break;
386
387       case 0x02:
388          /* File Data Block */
389          /* Raw Data.. */
390          dat_len = tvb_length_remaining(tvb, offset);
391          proto_tree_add_item(msg_tree,hf_uftp_datablock,tvb,offset,dat_len,FALSE);
392          offset += dat_len;
393          break;
394    }
395
396    return offset;
397
398 }
399
400
401 static gint
402 dissect_unistim_message(proto_tree *unistim_tree,packet_info *pinfo,tvbuff_t *tvb,gint offset){
403    guint addr;
404    guint msg_len;
405    proto_item *ti;
406    proto_tree *msg_tree;
407
408    ti = proto_tree_add_text(unistim_tree,tvb,offset,-1,"Unistim CMD");
409
410    msg_tree = proto_item_add_subtree(ti,ett_unistim);
411
412    addr=tvb_get_guint8(tvb,offset);
413
414    proto_tree_add_item(msg_tree,hf_unistim_cmd_add,tvb,offset,1,FALSE);
415
416    offset+=1;
417    msg_len=tvb_get_guint8(tvb,offset);
418
419    if (msg_len<=2)
420    {
421       ti=proto_tree_add_item(msg_tree,hf_unistim_len,tvb,offset,1,FALSE);
422       expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Length too short");
423       return tvb_length(tvb);
424    } else {
425       proto_item_set_len(ti,msg_len);
426       proto_tree_add_item(msg_tree,hf_unistim_len,tvb,offset,1,FALSE);
427    }
428
429    offset+=1;
430    /*from switch*/
431    switch(addr){
432       case 0x00:
433    /*Nothing*/
434          break;
435    /*Expansion Manager Switch*/
436       case 0x09:
437       case 0x0A:
438       case 0x0B:
439       case 0x0C:
440       case 0x0D:
441       case 0x0E:
442          offset = dissect_expansion_switch(msg_tree,tvb,offset,msg_len-2);
443          break;
444
445       case 0x11:
446    /*Broadcast Manager Switch*/
447          offset = dissect_broadcast_switch(msg_tree,tvb,offset,msg_len-2);
448          break;
449       case 0x16:
450    /*Audio Manager Switch*/
451          offset = dissect_audio_switch(msg_tree,pinfo,tvb,offset,msg_len-2);
452          break;
453       case 0x17:
454    /*Display Manager Switch*/
455          offset = dissect_display_switch(msg_tree,tvb,offset,msg_len-2);
456          break;
457       case 0x19:
458    /*Key Indicator Manager Switch*/
459          offset = dissect_key_indicator_switch(msg_tree,tvb,offset,msg_len-2);
460          break;
461       case 0x1a:
462    /*Basic Manager Switch*/
463          offset = dissect_basic_switch(msg_tree,tvb,offset,msg_len-2);
464          break;
465       case 0x1e:
466    /*Network Manager Switch*/
467          offset = dissect_network_switch(msg_tree,tvb,offset,msg_len-2);
468          break;
469       case 0x89:
470       case 0x8A:
471       case 0x8B:
472       case 0x8C:
473       case 0x8D:
474       case 0x8E:
475    /*Expansion Manager Phone*/
476          offset = dissect_expansion_phone(msg_tree,tvb,offset,msg_len-2);
477          break;
478
479       case 0x91:
480    /*Broadcast Manager phone*/
481          offset = dissect_broadcast_phone(msg_tree,tvb,offset,msg_len-2);
482          break;
483       case 0x96:
484    /*Audio Manager phone*/
485          offset = dissect_audio_phone(msg_tree,tvb,offset,msg_len-2);
486          break;
487       case 0x97:
488    /*Display Manager phone*/
489          offset = dissect_display_phone(msg_tree,tvb,offset,msg_len-2);
490          break;
491       case 0x99:
492    /*Key/Indicator Manager phone*/
493          offset = dissect_key_indicator_phone(msg_tree,tvb,offset,msg_len-2);
494          break;
495       case 0x9a:
496    /*Basic Manager phone*/
497          offset = dissect_basic_phone(msg_tree,tvb,offset,msg_len-2);
498          break;
499       case 0x9e:
500    /*Network Manager Switch*/
501          offset = dissect_network_phone(msg_tree,tvb,offset,msg_len-2);
502          break;
503       default:
504    /*See some undocumented messages.  Don't want to miss the ones we understand*/
505          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len-2,FALSE);
506
507          offset+=(msg_len-2);
508    }
509
510    return offset;
511 }
512
513
514    /*DONE*/
515 static gint
516 dissect_basic_phone(proto_tree *msg_tree,
517                     tvbuff_t *tvb,gint offset, guint msg_len){
518    guint basic_cmd;
519    proto_item *ti;
520
521    basic_cmd=tvb_get_guint8(tvb,offset);
522
523    ti=proto_tree_add_item(msg_tree,hf_basic_phone_cmd,tvb,offset,1,FALSE);
524
525    offset+=1;msg_len-=1;
526    switch(basic_cmd){
527
528       case 0x00:
529    /*Basic Manager Attributes Info*/
530          proto_tree_add_item(msg_tree,hf_basic_phone_eeprom_stat_cksum,
531                              tvb,offset,1,FALSE);
532          offset+=1;
533          proto_tree_add_item(msg_tree,hf_basic_phone_eeprom_dynam,
534                              tvb,offset,1,FALSE);
535          offset+=1;
536          proto_tree_add_item(msg_tree,hf_basic_phone_eeprom_net_config_cksum,
537                              tvb,offset,1,FALSE);
538          offset+=1;
539          break;
540       case 0x01:
541    /*Basic Manager Options Report*/
542          proto_tree_add_item(msg_tree,hf_basic_switch_options_secure,
543                              tvb,offset,1,FALSE);
544          offset+=1;
545          break;
546       case 0x02:
547    /*Firmware Version*/
548          proto_tree_add_item(msg_tree,hf_basic_phone_fw_ver,
549                              tvb,offset,msg_len,FALSE);
550          offset+=msg_len;
551          break;
552       case 0x03:
553    /*IT Type*/
554          proto_tree_add_item(msg_tree,hf_basic_it_type,tvb,offset,1,FALSE);
555          offset+=1;
556          break;
557       case 0x07:
558    /*Hardware ID*/
559          proto_tree_add_item(msg_tree,hf_basic_phone_hw_id,
560                              tvb,offset,msg_len,FALSE);
561          offset+=msg_len;
562          break;
563       case 0x08:
564    /*Product Engineering Code*/
565          proto_tree_add_item(msg_tree,hf_basic_prod_eng_code,
566                              tvb,offset,msg_len,FALSE);
567          offset+=msg_len;
568          break;
569       case 0x09:
570    /*Grey Market Info*/
571          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
572          offset+=msg_len;
573          break;
574       case 0x0a:
575    /*Encapsulate Command*/
576          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
577          offset+=msg_len;
578          break;
579       case 0x11:
580    /*Phone Ethernet address*/
581          proto_tree_add_item(msg_tree,hf_basic_ether_address,
582                              tvb,offset,msg_len,FALSE);
583          offset+=msg_len;
584          break;
585       case 0x0b:
586    /*not in pdf but get them*/
587          set_ascii_item(msg_tree,tvb,offset,msg_len);
588          offset+=msg_len;
589          break;
590       case 0xff:
591    /*Reserved*/
592          break;
593       default:
594          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
595          offset+=msg_len;
596    }
597
598    return offset;
599 }
600    /*DONE*/
601 static gint
602 dissect_basic_switch(proto_tree *msg_tree,
603                      tvbuff_t *tvb,gint offset,guint msg_len){
604    guint basic_cmd;
605    basic_cmd=tvb_get_guint8(tvb,offset);
606    proto_tree_add_item(msg_tree,hf_basic_switch_cmd,tvb,offset,1,FALSE);
607    offset+=1;msg_len-=1;
608    switch(basic_cmd){
609       case 0x01:
610    /*Query Basic Manager*/
611          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
612          proto_tree_add_item(msg_tree,hf_basic_switch_query_attr,
613                              tvb,offset,1,FALSE);
614          proto_tree_add_item(msg_tree,hf_basic_switch_query_opts,
615                              tvb,offset,1,FALSE);
616          proto_tree_add_item(msg_tree,hf_basic_switch_query_fw,
617                              tvb,offset,1,FALSE);
618          proto_tree_add_item(msg_tree,hf_basic_switch_query_hw_id,
619                              tvb,offset,1,FALSE);
620          proto_tree_add_item(msg_tree,hf_basic_switch_query_it_type,
621                              tvb,offset,1,FALSE);
622          proto_tree_add_item(msg_tree,hf_basic_switch_query_prod_eng_code,
623                              tvb,offset,1,FALSE);
624          proto_tree_add_item(msg_tree,hf_basic_switch_query_gray_mkt_info,
625                              tvb,offset,1,FALSE);
626          offset+=1;
627          break;
628       case 0x02:
629    /*Basic Manager Options*/
630          proto_tree_add_item(msg_tree,hf_basic_switch_options_secure,
631                              tvb,offset,1,FALSE);
632          offset+=1;
633          break;
634       case 0x06:
635    /*EEprom Write*/
636          proto_tree_add_item(msg_tree,hf_basic_switch_element_id,
637                              tvb,offset,1,FALSE);
638          offset+=1;
639          proto_tree_add_item(msg_tree,hf_basic_switch_eeprom_data,
640                              tvb,offset,msg_len,FALSE);
641          offset+=1;
642          break;
643       case 0x07:
644    /*Assign Terminal ID*/
645          /* Set tap info */
646          uinfo->set_termid = 1;
647
648          proto_tree_add_item(msg_tree,hf_basic_switch_terminal_id,
649                              tvb,offset,msg_len,FALSE);
650          offset+=msg_len;
651          break;
652       case 0x08:
653    /*Encapsulate Command*/
654          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
655          offset+=msg_len;
656          break;
657       case 0x0f:
658    /*showing up in captures but not in pdf*/
659          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
660          offset+=msg_len;
661       case 0xff:
662    /*Reserved*/
663          break;
664       default:
665          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
666          offset+=msg_len;
667
668    }
669
670    return offset;
671 }
672
673
674    /*DONE*/
675 static gint
676 dissect_broadcast_switch(proto_tree *msg_tree,
677                          tvbuff_t *tvb,gint offset, guint msg_len){
678    guint bcast_cmd;
679    guint year,month,day,hour,minute,second;
680    proto_item *date_label;
681    proto_item *time_label;
682    proto_tree *date_tree;
683    proto_tree *time_tree;
684    bcast_cmd=tvb_get_guint8(tvb,offset);
685    proto_tree_add_item(msg_tree,hf_broadcast_switch_cmd,tvb,offset,1,FALSE);
686    offset+=1;msg_len-=1;
687    switch(bcast_cmd){
688       case 0x00:
689    /*Accessory Sync Update   -   len=3 */
690          break;
691       case 0x01:
692    /*Logical Icon Update*/
693          proto_tree_add_item(msg_tree,hf_basic_bit_field,
694                              tvb,offset,1,FALSE);
695          proto_tree_add_item(msg_tree,hf_broadcast_icon_state,
696                              tvb,offset,1,FALSE);
697          proto_tree_add_item(msg_tree,hf_broadcast_icon_cadence,
698                              tvb,offset,1,FALSE);
699          offset+=1;
700          break;
701       case 0x02:
702    /*Time and Date Download*/
703          year=tvb_get_guint8(tvb,offset);
704          month=tvb_get_guint8(tvb,offset+1);
705          day=tvb_get_guint8(tvb,offset+2);
706          hour=tvb_get_guint8(tvb,offset+3);
707          minute=tvb_get_guint8(tvb,offset+4);
708          second=tvb_get_guint8(tvb,offset+5);
709          date_label=proto_tree_add_text(msg_tree,tvb,offset,3,
710                                         "Date %i/%i/%i",month,day,year%100);
711          date_tree=proto_item_add_subtree(date_label,ett_unistim);
712          proto_tree_add_item(date_tree,hf_broadcast_year,tvb,offset,1,FALSE);
713          offset+=1;
714          proto_tree_add_item(date_tree,hf_broadcast_month,tvb,offset,1,FALSE);
715          offset+=1;
716          proto_tree_add_item(date_tree,hf_broadcast_day,tvb,offset,1,FALSE);
717          offset+=1;
718
719          time_label=proto_tree_add_text(msg_tree,tvb,offset,3,
720                                         "Time %i:%i:%i",hour,minute,second);
721          time_tree=proto_item_add_subtree(time_label,ett_unistim);
722          proto_tree_add_item(time_tree,hf_broadcast_hour,tvb,offset,1,FALSE);
723          offset+=1;
724          proto_tree_add_item(time_tree,hf_broadcast_minute,tvb,offset,1,FALSE);
725          offset+=1;
726          proto_tree_add_item(time_tree,hf_broadcast_second,tvb,offset,1,FALSE);
727          offset+=1;
728          break;
729       case 0x03:
730    /*Set Default Character Table Config */
731          /* UGLY may work may not*/
732          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
733          offset+=msg_len;
734          break;
735       case 0xff:
736    /*Reserved*/
737          break;
738       default:
739          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
740          offset+=msg_len;
741    }
742
743    return offset;
744 }
745    /*DONE Haven't seen any phone broadcasts, wouldn't expect to*/
746 static gint
747 dissect_broadcast_phone(proto_tree *msg_tree,
748                         tvbuff_t *tvb, gint offset,guint msg_len){
749
750    proto_tree_add_item(msg_tree,hf_generic_data, tvb,offset,msg_len,FALSE);
751    offset+=msg_len;
752
753    return offset;
754 }
755
756    /*DONE*/
757 static gint
758 dissect_display_switch(proto_tree *msg_tree,
759                        tvbuff_t *tvb, gint offset,guint msg_len){
760    guint clear_mask;
761    guint highlight_cmd;
762    guint time_date_mask;
763    guint display_cmd;
764    guint address_byte;
765    guint movement_byte;
766    proto_tree *address_tree;
767    proto_item *tmp_ti;
768    display_cmd=tvb_get_guint8(tvb,offset);
769    proto_tree_add_item(msg_tree,hf_display_switch_cmd,tvb,offset,1,FALSE);
770    offset+=1;msg_len-=1;
771
772    switch(display_cmd){
773       case 0x01:
774    /*Restore Default Character Table Configuration length = 3*/
775          break;
776       case 0x04:
777    /*Arrow*/
778          proto_tree_add_item(msg_tree,hf_display_arrow,tvb,offset,1,FALSE);
779          offset+=1;
780          break;
781       case 0x05:
782    /*Query Status Bar Icon*/
783          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
784          offset+=msg_len;
785          break;
786       case 0x06:
787    /*Highlight Off length = 3*/
788          break;
789       case 0x07:
790    /*Highlight On length = 3*/
791          break;
792       case 0x09:
793    /*Restore Time and Date length  = 3*/
794          break;
795       case 0x0a:
796    /*Clear Time and Date length  = 3*/
797          break;
798       case 0x0b:
799    /*Call Duration Timer*/
800          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
801          proto_tree_add_item(msg_tree,hf_display_call_timer_mode,tvb,offset,
802                              1,FALSE);
803          proto_tree_add_item(msg_tree,hf_display_call_timer_reset,tvb,offset,
804                              1,FALSE);
805          proto_tree_add_item(msg_tree,hf_display_call_timer_display,tvb,offset,
806                              1,FALSE);
807          proto_tree_add_item(msg_tree,hf_display_call_timer_delay,tvb,offset,
808                              1,FALSE);
809          offset+=1;msg_len-=1;
810          proto_tree_add_item(msg_tree,hf_display_call_timer_id,tvb,offset,
811                              1,FALSE);
812          offset+=1;msg_len-=1;
813          break;
814       case 0x0c:
815    /*Query Display Manager*/
816          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
817          offset+=msg_len;
818          break;
819       case 0x0d:
820    /*Download Call Duration Timer Delay*/
821          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
822          offset+=msg_len;
823          break;
824       case 0x0e:
825    /*Disable Display Field*/
826          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
827          offset+=msg_len;
828          break;
829       case 0x0f:
830    /*Clear Field*/
831          clear_mask=tvb_get_guint8(tvb,offset);
832    /*need to know which paths to take*/
833          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
834          proto_tree_add_item(msg_tree,hf_display_clear_numeric,
835                              tvb,offset,1,FALSE);
836          proto_tree_add_item(msg_tree,hf_display_clear_context,
837                              tvb,offset,1,FALSE);
838          proto_tree_add_item(msg_tree,hf_display_clear_date,
839                              tvb,offset,1,FALSE);
840
841          proto_tree_add_item(msg_tree,hf_display_clear_time,
842                              tvb,offset,1,FALSE);
843          proto_tree_add_item(msg_tree,hf_display_clear_line,
844                              tvb,offset,1,FALSE);
845          proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon,
846                              tvb,offset,1,FALSE);
847          proto_tree_add_item(msg_tree,hf_display_clear_softkey,
848                              tvb,offset,1,FALSE);
849          proto_tree_add_item(msg_tree,hf_display_clear_softkey_label,
850                              tvb,offset,1,FALSE);
851          offset+=1;msg_len-=1;
852          if((clear_mask&DISPLAY_CLEAR_LINE)==DISPLAY_CLEAR_LINE){
853             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
854             proto_tree_add_item(msg_tree,hf_display_clear_line_1,
855                                 tvb,offset,1,FALSE);
856             proto_tree_add_item(msg_tree,hf_display_clear_line_2,
857                                 tvb,offset,1,FALSE);
858             proto_tree_add_item(msg_tree,hf_display_clear_line_3,
859                                 tvb,offset,1,FALSE);
860             proto_tree_add_item(msg_tree,hf_display_clear_line_4,
861                                 tvb,offset,1,FALSE);
862             proto_tree_add_item(msg_tree,hf_display_clear_line_5,
863                                 tvb,offset,1,FALSE);
864             proto_tree_add_item(msg_tree,hf_display_clear_line_6,
865                                 tvb,offset,1,FALSE);
866             proto_tree_add_item(msg_tree,hf_display_clear_line_7,
867                                 tvb,offset,1,FALSE);
868             proto_tree_add_item(msg_tree,hf_display_clear_line_8,
869                                 tvb,offset,1,FALSE);
870             offset+=1;msg_len-=1;
871          }
872          if((clear_mask&DISPLAY_CLEAR_STATUS_BAR_ICON)==
873                         DISPLAY_CLEAR_STATUS_BAR_ICON){
874             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
875             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_1,
876                                 tvb,offset,1,FALSE);
877             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_2,
878                                 tvb,offset,1,FALSE);
879             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_3,
880                                 tvb,offset,1,FALSE);
881             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_4,
882                                 tvb,offset,1,FALSE);
883             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_5,
884                                 tvb,offset,1,FALSE);
885             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_6,
886                                 tvb,offset,1,FALSE);
887             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_7,
888                                 tvb,offset,1,FALSE);
889             proto_tree_add_item(msg_tree,hf_display_clear_status_bar_icon_8,
890                                 tvb,offset,1,FALSE);
891             offset+=1;msg_len-=1;
892          }
893          if((clear_mask&DISPLAY_CLEAR_SOFTKEY)==DISPLAY_CLEAR_SOFTKEY){
894             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
895             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_1,
896                                 tvb,offset,1,FALSE);
897             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_2,
898                                 tvb,offset,1,FALSE);
899             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_3,
900                                 tvb,offset,1,FALSE);
901             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_4,
902                                 tvb,offset,1,FALSE);
903             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_5,
904                                 tvb,offset,1,FALSE);
905             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_6,
906                                 tvb,offset,1,FALSE);
907             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_7,
908                                 tvb,offset,1,FALSE);
909             proto_tree_add_item(msg_tree,hf_display_clear_soft_key_8,
910                                 tvb,offset,1,FALSE);
911             offset+=1;msg_len-=1;
912          }
913          if((clear_mask&DISPLAY_CLEAR_SOFTKEY_LABEL)==DISPLAY_CLEAR_SOFTKEY_LABEL){
914             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
915             proto_tree_add_item(msg_tree,hf_display_clear_sk_label_key_id,tvb,offset,1,FALSE);
916             proto_tree_add_item(msg_tree,hf_display_clear_all_slks,tvb,offset,1,FALSE);
917             offset+=1;msg_len-=1;
918          }
919          break;
920       case 0x10:
921    /*Cursor Control*/
922          movement_byte=tvb_get_guint8(tvb,offset);
923          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
924          proto_tree_add_item(msg_tree,hf_display_cursor_move_cmd,tvb,offset,1,FALSE);
925          proto_tree_add_item(msg_tree,hf_display_cursor_blink,tvb,offset,1,FALSE);
926          offset+=1;msg_len-=1;
927          if(msg_len==0){
928    /*turn cursor off*/
929             break;
930          }
931          if((movement_byte&0x01)==0x01){
932             address_byte=tvb_get_guint8(tvb,offset);
933             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
934             proto_tree_add_item(msg_tree,hf_display_write_address_numeric,
935                                 tvb,offset,1,FALSE);
936             proto_tree_add_item(msg_tree,hf_display_write_address_context,
937                                 tvb,offset,1,FALSE);
938             proto_tree_add_item(msg_tree,hf_display_write_address_line,
939                                 tvb,offset,1,FALSE);
940             proto_tree_add_item(msg_tree,hf_display_write_address_soft_key,
941                                 tvb,offset,1,FALSE);
942             if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)==
943                              DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)
944                proto_tree_add_item(msg_tree,
945                                    hf_display_write_address_softkey_id,
946                                    tvb,offset,1,FALSE);
947             offset+=1;msg_len-=1;
948             if(msg_len==0){
949    /*turn cursor off*/
950                break;
951             }
952          }
953          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
954          proto_tree_add_item(msg_tree,hf_display_write_address_char_pos,
955                              tvb,offset,1,FALSE);
956          proto_tree_add_item(msg_tree,hf_display_write_address_line_number,
957                              tvb,offset,1,FALSE);
958          offset+=1;msg_len-=1;
959          break;
960       case 0x12:
961    /*Display Scroll with Data (before)*/
962          set_ascii_item(msg_tree,tvb,offset,msg_len);
963          offset+=msg_len;
964          break;
965       case 0x13:
966    /*Display Scroll with Data (after)*/
967          set_ascii_item(msg_tree,tvb,offset,msg_len);
968          offset+=msg_len;
969          break;
970       case 0x14:
971    /*Status Bar Icon Update*/
972          proto_tree_add_item(msg_tree,hf_basic_bit_field, tvb,offset,1,FALSE);
973          proto_tree_add_item(msg_tree,hf_icon_id,tvb,offset,1,FALSE);
974          offset+=1;
975          proto_tree_add_item(msg_tree,hf_basic_bit_field, tvb,offset,1,FALSE);
976          proto_tree_add_item(msg_tree,hf_broadcast_icon_state,
977                              tvb,offset,1,FALSE);
978          proto_tree_add_item(msg_tree,hf_broadcast_icon_cadence,
979                              tvb,offset,1,FALSE);
980          offset+=1;
981          break;
982       case 0x15:
983    /*Month Labels Download*/
984          set_ascii_item(msg_tree,tvb,offset,msg_len);
985          offset+=msg_len;
986          break;
987       case 0x16:
988    /*Call Duration Timer Label Download*/
989          set_ascii_item(msg_tree,tvb,offset,msg_len);
990          offset+=1;msg_len-=1;
991          break;
992       case 0x17:
993    /*Time and Date Format*/
994          time_date_mask=tvb_get_guint8(tvb,offset);
995          if((time_date_mask&DISPLAY_USE_TIME_FORMAT)==DISPLAY_USE_TIME_FORMAT){
996             proto_tree_add_item(msg_tree,hf_display_time_format,tvb,offset,1,FALSE);
997          }
998          if((time_date_mask&DISPLAY_USE_DATE_FORMAT)==DISPLAY_USE_DATE_FORMAT){
999             proto_tree_add_item(msg_tree,hf_display_date_format,tvb,offset,1,FALSE);
1000          }
1001          proto_tree_add_item(msg_tree,hf_display_use_time_format,tvb,offset,1,FALSE);
1002          proto_tree_add_item(msg_tree,hf_display_use_date_format,tvb,offset,1,FALSE);
1003          offset+=1;msg_len-=1;
1004          break;
1005       case 0x18:
1006    /*address|no control|no tag|no*/
1007          set_ascii_item(msg_tree,tvb,offset,msg_len);
1008          offset+=msg_len;
1009          break;
1010       case 0x19:
1011    /*address|yes control|no tag|no*/
1012          tmp_ti=proto_tree_add_text(msg_tree,tvb,offset,0,"Address");
1013
1014          address_tree=proto_item_add_subtree(tmp_ti,ett_unistim);
1015          address_byte=tvb_get_guint8(tvb,offset);
1016          proto_tree_add_item(address_tree,hf_basic_bit_field,
1017                              tvb,offset,1,FALSE);
1018          proto_tree_add_item(address_tree,hf_display_write_address_numeric,
1019                              tvb,offset,1,FALSE);
1020          proto_tree_add_item(address_tree,hf_display_write_address_context,
1021                              tvb,offset,1,FALSE);
1022          proto_tree_add_item(address_tree,hf_display_write_address_line,
1023                              tvb,offset,1,FALSE);
1024          proto_tree_add_item(address_tree,hf_display_write_address_soft_key,
1025                              tvb,offset,1,FALSE);
1026          proto_tree_add_item(address_tree,hf_display_write_address_soft_label,
1027                              tvb,offset,1,FALSE);
1028
1029          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)==
1030                           DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG){
1031             proto_tree_add_item(address_tree,
1032                                 hf_display_write_address_softkey_id,
1033                                 tvb,offset,1,FALSE);
1034          }
1035          offset+=1;msg_len-=1;
1036          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)==
1037              DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG){
1038             proto_tree_add_item(address_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1039             proto_tree_add_item(address_tree,
1040                                 hf_display_write_address_char_pos,
1041                                 tvb,offset,1,FALSE);
1042             if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)!=
1043                              DISPLAY_WRITE_ADDRESS_LINE_FLAG){
1044                offset+=1;msg_len-=1;
1045             }
1046          }
1047          if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
1048              DISPLAY_WRITE_ADDRESS_LINE_FLAG){
1049             proto_tree_add_item(address_tree,
1050                                 hf_display_write_address_line_number,
1051                                 tvb,offset,1,FALSE);
1052             offset+=1;msg_len-=1;
1053          }
1054          if(msg_len>0){
1055             /* I'm guessing this will work flakily at best */
1056             uinfo->string_data = tvb_get_string(tvb,offset,msg_len);
1057             set_ascii_item(msg_tree,tvb,offset,msg_len);
1058          }
1059
1060          offset+=msg_len;
1061          break;
1062       case 0x1a:
1063    /*address|no control|yes tag|no*/
1064          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1065          proto_tree_add_item(msg_tree,hf_display_write_cursor_move,
1066                              tvb,offset,1,FALSE);
1067          proto_tree_add_item(msg_tree,hf_display_write_clear_left,
1068                              tvb,offset,1,FALSE);
1069          proto_tree_add_item(msg_tree,hf_display_write_clear_right,
1070                              tvb,offset,1,FALSE);
1071          proto_tree_add_item(msg_tree,hf_display_write_shift_left,
1072                              tvb,offset,1,FALSE);
1073          proto_tree_add_item(msg_tree,hf_display_write_shift_right,
1074                              tvb,offset,1,FALSE);
1075          proto_tree_add_item(msg_tree,hf_display_write_highlight,
1076                              tvb,offset,1,FALSE);
1077          offset+=1;msg_len-=1;
1078          set_ascii_item(msg_tree,tvb,offset,msg_len);
1079          offset+=msg_len;
1080          proto_tree_add_item(msg_tree,hf_generic_string,
1081                              tvb,offset,msg_len,FALSE);
1082          offset+=msg_len;
1083          break;
1084       case 0x1b:
1085    /*address|yes control|yes tag|no*/
1086          tmp_ti=proto_tree_add_text(msg_tree,tvb,offset,0,"Address Data");
1087          address_tree=proto_item_add_subtree(tmp_ti,ett_unistim);
1088          address_byte=tvb_get_guint8(tvb,offset);
1089          proto_tree_add_item(address_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1090          proto_tree_add_item(address_tree,
1091                              hf_display_write_address_numeric,
1092                              tvb,offset,1,FALSE);
1093          proto_tree_add_item(address_tree,
1094                              hf_display_write_address_context,
1095                              tvb,offset,1,FALSE);
1096          proto_tree_add_item(address_tree,
1097                              hf_display_write_address_line,
1098                              tvb,offset,1,FALSE);
1099          proto_tree_add_item(address_tree,
1100                              hf_display_write_address_soft_key,
1101                              tvb,offset,1,FALSE);
1102          proto_tree_add_item(address_tree,
1103                              hf_display_write_address_soft_label,
1104                              tvb,offset,1,FALSE);
1105          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)==
1106                           DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG){
1107             proto_tree_add_item(address_tree,hf_display_write_address_softkey_id,
1108                                 tvb,offset,1,FALSE);
1109             offset+=1; msg_len-=1;
1110          }
1111          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)==
1112                           DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG){
1113             proto_tree_add_item(address_tree,
1114                                 hf_display_write_address_char_pos,
1115                                 tvb,offset,1,FALSE);
1116             if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)!=
1117                              DISPLAY_WRITE_ADDRESS_LINE_FLAG)
1118                offset+=1;msg_len-=1;
1119          }
1120          if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
1121                           DISPLAY_WRITE_ADDRESS_LINE_FLAG){
1122             proto_tree_add_item(address_tree,
1123                                 hf_display_write_address_line_number,
1124                                 tvb,offset,1,FALSE);
1125             offset+=1;msg_len-=1;
1126          }
1127          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1128          proto_tree_add_item(msg_tree,hf_display_write_cursor_move,
1129                              tvb,offset,1,FALSE);
1130          proto_tree_add_item(msg_tree,hf_display_write_clear_left,
1131                              tvb,offset,1,FALSE);
1132          proto_tree_add_item(msg_tree,hf_display_write_clear_right,
1133                              tvb,offset,1,FALSE);
1134          proto_tree_add_item(msg_tree,hf_display_write_shift_left,
1135                              tvb,offset,1,FALSE);
1136          proto_tree_add_item(msg_tree,hf_display_write_shift_right,
1137                              tvb,offset,1,FALSE);
1138          proto_tree_add_item(msg_tree,hf_display_write_highlight,
1139                              tvb,offset,1,FALSE);
1140          offset+=1;msg_len-=1;
1141          set_ascii_item(msg_tree,tvb,offset,msg_len);
1142          offset+=msg_len;
1143          break;
1144       case 0x1c:
1145    /*address|no control|no tag|yes*/
1146          proto_tree_add_item(msg_tree,hf_display_write_tag,tvb,offset,1,FALSE);
1147          offset+=1;msg_len-=1;
1148          set_ascii_item(msg_tree,tvb,offset,msg_len);
1149          offset+=msg_len;
1150          break;
1151       case 0x1d:
1152    /*address|yes control|no tag|yes*/
1153          tmp_ti=proto_tree_add_text(msg_tree,tvb,offset,0,"Address Data");
1154          address_tree=proto_item_add_subtree(tmp_ti,ett_unistim);
1155          address_byte=tvb_get_guint8(tvb,offset);
1156          proto_tree_add_item(address_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1157          proto_tree_add_item(address_tree,hf_display_write_address_numeric,tvb,
1158                              offset,1,FALSE);
1159          proto_tree_add_item(address_tree,hf_display_write_address_context,
1160                              tvb,offset,1,FALSE);
1161          proto_tree_add_item(address_tree,hf_display_write_address_line,
1162                              tvb,offset,1,FALSE);
1163          proto_tree_add_item(address_tree,hf_display_write_address_soft_key,
1164                              tvb,offset,1,FALSE);
1165          proto_tree_add_item(address_tree,hf_display_write_address_soft_label,
1166                              tvb,offset,1,FALSE);
1167          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)==
1168              DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)
1169             proto_tree_add_item(address_tree,
1170                                 hf_display_write_address_softkey_id,
1171                                 tvb,offset,1,FALSE);
1172          offset+=1; msg_len-=1;
1173          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)==
1174              DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG){
1175             proto_tree_add_item(address_tree,
1176                                 hf_display_write_address_char_pos,
1177                                 tvb,offset,1,FALSE);
1178             if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)!=
1179                 DISPLAY_WRITE_ADDRESS_LINE_FLAG)
1180                offset+=1;msg_len-=1;
1181          }
1182          if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
1183              DISPLAY_WRITE_ADDRESS_LINE_FLAG){
1184             proto_tree_add_item(address_tree,hf_display_write_address_line_number,
1185                                 tvb,offset,1,FALSE);
1186             offset+=1;msg_len-=1;
1187          }
1188          set_ascii_item(msg_tree,tvb,offset,msg_len);
1189          offset+=msg_len;
1190          break;
1191       case 0x1e:
1192    /*address|no control|yes tag|yes*/
1193          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1194          proto_tree_add_item(msg_tree,hf_display_write_cursor_move,
1195                              tvb,offset,1,FALSE);
1196          proto_tree_add_item(msg_tree,hf_display_write_clear_left,
1197                              tvb,offset,1,FALSE);
1198          proto_tree_add_item(msg_tree,hf_display_write_clear_right,
1199                              tvb,offset,1,FALSE);
1200          proto_tree_add_item(msg_tree,hf_display_write_shift_left,
1201                              tvb,offset,1,FALSE);
1202          proto_tree_add_item(msg_tree,hf_display_write_shift_right,
1203                              tvb,offset,1,FALSE);
1204          proto_tree_add_item(msg_tree,hf_display_write_highlight,
1205                              tvb,offset,1,FALSE);
1206          offset+=1;msg_len-=1;
1207
1208          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1209          offset+=msg_len;
1210          proto_tree_add_item(msg_tree,hf_display_write_tag,tvb,offset,1,FALSE);
1211          offset+=1;msg_len-=1;
1212          set_ascii_item(msg_tree,tvb,offset,msg_len);
1213          offset+=msg_len;
1214          break;
1215       case 0x1f:
1216    /*address|yes control|yes tag|yes*/
1217          tmp_ti=proto_tree_add_text(msg_tree,tvb,offset,0,"Address");
1218          address_tree=proto_item_add_subtree(tmp_ti,ett_unistim);
1219          address_byte=tvb_get_guint8(tvb,offset);
1220          proto_tree_add_item(address_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1221          proto_tree_add_item(address_tree,hf_display_write_address_numeric,
1222                              tvb,offset,1,FALSE);
1223          proto_tree_add_item(address_tree,hf_display_write_address_context,
1224                              tvb,offset,1,FALSE);
1225          proto_tree_add_item(address_tree,hf_display_write_address_line,
1226                              tvb,offset,1,FALSE);
1227          proto_tree_add_item(address_tree,hf_display_write_address_soft_key,
1228                              tvb,offset,1,FALSE);
1229          proto_tree_add_item(address_tree,hf_display_write_address_soft_label,
1230                              tvb,offset,1,FALSE);
1231          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)==
1232                           DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG)
1233             proto_tree_add_item(address_tree,hf_display_write_address_softkey_id,
1234                                 tvb,offset,1,FALSE);
1235          offset+=1; msg_len-=1;
1236          proto_tree_add_item(msg_tree,hf_generic_string,
1237                              tvb,offset,msg_len,FALSE);
1238          offset+=msg_len;
1239          if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)==
1240                           DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG){
1241             proto_tree_add_item(address_tree,hf_display_write_address_char_pos,
1242                                 tvb,offset,1,FALSE);
1243             if((address_byte&DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)!=
1244                              DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG)
1245                offset+=1;msg_len-=1;
1246          }
1247          if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
1248                           DISPLAY_WRITE_ADDRESS_LINE_FLAG){
1249             proto_tree_add_item(address_tree,
1250                                 hf_display_write_address_line_number,
1251                                 tvb,offset,1,FALSE);
1252             offset+=1;msg_len-=1;
1253          }
1254          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1255          proto_tree_add_item(msg_tree,hf_display_write_cursor_move,
1256                              tvb,offset,1,FALSE);
1257          proto_tree_add_item(msg_tree,hf_display_write_clear_left,
1258                              tvb,offset,1,FALSE);
1259          proto_tree_add_item(msg_tree,hf_display_write_clear_right,
1260                              tvb,offset,1,FALSE);
1261          proto_tree_add_item(msg_tree,hf_display_write_shift_left,
1262                              tvb,offset,1,FALSE);
1263          proto_tree_add_item(msg_tree,hf_display_write_shift_right,
1264                              tvb,offset,1,FALSE);
1265          proto_tree_add_item(msg_tree,hf_display_write_highlight,
1266                              tvb,offset,1,FALSE);
1267          offset+=1;msg_len-=1;
1268          proto_tree_add_item(msg_tree,hf_display_write_tag,
1269                              tvb,offset,1,FALSE);
1270          offset+=1;msg_len-=1;
1271          set_ascii_item(msg_tree,tvb,offset,msg_len);
1272          offset+=msg_len;
1273          break;
1274       case 0x20:
1275    /*Context Info Bar Format*/
1276          while(msg_len>0){
1277             proto_tree_add_item(msg_tree,hf_display_context_format,tvb,offset,1,FALSE);
1278             proto_tree_add_item(msg_tree,hf_display_context_field,tvb,offset,1,FALSE);
1279             offset+=1;msg_len-=1;
1280          }
1281          break;
1282       case 0x21:
1283    /*Set Default Character Table Configuration VERY UGLY*/
1284          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1285          offset+=msg_len;
1286          break;
1287       case 0x22:
1288    /*Special Character Download*/
1289          proto_tree_add_item(msg_tree,hf_display_char_address,tvb,offset,1,FALSE);
1290          offset+=1;msg_len-=1;
1291          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1292          offset+=msg_len;
1293          break;
1294       case 0x23:
1295    /*Highlighted Field Definition*/
1296          highlight_cmd=tvb_get_guint8(tvb,offset);
1297          proto_tree_add_item(msg_tree,hf_display_cursor_numeric,tvb,offset,1,FALSE);
1298          proto_tree_add_item(msg_tree,hf_display_cursor_context ,tvb,offset,1,FALSE);
1299          proto_tree_add_item(msg_tree,hf_display_cursor_line,tvb,offset,1,FALSE);
1300          proto_tree_add_item(msg_tree,hf_display_cursor_softkey,tvb,offset,1,FALSE);
1301          proto_tree_add_item(msg_tree,hf_display_cursor_softkey_id,tvb,offset,1,FALSE);
1302          offset+=1;msg_len-=1;proto_tree_add_item(msg_tree,hf_display_hlight_start,tvb,offset,1,FALSE);
1303          offset+=1;msg_len-=1;
1304          proto_tree_add_item(msg_tree,hf_display_hlight_end,tvb,offset,1,FALSE);
1305          offset+=1;msg_len-=1;
1306          if(msg_len==0)
1307              break;
1308          if((highlight_cmd&DISPLAY_CURSOR_LINE)==DISPLAY_CURSOR_LINE){
1309            proto_tree_add_item(msg_tree,hf_display_cursor_char_pos,tvb,offset,1,FALSE);
1310            proto_tree_add_item(msg_tree,hf_display_cursor_line_number,tvb,offset,1,FALSE);
1311            offset+=1;msg_len-=1;
1312          }
1313          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1314          offset+=msg_len;
1315          break;
1316       case 0x24:
1317    /*Contrast*/
1318          proto_tree_add_item(msg_tree,hf_display_contrast,tvb,offset,1,FALSE);
1319          offset+=1;msg_len-=1;
1320          break;
1321       case 0x25:
1322    /*Caller Log Download*/
1323          proto_tree_add_item(msg_tree,hf_broadcast_hour,tvb,offset,msg_len,FALSE);
1324          offset+=1;msg_len-=1;
1325          proto_tree_add_item(msg_tree,hf_broadcast_minute,tvb,offset,msg_len,FALSE);
1326          offset+=1;msg_len-=1;
1327          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1328          offset+=msg_len;
1329          break;
1330       case 0x30:
1331    /*Layered Softkey Text Download*/
1332          proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1333          offset+=1;msg_len-=1;
1334          proto_tree_add_item(msg_tree,hf_display_layer_number,tvb,offset,1,FALSE);
1335          offset+=1;msg_len-=1;
1336          set_ascii_item(msg_tree,tvb,offset,msg_len);
1337          offset+=msg_len;
1338          break;
1339       case 0x31:
1340    /*Layered Softkey Clear*/
1341          proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1342          proto_tree_add_item(msg_tree,hf_display_layer_all_skeys,tvb,offset,msg_len,FALSE);
1343          offset+=1;msg_len-=1;
1344          proto_tree_add_item(msg_tree,hf_display_layer_number,tvb,offset,1,FALSE);
1345          offset+=1;msg_len-=1;
1346          break;
1347       case 0x32:
1348    /*Set Visible Softkey Layer*/
1349          proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1350          proto_tree_add_item(msg_tree,hf_display_layer_all_skeys,tvb,offset,msg_len,FALSE);
1351          offset+=1;msg_len-=1;
1352          proto_tree_add_item(msg_tree,hf_display_layer_number,tvb,offset,1,FALSE);
1353          offset+=1;msg_len-=1;
1354          break;
1355       case 0x33:
1356    /*Layered Softkey Cadence Download*/
1357          proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1358          proto_tree_add_item(msg_tree,hf_display_once_or_cyclic,tvb,offset,msg_len,FALSE);
1359          offset+=1;msg_len-=1;
1360          while(msg_len>0){
1361             proto_tree_add_item(msg_tree,hf_display_layer_number,tvb,offset,1,FALSE);
1362             offset+=1;msg_len-=1;
1363             proto_tree_add_item(msg_tree,hf_display_layer_duration,tvb,offset,1,FALSE);
1364             offset+=1;msg_len-=1;
1365          }
1366          break;
1367       case 0x34:
1368    /*Layered Softkey Cadencing On*/
1369         proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1370         offset+=1;msg_len-=1;
1371         break;
1372       case 0x35:
1373    /*Layered Softkey Cadencing Off*/
1374          proto_tree_add_item(msg_tree,hf_display_layer_skey_id,tvb,offset,1,FALSE);
1375          offset+=1;msg_len-=1;
1376          break;
1377       case 0xff:
1378    /*Reserved*/
1379          break;
1380       default:
1381          proto_tree_add_item(msg_tree,hf_generic_data,
1382                              tvb,offset,msg_len,FALSE);
1383          offset+=msg_len;
1384    }
1385
1386    return offset;
1387 }
1388    /*DONE*/
1389 static gint
1390 dissect_display_phone(proto_tree *msg_tree,
1391                       tvbuff_t *tvb,gint offset,guint msg_len){
1392    guint display_cmd;
1393    guint highlight_cmd;
1394    display_cmd=tvb_get_guint8(tvb,offset);
1395    proto_tree_add_item(msg_tree,hf_display_phone_cmd,tvb,offset,1,FALSE);
1396    offset+=1;msg_len-=1;
1397    switch(display_cmd){
1398       case 0x00:
1399    /*Display Manager Attributes Info*/
1400          proto_tree_add_item(msg_tree,hf_display_line_width,tvb,offset,1,FALSE);
1401          proto_tree_add_item(msg_tree,hf_display_lines,tvb,offset,1,FALSE);
1402          offset+=1;msg_len-=1;
1403          proto_tree_add_item(msg_tree,hf_display_softkey_width,tvb,offset,1,FALSE);
1404          proto_tree_add_item(msg_tree,hf_display_softkeys,tvb,offset,1,FALSE);
1405          proto_tree_add_item(msg_tree,hf_display_icon,tvb,offset,1,FALSE);
1406          offset+=1;msg_len-=1;
1407          proto_tree_add_item(msg_tree,hf_display_softlabel_key_width,tvb,offset,1,FALSE);
1408          proto_tree_add_item(msg_tree,hf_display_context_width,tvb,offset,1,FALSE);
1409          offset+=1;msg_len-=1;
1410          proto_tree_add_item(msg_tree,hf_display_numeric_width,tvb,offset,1,FALSE);
1411          proto_tree_add_item(msg_tree,hf_display_time_width,tvb,offset,1,FALSE);
1412          proto_tree_add_item(msg_tree,hf_display_date_width,tvb,offset,1,FALSE);
1413          offset+=1;msg_len-=1;
1414          proto_tree_add_item(msg_tree,hf_display_char_dload,tvb,offset,1,FALSE);
1415          proto_tree_add_item(msg_tree,hf_display_freeform_icon_dload,tvb,offset,1,FALSE);
1416          proto_tree_add_item(msg_tree,hf_display_icon_type,tvb,offset,1,FALSE);
1417          offset+=1;msg_len-=1;
1418          proto_tree_add_item(msg_tree,hf_display_charsets,tvb,offset,1,FALSE);
1419          offset+=1;msg_len-=1;
1420
1421          break;
1422       case 0x01:
1423    /*Contrast Level Report*/
1424          proto_tree_add_item(msg_tree,hf_display_contrast,tvb,offset,1,FALSE);
1425          offset+=1;msg_len-=1;
1426          break;
1427       case 0x02:
1428    /*Cursor Location Report*/
1429          proto_tree_add_item(msg_tree,hf_display_cursor_numeric,tvb,offset,1,FALSE);
1430          proto_tree_add_item(msg_tree,hf_display_cursor_context ,tvb,offset,1,FALSE);
1431          proto_tree_add_item(msg_tree,hf_display_cursor_line,tvb,offset,1,FALSE);
1432          proto_tree_add_item(msg_tree,hf_display_cursor_softkey,tvb,offset,1,FALSE);
1433          proto_tree_add_item(msg_tree,hf_display_cursor_softkey_id,tvb,offset,1,FALSE);
1434          offset+=1;msg_len-=1;
1435          proto_tree_add_item(msg_tree,hf_display_cursor_char_pos,tvb,offset,1,FALSE);
1436          proto_tree_add_item(msg_tree,hf_display_cursor_line_number,tvb,offset,1,FALSE);
1437          offset+=1;msg_len-=1;
1438          break;
1439       case 0x03:
1440    /*Highlight Status On*/
1441          highlight_cmd=tvb_get_guint8(tvb,offset);
1442          proto_tree_add_item(msg_tree,hf_display_cursor_numeric,tvb,offset,1,FALSE);
1443          proto_tree_add_item(msg_tree,hf_display_cursor_context ,tvb,offset,1,FALSE);
1444          proto_tree_add_item(msg_tree,hf_display_cursor_line,tvb,offset,1,FALSE);
1445          proto_tree_add_item(msg_tree,hf_display_cursor_softkey,tvb,offset,1,FALSE);
1446          proto_tree_add_item(msg_tree,hf_display_cursor_softkey_id,tvb,offset,1,FALSE);
1447          offset+=1;msg_len-=1;proto_tree_add_item(msg_tree,hf_display_hlight_start,tvb,offset,1,FALSE);
1448          offset+=1;msg_len-=1;
1449          proto_tree_add_item(msg_tree,hf_display_hlight_end,tvb,offset,1,FALSE);
1450          offset+=1;msg_len-=1;
1451          if((highlight_cmd&DISPLAY_CURSOR_LINE)==DISPLAY_CURSOR_LINE){
1452            proto_tree_add_item(msg_tree,hf_display_cursor_char_pos,tvb,offset,1,FALSE);
1453            proto_tree_add_item(msg_tree,hf_display_cursor_line_number,tvb,offset,1,FALSE);
1454            offset+=1;msg_len-=1;
1455          }
1456          break;
1457       case 0x04:
1458    /*Current Character Table Configuration Status   VERY UGLY*/
1459          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1460          offset+=msg_len;
1461          break;
1462       case 0x05:
1463    /*Default Character Table Configuration Status   VERY UGLY*/
1464          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1465          offset+=msg_len;
1466          break;
1467       case 0x06:
1468    /*Timer And Date Format Report*/
1469          proto_tree_add_item(msg_tree,hf_display_time_format,tvb,offset,1,FALSE);
1470          proto_tree_add_item(msg_tree,hf_display_date_format,tvb,offset,1,FALSE);
1471          offset+=1;msg_len-=1;
1472          break;
1473       case 0x07:
1474    /*Status Bar Icon State Report*/
1475          proto_tree_add_item(msg_tree,hf_icon_id,tvb,offset,msg_len,FALSE);
1476          offset+=1;msg_len-=1;
1477          proto_tree_add_item(msg_tree,hf_broadcast_icon_state,tvb,offset,msg_len,FALSE);
1478          proto_tree_add_item(msg_tree,hf_broadcast_icon_cadence,tvb,offset,msg_len,FALSE);
1479          offset+=1;msg_len-=1;
1480          break;
1481       case 0x0a:
1482    /*Highlight Status Off length = 3*/
1483          break;
1484       case 0xff:
1485    /*Reserved*/
1486          break;
1487       default:
1488          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1489          offset+=msg_len;
1490    }
1491
1492    return offset;
1493 }
1494
1495
1496 static gint
1497 dissect_key_indicator_switch(proto_tree *msg_tree,
1498                              tvbuff_t *tvb, gint offset,guint msg_len){
1499    guint key_cmd;
1500    key_cmd=tvb_get_guint8(tvb,offset);
1501    proto_tree_add_item(msg_tree,hf_key_switch_cmd,tvb,offset,1,FALSE);
1502    offset+=1;msg_len-=1;
1503    switch(key_cmd){
1504       case 0x00:
1505    /*LED Update*/
1506          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1507          proto_tree_add_item(msg_tree,hf_key_led_cadence,tvb,offset,1,FALSE);
1508          proto_tree_add_item(msg_tree,hf_key_led_id,tvb,offset,1,FALSE);
1509          offset+=1;msg_len-=1;
1510          break;
1511       case 0x01:
1512    /*Query Hookswitch length = 3 */
1513          break;
1514       case 0x02:
1515    /*User Activity Timer Stop length = 3*/
1516          break;
1517       case 0x03:
1518    /*User Activity Timer Start length = 3*/
1519          break;
1520       case 0x04:
1521    /*Downloadable Free Form Icon Access (Hardcoded) length of 3*/
1522          break;
1523       case 0x05:
1524    /*Downloadable Free Form Icon Access (Downloadable) length of 3*/
1525          break;
1526       case 0x06:
1527    /*Query Key/Indicator Manager*/
1528          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1529          offset+=msg_len;
1530          break;
1531       case 0x07:
1532    /*Key/Indicator Manager Options*/
1533          proto_tree_add_item(msg_tree,hf_keys_send_key_rel,tvb,offset,1,FALSE);
1534          proto_tree_add_item(msg_tree,hf_keys_enable_vol,tvb,offset,1,FALSE);
1535          proto_tree_add_item(msg_tree,hf_keys_conspic_prog_key,tvb,offset,1,FALSE);
1536          proto_tree_add_item(msg_tree,hf_keys_acd_super_control,tvb,offset,1,FALSE);
1537          proto_tree_add_item(msg_tree,hf_keys_local_dial_feedback,tvb,offset,1,FALSE);
1538          offset+=1;msg_len-=1;
1539          break;
1540       case 0x08:
1541    /*Logical Icon Mapping*/
1542          proto_tree_add_item(msg_tree,hf_key_icon_id,tvb,offset,1,FALSE);
1543          proto_tree_add_item(msg_tree,hf_keys_admin_command,tvb,offset,1,FALSE);
1544          offset+=1;msg_len-=1;
1545          proto_tree_add_item(msg_tree,hf_keys_logical_icon_id,tvb,offset,2,FALSE);
1546          offset+=2;msg_len-=2;
1547          break;
1548       case 0x09:
1549    /*Key Repeat Timer Download*/
1550          proto_tree_add_item(msg_tree,hf_keys_repeat_timer_one,tvb,offset,1,FALSE);
1551          offset+=1;msg_len-=1;
1552          proto_tree_add_item(msg_tree,hf_keys_repeat_timer_two,tvb,offset,1,FALSE);
1553          offset+=1;msg_len-=1;
1554          break;
1555       case 0x0a:
1556    /*Query LED State*/
1557          proto_tree_add_item(msg_tree,hf_keys_led_id,tvb,offset,1,FALSE);
1558          offset+=1;msg_len-=1;
1559          break;
1560       case 0x0b:
1561    /*Query Phone Icon State*/
1562          proto_tree_add_item(msg_tree,hf_keys_phone_icon_id,tvb,offset,1,FALSE);
1563          offset+=1;msg_len-=1;
1564          break;
1565       case 0x0c:
1566    /*Indicator Cadence Download*/
1567          while(msg_len>0){
1568             proto_tree_add_item(msg_tree,hf_keys_cadence_on_time,tvb,offset,1,FALSE);
1569             offset+=1;msg_len-=1;
1570             proto_tree_add_item(msg_tree,hf_keys_cadence_off_time,tvb,offset,1,FALSE);
1571             offset+=1;msg_len-=1;
1572          }
1573          break;
1574       case 0x0d:
1575    /*User Activity Timer Download*/
1576          proto_tree_add_item(msg_tree,hf_keys_user_activity_timeout,tvb,offset,1,FALSE);
1577          offset+=1;msg_len-=1;
1578          break;
1579       case 0x0e:
1580    /*Free Form Icon Download*/
1581          proto_tree_add_item(msg_tree,hf_key_icon_id,tvb,offset,1,FALSE);
1582          offset+=1;msg_len-=1;
1583          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1584          offset+=msg_len;
1585          break;
1586       case 0x0f:
1587    /*Phone Icon Update*/
1588          proto_tree_add_item(msg_tree,hf_key_icon_id,tvb,offset,1,FALSE);
1589          offset+=1;msg_len-=1;
1590          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1591          proto_tree_add_item(msg_tree,hf_broadcast_icon_state,tvb,offset,1,FALSE);
1592          proto_tree_add_item(msg_tree,hf_broadcast_icon_cadence,tvb,offset,1,FALSE);
1593          offset+=1;msg_len-=1;
1594          break;
1595       case 0xff:
1596    /*Reserved*/
1597          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1598          offset+=msg_len;
1599          break;
1600       default:
1601          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1602          offset+=msg_len;
1603    }
1604
1605    return offset;
1606 }
1607
1608 /*DONE*/
1609 static gint
1610 dissect_key_indicator_phone(proto_tree *msg_tree,
1611                             tvbuff_t *tvb,gint offset, guint msg_len){
1612    guint key_cmd;
1613    key_cmd=tvb_get_guint8(tvb,offset);
1614    proto_tree_add_item(msg_tree,hf_key_phone_cmd,tvb,offset,1,FALSE);
1615    offset+=1;msg_len-=1;
1616    switch(key_cmd){
1617       case 0x00:
1618    /*Key Event*/
1619          /* Set the tap info */
1620          uinfo->key_state = tvb_get_guint8(tvb,offset);
1621          uinfo->key_state >>= 6;
1622          /* Extract the key code */
1623          uinfo->key_val = (tvb_get_guint8(tvb,offset) & 0x3F);
1624
1625          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1626          proto_tree_add_item(msg_tree,hf_key_code,tvb,offset,1,FALSE);
1627          proto_tree_add_item(msg_tree,hf_key_command,tvb,offset,1,FALSE);
1628          offset+=1;
1629          break;
1630       case 0x01:
1631    /*LED Status Report*/
1632          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1633          offset+=msg_len;
1634          break;
1635       case 0x03:
1636    /*On Hook length = 3*/
1637          /* Set tap info.. */
1638          uinfo->hook_state = 0;
1639
1640          break;
1641       case 0x04:
1642    /*Off Hook length = 3*/
1643          /* Set tap info.. */
1644          uinfo->hook_state = 1;
1645
1646          break;
1647       case 0x05:
1648    /*User Activity Timer Expired length = 3*/
1649          break;
1650       case 0x06:
1651    /*Hookswitch State (on hook) length = 3*/
1652          break;
1653       case 0x07:
1654    /*Hookswitch State (off hook) length = 3*/
1655          break;
1656       case 0x08:
1657    /*Key/Indicator Manager Attributes Info*/
1658          proto_tree_add_item(msg_tree,hf_key_programmable_keys,tvb,offset,1,FALSE);
1659          proto_tree_add_item(msg_tree,hf_keys_soft_keys,tvb,offset,1,FALSE);
1660          offset+=1;msg_len-=1;
1661          proto_tree_add_item(msg_tree,hf_keys_hd_key,tvb,offset,1,FALSE);
1662          proto_tree_add_item(msg_tree,hf_keys_mute_key,tvb,offset,1,FALSE);
1663          proto_tree_add_item(msg_tree,hf_keys_quit_key,tvb,offset,1,FALSE);
1664          proto_tree_add_item(msg_tree,hf_keys_copy_key,tvb,offset,1,FALSE);
1665          proto_tree_add_item(msg_tree,hf_keys_mwi_key,tvb,offset,1,FALSE);
1666          offset+=1;msg_len-=1;
1667          proto_tree_add_item(msg_tree,hf_keys_num_nav_keys,tvb,offset,1,FALSE);
1668          proto_tree_add_item(msg_tree,hf_keys_num_conspic_keys,tvb,offset,1,FALSE);
1669          offset+=1;msg_len-=1;
1670
1671          break;
1672       case 0x09:
1673    /*Key/Indicator Manager Options Report*/
1674          proto_tree_add_item(msg_tree,hf_keys_send_key_rel,tvb,offset,1,FALSE);
1675          proto_tree_add_item(msg_tree,hf_keys_enable_vol,tvb,offset,1,FALSE);
1676          proto_tree_add_item(msg_tree,hf_keys_conspic_prog_key,tvb,offset,1,FALSE);
1677          proto_tree_add_item(msg_tree,hf_keys_acd_super_control,tvb,offset,1,FALSE);
1678          proto_tree_add_item(msg_tree,hf_keys_local_dial_feedback,tvb,offset,1,FALSE);
1679          offset+=1;msg_len-=1;
1680          break;
1681       case 0x0a:
1682    /*Phone Icon Status Report*/
1683          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1684          offset+=msg_len;
1685          break;
1686       case 0xff:
1687    /*Reserved*/
1688          break;
1689       default:
1690          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1691          offset+=msg_len;
1692    }
1693
1694    return offset;
1695 }
1696
1697
1698 /*Done*/
1699 static gint
1700 dissect_network_switch(proto_tree *msg_tree,
1701                        tvbuff_t *tvb,gint offset, guint msg_len){
1702    guint network_cmd;
1703    guint string_len;
1704
1705    network_cmd=tvb_get_guint8(tvb,offset);
1706    proto_tree_add_item(msg_tree,hf_network_switch_cmd,tvb,offset,1,FALSE);
1707    offset+=1;msg_len-=1;
1708    switch(network_cmd){
1709       case 0x02:
1710    /*Soft Reset done*/
1711          break;
1712       case 0x03:
1713    /*Hard Reset done*/
1714          break;
1715       case 0x04:
1716    /*Query Network Manager*/
1717          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1718          proto_tree_add_item(msg_tree,hf_net_diag_flag,tvb,offset,1,FALSE);
1719          proto_tree_add_item(msg_tree,hf_net_managers_flag,tvb,offset,1,FALSE);
1720          proto_tree_add_item(msg_tree,hf_net_attributes_flag,tvb,offset,1,FALSE);
1721          proto_tree_add_item(msg_tree,hf_net_serv_info_flag,tvb,offset,1,FALSE);
1722          proto_tree_add_item(msg_tree,hf_net_options_flag,tvb,offset,1,FALSE);
1723          proto_tree_add_item(msg_tree,hf_net_sanity_flag,tvb,offset,1,FALSE);
1724          offset+=1;
1725          break;
1726       case 0x05:
1727    /*Network Manager Options*/
1728          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1729          proto_tree_add_item(msg_tree,hf_net_enable_diag,tvb,offset,1,FALSE);
1730          proto_tree_add_item(msg_tree,hf_net_enable_rudp,tvb,offset,1,FALSE);
1731          offset+=1;
1732          break;
1733       case 0x06:
1734    /*QoS Configuration*/
1735          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1736          offset+=msg_len;
1737          break;
1738       case 0x09:
1739    /*Set RTCP Source Description Item*/
1740          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1741          offset+=msg_len;
1742          break;
1743       case 0x0b:
1744    /*Download Server Information*/
1745          proto_tree_add_item(msg_tree,hf_net_server_id,tvb,offset,1,FALSE);
1746          offset+=1;
1747          proto_tree_add_item(msg_tree,hf_net_server_port,tvb,offset,2,FALSE);
1748          offset+=2;
1749          proto_tree_add_item(msg_tree,hf_net_server_action,tvb,offset,1,FALSE);
1750          offset+=1;
1751          proto_tree_add_item(msg_tree,hf_net_server_retry_count,tvb,offset,1,FALSE);
1752          offset+=1;
1753          proto_tree_add_item(msg_tree,hf_net_server_failover_id,tvb,offset,1,FALSE);
1754          offset+=1;
1755          proto_tree_add_item(msg_tree,hf_net_server_ip_address,tvb,offset,4,FALSE);
1756          offset+=4;
1757          break;
1758       case 0x0c:
1759    /*Server Switch*/
1760          proto_tree_add_item(msg_tree,hf_net_server_id,tvb,offset,1,FALSE);
1761          offset+=1;
1762          break;
1763       case 0x0d:
1764    /*Query Network Configuration Element*/
1765          proto_tree_add_item(msg_tree,hf_net_server_config_element,
1766                              tvb,offset-1,1,FALSE);
1767          offset+=1;
1768          break;
1769       case 0x0e:
1770    /*Download Software Upgrade*/
1771          proto_tree_add_item(msg_tree,hf_net_file_xfer_mode,tvb,offset,1,FALSE);
1772          proto_tree_add_item(msg_tree,hf_net_force_download,tvb,offset,1,FALSE);
1773          proto_tree_add_item(msg_tree,hf_net_use_file_server_port,tvb,offset,1,FALSE);
1774          proto_tree_add_item(msg_tree,hf_net_use_local_port,tvb,offset,1,FALSE);
1775          offset+=1;msg_len-=1;
1776          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,1,FALSE);
1777          offset+=1;msg_len-=1;
1778          string_len=tvb_strsize(tvb,offset);
1779          proto_tree_add_item(msg_tree,hf_net_full_pathname,tvb,offset,string_len,ENC_NA);
1780          offset+=string_len;msg_len-=string_len;
1781          string_len=tvb_strsize(tvb,offset);
1782          proto_tree_add_item(msg_tree,hf_net_file_identifier,tvb,offset,string_len,ENC_NA);
1783          offset+=string_len;msg_len-=string_len;
1784          proto_tree_add_item(msg_tree,hf_net_file_server_port,tvb,offset,2,FALSE);
1785          offset+=2;msg_len-=2;
1786          proto_tree_add_item(msg_tree,hf_net_local_port,tvb,offset,2,FALSE);
1787          offset+=2;msg_len-=2;
1788          proto_tree_add_item(msg_tree,hf_net_file_server_address,tvb,offset,4,FALSE);
1789          offset+=4;msg_len-=4;
1790          break;
1791       case 0x0f:
1792    /*Set RTCP Report Interval*/
1793          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1794          offset+=msg_len;
1795          break;
1796       case 0x10:
1797    /*Set Primary Server*/
1798          proto_tree_add_item(msg_tree,hf_net_server_id,tvb,offset,1,FALSE);
1799          offset+=1;
1800          break;
1801       case 0x12:
1802    /*Reset Watchdog*/
1803          proto_tree_add_item(msg_tree,hf_net_server_time_out,
1804                              tvb,offset,2,FALSE);
1805          offset+=2;
1806          break;
1807       case 0x13:
1808    /*Set Recovery Procedure Time Interval*/
1809          proto_tree_add_item(msg_tree,hf_net_server_recovery_time_low,
1810                              tvb,offset,2,FALSE);
1811          offset+=2;
1812          proto_tree_add_item(msg_tree,hf_net_server_recovery_time_high,
1813                              tvb,offset,2,FALSE);
1814          offset+=2;
1815          break;
1816       case 0x14:
1817    /*Transport Reliability Layer Parameters Download*/
1818          proto_tree_add_item(msg_tree,hf_generic_data,
1819                              tvb,offset,msg_len,FALSE);
1820          offset+=msg_len;
1821          break;
1822       case 0xff:
1823    /*Reserved*/
1824          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1825          offset+=msg_len;
1826          break;
1827       default:
1828          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1829          offset+=msg_len;
1830
1831    }
1832
1833    return offset;
1834 }
1835
1836 /*DONE*/
1837 static gint
1838 dissect_expansion_switch(proto_tree *msg_tree,
1839                       tvbuff_t *tvb,gint offset, guint msg_len){
1840    guint expansion_cmd;
1841
1842
1843    expansion_cmd=tvb_get_guint8(tvb,offset);
1844    proto_tree_add_item(msg_tree,hf_expansion_switch_cmd,tvb,offset,1,FALSE);
1845    offset+=1; msg_len-=1;
1846    switch(expansion_cmd){
1847       case 0x17:
1848          break;
1849       case 0x57:
1850         /*skip a byte for now, not sure what it means*/
1851         offset+=1;
1852         msg_len-=1;
1853
1854
1855          proto_tree_add_item(msg_tree,hf_expansion_softlabel_number,tvb,
1856                           offset,1,FALSE);
1857          offset+=1;
1858          msg_len-=1;
1859
1860          set_ascii_item(msg_tree,tvb,offset,msg_len);
1861          break;
1862       case 0x59:
1863          /*skip a byte for now, not sure what it means*/
1864          offset+=1;
1865          msg_len-=1;
1866          proto_tree_add_item(msg_tree,hf_expansion_softlabel_number,tvb,
1867                           offset,1,FALSE);
1868          offset+=1;
1869          msg_len-=1;
1870          proto_tree_add_item(msg_tree,hf_basic_bit_field,
1871                              tvb,offset,1,FALSE);
1872          proto_tree_add_item(msg_tree,hf_broadcast_icon_state,
1873                              tvb,offset,1,FALSE);
1874          proto_tree_add_item(msg_tree,hf_broadcast_icon_cadence,
1875                              tvb,offset,1,FALSE);
1876          offset+=1;
1877          msg_len-=1;
1878          break;
1879    }
1880    offset+=msg_len;
1881    return offset;
1882 }
1883
1884 static gint
1885 dissect_expansion_phone(proto_tree *msg_tree,
1886                       tvbuff_t *tvb,gint offset, guint msg_len){
1887    guint expansion_cmd;
1888    guint key_number;
1889
1890    expansion_cmd=tvb_get_guint8(tvb,offset);
1891    proto_tree_add_item(msg_tree,hf_expansion_phone_cmd,tvb,offset,1,FALSE);
1892    offset+=1; msg_len-=1;
1893    key_number=(tvb_get_guint8(tvb,offset))-64;
1894
1895    switch(expansion_cmd){
1896       case 0x59:
1897          proto_tree_add_text(msg_tree,tvb,offset,msg_len,"Module Key Number: %i",key_number);
1898          offset+=1;
1899          msg_len-=1;
1900          break;
1901    }
1902    offset+=msg_len;
1903    return offset;
1904 }
1905
1906 static gint
1907 dissect_network_phone(proto_tree *msg_tree,
1908                       tvbuff_t *tvb,gint offset, guint msg_len){
1909    guint network_cmd;
1910    proto_tree *server_tree;
1911    proto_item *server;
1912    guint i;
1913    network_cmd=tvb_get_guint8(tvb,offset);
1914    proto_tree_add_item(msg_tree,hf_network_phone_cmd,tvb,offset,1,FALSE);
1915    offset+=1;msg_len-=1;
1916    switch(network_cmd){
1917       case 0x00:
1918    /*Soft Reset Ack done length = 3*/
1919          break;
1920       case 0x01:
1921    /*Sanity OK done length = 3*/
1922          break;
1923       case 0x02:
1924    /*Network Manager Attributes Info*/
1925          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1926          offset+=msg_len;
1927          break;
1928       case 0x03:
1929    /*Network Manager Diagnostic Info*/
1930          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
1931          proto_tree_add_item(msg_tree,hf_net_phone_rx_ovr_flag,
1932                              tvb,offset,1,FALSE);
1933          proto_tree_add_item(msg_tree,hf_net_phone_tx_ovr_flag,
1934                              tvb,offset,1,FALSE);
1935          proto_tree_add_item(msg_tree,hf_net_phone_rx_empty_flag,
1936                              tvb,offset,1,FALSE);
1937          proto_tree_add_item(msg_tree,hf_net_phone_invalid_msg_flag,
1938                              tvb,offset,1,FALSE);
1939          proto_tree_add_item(msg_tree,hf_net_phone_eeprom_insane_flag,
1940                              tvb,offset,1,FALSE);
1941          proto_tree_add_item(msg_tree,hf_net_phone_eeprom_unsafe_flag,
1942                              tvb,offset,1,FALSE);
1943          offset+=1;
1944          break;
1945       case 0x04:
1946    /*Manager IDs*/
1947          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1948          offset+=msg_len;
1949          break;
1950       case 0x05:
1951    /*Network Manager Options Report*/
1952          proto_tree_add_boolean(msg_tree,hf_net_phone_diag,tvb,offset,1,FALSE);
1953          proto_tree_add_item(msg_tree,hf_net_phone_rudp,tvb,offset,1,FALSE);
1954          offset+=1;
1955          break;
1956       case 0x08:
1957    /*Resume Connection with Server done*/
1958          break;
1959       case 0x09:
1960    /*Suspend Connection with Server done*/
1961          break;
1962       case 0x0b:
1963    /*Network Configuration Element Report*/
1964          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
1965          offset+=msg_len;
1966          break;
1967       case 0x0c:
1968    /*Server Information Report*/
1969          proto_tree_add_item(msg_tree,hf_net_phone_primary_server_id,
1970                              tvb,offset,1,FALSE);
1971          offset+=1;msg_len-=1;
1972          for (i=1; msg_len>8; i++){
1973    /*if less than 9 not full report so punt*/
1974 /*          guint16 port_num;
1975             port_num=tvb_get_ntohs(tvb,offset);
1976             if(port_num<1064)
1977                break;
1978 */
1979             server=proto_tree_add_text(msg_tree,tvb,offset,9,
1980                                        "Server (S%d) Server ID: %X",i,i-1);
1981             server_tree=proto_item_add_subtree(server,ett_unistim);
1982             proto_tree_add_item(server_tree,
1983                                 hf_net_phone_server_port,
1984                                 tvb,offset,2,FALSE);
1985             offset+=2;msg_len-=2;
1986             proto_tree_add_item(server_tree,
1987                                 hf_net_phone_server_action,
1988                                 tvb,offset,1,FALSE);
1989             offset+=1;msg_len-=1;
1990             proto_tree_add_item(server_tree,
1991                                 hf_net_phone_server_retry_count,
1992                                 tvb,offset,1,FALSE);
1993             offset+=1;msg_len-=1;
1994             proto_tree_add_item(server_tree,
1995                                 hf_net_phone_server_failover_id,
1996                                 tvb,offset,1,FALSE);
1997             offset+=1;msg_len-=1;
1998             proto_tree_add_item(server_tree,hf_net_phone_server_ip,
1999                                 tvb,offset,4,FALSE);
2000             offset+=4;msg_len-=4;
2001          }
2002          break;
2003       case 0xff:
2004    /*Reserved*/
2005          break;
2006       default:
2007          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2008          offset+=msg_len;
2009    }
2010
2011    return offset;
2012 }
2013 /*DONE*/
2014 static gint
2015 dissect_audio_switch(proto_tree *msg_tree,packet_info *pinfo,
2016                                     tvbuff_t *tvb,gint offset,guint msg_len){
2017    proto_tree *param_tree;
2018    proto_item *param;
2019    guint audio_cmd;
2020    guint apb_op_code;
2021    guint apb_data_len;
2022    guint vocoder_param;
2023    audio_cmd=tvb_get_guint8(tvb,offset);
2024    proto_tree_add_item(msg_tree,hf_audio_switch_cmd,tvb,offset,1,FALSE);
2025    offset+=1;msg_len-=1;
2026    switch(audio_cmd){
2027    case 0x00:
2028    /*Query Audio Manager*/
2029       proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2030       proto_tree_add_item(msg_tree,hf_audio_mgr_attr,tvb,offset,1,FALSE);
2031       proto_tree_add_item(msg_tree,hf_audio_mgr_opts,tvb,offset,1,FALSE);
2032       proto_tree_add_item(msg_tree,hf_audio_mgr_alert,tvb,offset,1,FALSE);
2033       proto_tree_add_item(msg_tree,hf_audio_mgr_adj_rx_vol,tvb,offset,1,FALSE);
2034       proto_tree_add_item(msg_tree,hf_audio_mgr_def_rx_vol,tvb,offset,1,FALSE);
2035       proto_tree_add_item(msg_tree,hf_audio_mgr_handset,tvb,offset,1,FALSE);
2036       proto_tree_add_item(msg_tree,hf_audio_mgr_headset,tvb,offset,1,FALSE);
2037       offset+=1;
2038       proto_tree_add_item(msg_tree,hf_audio_default_rx_vol_id,
2039                           tvb,offset,1,FALSE);
2040       offset+=1;
2041       break;
2042    case 0x01:
2043    /*Query Supervisor Headset Status*/
2044       /*done*/
2045       break;
2046    case 0x02:
2047    /*Audio Manager Options*/
2048       proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2049       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_max_vol,
2050                           tvb,offset,1,FALSE);
2051       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_adj_vol,
2052                           tvb,offset,1,FALSE);
2053       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_aa_rx_vol_rpt,
2054                           tvb,offset,1,FALSE);
2055       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_hs_on_air,
2056                           tvb,offset,1,FALSE);
2057       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_hd_on_air,
2058                           tvb,offset,1,FALSE);
2059       proto_tree_add_item(msg_tree,hf_audio_mgr_opt_noise_squelch,
2060                           tvb,offset,1,FALSE);
2061       offset+=1;
2062          break;
2063       case 0x04:
2064    /*Mute/Unmute*/
2065          while(msg_len>0){
2066             proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2067             proto_tree_add_item(msg_tree,hf_audio_mgr_mute,tvb,offset,1,FALSE);
2068             proto_tree_add_item(msg_tree,hf_audio_mgr_tx_rx,tvb,offset,1,FALSE);
2069             offset+=1;msg_len-=1;
2070             proto_tree_add_item(msg_tree,hf_audio_mgr_stream_id,
2071                                 tvb,offset,1,FALSE);
2072             offset+=1;msg_len-=1;
2073          }
2074          break;
2075       case 0x10:
2076    /*Transducer Based Tone On*/
2077          proto_tree_add_item(msg_tree,
2078                              hf_audio_mgr_transducer_based_tone_id,
2079                              tvb,offset,1,FALSE);
2080          proto_tree_add_item(msg_tree,hf_audio_mgr_attenuated,
2081                              tvb,offset,1,FALSE);
2082          offset+=1;
2083          break;
2084       case 0x11:
2085    /*Transducer Based Tone Off*/
2086          proto_tree_add_item(msg_tree,hf_audio_mgr_transducer_based_tone_id,
2087                              tvb,offset,1,FALSE);
2088          offset+=1;
2089          break;
2090       case 0x12:
2091    /*Alerting Tone Configuration*/
2092          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2093          proto_tree_add_item(msg_tree,hf_audio_mgr_warbler_select,
2094                              tvb,offset,1,FALSE);
2095          proto_tree_add_item(msg_tree,hf_audio_mgr_transducer_routing,
2096                              tvb,offset,1,FALSE);
2097          offset+=1;
2098          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2099          proto_tree_add_item(msg_tree,hf_audio_mgr_tone_vol_range,
2100                              tvb,offset,1,FALSE);
2101          proto_tree_add_item(msg_tree,hf_audio_mgr_cadence_select,
2102                              tvb,offset,1,FALSE);
2103          offset+=1;
2104          break;
2105       case 0x13:
2106    /*Special Tone Configuration*/
2107          proto_tree_add_item(msg_tree,hf_audio_mgr_transducer_routing,
2108                              tvb,offset,1,FALSE);
2109          offset+=1;
2110          proto_tree_add_item(msg_tree,hf_audio_mgr_tone_vol_range,
2111                              tvb,offset,1,FALSE);
2112          offset+=1;
2113          proto_tree_add_item(msg_tree,hf_audio_special_tone,tvb,offset,1,FALSE);
2114          offset+=1;
2115          break;
2116       case 0x14:
2117    /*Paging Tone Configuration*/
2118          proto_tree_add_item(msg_tree,hf_audio_mgr_transducer_routing,
2119                              tvb,offset,1,FALSE);
2120          offset+=1;
2121          proto_tree_add_item(msg_tree,hf_audio_mgr_tone_vol_range,
2122                              tvb,offset,1,FALSE);
2123          proto_tree_add_item(msg_tree,hf_audio_mgr_cadence_select,
2124                              tvb,offset,1,FALSE);
2125          offset+=1;
2126          break;
2127       case 0x15:
2128    /*Alerting Tone Cadence Download*/
2129          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2130          offset+=msg_len;
2131          break;
2132    /*TODO UGLY*/
2133       case 0x17:
2134    /*Paging Tone Cadence Download*/
2135          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2136          offset+=msg_len;
2137          break;
2138    /*TODO UGLY*/
2139       case 0x18:
2140    /*Transducer Based Tone Volume Level*/
2141          proto_tree_add_item(msg_tree,hf_basic_bit_field,
2142                              tvb,offset,1,FALSE);
2143          proto_tree_add_item(msg_tree,
2144                              hf_audio_mgr_transducer_based_tone_id,
2145                              tvb,offset,1,FALSE);
2146          proto_tree_add_item(msg_tree,hf_audio_tone_level,tvb,offset,1,FALSE);
2147          offset+=1;
2148          break;
2149       case 0x1a:
2150    /*Visual Transducer Based Tone Enable*/
2151          proto_tree_add_item(msg_tree,hf_audio_visual_tones,
2152                              tvb,offset,1,FALSE);
2153          offset+=1;
2154          break;
2155       case 0x1b:
2156    /*Stream Based Tone On*/
2157          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2158          proto_tree_add_item(msg_tree,hf_audio_stream_based_tone_id,
2159                              tvb,offset,1,FALSE);
2160          proto_tree_add_item(msg_tree,hf_audio_stream_based_tone_rx_tx,
2161                              tvb,offset,1,FALSE);
2162          proto_tree_add_item(msg_tree,hf_audio_stream_based_tone_mute,
2163                              tvb,offset,1,FALSE);
2164          offset+=1;
2165          proto_tree_add_item(msg_tree,hf_audio_stream_id,tvb,offset,1,FALSE);
2166          offset+=1;
2167          proto_tree_add_item(msg_tree,hf_audio_stream_based_volume,tvb,offset,1,FALSE);
2168          offset+=1;
2169          break;
2170       case 0x1c:
2171    /*Stream Based Tone Off*/
2172          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2173          proto_tree_add_item(msg_tree,hf_audio_stream_based_tone_id,
2174                              tvb,offset,1,FALSE);
2175          proto_tree_add_item(msg_tree,hf_audio_stream_based_tone_rx_tx,
2176                              tvb,offset,1,FALSE);
2177          offset+=1;
2178          proto_tree_add_item(msg_tree,hf_audio_stream_id,tvb,offset,1,FALSE);
2179          offset+=1;
2180          break;
2181       case 0x1d:
2182    /*Stream Based Tone Frequency Component List Download*/
2183          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2184          offset+=msg_len;
2185          break;
2186       case 0x1e:
2187    /*Stream Based Tone Cadence Download*/
2188          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2189          offset+=msg_len;
2190          break;
2191       case 0x20:
2192    /*Select Adjustable Rx Volume*/
2193          proto_tree_add_item(msg_tree,hf_audio_default_rx_vol_id,
2194                              tvb,offset,1,FALSE);
2195          break;
2196       case 0x21:
2197    /*Set APB's Rx Volume Level*/
2198          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2199          offset+=msg_len;
2200          break;
2201       case 0x22:
2202    /*Change Adjustable Rx Volume (quieter) DONE*/
2203          proto_tree_add_item(msg_tree,hf_generic_data,
2204                              tvb,offset,msg_len,FALSE);
2205          offset+=msg_len;
2206          break;
2207       case 0x23:
2208    /*Change Adjustable Rx Volume (louder) DONE*/
2209          proto_tree_add_item(msg_tree,hf_generic_data,
2210                              tvb,offset,msg_len,FALSE);
2211          offset+=msg_len;
2212          break;
2213       case 0x24:
2214    /*Adjust Default Rx Volume(quieter)*/
2215          proto_tree_add_item(msg_tree,hf_audio_default_rx_vol_id,
2216                              tvb,offset,1,FALSE);
2217          break;
2218       case 0x25:
2219    /*Adjust Default Rx Volume(louder)*/
2220          proto_tree_add_item(msg_tree,hf_audio_default_rx_vol_id,
2221                              tvb,offset,1,FALSE);
2222          break;
2223       case 0x28:
2224    /*APB Download*/
2225          proto_tree_add_item(msg_tree,hf_audio_apb_number,tvb,offset,1,FALSE);
2226          offset+=1;msg_len-=1;
2227          while(msg_len>0){
2228             apb_op_code=tvb_get_guint8(tvb,offset);
2229             proto_tree_add_item(msg_tree,hf_audio_apb_op_code,tvb,
2230                                 offset,1,FALSE);
2231             offset+=1;msg_len-=1;
2232             if(apb_op_code>0x39){
2233    /*should have a len + data*/
2234                apb_data_len=tvb_get_guint8(tvb,offset);
2235                proto_tree_add_item(msg_tree,hf_audio_apb_param_len,tvb,
2236                                    offset,1,FALSE);
2237                offset+=1;msg_len-=1;
2238                proto_tree_add_item(msg_tree,hf_audio_apb_data,tvb,
2239                                    offset,apb_data_len,FALSE);
2240                offset+=apb_data_len;msg_len-=apb_data_len;
2241             }
2242          }
2243          break;
2244       case 0x30:
2245    /*Open Audio Stream*/
2246          /* Set the tap info */
2247          uinfo->stream_connect = 1;
2248
2249          proto_tree_add_item(msg_tree,hf_audio_rx_stream_id,tvb,offset,1,FALSE);
2250          offset+=1;msg_len-=1;
2251          proto_tree_add_item(msg_tree,hf_audio_tx_stream_id,tvb,offset,1,FALSE);
2252          offset+=1;msg_len-=1;
2253          proto_tree_add_item(msg_tree,hf_rx_vocoder_type,tvb,offset,1,FALSE);
2254          offset+=1;msg_len-=1;
2255          proto_tree_add_item(msg_tree,hf_tx_vocoder_type,tvb,offset,1,FALSE);
2256          offset+=1;msg_len-=1;
2257          proto_tree_add_item(msg_tree,hf_frames_per_packet,tvb,offset,1,FALSE);
2258          offset+=1;msg_len-=1;
2259          proto_tree_add_item(msg_tree,hf_audio_tos,tvb,offset,1,FALSE);
2260          proto_tree_add_item(msg_tree,hf_audio_precedence,tvb,offset,1,FALSE);
2261          proto_tree_add_item(msg_tree,hf_audio_frf_11,tvb,offset,1,FALSE);
2262          offset+=1;msg_len-=1;
2263          proto_tree_add_item(msg_tree,hf_rtcp_bucket_id,
2264                              tvb,offset,1,FALSE);
2265          offset+=1;msg_len-=1;
2266          proto_tree_add_item(msg_tree,hf_generic_data,
2267                              tvb,offset,4,FALSE);
2268          offset+=4;msg_len-=4;
2269          proto_tree_add_item(msg_tree,hf_audio_lcl_rtp_port,
2270                              tvb,offset,2,FALSE);
2271          offset+=2;msg_len-=2;
2272          proto_tree_add_item(msg_tree,hf_audio_lcl_rtcp_port,
2273                              tvb,offset,2,FALSE);
2274          offset+=2;msg_len-=2;
2275
2276          proto_tree_add_item(msg_tree,hf_audio_far_rtp_port,
2277                              tvb,offset,2,FALSE);
2278          offset+=2;msg_len-=2;
2279          proto_tree_add_item(msg_tree,hf_audio_far_rtcp_port,
2280                              tvb,offset,2,FALSE);
2281          offset+=2;msg_len-=2;
2282
2283          /* Sometimes the open stream does not specify an endpoint */
2284          /* In this circumstance the packet is truncated at the far end */
2285          /* rtp port */
2286          if(msg_len > 0){
2287             proto_tree_add_item(msg_tree,hf_audio_far_ip_add,tvb,offset,4,FALSE);
2288             offset+=4;msg_len-=4;
2289             {
2290                guint32 far_ip_addr;
2291                address far_addr;
2292                guint16 far_port;
2293
2294                far_ip_addr = tvb_get_ipv4(tvb, offset-4);
2295                SET_ADDRESS(&far_addr, AT_IPv4, 4, &far_ip_addr);
2296
2297                far_port = tvb_get_ntohs(tvb, offset-8);
2298                rtp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->fd->num, FALSE, NULL);
2299
2300                far_port = tvb_get_ntohs(tvb, offset-6);
2301                rtcp_add_address(pinfo, &far_addr, far_port, 0, "UNISTIM", pinfo->fd->num);
2302             }
2303          }
2304          break;
2305       case 0x31:
2306    /*Close Audio Stream*/
2307          /* Set the tap info */
2308          uinfo->stream_connect = 0;
2309
2310          proto_tree_add_item(msg_tree,hf_audio_rx_stream_id,tvb,offset,1,FALSE);
2311          offset+=1;msg_len-=1;
2312          proto_tree_add_item(msg_tree,hf_audio_tx_stream_id,tvb,offset,1,FALSE);
2313          offset+=1;msg_len-=1;
2314          break;
2315       case 0x32:
2316    /*Connect Transducer*/
2317          /* Tap info again */
2318          uinfo->trans_connect = 1;
2319
2320          proto_tree_add_item(msg_tree,hf_basic_bit_field, tvb,offset,1,FALSE);
2321          proto_tree_add_item(msg_tree,hf_audio_transducer_pair,tvb,offset,1,FALSE);
2322          proto_tree_add_item(msg_tree,hf_audio_rx_enable,tvb,offset,1,FALSE);
2323          proto_tree_add_item(msg_tree,hf_audio_tx_enable,tvb,offset,1,FALSE);
2324          offset+=1;msg_len-=1;
2325          proto_tree_add_item(msg_tree,hf_basic_bit_field, tvb,offset,1,FALSE);
2326          proto_tree_add_item(msg_tree,hf_audio_apb_number,tvb,offset,1,FALSE);
2327          proto_tree_add_item(msg_tree,hf_audio_sidetone_disable,tvb,offset,1,FALSE);
2328          proto_tree_add_item(msg_tree,hf_audio_destruct_additive,tvb,offset,1,FALSE);
2329          proto_tree_add_item(msg_tree,hf_audio_dont_force_active,tvb,offset,1,FALSE);
2330          offset+=1;msg_len-=1;
2331          while(msg_len>0){
2332             proto_tree_add_item(msg_tree,hf_audio_mgr_stream_id,tvb,offset,1,TRUE);
2333             offset+=1;msg_len-=1;
2334          }
2335          break;
2336       case 0x34:
2337    /*Filter Block Download*/
2338          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2339          offset+=msg_len;
2340          break;
2341       case 0x37:
2342    /*Query RTCP Statistics*/
2343          proto_tree_add_item(msg_tree,hf_audio_rtcp_bucket_id,tvb,offset,1,FALSE);
2344          proto_tree_add_item(msg_tree,hf_audio_clear_bucket,tvb,offset,1,FALSE);
2345
2346          offset+=1;msg_len-=1;
2347          break;
2348       case 0x38:
2349    /*Configure Vocoder Parameters*/
2350          proto_tree_add_item(msg_tree,hf_audio_mgr_stream_id,tvb,offset,1,TRUE);
2351          offset+=1;msg_len-=1;
2352          proto_tree_add_item(msg_tree,hf_audio_vocoder_id,tvb,offset,1,FALSE),
2353          offset+=1;msg_len-=1;
2354          while(msg_len>0){
2355             param=proto_tree_add_text(msg_tree,tvb,offset,0,"Param");
2356             param_tree=proto_item_add_subtree(param,ett_unistim);
2357             vocoder_param=tvb_get_guint8(tvb,offset);
2358             proto_tree_add_item(param_tree,hf_basic_bit_field,
2359                                 tvb,offset,1,FALSE);
2360             proto_tree_add_item(param_tree,hf_audio_vocoder_param,
2361                                 tvb,offset,1,FALSE);
2362             proto_tree_add_item(param_tree,hf_audio_vocoder_entity,
2363                                 tvb,offset,1,FALSE);
2364             offset+=1;msg_len-=1;
2365             if((vocoder_param&0x0a)==0x0a){
2366                proto_tree_add_item(param_tree,hf_audio_vocoder_annexa,
2367                                    tvb,offset,1,FALSE);
2368                proto_tree_add_item(param_tree,hf_audio_vocoder_annexb,
2369                                    tvb,offset,1,FALSE);
2370                offset+=1;msg_len-=1;
2371             }
2372             else if((vocoder_param&0x0b)==0x0b){
2373                proto_tree_add_item(param_tree,hf_audio_sample_rate,
2374                                    tvb,offset,1,FALSE);
2375                offset+=1;msg_len-=1;
2376             }
2377             else if((vocoder_param&0x0c)==0x0c){
2378                proto_tree_add_item(param_tree,hf_audio_rtp_type,
2379                                    tvb,offset,1,FALSE);
2380                offset+=1;msg_len-=1;
2381             }
2382             else if((vocoder_param&0x20)==0x20){
2383                proto_tree_add_item(param_tree,hf_audio_bytes_per_frame,
2384                                    tvb,offset,2,FALSE);
2385                offset+=2;msg_len-=2;
2386             }
2387          }
2388          break;
2389       case 0x39:
2390    /*Query RTCP Bucket's SDES Information*/
2391          proto_tree_add_item(msg_tree,hf_audio_source_descr,tvb,offset,msg_len,FALSE);
2392          proto_tree_add_item(msg_tree,hf_audio_sdes_rtcp_bucket,tvb,offset,msg_len,FALSE);
2393          offset+=1;msg_len-=1;
2394          break;
2395       case 0x3a:
2396    /*Jitter Buffer Parameters Configuration*/
2397          proto_tree_add_item(msg_tree,hf_audio_rx_stream_id,tvb,offset,1,FALSE);
2398          offset+=1;msg_len-=1;
2399          proto_tree_add_item(msg_tree,hf_audio_desired_jitter,tvb,offset,1,FALSE);
2400          offset+=1;msg_len-=1;
2401          proto_tree_add_item(msg_tree,hf_audio_high_water_mark,tvb,offset,1,FALSE);
2402          offset+=1;msg_len-=1;
2403          proto_tree_add_item(msg_tree,hf_audio_early_packet_resync_thresh,tvb,
2404                              offset,4,FALSE);
2405          offset+=4;msg_len-=4;
2406          proto_tree_add_item(msg_tree,hf_audio_late_packet_resync_thresh,tvb,
2407                              offset,4,FALSE);
2408          offset+=4;msg_len-=4;
2409          break;
2410       case 0x3b:
2411    /*Resolve Port Mapping*/
2412          proto_tree_add_item(msg_tree,hf_audio_resolve_phone_port,tvb,offset,2,FALSE);
2413          offset+=2;msg_len-=2;
2414          proto_tree_add_item(msg_tree,hf_audio_far_end_echo_port,tvb,offset,2,FALSE);
2415          offset+=2;msg_len-=2;
2416          proto_tree_add_item(msg_tree,hf_audio_far_end_ip_address,tvb,offset,4,FALSE);
2417          offset+=4;msg_len-=4;
2418          break;
2419       case 0x3c:
2420    /*Port Mapping Discovery Ack*/
2421          proto_tree_add_item(msg_tree,hf_audio_nat_port,tvb,offset,2,FALSE);
2422          offset+=2;msg_len-=2;
2423          proto_tree_add_item(msg_tree,hf_audio_nat_ip_address,tvb,offset,4,FALSE);
2424          offset+=4;msg_len-=4;
2425          break;
2426       case 0x3d:
2427    /*Query Audio Stream Status*/
2428          proto_tree_add_item(msg_tree,hf_audio_direction_code,tvb,offset,1,FALSE);
2429          offset+=1;msg_len-=1;
2430          proto_tree_add_item(msg_tree,hf_audio_mgr_stream_id,tvb,offset,1,FALSE);
2431          offset+=1;msg_len-=1;
2432          break;
2433       case 0xff:
2434    /*Reserved*/
2435       default:
2436          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2437          offset+=msg_len;
2438    }
2439
2440    return offset;
2441 }
2442
2443 /*DONE*/
2444 static gint
2445 dissect_audio_phone(proto_tree *msg_tree,
2446                                  tvbuff_t *tvb,gint offset,guint msg_len){
2447    guint audio_cmd;
2448    guint apb_op_code;
2449    guint apb_data_len;
2450    guint stream_dir;
2451    guint stream_state;
2452    audio_cmd=tvb_get_guint8(tvb,offset);
2453    proto_tree_add_item(msg_tree,hf_audio_phone_cmd,tvb,offset,1,FALSE);
2454    offset+=1;msg_len-=1;
2455    switch(audio_cmd){
2456       case 0x00:
2457    /*Handset Connected length =3*/
2458          /* Set the tap info */
2459          uinfo->hook_state = 1;
2460          break;
2461       case 0x01:
2462    /*Handset Disconnected length =3*/
2463          /* Set the tap info */
2464          uinfo->hook_state = 0;
2465          break;
2466       case 0x02:
2467    /*Headset Connected length =3*/
2468          /* Set the tap info */
2469          uinfo->hook_state = 1;
2470          break;
2471       case 0x03:
2472    /*Headset Disconnected length =3*/
2473          /* Set the tap info */
2474          uinfo->hook_state = 0;
2475          break;
2476       case 0x04:
2477    /*Supervisor Headset Connected length =3*/
2478          /* Set the tap info */
2479          uinfo->hook_state = 1;
2480          break;
2481       case 0x05:
2482    /*Supervisor Headset Disconnected length =3*/
2483          /* Set the tap info */
2484          uinfo->hook_state = 0;
2485          break;
2486       case 0x07:
2487    /*Audio Manager Attributes Info*/
2488          proto_tree_add_item(msg_tree,hf_audio_hf_support,tvb,offset,1,FALSE);
2489          offset+=1;msg_len-=1;
2490          while(msg_len>0){
2491           proto_tree_add_item(msg_tree,hf_rx_vocoder_type,tvb,offset,1,FALSE);
2492           offset+=1;msg_len-=1;
2493          }
2494          break;
2495       case 0x08:
2496    /*Audio Manager Options Report*/
2497          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2498          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_max,tvb,offset,1,FALSE);
2499          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_adj_vol,tvb,offset,1,FALSE);
2500          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_auto_adj_vol,tvb,offset,1,FALSE);
2501          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_hs_on_air,tvb,offset,1,FALSE);
2502          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_hd_on_air,tvb,offset,1,FALSE);
2503          proto_tree_add_item(msg_tree,hf_audio_opt_rpt_noise_squelch,tvb,offset,1,FALSE);
2504          offset+=1;msg_len-=1;
2505          break;
2506       case 0x09:
2507    /*Adjustable Rx Volume Report*/
2508          proto_tree_add_item(msg_tree,hf_basic_bit_field,tvb,offset,1,FALSE);
2509          proto_tree_add_item(msg_tree,hf_audio_rx_vol_apb_rpt,tvb,offset,1,FALSE);
2510          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_up,tvb,offset,1,FALSE);
2511          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_floor,tvb,offset,1,FALSE);
2512          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_ceiling,tvb,offset,1,FALSE);
2513          offset+=1;msg_len-=1;
2514          break;
2515       case 0x0a:
2516    /*Adjustable Rx Volume Information*/
2517          proto_tree_add_item(msg_tree,hf_audio_current_adj_vol_id,tvb,offset,1,FALSE);
2518          proto_tree_add_item(msg_tree,hf_audio_rx_vol_apb_rpt,tvb,offset,1,FALSE);
2519          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_up,tvb,offset,1,FALSE);
2520          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_floor,tvb,offset,1,FALSE);
2521          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_ceiling,tvb,offset,1,FALSE);
2522          offset+=1;msg_len-=1;
2523          proto_tree_add_item(msg_tree,hf_audio_current_rx_level,tvb,offset,1,FALSE);
2524          offset+=1;msg_len-=1;
2525          proto_tree_add_item(msg_tree,hf_audio_current_rx_range,tvb,offset,1,FALSE);
2526          offset+=1;msg_len-=1;
2527          break;
2528       case 0x0b:
2529    /*APB's Default Rx Volume Value*/
2530          proto_tree_add_item(msg_tree,hf_audio_current_adj_vol_id,tvb,offset,1,FALSE);
2531          proto_tree_add_item(msg_tree,hf_audio_rx_vol_apb_rpt,tvb,offset,1,FALSE);
2532          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_up,tvb,offset,1,FALSE);
2533          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_floor,tvb,offset,1,FALSE);
2534          proto_tree_add_item(msg_tree,hf_audio_rx_vol_vol_ceiling,tvb,offset,1,FALSE);
2535          offset+=1;msg_len-=1;
2536          proto_tree_add_item(msg_tree,hf_audio_current_rx_level,tvb,offset,1,FALSE);
2537          offset+=1;msg_len-=1;
2538          proto_tree_add_item(msg_tree,hf_audio_current_rx_range,tvb,offset,1,FALSE);
2539          offset+=1;msg_len-=1;
2540          break;
2541       case 0x0c:
2542    /*Alerting Tone Select*/
2543          proto_tree_add_item(msg_tree,hf_audio_cadence_select,tvb,offset,1,FALSE);
2544          proto_tree_add_item(msg_tree,hf_audio_warbler_select,tvb,offset,1,FALSE);
2545          offset+=1;msg_len-=1;
2546          break;
2547       case 0x0e:
2548    /*RTCP Statistics Report UGLY*/
2549          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2550          offset+=msg_len;
2551          break;
2552       case 0x0f:
2553    /*Open Audio Stream Report*/
2554          proto_tree_add_item(msg_tree,hf_audio_open_stream_rpt,tvb,offset,1,FALSE);
2555          offset+=1;msg_len-=1;
2556          break;
2557       case 0x10:
2558    /*RTCP Bucket SDES Information Report*/
2559          proto_tree_add_item(msg_tree,hf_audio_sdes_rpt_source_desc,tvb,offset,1,FALSE);
2560          proto_tree_add_item(msg_tree,hf_audio_sdes_rpt_buk_id,tvb,offset,1,FALSE);
2561          offset+=1;msg_len-=1;
2562          set_ascii_item(msg_tree,tvb,offset,msg_len);
2563          offset+=msg_len;
2564          break;
2565       case 0x11:
2566    /*Port Mapping Discovery*/
2567          proto_tree_add_item(msg_tree,hf_audio_phone_port,tvb,offset,2,FALSE);
2568          offset+=2;msg_len-=2;
2569          proto_tree_add_item(msg_tree,hf_audio_phone_ip,tvb,offset,4,FALSE);
2570          offset+=4;msg_len-=4;
2571          break;
2572       case 0x12:
2573    /*Resolve Port Mapping*/
2574          proto_tree_add_item(msg_tree,hf_audio_nat_listen_port,tvb,offset,2,FALSE);
2575          offset+=2;msg_len-=2;
2576          proto_tree_add_item(msg_tree,hf_audio_nat_ip,tvb,offset,4,FALSE);
2577          offset+=4;msg_len-=4;
2578          proto_tree_add_item(msg_tree,hf_audio_nat_add_len,tvb,offset,1,FALSE);
2579          offset+=1;msg_len-=1;
2580          proto_tree_add_item(msg_tree,hf_audio_phone_port,tvb,offset,2,FALSE);
2581          offset+=2;msg_len-=2;
2582          proto_tree_add_item(msg_tree,hf_audio_phone_ip,tvb,offset,4,FALSE);
2583          offset+=4;msg_len-=4;
2584          proto_tree_add_item(msg_tree,hf_audio_phone_add_len,tvb,offset,1,FALSE);
2585          offset+=1;msg_len-=1;
2586          break;
2587       case 0x13:
2588    /*Audio Stream Status Report*/
2589          stream_dir=tvb_get_guint8(tvb,offset);
2590          proto_tree_add_item(msg_tree,hf_audio_stream_direction_code,tvb,offset,1,FALSE);
2591          offset+=1;msg_len-=1;
2592          proto_tree_add_item(msg_tree,hf_audio_mgr_stream_id,tvb,offset,1,FALSE);
2593          offset+=1;msg_len-=1;
2594          stream_state=tvb_get_guint8(tvb,offset);
2595          proto_tree_add_item(msg_tree,hf_audio_stream_state,tvb,offset,1,FALSE);
2596          offset+=1;msg_len-=1;
2597          if((AUDIO_STREAM_STATE&stream_state)!=AUDIO_STREAM_STATE)
2598            break;
2599          if((AUDIO_STREAM_DIRECTION_RX&stream_dir)==AUDIO_STREAM_DIRECTION_RX)
2600             proto_tree_add_item(msg_tree,hf_rx_vocoder_type,tvb,offset,1,FALSE);
2601          else if((AUDIO_STREAM_DIRECTION_TX&stream_dir)==AUDIO_STREAM_DIRECTION_TX)
2602             proto_tree_add_item(msg_tree,hf_tx_vocoder_type,tvb,offset,1,FALSE);
2603          else
2604             proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,1,FALSE);
2605          offset+=1;msg_len-=1;
2606          proto_tree_add_item(msg_tree,hf_frames_per_packet,tvb,offset,1,FALSE);
2607          offset+=1;msg_len-=1;
2608          proto_tree_add_item(msg_tree,hf_audio_tos,tvb,offset,1,FALSE);
2609          proto_tree_add_item(msg_tree,hf_audio_precedence,tvb,offset,1,FALSE);
2610          proto_tree_add_item(msg_tree,hf_audio_frf_11,tvb,offset,1,FALSE);
2611          offset+=1;msg_len-=1;
2612          proto_tree_add_item(msg_tree,hf_rtcp_bucket_id,tvb,offset,1,FALSE);
2613          offset+=1;msg_len-=1;
2614          proto_tree_add_item(msg_tree,hf_audio_lcl_rtp_port,tvb,offset,2,FALSE);
2615          offset+=2;msg_len-=2;
2616          proto_tree_add_item(msg_tree,hf_audio_lcl_rtcp_port,tvb,offset,2,FALSE);
2617          offset+=2;msg_len-=2;
2618          proto_tree_add_item(msg_tree,hf_audio_far_rtp_port,tvb,offset,2,FALSE);
2619          offset+=2;msg_len-=2;
2620          proto_tree_add_item(msg_tree,hf_audio_far_rtcp_port,tvb,offset,2,FALSE);
2621          offset+=2;msg_len-=2;
2622          proto_tree_add_item(msg_tree,hf_audio_far_ip_add,tvb,offset,4,FALSE);
2623          offset+=4;msg_len-=4;
2624          proto_tree_add_item(msg_tree,hf_audio_transducer_list_length,tvb,offset,1,FALSE);
2625          offset+=1;msg_len-=1;
2626          while(msg_len>0){
2627             proto_tree_add_item(msg_tree,hf_audio_transducer_pair,tvb,offset,1,FALSE);
2628             offset+=1;msg_len-=1;
2629          }
2630       case 0x14:
2631    /*Query APB Response*/
2632          proto_tree_add_item(msg_tree,hf_audio_apb_number,tvb,offset,1,FALSE);
2633          offset+=1;msg_len-=1;
2634          while(msg_len>0){
2635             apb_op_code=tvb_get_guint8(tvb,offset);
2636             proto_tree_add_item(msg_tree,hf_audio_apb_op_code,tvb,
2637                                 offset,1,FALSE);
2638             offset+=1;msg_len-=1;
2639             if(apb_op_code>0x39){
2640                /*should have a len + data*/
2641                apb_data_len=tvb_get_guint8(tvb,offset);
2642                proto_tree_add_item(msg_tree,hf_audio_apb_param_len,tvb,
2643                                    offset,1,FALSE);
2644                offset+=1;msg_len-=1;
2645                proto_tree_add_item(msg_tree,hf_audio_apb_data,tvb,
2646                                    offset,apb_data_len,FALSE);
2647                offset+=apb_data_len;msg_len-=apb_data_len;
2648             }
2649          }
2650          break;
2651       case 0xff:
2652    /*Reserved*/
2653          break;
2654       default:
2655          proto_tree_add_item(msg_tree,hf_generic_data,tvb,offset,msg_len,FALSE);
2656          offset+=msg_len;
2657    }
2658
2659    return offset;
2660 }
2661
2662 static void
2663 set_ascii_item(proto_tree *msg_tree,tvbuff_t *tvb, gint offset,guint msg_len){
2664    proto_tree_add_text(msg_tree,tvb,offset,msg_len,"DATA: %s",
2665                        tvb_format_text(tvb,offset,msg_len));
2666 }
2667
2668 void
2669 proto_register_unistim(void){
2670
2671    module_t* unistim_module;
2672
2673    static hf_register_info hf[] = {
2674          { &hf_unistim_seq_nu,
2675             { "RUDP Seq Num","unistim.num",FT_UINT32,
2676                BASE_HEX|BASE_RANGE_STRING, RVALS(sequence_numbers), 0x0, NULL, HFILL}
2677          },
2678          { &hf_unistim_cmd_add,
2679             { "UNISTIM CMD Address","unistim.add",FT_UINT8,
2680                BASE_HEX,VALS(command_address),0x0,NULL,HFILL}
2681          },
2682          { &hf_uftp_command,
2683             { "UFTP CMD","uftp.cmd",FT_UINT8,
2684                BASE_HEX,VALS(uftp_commands),0x0,NULL,HFILL}
2685          },
2686          { &hf_uftp_datablock_size,
2687             { "UFTP Datablock Size","uftp.blocksize",FT_UINT32,
2688                BASE_DEC,NULL,0x0,NULL,HFILL}
2689          },
2690          { &hf_uftp_datablock_limit,
2691             { "UFTP Datablock Limit","uftp.limit",FT_UINT8,
2692                BASE_DEC,NULL,0x0,NULL,HFILL}
2693          },
2694          { &hf_uftp_filename,
2695             { "UFTP Filename","uftp.filename",FT_STRINGZ,
2696                BASE_NONE,NULL,0x0,NULL,HFILL}
2697          },
2698          { &hf_uftp_datablock,
2699             { "UFTP Data Block","uftp.datablock",FT_BYTES,
2700                BASE_NONE,NULL,0x0,NULL,HFILL}
2701          },
2702          { &hf_unistim_packet_type,
2703             { "RUDP Pkt type","unistim.type",FT_UINT8,
2704                BASE_DEC, VALS(packet_names),0x0,NULL,HFILL}
2705          },
2706          { &hf_unistim_payload,
2707             { "UNISTIM Payload","unistim.pay",FT_UINT8,
2708                BASE_HEX, VALS(payload_names),0x0,NULL,HFILL}
2709          },
2710          { &hf_unistim_len ,
2711             { "UNISTIM CMD Length","unistim.len",FT_UINT8,
2712                BASE_DEC,NULL,0x0,NULL,HFILL}
2713          },
2714          { &hf_basic_bit_field,
2715             {"FLAGS","unistim.bit.fields",FT_BOOLEAN,
2716                8,TFS(&basic_bit_yn),0xff,NULL,HFILL}
2717          },
2718          { &hf_basic_switch_cmd ,
2719             {"Basic Cmd (switch)","unistim.basic.switch",FT_UINT8,
2720                BASE_HEX,VALS(basic_switch_msgs),0x0,NULL,HFILL}
2721          },
2722          { &hf_basic_phone_cmd ,
2723             {"Basic Cmd (phone)","unistim.basic.phone",FT_UINT8,
2724                BASE_HEX,VALS(basic_phone_msgs),0x0,NULL,HFILL}
2725          },
2726          { &hf_broadcast_switch_cmd ,
2727             {"Broadcast Cmd (switch)","unistim.broadcast.switch",FT_UINT8,
2728                BASE_HEX,VALS(broadcast_switch_msgs),0x0,NULL,HFILL}
2729          },
2730          { &hf_broadcast_phone_cmd ,
2731             {"Broadcast Cmd (phone)","unistim.broadcast.phone",FT_UINT8,
2732                BASE_HEX,VALS(broadcast_phone_msgs),0x0,NULL,HFILL}
2733          },
2734          { &hf_audio_switch_cmd ,
2735             {"Audio Cmd (switch)","unistim.audio.switch",FT_UINT8,
2736                BASE_HEX,VALS(audio_switch_msgs),0x0,NULL,HFILL}
2737          },
2738          { &hf_audio_phone_cmd ,
2739             {"Audio Cmd (phone)","unistim.audio.phone",FT_UINT8,
2740                BASE_HEX,VALS(audio_phone_msgs),0x0,NULL,HFILL}
2741          },
2742          { &hf_display_switch_cmd ,
2743             {"Display Cmd (switch)","unistim.display.switch",FT_UINT8,
2744                BASE_HEX,VALS(display_switch_msgs),0x0,NULL,HFILL}
2745          },
2746          { &hf_display_phone_cmd ,
2747             {"Display Cmd (phone)","unistim.display.phone",FT_UINT8,
2748                BASE_HEX,VALS(display_phone_msgs),0x0,NULL,HFILL}
2749          },
2750          { &hf_key_switch_cmd ,
2751             {"Key Cmd (switch)","unistim.key.switch",FT_UINT8,
2752                BASE_HEX,VALS(key_switch_msgs),0x0,NULL,HFILL}
2753          },
2754          { &hf_key_phone_cmd ,
2755             {"Key Cmd (phone)","unistim.key.phone",FT_UINT8,
2756                BASE_HEX,VALS(key_phone_msgs),0x0,NULL,HFILL}
2757          },
2758          { &hf_network_switch_cmd ,
2759             {"Network Cmd (switch)","unistim.network.switch",FT_UINT8,
2760                BASE_HEX,VALS(network_switch_msgs),0x0,NULL,HFILL}
2761          },
2762          { &hf_network_phone_cmd ,
2763             {"Network Cmd (phone)","unistim.network.phone",FT_UINT8,
2764                BASE_HEX,VALS(network_phone_msgs),0x0,NULL,HFILL}
2765          },
2766          { &hf_terminal_id,
2767             {"Terminal ID","unistim.terminal.id",FT_IPv4,
2768                BASE_NONE,NULL,0x0,NULL,HFILL}
2769          },
2770          { &hf_broadcast_year,
2771             {"Year","unistim.broadcast.year",FT_UINT8,
2772                BASE_DEC,NULL,0x7f,NULL,HFILL}
2773          },
2774          { &hf_broadcast_month,
2775             {"Month","unistim.broadcast.month",FT_UINT8,
2776                BASE_DEC,NULL,0x0,NULL,HFILL}
2777          },
2778          { &hf_broadcast_day,
2779             {"Day","unistim.broadcast.day",FT_UINT8,
2780                BASE_DEC,NULL,0x0,NULL,HFILL}
2781          },
2782          { &hf_broadcast_hour,
2783             {"Hour","unistim.broadcast.hour",FT_UINT8,
2784                BASE_DEC,NULL,0x0,NULL,HFILL}
2785          },
2786          { &hf_broadcast_minute,
2787             {"Minute","unistim.broadcast.minute",FT_UINT8,
2788                BASE_DEC,NULL,0x0,NULL,HFILL}
2789          },
2790          { &hf_broadcast_second,
2791             {"Second","unistim.broadcast.second",FT_UINT8,
2792                BASE_DEC,NULL,0x0,NULL,HFILL}
2793          },
2794          { &hf_net_diag_flag,
2795             {"Query Network Manager Diagnostic","unistim.query.diagnostic",
2796                FT_BOOLEAN,8, NULL,
2797                QUERY_NETWORK_MANAGER_DIAGNOSTIC, NULL,HFILL}
2798          },
2799          { &hf_net_managers_flag,
2800             {"Query Network Manager Managers","unistim.query.managers",
2801                FT_BOOLEAN,8, NULL,
2802                QUERY_NETWORK_MANAGER_MANAGERS, NULL,HFILL}
2803          },
2804          { &hf_net_attributes_flag,
2805             {"Query Network Manager Attributes","unistim.query.attributes",
2806                FT_BOOLEAN, 8,NULL,
2807                QUERY_NETWORK_MANAGER_ATTRIBUTES,NULL,HFILL}
2808          },
2809          { &hf_net_serv_info_flag,
2810             {"Query Network Manager Server Info","unistim.query.serverInfo",
2811                FT_BOOLEAN, 8,NULL,
2812                QUERY_NETWORK_MANAGER_SERVER_INFO,NULL,HFILL}
2813          },
2814          { &hf_net_options_flag,
2815             {"Query Network Manager Options","unistim.query.options",
2816                FT_BOOLEAN, 8,NULL,
2817                QUERY_NETWORK_MANAGER_OPTIONS,NULL,HFILL}
2818          },
2819          { &hf_net_sanity_flag,
2820             {"Query Network Manager Sanity","unistim.query.sanity",
2821                FT_BOOLEAN, 8,NULL,
2822                QUERY_NETWORK_MANAGER_SANITY,NULL,HFILL}
2823          },
2824          { &hf_net_enable_diag,
2825             {"Network Manager Enable DIAG","unistim.enable.diag",
2826                FT_BOOLEAN, 8,NULL,
2827                NETWORK_MANAGER_ENABLE_DIAG,NULL,HFILL}
2828          },
2829          { &hf_net_enable_rudp,
2830             {"Network Manager Enable RUDP","unistim.enable.network.rel.udp",
2831                FT_BOOLEAN, 8,NULL,
2832                NETWORK_MANAGER_ENABLE_RUDP,NULL,HFILL}
2833          },
2834          { &hf_net_server_id,
2835             {"Download Server ID","unistim.download.id",FT_UINT8,
2836                BASE_HEX, VALS(network_server_id),0x00,NULL,HFILL}
2837          },
2838          { &hf_net_server_port,
2839             {"Download Server Port","unistim.download.port",FT_UINT16,
2840                BASE_DEC, NULL,0x00,NULL,HFILL}
2841          },
2842          { &hf_net_server_action,
2843             {"Download Server Action","unistim.download.action",FT_UINT8,
2844                BASE_HEX, VALS(server_action),0x00,NULL,HFILL}
2845          },
2846          { &hf_net_server_retry_count,
2847             {"Download Retry Count","unistim.download.retry",FT_UINT8,
2848                BASE_DEC, NULL,0x00,NULL,HFILL}
2849          },
2850          { &hf_net_server_failover_id,
2851             {"Download Failover Server ID","unistim.download.failover",FT_UINT8,
2852                BASE_HEX, VALS(network_server_id),0x00,NULL,HFILL}
2853          },
2854          { &hf_net_server_ip_address,
2855             {"Download Server Address","unistim.download.address",FT_UINT32,
2856                BASE_HEX, NULL,0x00,NULL,HFILL}
2857          },
2858          { &hf_net_server_time_out,
2859             {"Watchdog Timeout","unistim.watchdog.timeout",FT_UINT16,
2860                BASE_DEC, NULL,0x00,NULL,HFILL}
2861          },
2862          { &hf_net_server_config_element,
2863             {"Configure Network Element","unistim.config.element",FT_UINT8,
2864                BASE_HEX, VALS(network_elements),0x00,NULL,HFILL}
2865          },
2866          { &hf_net_server_recovery_time_low,
2867             {"Recovery Procedure Idle Low Boundary","unistim.recovery.low",FT_UINT16,
2868                BASE_DEC, NULL,0x00,NULL,HFILL}
2869          },
2870          { &hf_net_server_recovery_time_high,
2871             {"Recovery Procedure Idle High Boundary","unistim.recovery.high",FT_UINT16,
2872                BASE_DEC, NULL,0x00,NULL,HFILL}
2873          },
2874          { &hf_net_phone_rx_ovr_flag,
2875             {"Receive Buffer Overflow","unistim.receive.overflow",
2876                FT_BOOLEAN, 8,NULL,
2877                RX_BUFFER_OVERFLOW,NULL,HFILL}
2878          },
2879          { &hf_net_phone_tx_ovr_flag,
2880             {"Transmit Buffer Overflow","unistim.trans.overflow",
2881                FT_BOOLEAN, 8,NULL,
2882                TX_BUFFER_OVERFLOW,NULL,HFILL}
2883          },
2884          { &hf_net_phone_rx_empty_flag,
2885             {"Receive Buffer Unexpectedly Empty","unistim.receive.empty",
2886                FT_BOOLEAN, 8,NULL,
2887                RX_UNEXPECT_EMPTY,NULL,HFILL}
2888          },
2889          { &hf_net_phone_invalid_msg_flag,
2890             {"Received Invalid MSG","unistim.invalid.msg",
2891                FT_BOOLEAN, 8,NULL,
2892                INVALID_MSG,NULL,HFILL}
2893          },
2894          { &hf_net_phone_eeprom_insane_flag,
2895             {"EEProm Insane","unistim.eeprom.insane",
2896                FT_BOOLEAN, 8,NULL,
2897                EEPROM_INSANE,NULL,HFILL}
2898          },
2899          { &hf_net_phone_eeprom_unsafe_flag,
2900             {"EEProm Unsafe","unistim.eeprom.unsafe",
2901                FT_BOOLEAN, 8,NULL,
2902                EEPROM_UNSAFE,NULL,HFILL}
2903          },
2904          { &hf_net_phone_diag,
2905             {"Diagnostic Command Enabled","unistim.diag.enabled",FT_BOOLEAN,
2906               8,NULL,NETWORK_MGR_REPORT_DIAG,NULL,HFILL}
2907          },
2908          { &hf_net_phone_rudp,
2909             {"Reliable UDP Active","unistim.rudp.active",FT_BOOLEAN,
2910               8,NULL,NETWORK_MGR_REPORT_RUDP,NULL,HFILL}
2911          },
2912          { &hf_basic_switch_query_flags,
2913             {"Query Basic Manager","unistim.basic.query",FT_UINT8,
2914                BASE_HEX, NULL,0x00,"INITIAL PHONE QUERY",HFILL}
2915          },
2916          { &hf_basic_switch_query_attr,
2917             {"Query Basic Manager Attributes","unistim.basic.attrs",FT_BOOLEAN,
2918               8,NULL,BASIC_QUERY_ATTRIBUTES,"Basic Query Attributes",HFILL}
2919          },
2920          { &hf_basic_switch_query_opts,
2921             {"Query Basic Manager Options","unistim.basic.opts",FT_BOOLEAN,
2922               8,NULL,BASIC_QUERY_OPTIONS,"Basic Query Options",HFILL}
2923          },
2924          { &hf_basic_switch_query_fw,
2925             {"Query Basic Switch Firmware","unistim.basic.fw",FT_BOOLEAN,
2926                8,NULL,BASIC_QUERY_FW,"Basic Query Firmware",HFILL}
2927          },
2928          { &hf_basic_switch_query_hw_id,
2929             {"Query Basic Manager Hardware ID","unistim.basic.hwid",FT_BOOLEAN,
2930               8,NULL,BASIC_QUERY_HW_ID,"Basic Query Hardware ID",HFILL}
2931          },
2932          { &hf_basic_switch_query_it_type,
2933             {"Query Basic Manager Phone Type","unistim.basic.type",FT_BOOLEAN,
2934               8,NULL,BASIC_QUERY_IT_TYPE,"Basic Query Phone Type",HFILL}
2935          },
2936          { &hf_basic_switch_query_prod_eng_code,
2937             {"Query Basic Manager Prod Eng Code","unistim.basic.code",FT_BOOLEAN,
2938               8,NULL,BASIC_QUERY_PROD_ENG_CODE,"Basic Query Production Engineering Code",HFILL}
2939          },
2940          { &hf_basic_switch_query_gray_mkt_info,
2941             {"Query Basic Manager Gray Mkt Info","unistim.basic.gray",FT_BOOLEAN,
2942               8,NULL,BASIC_QUERY_GRAY_MKT_INFO,"Basic Query Gray Market Info",HFILL}
2943          },
2944          { &hf_basic_switch_options_secure,
2945             {"Basic Switch Options Secure Code","unistim.basic.secure",FT_BOOLEAN,
2946               8,NULL,BASIC_OPTION_SECURE,NULL,HFILL}
2947          },
2948          { &hf_basic_switch_element_id,
2949             {"Basic Element ID","unistim.basic.element.id",FT_UINT8,
2950                BASE_HEX,NULL,0x00,NULL,HFILL}
2951          },
2952          { &hf_basic_switch_eeprom_data,
2953             {"EEProm Data","unistim.basic.eeprom.data",FT_BYTES,
2954                BASE_NONE,NULL,0x00,NULL,HFILL}
2955          },
2956          { &hf_basic_phone_eeprom_stat_cksum,
2957             {"Basic Phone EEProm Static Checksum","unistim.static.cksum",FT_UINT8,
2958                BASE_HEX,NULL,0x0,NULL,HFILL}
2959          },
2960          { &hf_basic_phone_eeprom_dynam,
2961             {"Basic Phone EEProm Dynamic Checksum","unistim.dynam.cksum",FT_UINT8,
2962                BASE_HEX,NULL,0x00,NULL,HFILL}
2963          },
2964          { &hf_basic_phone_eeprom_net_config_cksum,
2965             {"Basic Phone EEProm Net Config Checksum","unistim.netconfig.cksum",FT_UINT8,
2966                BASE_HEX,NULL,0x00,NULL,HFILL}
2967          },
2968          { &hf_basic_phone_hw_id,
2969             {"Basic Phone Hardware ID","unistim.basic.hw.id",FT_BYTES,
2970                BASE_NONE,NULL,0x00,NULL,HFILL}
2971          },
2972          { &hf_basic_phone_fw_ver,
2973             {"Basic Phone Firmware Version","unistim.basic.fw.ver",FT_STRING,
2974                BASE_NONE,NULL,0x00,NULL,HFILL}
2975          },
2976          { &hf_key_code,
2977             {"Key Name","unistim.key.name",FT_UINT8,
2978                BASE_HEX,VALS(key_names),0x3f,NULL,HFILL}
2979          },
2980          { &hf_key_command,
2981             {"Key Action","unistim.key.action",FT_UINT8,
2982                BASE_HEX,VALS(key_cmds),0xc0,NULL,HFILL}
2983          },
2984          { &hf_icon_id,
2985             {"Icon ID","unistim.icon.id",FT_UINT8,
2986                BASE_HEX,NULL, DISPLAY_ICON_ID,NULL,HFILL}
2987          },
2988          { &hf_broadcast_icon_state,
2989             {"Icon State","unistim.icon.state",FT_UINT8,
2990                BASE_HEX,VALS(bcast_icon_states),0x1f,NULL,HFILL}
2991          },
2992          { &hf_broadcast_icon_cadence,
2993             {"Icon Cadence","unistim.icon.cadence",FT_UINT8,
2994                BASE_HEX,VALS(bcast_icon_cadence),0xe0,NULL,HFILL}
2995          },
2996          { &hf_audio_mgr_attr,
2997             {"Query Audio Manager Attributes","unistim.audio.attr",FT_BOOLEAN,
2998                8,NULL,QUERY_AUDIO_MGR_ATTRIBUTES,NULL,HFILL}
2999          },
3000          { &hf_audio_mgr_opts,
3001             {"Query Audio Manager Options","unistim.audio.options",FT_BOOLEAN,
3002                8,NULL,QUERY_AUDIO_MGR_OPTIONS,NULL,HFILL}
3003          },
3004          { &hf_audio_mgr_alert,
3005             {"Query Audio Manager Alerting","unistim.audio.alerting",FT_BOOLEAN,
3006                8,NULL,QUERY_AUDIO_MGR_ALERTING ,NULL,HFILL}
3007          },
3008          { &hf_audio_mgr_adj_rx_vol,
3009             {"Query Audio Manager Adjustable Receive Volume","unistim.audio.adj.volume",FT_BOOLEAN,
3010                8,NULL,QUERY_AUDIO_MGR_ADJ_RX_VOL,NULL,HFILL}
3011          },
3012          { &hf_audio_mgr_def_rx_vol,
3013             {"Query Audio Manager Default Receive Volume","unistim.audio.def.volume",FT_BOOLEAN,
3014                8,NULL,QUERY_AUDIO_MGR_DEF_RX_VOL,NULL,HFILL}
3015          },
3016          { &hf_audio_mgr_handset,
3017             {"Query Audio Manager Handset","unistim.audio.handset",FT_BOOLEAN,
3018                8,NULL,QUERY_AUDIO_MGR_HANDSET,NULL,HFILL}
3019          },
3020          { &hf_audio_mgr_headset,
3021             {"Query Audio Manager Headset","unistim.audio.headset",FT_BOOLEAN,
3022                8,NULL,QUERY_AUDIO_MGR_HEADSET,NULL,HFILL}
3023          },
3024          { &hf_audio_default_rx_vol_id,
3025             {"Audio Manager Default Receive Volume ID","unistim.audio.volume.id",FT_UINT8,
3026                BASE_HEX,VALS(default_rx_vol_id),0x00,NULL,HFILL}
3027          },
3028          { &hf_audio_mgr_opt_max_vol,
3029             {"Audio Manager Enable Max Tone Volume","unistim.audio.max.tone",FT_BOOLEAN,
3030                8,TFS(&audio_opts_enable_max_tone_vol),AUDIO_MGR_OPTS_MAX_VOL,NULL,HFILL}
3031          },
3032          { &hf_audio_mgr_opt_adj_vol,
3033             {"Audio Manager Adjust Volume","unistim.audio.opts.adj.vol",FT_BOOLEAN,
3034                8,TFS(&audio_opts_adjust_volume),AUDIO_MGR_ADJ_VOL,NULL,HFILL}
3035          },
3036          { &hf_audio_mgr_opt_aa_rx_vol_rpt,
3037             {"Audio Manager Auto Adjust Volume RPT","unistim.audio.aa.vol.rpt",FT_BOOLEAN,
3038                8,TFS(&audio_opts_automatic_adjustable),AUDIO_MGR_AUTO_RX_VOL_RPT,NULL,HFILL}
3039          },
3040          { &hf_audio_mgr_opt_hs_on_air,
3041             {"Audio Manager Handset","unistim.audio.handset",FT_BOOLEAN,
3042                8,TFS(&audio_opts_hs_on_air_feature),AUDIO_MGR_HS_ON_AIR,NULL,HFILL}
3043          },
3044          { &hf_audio_mgr_opt_hd_on_air,
3045             {"Audio Manager Headset","unistim.audio.headset",FT_BOOLEAN,
3046                8,TFS(&audio_opts_hd_on_air_feature),AUDIO_MGR_HD_ON_AIR,NULL,HFILL}
3047          },
3048          { &hf_audio_mgr_opt_noise_squelch,
3049             {"Audio Manager Noise Squelch","unistim.audio.squelch",FT_BOOLEAN,
3050                8,TFS(&noise_sqlch_disable), AUDIO_MGR_NOISE_SQUELCH,NULL,HFILL}
3051          },
3052          { &hf_audio_mgr_mute,
3053             {"Audio Manager Mute","unistim.audio.mute",FT_BOOLEAN,
3054                8,TFS(&audio_mgr_mute_val),AUDIO_MGR_MUTE,NULL,HFILL}
3055          },
3056          { &hf_audio_mgr_tx_rx,
3057             {"Audio Manager RX or TX","unistim.audio.rx.tx",FT_BOOLEAN,
3058                8,TFS(&audio_mgr_tx_rx_val),AUDIO_MGR_TX_RX,NULL,HFILL}
3059          },
3060          { &hf_audio_mgr_stream_id,
3061             {"Audio Manager Stream ID","unistim.audio.stream.id",FT_UINT8,
3062                BASE_DEC,NULL,0x00,NULL,HFILL}
3063          },
3064          { &hf_audio_mgr_transducer_based_tone_id,
3065             {"Audio Manager Transducer Based Tone On","unistim.audio.transducer.on",FT_UINT8,
3066                BASE_HEX,VALS(trans_base_tone_ids),0x07,NULL,HFILL}
3067          },
3068          { &hf_audio_mgr_attenuated,
3069             {"Audio Manager Transducer Tone Attenuated","unistim.audio.attenuated.on",FT_BOOLEAN,
3070                8,NULL,AUDIO_MGR_ATTENUATED,NULL,HFILL}
3071          },
3072          { &hf_audio_mgr_warbler_select,
3073             {"Warbler Select","unistim.warbler.select",FT_UINT8,
3074                BASE_HEX,NULL,0x07,NULL,HFILL}
3075          },
3076          { &hf_audio_mgr_transducer_routing,
3077             {"Transducer Routing","unistim.transducer.routing",FT_UINT8,
3078                BASE_HEX,VALS(transducer_routing_vals),0xf8,NULL,HFILL}
3079          },
3080          { &hf_audio_mgr_tone_vol_range,
3081             {"Tone Volume Range in Steps","unistim.tone.volume.range",FT_UINT8,
3082                BASE_HEX,NULL,0x0f,NULL,HFILL}
3083          },
3084          { &hf_audio_mgr_cadence_select,
3085             {"Cadence Select","unistim.cadence.select",FT_UINT8,
3086                BASE_HEX,VALS(cadence_select_vals),0xf0,NULL,HFILL}
3087          },
3088          { &hf_audio_special_tone,
3089             {"Special Tone Select","unistim.special.tone.select",FT_UINT8,
3090                BASE_HEX,VALS(special_tones_vals),0x00,NULL,HFILL}
3091          },
3092          { &hf_audio_tone_level,
3093             {"Tone Level","unistim.audio.tone.level",FT_UINT8,
3094                BASE_DEC,NULL,0xf0,NULL,HFILL}
3095          },
3096          { &hf_audio_visual_tones,
3097             {"Enable Visual Tones","unistim.visual.tones",FT_BOOLEAN,
3098                8,NULL,AUDIO_MGR_VISUAL_TONE,NULL,HFILL}
3099          },
3100          { &hf_audio_stream_based_tone_id,
3101             {"Stream Based Tone ID","unistim.stream.tone.id",FT_UINT8,
3102                BASE_HEX,VALS(stream_based_tone_vals),0x1f,NULL,HFILL}
3103          },
3104          { &hf_audio_stream_based_tone_rx_tx,
3105             {"Stream Based Tone RX or TX","unistim.stream.based.tone.rx.tx",FT_BOOLEAN,
3106                8,TFS(&stream_based_tone_rx_tx_yn),AUDIO_STREAM_BASED_TONE_RX_TX,NULL,HFILL}
3107          },
3108          { &hf_audio_stream_based_tone_mute,
3109             {"Stream Based Tone Mute","unistim.stream.tone.mute",FT_BOOLEAN,
3110                8,TFS(&stream_based_tone_mute_yn),AUDIO_STREAM_BASED_TONE_MUTE,NULL,HFILL}
3111          },
3112          { &hf_audio_stream_id,
3113             {"Stream ID","unistim.audio.stream.id",FT_UINT8,
3114                BASE_HEX,NULL,0x00,NULL,HFILL}
3115          },
3116          { &hf_audio_stream_based_volume,
3117             {"Stream Based Volume ID","unistim.stream.volume.id",FT_UINT8,
3118                BASE_HEX,VALS(stream_base_vol_level),0x00,NULL,HFILL}
3119          },
3120          { &hf_basic_switch_terminal_id,
3121             {"Terminal ID assigned by Switch","unistim.switch.terminal.id",FT_IPv4,
3122                BASE_NONE,NULL,0x00,NULL,HFILL}
3123          },
3124          { &hf_basic_it_type,
3125             {"IT (Phone) Type","unistim.it.type",FT_UINT8,
3126                BASE_HEX,VALS(it_types),0x00,NULL,HFILL}
3127          },
3128          { &hf_basic_prod_eng_code,
3129             {"Product Engineering Code for phone","unistim.basic.eng.code",FT_STRING,
3130                BASE_NONE,NULL,0x00,NULL,HFILL}
3131          },
3132          { &hf_net_phone_primary_server_id,
3133             {"Phone Primary Server ID","unistim.net.phone.primary.id",FT_UINT8,
3134                BASE_DEC,NULL,0x00,NULL,HFILL}
3135          },
3136          { &hf_net_phone_server_port,
3137             {"Port Number","unistim.server.port",FT_UINT16,
3138                BASE_DEC,NULL,0x00,NULL,HFILL}
3139          },
3140          { &hf_net_phone_server_action,
3141             {"Action","unistim.server.action.byte",FT_UINT8,
3142                BASE_HEX,VALS(action_bytes),0x00,NULL,HFILL}
3143          },
3144          { &hf_net_phone_server_retry_count,
3145             {"Number of times to Retry","unistim.server.retry.count",FT_UINT8,
3146                BASE_DEC,NULL,0x00,NULL,HFILL}
3147          },
3148          { &hf_net_phone_server_failover_id,
3149             {"Failover Server ID","unistim.server.failover.id",FT_UINT8,
3150                BASE_DEC,NULL,0x00,NULL,HFILL}
3151          },
3152          { &hf_net_phone_server_ip,
3153             {"IP address","unistim.server.ip.address",FT_IPv4,
3154                BASE_NONE,NULL,0x00,NULL,HFILL}
3155          },
3156          { &hf_audio_apb_number,
3157             {"APB Number","unistim.audio.apb.number",FT_UINT8,
3158                BASE_HEX,NULL,0x00,NULL,HFILL}
3159          },
3160          { & hf_audio_apb_op_code,
3161             {"APB Operation Code","unistim.audio.apb.op.code",FT_UINT8,
3162                BASE_HEX,VALS(apb_op_codes),0x00,NULL,HFILL}
3163          },
3164          { &hf_audio_apb_param_len,
3165             {"APB Operation Parameter Length","unistim.apb.param.len",FT_UINT8,
3166                BASE_DEC,NULL,0x00,NULL,HFILL}
3167          },
3168          { &hf_audio_apb_data,
3169             {"APB Operation Data","unistim.apb.operation.data",FT_BYTES,
3170                BASE_NONE,NULL,0x00,NULL,HFILL}
3171          },
3172          { &hf_display_write_address_numeric,
3173             {"Is Address Numeric","unistim.write.address.numeric",FT_BOOLEAN,
3174                8,NULL,DISPLAY_WRITE_ADDRESS_NUMERIC_FLAG,NULL,HFILL}
3175          },
3176          { &hf_display_write_address_context,
3177             {"Context Field in the Info Bar","unistim.write.address.context",FT_BOOLEAN,
3178                8,NULL,DISPLAY_WRITE_ADDRESS_CONTEXT_FLAG,NULL,HFILL}
3179          },
3180          { &hf_display_write_address_line,
3181             {"Write A Line","unistim.write.address.line",FT_BOOLEAN,
3182                8,NULL,DISPLAY_WRITE_ADDRESS_LINE_FLAG ,NULL,HFILL}
3183          },
3184          { &hf_display_write_address_soft_key,
3185             {"Write a SoftKey","unistim.write.address.softkey",FT_BOOLEAN,
3186                8,NULL,DISPLAY_WRITE_ADDRESS_SOFT_KEY_FLAG,NULL,HFILL}
3187          },
3188          { &hf_display_write_address_soft_label,
3189             {"Write A Softkey Label","unistim.write.address.softkey.label",FT_BOOLEAN,
3190                8,NULL,DISPLAY_WRITE_ADDRESS_SOFT_LABEL_FLAG,NULL,HFILL}
3191          },
3192          { &hf_display_write_address_softkey_id,
3193             {"Soft Key ID","unistim.write.addres.softkey.id",FT_UINT8,
3194                BASE_HEX,NULL,DISPLAY_WRITE_ADDRESS_SOFT_KEY_ID,NULL,HFILL}
3195          },
3196          { &hf_display_write_address_char_pos,
3197             {"Character Position or Soft-Label Key ID","unistim.display.write.address.char.pos",FT_UINT8,
3198                BASE_HEX,NULL,DISPLAY_WRITE_ADDRESS_CHAR_POS,NULL,HFILL}
3199          },
3200          { &hf_display_write_address_line_number,
3201             {"Line Number","unistim.write.address.line.number",FT_UINT8,
3202                BASE_DEC,NULL,DISPLAY_WRITE_ADDRESS_LINE_NUM,NULL,HFILL}
3203          },
3204          { &hf_display_write_cursor_move,
3205             {"Cursor Move","unistim.display.cursor.move",FT_BOOLEAN,
3206                8,NULL,DISPLAY_WRITE_CURSOR_MOVE,NULL,HFILL}
3207          },
3208          { &hf_display_write_clear_left,
3209             {"Clear Left","unistim.display.clear.left",FT_BOOLEAN,
3210                8,NULL,DISPLAY_WRITE_CLEAR_LEFT,NULL,HFILL}
3211          },
3212          { &hf_display_write_clear_right,
3213             {"Clear Right","unistim.display.clear.right",FT_BOOLEAN,
3214                8,NULL,DISPLAY_WRITE_CLEAR_RIGHT,NULL,HFILL}
3215          },
3216          { &hf_display_write_shift_left,
3217             {"Shift Left","unistim.display.shift.left",FT_BOOLEAN,
3218                8,NULL,DISPLAY_WRITE_SHIFT_LEFT,NULL,HFILL}
3219          },
3220          { &hf_display_write_shift_right,
3221             {"Shift Right","unistim.display.shift.right",FT_BOOLEAN,
3222                8,NULL,DISPLAY_WRITE_SHIFT_RIGHT,NULL,HFILL}
3223          },
3224          { &hf_display_write_highlight,
3225             {"Highlight","unistim.display.highlight",FT_BOOLEAN,
3226                8,NULL,DISPLAY_WRITE_HIGHLIGHT,NULL,HFILL}
3227          },
3228          { &hf_display_write_tag,
3229             {"Tag for text","unistim.display.text.tag",FT_UINT8,
3230                BASE_DEC,NULL,0x00,NULL,HFILL}
3231          },
3232          { &hf_display_cursor_move_cmd,
3233             {"Cursor Movement Command","unistim.cursor.move.cmd",FT_UINT8,
3234                BASE_HEX,VALS(cursor_move_cmds),DISPLAY_CURSOR_MOVE_CMD,NULL,HFILL}
3235          },
3236          { &hf_display_cursor_blink,
3237             {"Should Cursor Blink","unistim.cursor.blink",FT_BOOLEAN,
3238                8,NULL,DISPLAY_CURSOR_BLINK,NULL,HFILL}
3239          },
3240          { &hf_audio_vocoder_id,
3241             {"Vocoder Protocol","unistim.vocoder.id",FT_UINT8,
3242                BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL}
3243          },
3244          { &hf_audio_vocoder_param,
3245             {"Vocoder Config Param","unistim.vocoder.config.param",FT_UINT8,
3246                BASE_HEX,VALS(vocoder_config_params),AUDIO_VOCODER_CONFIG_PARAM,NULL,HFILL}
3247          },
3248          { &hf_audio_vocoder_entity,
3249             {"Vocoder Entity","unistim.vocoder.entity",FT_UINT8,
3250                BASE_HEX,VALS(config_param_entities),AUDIO_VOCODER_CONFIG_ENTITY,NULL,HFILL}
3251          },
3252          { &hf_audio_vocoder_annexa,
3253             {"Enable Annex A","unistim.enable.annexa",FT_BOOLEAN,
3254                8,NULL,AUDIO_VOCODER_ANNEXA,NULL,HFILL}
3255          },
3256          { &hf_audio_vocoder_annexb,
3257             {"Enable Annex B","unistim.enable.annexb",FT_BOOLEAN,
3258                8,NULL,AUDIO_VOCODER_ANNEXB,NULL,HFILL}
3259          },
3260          { &hf_audio_sample_rate,
3261             {"Sample Rate","unistim.audio.sample.rate",FT_UINT8,
3262                BASE_HEX,VALS(sample_rates),0x00,NULL,HFILL}
3263          },
3264          { &hf_audio_rtp_type,
3265             {"RTP Type","unistim.audio.rtp.type",FT_UINT8,
3266                BASE_HEX,NULL,0x00,NULL,HFILL}
3267          },
3268          { &hf_audio_bytes_per_frame,
3269             {"Bytes Per Frame","unistim.audio.bytes.per.frame",FT_UINT16,
3270                BASE_DEC,NULL,0x00,NULL,HFILL}
3271          },
3272          { &hf_audio_rx_stream_id,
3273             {"Receive Stream Id","unistim.rx.stream.id",FT_UINT8,
3274                BASE_HEX,NULL,0x00,NULL,HFILL}
3275          },
3276          { &hf_audio_tx_stream_id,
3277             {"Transmit Stream Id","unistim.rx.stream.id",FT_UINT8,
3278                BASE_HEX,NULL,0x00,NULL,HFILL}
3279          },
3280          { &hf_rx_vocoder_type,
3281             {"Receive Vocoder Protocol","unistim.vocoder.id",FT_UINT8,
3282                BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL}
3283          },
3284          { &hf_tx_vocoder_type,
3285             {"Transmit Vocoder Protocol","unistim.vocoder.id",FT_UINT8,
3286                BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL}
3287          },
3288          { &hf_frames_per_packet,
3289             {"Frames Per Packet","unistim.vocoder.frames.per.packet",FT_UINT8,
3290                BASE_DEC,NULL,0x00,NULL,HFILL}
3291          },
3292          { &hf_audio_tos,
3293             {"Type of Service","unistim.audio.type.service",FT_UINT8,
3294                BASE_HEX,VALS(types_of_service),AUDIO_TYPE_OF_SERVICE,NULL,HFILL}
3295          },
3296          { &hf_audio_precedence,
3297             {"Precedence","unistim.audio.precedence",FT_UINT8,
3298                BASE_HEX,VALS(precedences),AUDIO_PRECENDENCE,NULL,HFILL}
3299          },
3300          { &hf_audio_frf_11,
3301             {"FRF.11 Enable","unistim.audio.frf.11",FT_BOOLEAN,
3302                8,NULL,AUDIO_FRF_11,NULL,HFILL}
3303          },
3304          { &hf_audio_lcl_rtp_port,
3305             {"Phone RTP Port","unistim.local.rtp.port",FT_UINT16,
3306                BASE_DEC,NULL,0x00,NULL,HFILL}
3307          },
3308          { &hf_audio_lcl_rtcp_port,
3309             {"Phone RTCP Port","unistim.local.rtcp.port",FT_UINT16,
3310                BASE_DEC,NULL,0x00,NULL,HFILL}
3311          },
3312          { &hf_audio_far_rtp_port,
3313             {"Distant RTP Port","unistim.far.rtp.port",FT_UINT16,
3314                BASE_DEC,NULL,0x00,NULL,HFILL}
3315          },
3316          { &hf_audio_far_rtcp_port,
3317             {"Distant RTCP Port","unistim.far.rtcp.port",FT_UINT16,
3318                BASE_DEC,NULL,0x00,NULL,HFILL}
3319          },
3320          { &hf_audio_far_ip_add,
3321             {"Distant IP Address for RT[C]P","unistim.far.ip.address",FT_IPv4,
3322                BASE_NONE,NULL,0x00,NULL,HFILL}
3323          },
3324          { &hf_rtcp_bucket_id,
3325             {"RTCP Bucket ID","unistim.rtcp.bucket.id",FT_UINT16,
3326                BASE_HEX,NULL,0x00,NULL,HFILL}
3327          },
3328          { &hf_key_icon_id,
3329             {"Icon ID","unistim.key.icon.id",FT_UINT8,
3330                BASE_HEX,NULL,0x00,NULL,HFILL}
3331          },
3332          { &hf_display_clear_numeric,
3333             {"Numeric Index Field in InfoBar","unistim.display.clear.numeric",FT_BOOLEAN,
3334                8,NULL,DISPLAY_CLEAR_NUMERIC,NULL,HFILL}
3335          },
3336          { &hf_display_clear_context ,
3337             {"Context Field in InfoBar","unistim.display.clear.context",FT_BOOLEAN,
3338                8,NULL,DISPLAY_CLEAR_CONTEXT,NULL,HFILL}
3339          },
3340          { &hf_display_clear_date ,
3341             {"Date Field","unistim.display.clear.date",FT_BOOLEAN,
3342                8,NULL,DISPLAY_CLEAR_DATE,NULL,HFILL}
3343          },
3344          { &hf_display_clear_time,
3345             {"Time Field","unistim.display.clear.time",FT_BOOLEAN,
3346                8,NULL,DISPLAY_CLEAR_TIME,NULL,HFILL}
3347          },
3348          { &hf_display_clear_line,
3349             {"Line Data","unistim.display.clear.line",FT_BOOLEAN,
3350                8,NULL,DISPLAY_CLEAR_LINE,NULL,HFILL}
3351          },
3352          { &hf_display_clear_status_bar_icon,
3353             {"Status Bar Icon","unistim.display.statusbar.icon",FT_BOOLEAN,
3354                8,NULL,DISPLAY_CLEAR_STATUS_BAR_ICON,NULL,HFILL}
3355          },
3356          { &hf_display_clear_softkey,
3357             {"Soft Key","unistim.display.clear.softkey",FT_BOOLEAN,
3358                8,NULL,DISPLAY_CLEAR_SOFTKEY,NULL,HFILL}
3359          },
3360          { &hf_display_clear_softkey_label ,
3361             {"Soft Key Label","unistim.display.clear.softkey.label",FT_BOOLEAN,
3362                8,NULL,DISPLAY_CLEAR_SOFTKEY_LABEL,NULL,HFILL}
3363          },
3364          { &hf_display_clear_line_1 ,
3365             {"Line 1","unistim.display.clear.line1",FT_BOOLEAN,
3366                8,NULL,DISPLAY_CLEAR_LINE_1,NULL,HFILL}
3367          },
3368          { &hf_display_clear_line_2 ,
3369             {"Line 2","unistim.display.clear.line2",FT_BOOLEAN,
3370                8,NULL,DISPLAY_CLEAR_LINE_2,NULL,HFILL}
3371          },
3372          { &hf_display_clear_line_3 ,
3373             {"Line 3","unistim.display.clear.line3",FT_BOOLEAN,
3374                8,NULL,DISPLAY_CLEAR_LINE_3,NULL,HFILL}
3375          },
3376          { &hf_display_clear_line_4 ,
3377             {"Line 4","unistim.display.clear.line4",FT_BOOLEAN,
3378                8,NULL,DISPLAY_CLEAR_LINE_4,NULL,HFILL}
3379          },
3380          { &hf_display_clear_line_5 ,
3381             {"Line 5","unistim.display.clear.line5",FT_BOOLEAN,
3382                8,NULL,DISPLAY_CLEAR_LINE_5,NULL,HFILL}
3383          },
3384          { &hf_display_clear_line_6 ,
3385             {"Line 6","unistim.display.clear.line6",FT_BOOLEAN,
3386                8,NULL,DISPLAY_CLEAR_LINE_6,NULL,HFILL}
3387          },
3388          { &hf_display_clear_line_7 ,
3389             {"Line 7","unistim.display.clear.line7",FT_BOOLEAN,
3390                8,NULL,DISPLAY_CLEAR_LINE_7,NULL,HFILL}
3391          },
3392          { &hf_display_clear_line_8 ,
3393             {"Line 8","unistim.display.clear.line8",FT_BOOLEAN,
3394                8,NULL,DISPLAY_CLEAR_LINE_8,NULL,HFILL}
3395          },
3396          { &hf_display_clear_status_bar_icon_1 ,
3397             {"Status Bar Icon 1","unistim.display.clear.sbar.icon1",FT_BOOLEAN,
3398                8,NULL,DISPLAY_STATUS_BAR_ICON_1,NULL,HFILL}
3399          },
3400          { &hf_display_clear_status_bar_icon_2 ,
3401             {"Status Bar Icon 2","unistim.display.clear.sbar.icon2",FT_BOOLEAN,
3402                8,NULL,DISPLAY_STATUS_BAR_ICON_2,NULL,HFILL}
3403          },
3404          { &hf_display_clear_status_bar_icon_3 ,
3405             {"Status Bar Icon 3","unistim.display.clear.sbar.icon3",FT_BOOLEAN,
3406                8,NULL,DISPLAY_STATUS_BAR_ICON_3,NULL,HFILL}
3407          },
3408          { &hf_display_clear_status_bar_icon_4 ,
3409             {"Status Bar Icon 4","unistim.display.clear.sbar.icon4",FT_BOOLEAN,
3410                8,NULL,DISPLAY_STATUS_BAR_ICON_4,NULL,HFILL}
3411          },
3412          { &hf_display_clear_status_bar_icon_5 ,
3413             {"Status Bar Icon 5","unistim.display.clear.sbar.icon5",FT_BOOLEAN,
3414                8,NULL,DISPLAY_STATUS_BAR_ICON_5,NULL,HFILL}
3415          },
3416          { &hf_display_clear_status_bar_icon_6 ,
3417             {"Status Bar Icon 6","unistim.display.clear.sbar.icon6",FT_BOOLEAN,
3418                8,NULL,DISPLAY_STATUS_BAR_ICON_6,NULL,HFILL}
3419          },
3420          { &hf_display_clear_status_bar_icon_7 ,
3421             {"Status Bar Icon 7","unistim.display.clear.sbar.icon7",FT_BOOLEAN,
3422                8,NULL,DISPLAY_STATUS_BAR_ICON_7,NULL,HFILL}
3423          },
3424          { &hf_display_clear_status_bar_icon_8 ,
3425             {"Status Bar Icon 8","unistim.display.clear.sbar.icon8",FT_BOOLEAN,
3426                8,NULL,DISPLAY_STATUS_BAR_ICON_8,NULL,HFILL}
3427          },
3428          { &hf_display_clear_soft_key_1 ,
3429             {"Soft Key 1","unistim.display.clear.soft.key1",FT_BOOLEAN,
3430                8,NULL,DISPLAY_SOFT_KEY_1,NULL,HFILL}
3431          },
3432          { &hf_display_clear_soft_key_2 ,
3433             {"Soft Key 2","unistim.display.clear.soft.key2",FT_BOOLEAN,
3434                8,NULL,DISPLAY_SOFT_KEY_2,NULL,HFILL}
3435          },
3436          { &hf_display_clear_soft_key_3 ,
3437             {"Soft Key 3","unistim.display.clear.soft.key3",FT_BOOLEAN,
3438                8,NULL,DISPLAY_SOFT_KEY_3,NULL,HFILL}
3439          },
3440          { &hf_display_clear_soft_key_4 ,
3441             {"Soft Key 4","unistim.display.clear.soft.key4",FT_BOOLEAN,
3442                8,NULL,DISPLAY_SOFT_KEY_4,NULL,HFILL}
3443          },
3444          { &hf_display_clear_soft_key_5 ,
3445             {"Soft Key 5","unistim.display.clear.soft.key5",FT_BOOLEAN,
3446                8,NULL,DISPLAY_SOFT_KEY_5,NULL,HFILL}
3447          },
3448          { &hf_display_clear_soft_key_6 ,
3449             {"Soft Key 6","unistim.display.clear.soft.key6",FT_BOOLEAN,
3450                8,NULL,DISPLAY_SOFT_KEY_6,NULL,HFILL}
3451          },
3452          { &hf_display_clear_soft_key_7 ,
3453             {"Soft Key 7","unistim.display.clear.soft.key7",FT_BOOLEAN,
3454                8,NULL,DISPLAY_SOFT_KEY_7,NULL,HFILL}
3455          },
3456          { &hf_display_clear_soft_key_8 ,
3457             {"Soft Key 8","unistim.display.clear.soft.key8",FT_BOOLEAN,
3458                8,NULL,DISPLAY_SOFT_KEY_8,NULL,HFILL}
3459          },
3460          { &hf_display_clear_sk_label_key_id,
3461             {"Soft Key Label ID","unistim.display.clear.sk.label.id",FT_UINT8,
3462                BASE_HEX,NULL, DISPLAY_CLEAR_SK_LABEL_KEY_ID,NULL,HFILL}
3463          },
3464          { &hf_display_clear_all_slks,
3465             {"Clear All Soft Key Labels","unistim.display.clear.all.sks",FT_BOOLEAN,
3466                8,NULL,DISPLAY_CLEAR_ALL_SLKS,NULL,HFILL}
3467          },
3468          { &hf_key_led_cadence,
3469             {"LED Cadence","unistim.key.led.cadence",FT_UINT8,
3470                BASE_HEX,VALS(led_cadences),KEY_LED_CADENCE,NULL,HFILL}
3471          },
3472          { &hf_key_led_id,
3473             {"LED ID","unistim.key.led.id",FT_UINT8,
3474                BASE_HEX,VALS(led_ids),KEY_LED_ID,NULL,HFILL}
3475          },
3476          { &hf_basic_ether_address,
3477             {"Phone Ethernet Address","unistim.phone.ether",FT_ETHER,
3478                BASE_NONE,NULL,0x00,NULL,HFILL}
3479          },
3480          { &hf_audio_rtcp_bucket_id,
3481             {"RTCP Bucket ID","unistim.audio.rtcp.bucket.id",FT_UINT8,
3482                BASE_HEX,NULL,AUDIO_RTCP_BUCKET_ID,NULL,HFILL}
3483          },
3484          { &hf_audio_clear_bucket,
3485             {"Clear Bucket Counter","unistim.clear.bucket",FT_BOOLEAN,
3486                8,NULL,AUDIO_CLEAR_BUCKET,NULL,HFILL}
3487          },
3488          { &hf_display_arrow,
3489             {"Arrow Display Direction","unistim.arrow.direction",FT_UINT8,
3490                BASE_HEX,VALS(arrow_dirs),0x00,NULL,HFILL}
3491          },
3492          { &hf_audio_transducer_pair,
3493             {"Audio Transducer Pair","unistim.transducer.pairs",FT_UINT8,
3494                BASE_HEX,VALS(transducer_pairs),AUDIO_TRANSDUCER_PAIR_ID,NULL,HFILL}
3495          },
3496          { &hf_audio_rx_enable,
3497             {"RX Enable","unistim.receive.enable",FT_BOOLEAN,
3498                8,NULL,AUDIO_RX_ENABLE,NULL,HFILL}
3499          },
3500          { &hf_audio_tx_enable,
3501             {"TX Enable","unistim.transmit.enable",FT_BOOLEAN,
3502                8,NULL,AUDIO_TX_ENABLE,NULL,HFILL}
3503          },
3504          { &hf_audio_sidetone_disable,
3505             {"Disable Sidetone","unistim.audio.sidetone.disable",FT_BOOLEAN,
3506                8,NULL,AUDIO_SIDETONE_DISABLE,NULL,HFILL}
3507          },
3508          { &hf_audio_destruct_additive,
3509             {"Destructive/Additive","unistim.destructive.active",FT_BOOLEAN,
3510                8,TFS(&destruct_additive),AUDIO_DESTRUCT_ADD,NULL,HFILL}
3511          },
3512          { &hf_audio_dont_force_active,
3513             {"Don't Force Active","unistim.dont.force.active",FT_BOOLEAN,
3514                8,TFS(&dont_force_active),AUDIO_DONT_FORCE_ACTIVE,NULL,HFILL}
3515          },
3516          { &hf_display_line_width,
3517             {"Phone Line Width","unistim.line.width",FT_UINT8,
3518                BASE_DEC,NULL,DISPLAY_LINE_WIDTH,NULL,HFILL}
3519          },
3520          { &hf_display_lines,
3521             {"Number Of Lines","unistim.number.lines",FT_UINT8,
3522                BASE_DEC,NULL,DISPLAY_LINES,NULL,HFILL}
3523          },
3524          { &hf_display_softkey_width,
3525             {"Phone Softkey Width","unistim.softkey.width",FT_UINT8,
3526                BASE_DEC,NULL,DISPLAY_SKEY_WIDTH,NULL,HFILL}
3527          },
3528          { &hf_display_softkeys,
3529             {"Phone Softkeys","unistim.phone.softkeys",FT_UINT8,
3530                BASE_DEC,NULL,DISPLAY_SKEYS,NULL,HFILL}
3531          },
3532          { &hf_display_icon,
3533             {"Phone Icon Type","unistim.phone.icon.type",FT_UINT8,
3534                BASE_HEX,VALS(icon_types),DISPLAY_ICON,NULL,HFILL}
3535          },
3536          { &hf_display_softlabel_key_width,
3537             {"Soft-Label Key width","unistim.softlabel.key.width",FT_UINT8,
3538                BASE_DEC,NULL,DISPLAY_SOFTLABEL_WIDTH,NULL,HFILL}
3539          },
3540          { &hf_display_context_width,
3541             {"Phone Context Width","unistim.context.width",FT_UINT8,
3542                BASE_DEC,NULL,DISPLAY_CONTEXT_WIDTH,NULL,HFILL}
3543          },
3544          { &hf_display_numeric_width,
3545             {"Phone Numeric Width","unistim.numeric.width",FT_UINT8,
3546                BASE_DEC,NULL,DISPLAY_NUMERIC_WIDTH,NULL,HFILL}
3547          },
3548          { &hf_display_time_width,
3549             {"Phone Time Width","unistim.time.width",FT_UINT8,
3550                BASE_DEC,NULL,DISPLAY_TIME_WIDTH,NULL,HFILL}
3551          },
3552          { &hf_display_date_width,
3553             {"Phone Date Width","unistim.date.width",FT_UINT8,
3554                BASE_DEC,NULL,DISPLAY_DATE_WIDTH,NULL,HFILL}
3555          },
3556          { &hf_display_char_dload,
3557             {"Number of Downloadable Chars","unistim.number.dload.chars",FT_UINT8,
3558                BASE_DEC,NULL,DISPLAY_CHAR_DLOAD,NULL,HFILL}
3559          },
3560          { &hf_display_freeform_icon_dload,
3561             {"Number of Freeform Icon Downloads","unistim.number.dload.icons",FT_UINT8,
3562                BASE_DEC,NULL,DISPLAY_FFORM_ICON_DLOAD,NULL,HFILL}
3563          },
3564          { &hf_display_icon_type,
3565             {"Icon Types","unistim.icon.types",FT_UINT8,
3566                BASE_HEX,NULL,DISPLAY_ICON_TYPE,NULL,HFILL}
3567          },
3568          { &hf_display_charsets,
3569             {"Character Sets","unistim.phone.charsets",FT_UINT8,
3570                BASE_HEX,NULL,DISPLAY_CHARSET,NULL,HFILL}
3571          },
3572          { &hf_display_contrast,
3573             {"Phone Contrast Level","unistim.phone.contrast.level",FT_UINT8,
3574                BASE_DEC,NULL,0x00,NULL,HFILL}
3575          },
3576          { &hf_display_cursor_numeric,
3577             {"Numeric Index Field","unistim.field.numeric",FT_BOOLEAN,
3578                8,NULL,DISPLAY_CURSOR_NUMERIC,NULL,HFILL}
3579          },
3580          { &hf_display_cursor_context,
3581             {"Context Field","unistim.field.context",FT_BOOLEAN,
3582                8,NULL,DISPLAY_CURSOR_CONTEXT,NULL,HFILL}
3583          },
3584          { &hf_display_cursor_line,
3585             {"Text Line","unistim.field.text.line",FT_BOOLEAN,
3586                8,NULL,DISPLAY_CURSOR_LINE,NULL,HFILL}
3587          },
3588          { &hf_display_cursor_softkey,
3589             {"Softkey Position","unistim.position.skey",FT_BOOLEAN,
3590                8,NULL,DISPLAY_CURSOR_SKEY,NULL,HFILL}
3591          },
3592          { &hf_display_cursor_softkey_id,
3593             {"Soft Key Id","unistim.cursor.skey.id",FT_UINT8,
3594                BASE_DEC,NULL,DISPLAY_CURSOR_SKEY_ID,NULL,HFILL}
3595          },
3596          { &hf_display_cursor_char_pos,
3597             {"Character Position","unistim.phone.char.pos",FT_UINT8,
3598                BASE_DEC,NULL,DISPLAY_CURSOR_CHAR_POS,NULL,HFILL}
3599          },
3600          { &hf_display_cursor_line_number,
3601             {"Display Line Number","unistim.display.line.number",FT_UINT8,
3602                BASE_DEC,NULL,DISPLAY_CURSOR_LINE_NUM,NULL,HFILL}
3603          },
3604          { &hf_display_hlight_start,
3605             {"Display Highlight Start Position","unistim.hilite.start.pos",FT_UINT8,
3606                BASE_DEC,NULL,0x00,NULL,HFILL}
3607          },
3608          { &hf_display_hlight_end,
3609             {"Display Highlight End Position","unistim.hilite.end.pos",FT_UINT8,
3610                BASE_DEC,NULL,0x00,NULL,HFILL}
3611          },
3612          { &hf_display_date_format,
3613             {"Date Format","unistim.display.date.format",FT_UINT8,
3614                BASE_HEX,VALS(date_formats),DISPLAY_DATE_FORMAT,NULL,HFILL}
3615          },
3616          { &hf_display_time_format,
3617             {"Time Format","unistim.display.time.format",FT_UINT8,
3618                BASE_HEX,VALS(time_formats),DISPLAY_TIME_FORMAT,NULL,HFILL}
3619          },
3620          { &hf_display_use_time_format,
3621             {"Use Time Format","unistim.display.use.time.format",FT_BOOLEAN,
3622                8,NULL,DISPLAY_USE_TIME_FORMAT,NULL,HFILL}
3623          },
3624          { &hf_display_use_date_format,
3625             {"Use Date Format","unistim.display.use.date.format",FT_BOOLEAN,
3626                8,NULL,DISPLAY_USE_DATE_FORMAT,NULL,HFILL}
3627          },
3628          { &hf_display_context_format,
3629             {"Context Info Bar Format","unistim.display.context.format",FT_UINT8,
3630                BASE_HEX,VALS(display_formats),DISPLAY_CTX_FORMAT,NULL,HFILL}
3631          },
3632          { &hf_display_context_field,
3633             {"Context Info Bar Field","unistim.display.context.field",FT_UINT8,
3634                BASE_HEX,VALS(display_format_fields),DISPLAY_CTX_FIELD,NULL,HFILL}
3635          },
3636          { &hf_display_char_address,
3637             {"Display Character Address","unistim.display.char.address",FT_UINT8,
3638                BASE_HEX,NULL,0x00,NULL,HFILL}
3639          },
3640          { &hf_display_layer_number,
3641             {"Softkey Layer Number","unistim.softkey.layer.num",FT_UINT8,
3642                BASE_HEX,NULL,0x00,NULL,HFILL}
3643          },
3644          { &hf_display_layer_skey_id,
3645             {"Softkey ID","unistim.layer.softkey.id",FT_UINT8,
3646                BASE_DEC,NULL,DISPLAY_LAYER_SKEY_ID,NULL,HFILL}
3647          },
3648          { &hf_display_layer_all_skeys,
3649             {"All Softkeys","unistim.layer.all.skeys",FT_BOOLEAN,
3650                8,NULL,DISPLAY_LAYER_ALL_SKEYS,NULL,HFILL}
3651          },
3652          { &hf_display_once_or_cyclic,
3653             {"Layer Softkey Once/Cyclic","unistim.layer.once.cyclic",FT_BOOLEAN,
3654                8,TFS(&once_or_cyclic),DISPLAY_ONE_OR_CYCLIC,NULL,HFILL}
3655          },
3656          { &hf_display_layer_duration,
3657             {"Display Duration (20ms steps)","unistim.layer.display.duration",FT_UINT8,
3658                BASE_DEC,NULL,0x00,NULL,HFILL}
3659          },
3660          { &hf_key_programmable_keys,
3661             {"Number of Programmable Keys","unistim.num.prog.keys",FT_UINT8,
3662                BASE_DEC,NULL,KEY_NUM_PROG_KEYS,NULL,HFILL}
3663          },
3664          { &hf_keys_soft_keys,
3665             {"Number of Soft Keys","unistim.num.soft.keys",FT_UINT8,
3666                BASE_DEC,NULL,KEY_NUM_SOFT_KEYS,NULL,HFILL}
3667          },
3668          { &hf_keys_hd_key,
3669             {"Headset Key Exists","unistim.exist.hd.key",FT_BOOLEAN,
3670                8,NULL,KEY_HD_KEY_EXISTS,NULL,HFILL}
3671          },
3672          { &hf_keys_mute_key,
3673             {"Mute Key Exists","unistim.exist.mute.key",FT_BOOLEAN,
3674                8,NULL,KEY_MUTE_KEY_EXISTS,NULL,HFILL}
3675          },
3676          { &hf_keys_quit_key,
3677             {"Quit Key Exists","unistim.exist.quit.key",FT_BOOLEAN,
3678                8,NULL,KEY_QUIT_KEY_EXISTS,NULL,HFILL}
3679          },
3680          { &hf_keys_copy_key,
3681             {"Copy Key Exists","unistim.exist.copy.key",FT_BOOLEAN,
3682                8,NULL,KEY_COPY_KEY_EXISTS,NULL,HFILL}
3683          },
3684          { &hf_keys_mwi_key,
3685             {"Message Waiting Indicator Exists","unistim.exist.mwi.key",FT_BOOLEAN,
3686                8,NULL,KEY_MWI_EXISTS,NULL,HFILL}
3687          },
3688          { &hf_keys_num_nav_keys,
3689             {"Number of Navigation Keys","unistim.num.nav.keys",FT_UINT8,
3690                BASE_DEC,VALS(number_nav_keys),KEY_NUM_NAV_KEYS,NULL,HFILL}
3691          },
3692          { &hf_keys_num_conspic_keys,
3693             {"Number Of Conspicuous Keys","unistim.num.conspic.keys",FT_UINT8,
3694                BASE_DEC,NULL,KEY_NUM_CONSPIC_KEYS,NULL,HFILL}
3695          },
3696          { &hf_keys_send_key_rel,
3697             {"Send Key Release","unistim.key.send.release",FT_BOOLEAN,
3698                8,TFS(&key_release),KEY_SEND_KEY_RELEASE,NULL,HFILL}
3699          },
3700          { &hf_keys_enable_vol,
3701             {"Enable Volume Control","unistim.key.enable.vol",FT_BOOLEAN,
3702                8,TFS(&enable_vol),KEY_ENABLE_VOL_KEY,NULL,HFILL}
3703          },
3704          { &hf_keys_conspic_prog_key,
3705             {"Conspicuous and Programmable Keys Same","unistim.conspic.prog.keys",FT_BOOLEAN,
3706                8,TFS(&conspic_prog),KEY_CONSPIC_PROG_KEY0,NULL,HFILL}
3707          },
3708          { &hf_keys_acd_super_control,
3709             {"ACD Supervisor Control","unistim.acd.super.control",FT_BOOLEAN,
3710                8,TFS(&acd_supervisor),KEY_ACD_SUP_CONTROL,NULL,HFILL}
3711          },
3712          { &hf_keys_local_dial_feedback,
3713             {"Local Keypad Feedback","unistim.key.feedback",FT_UINT8,
3714                BASE_HEX,VALS(local_dialpad_feedback),KEY_LOCAL_DIAL_PAD_FEED,NULL,HFILL}
3715          },
3716          { &hf_audio_source_descr,
3717             {"Source Description Item","unistim.source.desc.item",FT_UINT8,
3718                BASE_HEX,VALS(source_descriptions),AUDIO_SOURCE_DESCRIPTION,NULL,HFILL}
3719          },
3720          { &hf_audio_sdes_rtcp_bucket,
3721             {"RTCP Bucket Id","unistim.sdes.rtcp.bucket",FT_UINT8,
3722                BASE_HEX,NULL,AUDIO_SDES_RTCP_BUCKET,NULL,HFILL}
3723          },
3724          { &hf_audio_desired_jitter,
3725             {"Desired Jitter","unistim.audio.desired.jitter",FT_UINT8,
3726                BASE_DEC,NULL,0x00,NULL,HFILL}
3727          },
3728          { &hf_audio_high_water_mark,
3729             {"Threshold of audio frames where jitter buffer removes frames","unistim.high.water.mark",FT_UINT8,
3730                BASE_DEC,NULL,0x00,NULL,HFILL}
3731          },
3732          {  &hf_audio_early_packet_resync_thresh,
3733             {"Threshold in x/8000 sec where packets are too early","unistim.early.packet.thresh",FT_UINT32,
3734               BASE_DEC,NULL,0x00,NULL,HFILL}
3735          },
3736          { &hf_audio_late_packet_resync_thresh,
3737             {"Threshold in x/8000 sec where packets are too late","unistim.late.packet.thresh",FT_UINT32,
3738                BASE_DEC,NULL,0x00,NULL,HFILL}
3739          },
3740          { &hf_audio_resolve_phone_port,
3741             {"Resolve Phone Port","unistim.resolve.phone.port",FT_UINT16,
3742                BASE_DEC,NULL,0x00,NULL,HFILL}
3743          },
3744          { &hf_audio_far_end_echo_port,
3745             {"Resolve Far End Port","unistim.resolve.far.port",FT_UINT16,
3746                BASE_DEC,NULL,0x00,NULL,HFILL}
3747          },
3748          { &hf_audio_far_end_ip_address,
3749             {"Resolve Far End IP","unistim.resolve.far.ip",FT_IPv4,
3750                BASE_NONE,NULL,0x00,NULL,HFILL}
3751          },
3752          { &hf_audio_nat_port,
3753             {"NAT Port","unistim.audio.nat.port",FT_UINT16,
3754                BASE_DEC,NULL,0x00,NULL,HFILL}
3755          },
3756          { &hf_audio_nat_ip_address,
3757             {"NAT IP Address","unistim.audio.nat.ip",FT_IPv4,
3758                BASE_NONE,NULL,0x00,NULL,HFILL}
3759          },
3760          { &hf_audio_direction_code,
3761             {"Stream Direction Code","unistim.audio.direction.codes",FT_UINT8,
3762                BASE_HEX,VALS(direction_codes),AUDIO_DIRECTION_CODE,NULL,HFILL}
3763          },
3764          { &hf_audio_hf_support,
3765             {"Handsfree supported","unistim.handsfree.support",FT_BOOLEAN,
3766                8,NULL,AUDIO_HF_SUPPORT,NULL,HFILL}
3767          },
3768          { &hf_audio_opt_rpt_max,
3769             {"Max Volume","unistim.max.vol",FT_BOOLEAN,
3770                8,TFS(&opt_rpt_enable_max_tone_vol),AUDIO_ENABLED_MAX_TONE,NULL,HFILL}
3771          },
3772          { &hf_audio_opt_rpt_adj_vol,
3773             {"Volume Adjustments","unistim.audio.volume.adj",FT_BOOLEAN,
3774                8,TFS(&opt_rpt_adjust_volume),AUDIO_ENABLED_ADJ_VOL,NULL,HFILL}
3775          },
3776          { &hf_audio_opt_rpt_auto_adj_vol,
3777             {"Auto Adjust RX Volume","unistim.auto.adj.rx.vol",FT_BOOLEAN,
3778                8,TFS(&opt_rpt_automatic_adjustable_rx_volume_report),
3779                AUDIO_AUTO_ADJ_RX_REP,NULL,HFILL}
3780          },
3781          { &hf_audio_opt_rpt_hs_on_air,
3782             {"HS On Air","unistim.audio.hs.on.air",FT_BOOLEAN,
3783                8,TFS(&opt_rpths_on_air_feature),AUDIO_HS_ON_AIR_FEATURE,NULL,HFILL}
3784          },
3785          { &hf_audio_opt_rpt_hd_on_air,
3786             {"HD On Air","unistim.audio.hd.on.air",FT_BOOLEAN,
3787                8,TFS(&opt_rpt_hd_on_air_feature),AUDIO_HD_ON_AIR_FEATURE,NULL,HFILL}
3788          },
3789          { &hf_audio_opt_rpt_noise_squelch,
3790             {"Automatic Squelch","unistim.auto.noise.squelch",FT_BOOLEAN,
3791                8,TFS(&opt_rpt_noise_sqlch_disable),AUDIO_NOISE_SQUELCH_DIS,NULL,HFILL}
3792          },
3793          { &hf_audio_rx_vol_apb_rpt,
3794             {"APB Volume Report","unistim.apb.volume.rpt",FT_UINT8,
3795                BASE_HEX,VALS(volume_rpt_apbs),AUDIO_APB_VOL_RPT,NULL,HFILL}
3796          },
3797          { &hf_audio_rx_vol_vol_up,
3798             {"Volume Up","unistim.audio.volume.up",FT_BOOLEAN,
3799                8,NULL,AUDIO_VOL_UP_RPT,NULL,HFILL}
3800          },
3801          { &hf_audio_rx_vol_vol_floor,
3802             {"RX Volume at Floor","unistim.audio.rx.vol.floor",FT_BOOLEAN,
3803                8,NULL,AUDIO_VOL_FLR_RPT,NULL,HFILL}
3804          },
3805          { &hf_audio_rx_vol_vol_ceiling,
3806             {"RX Volume at Ceiling","unistim.audio.rx.vol.ceiling",FT_BOOLEAN,
3807                8,NULL,AUDIO_VOL_CEIL_RPT,NULL,HFILL}
3808          },
3809          { &hf_audio_current_adj_vol_id,
3810             {"Current APB Volume Report","unistim.current.volume.rpt",FT_UINT8,
3811                BASE_HEX,VALS(volume_rpt_apbs),AUDIO_APB_VOL_RPT,NULL,HFILL}
3812           },
3813           { &hf_audio_current_rx_level,
3814              {"Current RX Volume Level","unistim.current.rx.vol.level",FT_UINT8,
3815                 BASE_DEC,NULL,0x00,NULL,HFILL}
3816           },
3817           { &hf_audio_current_rx_range,
3818              {"Current RX Volume Range","unistim.current.rx.vol.range",FT_UINT8,
3819                 BASE_DEC,NULL,0x00,NULL,HFILL}
3820           },
3821           { &hf_audio_cadence_select,
3822              {"Alerting Cadence Select","unistim.alert.cad.sel",FT_UINT8,
3823                 BASE_HEX,NULL,AUDIO_ALERT_CADENCE_SEL,NULL,HFILL}
3824           },
3825           { &hf_audio_warbler_select,
3826              {"Alerting Warbler Select","unistim.alert.warb.select",FT_UINT8,
3827                 BASE_HEX,NULL,AUDIO_ALERT_WARBLER_SEL,NULL,HFILL}
3828           },
3829           { &hf_audio_open_stream_rpt,
3830              {"Open Stream Report","unistim.open.audio.stream.rpt",FT_UINT8,
3831                 BASE_HEX,VALS(stream_result),0x00,NULL,HFILL}
3832           },
3833           { &hf_audio_sdes_rpt_source_desc,
3834              {"Report Source Description","unistim.rpt.src.desc",FT_UINT8,
3835                 BASE_HEX,VALS(source_descipts),AUDIO_SDES_INFO_RPT_DESC,NULL,HFILL}
3836           },
3837           { &hf_audio_sdes_rpt_buk_id,
3838              {"Report RTCP Bucket ID","unistim.rpt.rtcp.buk.id",FT_UINT8,
3839                 BASE_HEX,NULL,AUDIO_SDES_INFO_RPT_BUK,NULL,HFILL}
3840           },
3841           { &hf_audio_phone_port,
3842              {"Phone Listen Port","unistim.phone.listen.port",FT_UINT16,
3843                 BASE_DEC,NULL,0x00,NULL,HFILL}
3844           },
3845           { &hf_audio_phone_ip,
3846              {"Phone Listen Address","unistim.phone.listen.address",FT_IPv4,
3847                 BASE_NONE,NULL,0x00,NULL,HFILL}
3848           },
3849           { &hf_audio_phone_add_len,
3850              {"Phone Address Length","unistim.phone.address.len",FT_UINT8,
3851                 BASE_DEC,NULL,0x00,NULL,HFILL}
3852           },
3853           { &hf_audio_nat_listen_port,
3854              {"NAT Listen Port","unistim.nat.listen.port",FT_UINT16,
3855                 BASE_DEC,NULL,0x00,NULL,HFILL}
3856           },
3857           { &hf_audio_nat_ip,
3858              {"NAT Listen Address","unistim.nat.listen.address",FT_UINT8,
3859                 BASE_DEC,NULL,0x00,NULL,HFILL}
3860           },
3861           { &hf_audio_nat_add_len,
3862              {"NAT Address Length","unistim.nat.address.len",FT_UINT8,
3863                 BASE_DEC,NULL,0x00,NULL,HFILL}
3864           },
3865           { &hf_audio_stream_direction_code,
3866              {"Audio Stream Direction","unistim.audio.stream.direction",FT_UINT8,
3867                 BASE_HEX,VALS(stream_direction_codes),AUDIO_STREAM_DIRECTION,NULL,HFILL}
3868           },
3869           { &hf_audio_stream_state,
3870              {"Audio Stream State","unistim.audio.stream.state",FT_BOOLEAN,
3871                 8,TFS(&stream_states),AUDIO_STREAM_STATE,NULL,HFILL}
3872           },
3873           { &hf_audio_transducer_list_length,
3874              {"Transducer List Length","unistim.trans.list.len",FT_UINT8,
3875                 BASE_DEC,NULL,0x00,NULL,HFILL}
3876           },
3877           { &hf_net_file_xfer_mode,
3878              {"File Transfer Mode","unistim.net.file.xfer.mode",FT_UINT8,
3879                 BASE_HEX,VALS(file_xfer_modes),NETWORK_FILE_XFER_MODE,NULL,HFILL}
3880           },
3881           { &hf_net_force_download ,
3882              {"Force Download","unistim.net.force.download",FT_BOOLEAN,
3883                 8,NULL,NETWORK_FORCE_DLOAD,NULL,HFILL}
3884           },
3885           { &hf_net_use_file_server_port,
3886              {"Use Custom Server Port","unistim.net.use.server.port",FT_BOOLEAN,
3887                 8,NULL,NETWORK_USE_FSERV_PORT,NULL,HFILL}
3888           },
3889           { &hf_net_use_local_port,
3890              {"Use Custom Local Port","unistim.net.use.local.port",FT_BOOLEAN,
3891                 8,NULL,NETWORK_USE_LOCAL_PORT,NULL,HFILL}
3892           },
3893           { &hf_net_file_server_port,
3894              {"File Server Port","unistim.net.file.server.port",FT_UINT16,
3895                 BASE_DEC,NULL,0x00,NULL,HFILL}
3896           },
3897           { &hf_net_full_pathname,
3898              {"Full Pathname","unistim.net.full_pathname",FT_STRINGZ,
3899                 BASE_NONE,NULL,0x00,NULL,HFILL}
3900           },
3901           { &hf_net_file_identifier,
3902              {"File Identifier","unistim.net.file_identifier",FT_STRINGZ,
3903                 BASE_NONE,NULL,0x00,NULL,HFILL}
3904           },
3905           { &hf_net_local_port,
3906              {"Local XFer Port","unistim.net.local.xfer.port",FT_UINT16,
3907                 BASE_DEC,NULL,0x00,NULL,HFILL}
3908           },
3909           { &hf_net_file_server_address,
3910              {"File Server IP Address","unistim.net.file.server.address",FT_IPv4,
3911                 BASE_NONE,NULL,0x00,NULL,HFILL}
3912           },
3913           { &hf_keys_admin_command,
3914              {"Admin Command","unistim.key.icon.admin.cmd",FT_UINT8,
3915                 BASE_HEX,VALS(admin_commands),KEY_ADMIN_CMD,NULL,HFILL}
3916           },
3917           { &hf_keys_logical_icon_id,
3918              {"Logical Icon ID","unistim.keys.logical.icon.id",FT_UINT16,
3919                 BASE_HEX,NULL,0x00,NULL,HFILL}
3920           },
3921           { &hf_keys_repeat_timer_one,
3922              {"Key Repeat Timer 1 Value","unistim.keys.repeat.time.one",FT_UINT8,
3923                 BASE_DEC,NULL,0x00,NULL,HFILL}
3924           },
3925           { &hf_keys_repeat_timer_two,
3926              {"Key Repeat Timer 2 Value","unistim.keys.repeat.time.two",FT_UINT8,
3927                 BASE_DEC,NULL,0x00,NULL,HFILL}
3928           },
3929           { &hf_keys_led_id,
3930              {"Led ID","unistim.keys.led.id",FT_UINT8,
3931                 BASE_HEX,VALS(keys_led_ids),0x00,NULL,HFILL}
3932           },
3933           { &hf_keys_phone_icon_id,
3934              {"Phone Icon ID","unistim.keys.phone.icon.id",FT_UINT8,
3935                 BASE_HEX,NULL,0x00,NULL,HFILL}
3936           },
3937           { &hf_keys_cadence_on_time,
3938              {"Indicator Cadence On Time","unistim.keys.cadence.on.time",FT_UINT8,
3939                 BASE_DEC,NULL,0x00,NULL,HFILL}
3940           },
3941           { &hf_keys_cadence_off_time,
3942              {"Indicator Cadence Off Time","unistim.keys.cadence.off.time",FT_UINT8,
3943                 BASE_DEC,NULL,0x00,NULL,HFILL}
3944           },
3945           { &hf_keys_user_activity_timeout,
3946              {"User Activity Timeout Value","unistim.keys.user.timeout.value",FT_UINT8,
3947                 BASE_DEC,NULL,0x00,NULL,HFILL}
3948           },
3949           { &hf_display_call_timer_mode,
3950             {"Call Timer Mode","unistim.display.call.timer.mode",FT_BOOLEAN,
3951               8,TFS(&call_duration_timer_mode),DISPLAY_CALL_TIMER_MODE,NULL,HFILL}
3952           },
3953           { &hf_display_call_timer_reset,
3954             {"Call Timer Reset","unistim.display.call.timer.reset",FT_BOOLEAN,
3955               8,TFS(&call_duration_timer_reset),DISPLAY_CALL_TIMER_RESET,NULL,HFILL}
3956           },
3957           { &hf_display_call_timer_display,
3958             {"Call Timer Display","unistim.display.call.timer.display",FT_BOOLEAN,
3959               8,TFS(&call_duration_display_timer),DISPLAY_CALL_TIMER_DISPLAY,NULL,HFILL}
3960           },
3961           { &hf_display_call_timer_delay,
3962             {"Call Timer Delay","unistim.display.call.timer.delay",FT_BOOLEAN,
3963               8,TFS(&call_duration_timer_delay),DISPLAY_CALL_TIMER_DELAY,NULL,HFILL}
3964           },
3965           { &hf_display_call_timer_id,
3966             {"Call Timer ID","unistim.display.call.timer.id",FT_UINT8,
3967               BASE_DEC,NULL,DISPLAY_CALL_TIMER_ID,NULL,HFILL}
3968           },
3969           { &hf_expansion_switch_cmd,
3970             {"Expansion CMD (switch)","unistim.expansion.switch",FT_UINT8,
3971               BASE_HEX,VALS(expansion_switch_msgs),0x0,NULL,HFILL}
3972           },
3973           { &hf_expansion_phone_cmd,
3974              {"Expansion CMD (phone)","unistim.expansion.phone",FT_UINT8,
3975               BASE_HEX,VALS(expansion_phone_msgs),0x0,NULL,HFILL}
3976           },
3977           { &hf_expansion_softlabel_number,
3978             {"Module Soft Label Number","unistim.expansion.label.number",FT_UINT8,
3979               BASE_DEC,NULL,0x00,NULL,HFILL}
3980           },
3981
3982
3983          /****LAST****/
3984          { &hf_generic_string,
3985             {"DATA","unistim.generic.data",FT_STRING,
3986                BASE_NONE,NULL,0x00,NULL,HFILL}
3987          },
3988          { &hf_generic_data,
3989             {"DATA","unistim.generic.data",FT_BYTES,
3990                BASE_NONE,NULL,0x00,NULL,HFILL}
3991          }
3992    };
3993
3994 /* Setup protocol subtree array */
3995
3996    static gint *ett[] = {
3997          &ett_unistim
3998    };
3999
4000    proto_unistim=proto_register_protocol("UNISTIM Protocol", "UNISTIM", "unistim");
4001
4002    proto_register_subtree_array(ett,array_length(ett));
4003    proto_register_field_array(proto_unistim,hf,array_length(hf));
4004
4005    unistim_tap = register_tap("unistim");
4006
4007    unistim_module = prefs_register_protocol(proto_unistim, proto_reg_handoff_unistim);
4008
4009    prefs_register_uint_preference(unistim_module, "udp.port", "UNISTIM UDP port",
4010                                   "UNISTIM port (default 5000)", 10, &global_unistim_port);
4011 }
4012
4013 void
4014 proto_reg_handoff_unistim(void) {
4015    static gboolean initialized = FALSE;
4016    static dissector_handle_t unistim_handle;
4017    static guint unistim_port;
4018
4019    if (!initialized) {
4020       unistim_handle=new_create_dissector_handle(dissect_unistim,proto_unistim);
4021       dissector_add_handle("udp.port", unistim_handle);  /* for "decode as" */
4022       initialized=TRUE;
4023    } else {
4024       if (unistim_port != 0) {
4025          dissector_delete_uint("udp.port",unistim_port,unistim_handle);
4026       }
4027    }
4028
4029    if (global_unistim_port != 0) {
4030       dissector_add_uint("udp.port",global_unistim_port,unistim_handle);
4031    }
4032    unistim_port = global_unistim_port;
4033 }
4034