ccb8fdf3d0e467d0b81c8be6f5624e67b08d0058
[obnox/wireshark/wip.git] / epan / dissectors / packet-dect.c
1 /* packet-dect.c
2  *
3  * Dissector for the Digital Enhanced Cordless Telecommunications
4  * protocol.
5  *
6  * $Id$
7  *
8  * Copyright 2008-2009:
9  * - Andreas Schuler <andreas (A) schulerdev.de>
10  * - Matthias Wenzel <dect (A) mazzoo.de>
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 1998 Gerald Combs
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29  */
30
31 /*
32  TODO (roughly in that order)
33  - Don't use structs to access the elements in the datastream
34    (i.e. pkt_afield, pkt_bfield).
35  - Add references to documentation (ETSI EN 300 175 parts 1-8)
36  - Make things stateful
37  - Once the capture format has stabilized, get rid of the Ethernet
38  hack and use a proper capture type.
39  */
40
41 #ifdef HAVE_CONFIG_H
42 # include "config.h"
43 #endif
44
45 #include <epan/packet.h>
46 #include <epan/etypes.h>
47 #include <string.h>
48
49 #define ETHERTYPE_DECT 0x2323                           /* move to epan/etypes.h */
50
51 #define DECT_PACKET_PP  0
52 #define DECT_PACKET_FP  1
53
54 #define DECT_PACKET_INFO_LEN    11
55
56 /* scramble table with corrections by Jakub Hruska */
57 static guint8 scrt[8][31]=
58 {
59         {0x3B, 0xCD, 0x21, 0x5D, 0x88, 0x65, 0xBD, 0x44, 0xEF, 0x34, 0x85, 0x76, 0x21, 0x96, 0xF5, 0x13, 0xBC, 0xD2, 0x15, 0xD8, 0x86, 0x5B, 0xD4, 0x4E, 0xF3, 0x48, 0x57, 0x62, 0x19, 0x6F, 0x51},
60         {0x32, 0xDE, 0xA2, 0x77, 0x9A, 0x42, 0xBB, 0x10, 0xCB, 0x7A, 0x89, 0xDE, 0x69, 0x0A, 0xEC, 0x43, 0x2D, 0xEA, 0x27, 0x79, 0xA4, 0x2B, 0xB1, 0x0C, 0xB7, 0xA8, 0x9D, 0xE6, 0x90, 0xAE, 0xC4},
61         {0x2D, 0xEA, 0x27, 0x79, 0xA4, 0x2B, 0xB1, 0x0C, 0xB7, 0xA8, 0x9D, 0xE6, 0x90, 0xAE, 0xC4, 0x32, 0xDE, 0xA2, 0x77, 0x9A, 0x42, 0xBB, 0x10, 0xCB, 0x7A, 0x89, 0xDE, 0x69, 0x0A, 0xEC, 0x43},
62         {0x27, 0x79, 0xA4, 0x2B, 0xB1, 0x0C, 0xB7, 0xA8, 0x9D, 0xE6, 0x90, 0xAE, 0xC4, 0x32, 0xDE, 0xA2, 0x77, 0x9A, 0x42, 0xBB, 0x10, 0xCB, 0x7A, 0x89, 0xDE, 0x69, 0x0A, 0xEC, 0x43, 0x2D, 0xEA},
63         {0x19, 0x6F, 0x51, 0x3B, 0xCD, 0x21, 0x5D, 0x88, 0x65, 0xBD, 0x44, 0xEF, 0x34, 0x85, 0x76, 0x21, 0x96, 0xF5, 0x13, 0xBC, 0xD2, 0x15, 0xD8, 0x86, 0x5B, 0xD4, 0x4E, 0xF3, 0x48, 0x57, 0x62},
64         {0x13, 0xBC, 0xD2, 0x15, 0xD8, 0x86, 0x5B, 0xD4, 0x4E, 0xF3, 0x48, 0x57, 0x62, 0x19, 0x6F, 0x51, 0x3B, 0xCD, 0x21, 0x5D, 0x88, 0x65, 0xBD, 0x44, 0xEF, 0x34, 0x85, 0x76, 0x21, 0x96, 0xF5},
65         {0x0C, 0xB7, 0xA8, 0x9D, 0xE6, 0x90, 0xAE, 0xC4, 0x32, 0xDE, 0xA2, 0x77, 0x9A, 0x42, 0xBB, 0x10, 0xCB, 0x7A, 0x89, 0xDE, 0x69, 0x0A, 0xEC, 0x43, 0x2D, 0xEA, 0x27, 0x79, 0xA4, 0x2B, 0xB1},
66         {0x79, 0xA4, 0x2B, 0xB1, 0x0C, 0xB7, 0xA8, 0x9D, 0xE6, 0x90, 0xAE, 0xC4, 0x32, 0xDE, 0xA2, 0x77, 0x9A, 0x42, 0xBB, 0x10, 0xCB, 0x7A, 0x89, 0xDE, 0x69, 0x0A, 0xEC, 0x43, 0x2D, 0xEA, 0x27}
67 };
68
69 #define DECT_AFIELD_TAIL_SIZE 5
70 struct dect_afield
71 {
72         guint8  Header;
73         guint8  Tail[DECT_AFIELD_TAIL_SIZE];
74         guint16 RCRC;
75 };
76
77 #define DECT_BFIELD_DATA_SIZE 128
78 struct dect_bfield
79 {
80         guint8  Data[DECT_BFIELD_DATA_SIZE];
81         guint8  Length;
82 };
83
84 static int proto_dect = -1;
85
86
87 static gint ett_dect                            = -1;
88 static gint ett_columns                         = -1;
89 static gint ett_afield                          = -1;
90 static gint ett_ahead                           = -1;
91 static gint ett_atail                           = -1;
92 static gint ett_aqt                             = -1;
93 static gint ett_bfield                          = -1;
94 static gint ett_bfdescrdata                     = -1;
95
96 static int hf_dect_transceivermode              = -1;
97 static int hf_dect_preamble                     = -1;
98 static int hf_dect_type                         = -1;
99 static int hf_dect_channel                      = -1;
100 static int hf_dect_framenumber                  = -1;
101 static int hf_dect_rssi                         = -1;
102 static int hf_dect_slot                         = -1;
103 static int hf_dect_cc                           = -1;
104 static int hf_dect_cc_TA                        = -1;
105 static int hf_dect_cc_AField            = -1;
106 static int hf_dect_cc_BField            = -1;
107 static int hf_dect_A                            = -1;
108 static int hf_dect_A_Head                       = -1;
109 static int hf_dect_A_Head_TA_FP                 = -1;
110 static int hf_dect_A_Head_TA_PP                 = -1;
111 static int hf_dect_A_Head_Q1                    = -1;
112 static int hf_dect_A_Head_BA                    = -1;
113 static int hf_dect_A_Head_Q2                    = -1;
114 static int hf_dect_A_Tail                       = -1;
115 static int hf_dect_A_Tail_Nt                    = -1;
116 static int hf_dect_A_Tail_Qt_Qh                 = -1;
117 static int hf_dect_A_Tail_Qt_0_Sn               = -1;
118 static int hf_dect_A_Tail_Qt_0_Nr               = -1;
119 static int hf_dect_A_Tail_Qt_0_Sp               = -1;
120 static int hf_dect_A_Tail_Qt_0_Esc              = -1;
121 static int hf_dect_A_Tail_Qt_0_Txs              = -1;
122 static int hf_dect_A_Tail_Qt_0_Mc               = -1;
123 static int hf_dect_A_Tail_Qt_0_CA               = -1;
124 static int hf_dect_A_Tail_Qt_0_Spr1             = -1;
125 static int hf_dect_A_Tail_Qt_0_Cn               = -1;
126 static int hf_dect_A_Tail_Qt_0_Spr2             = -1;
127 static int hf_dect_A_Tail_Qt_0_PSCN             = -1;
128 static int hf_dect_A_Tail_Qt_3_A12              = -1;
129 static int hf_dect_A_Tail_Qt_3_A13              = -1;
130 static int hf_dect_A_Tail_Qt_3_A14              = -1;
131 static int hf_dect_A_Tail_Qt_3_A15              = -1;
132 static int hf_dect_A_Tail_Qt_3_A16              = -1;
133 static int hf_dect_A_Tail_Qt_3_A17              = -1;
134 static int hf_dect_A_Tail_Qt_3_A18              = -1;
135 static int hf_dect_A_Tail_Qt_3_A19              = -1;
136 static int hf_dect_A_Tail_Qt_3_A20              = -1;
137 static int hf_dect_A_Tail_Qt_3_A21              = -1;
138 static int hf_dect_A_Tail_Qt_3_A22              = -1;
139 static int hf_dect_A_Tail_Qt_3_A23              = -1;
140 static int hf_dect_A_Tail_Qt_3_A24              = -1;
141 static int hf_dect_A_Tail_Qt_3_A25              = -1;
142 static int hf_dect_A_Tail_Qt_3_A26              = -1;
143 static int hf_dect_A_Tail_Qt_3_A27              = -1;
144 static int hf_dect_A_Tail_Qt_3_A28              = -1;
145 static int hf_dect_A_Tail_Qt_3_A29              = -1;
146 static int hf_dect_A_Tail_Qt_3_A30              = -1;
147 static int hf_dect_A_Tail_Qt_3_A31              = -1;
148 static int hf_dect_A_Tail_Qt_3_A32              = -1;
149 static int hf_dect_A_Tail_Qt_3_A33              = -1;
150 static int hf_dect_A_Tail_Qt_3_A34              = -1;
151 static int hf_dect_A_Tail_Qt_3_A35              = -1;
152 static int hf_dect_A_Tail_Qt_3_A36              = -1;
153 static int hf_dect_A_Tail_Qt_3_A37              = -1;
154 static int hf_dect_A_Tail_Qt_3_A38              = -1;
155 static int hf_dect_A_Tail_Qt_3_A39              = -1;
156 static int hf_dect_A_Tail_Qt_3_A40              = -1;
157 static int hf_dect_A_Tail_Qt_3_A41              = -1;
158 static int hf_dect_A_Tail_Qt_3_A42              = -1;
159 static int hf_dect_A_Tail_Qt_3_A43              = -1;
160 static int hf_dect_A_Tail_Qt_3_A44              = -1;
161 static int hf_dect_A_Tail_Qt_3_A45              = -1;
162 static int hf_dect_A_Tail_Qt_3_A46              = -1;
163 static int hf_dect_A_Tail_Qt_3_A47              = -1;
164 static int hf_dect_A_Tail_Qt_4_CRFPHops         = -1;
165 static int hf_dect_A_Tail_Qt_4_CRFPEnc          = -1;
166 static int hf_dect_A_Tail_Qt_4_REFHops          = -1;
167 static int hf_dect_A_Tail_Qt_4_REPCap           = -1;
168 static int hf_dect_A_Tail_Qt_4_Sync             = -1;
169 static int hf_dect_A_Tail_Qt_4_A20              = -1;
170 static int hf_dect_A_Tail_Qt_4_MACSusp          = -1;
171 static int hf_dect_A_Tail_Qt_4_MACIpq           = -1;
172 static int hf_dect_A_Tail_Qt_4_A23              = -1;
173 static int hf_dect_A_Tail_Qt_4_A24              = -1;
174 static int hf_dect_A_Tail_Qt_4_A25              = -1;
175 static int hf_dect_A_Tail_Qt_4_A26              = -1;
176 static int hf_dect_A_Tail_Qt_4_A27              = -1;
177 static int hf_dect_A_Tail_Qt_4_A28              = -1;
178 static int hf_dect_A_Tail_Qt_4_A29              = -1;
179 static int hf_dect_A_Tail_Qt_4_A30              = -1;
180 static int hf_dect_A_Tail_Qt_4_A31              = -1;
181 static int hf_dect_A_Tail_Qt_4_A32              = -1;
182 static int hf_dect_A_Tail_Qt_4_A33              = -1;
183 static int hf_dect_A_Tail_Qt_4_A34              = -1;
184 static int hf_dect_A_Tail_Qt_4_A35              = -1;
185 static int hf_dect_A_Tail_Qt_4_A36              = -1;
186 static int hf_dect_A_Tail_Qt_4_A37              = -1;
187 static int hf_dect_A_Tail_Qt_4_A38              = -1;
188 static int hf_dect_A_Tail_Qt_4_A39              = -1;
189 static int hf_dect_A_Tail_Qt_4_A40              = -1;
190 static int hf_dect_A_Tail_Qt_4_A41              = -1;
191 static int hf_dect_A_Tail_Qt_4_A42              = -1;
192 static int hf_dect_A_Tail_Qt_4_A43              = -1;
193 static int hf_dect_A_Tail_Qt_4_A44              = -1;
194 static int hf_dect_A_Tail_Qt_4_A45              = -1;
195 static int hf_dect_A_Tail_Qt_4_A46              = -1;
196 static int hf_dect_A_Tail_Qt_4_A47              = -1;
197 static int hf_dect_A_Tail_Qt_6_Spare            = -1;
198 static int hf_dect_A_Tail_Qt_6_Mfn              = -1;
199 static int hf_dect_A_Tail_Mt_Mh                 = -1;
200 static int hf_dect_A_Tail_Mt_Mh_attr    = -1;
201 static int hf_dect_A_Tail_Mt_Mh_fmid            = -1;
202 static int hf_dect_A_Tail_Mt_Mh_pmid            = -1;
203 static int hf_dect_A_Tail_Mt_BasicConCtrl       = -1;
204 static int hf_dect_A_Tail_Mt_Encr_Cmd1          = -1;
205 static int hf_dect_A_Tail_Mt_Encr_Cmd2          = -1;
206 static int hf_dect_A_Tail_Pt_ExtFlag            = -1;
207 static int hf_dect_A_Tail_Pt_SDU                = -1;
208 static int hf_dect_A_Tail_Pt_RFPI               = -1;
209 static int hf_dect_A_Tail_Pt_BsData             = -1; 
210 static int hf_dect_A_Tail_Pt_InfoType           = -1;
211 static int hf_dect_A_Tail_Pt_SlotPairs          = -1;
212 static int hf_dect_A_Tail_Pt_Fillbits           = -1;
213 static int hf_dect_A_Tail_Pt_Bearer_Sn          = -1;
214 static int hf_dect_A_Tail_Pt_Bearer_Cn          = -1;
215 static int hf_dect_A_Tail_Pt_Bearer_Sp          = -1;
216 static int hf_dect_A_RCRC                       = -1;
217 static int hf_dect_B                            = -1;
218 static int hf_dect_B_Data                       = -1;
219 static int hf_dect_B_DescrambledData            = -1;
220 static int hf_dect_B_fn                         = -1;
221 static int hf_dect_B_XCRC                       = -1;
222
223 static const value_string tranceiver_mode[]=
224 {
225         {0, "Receive"},
226         {1, "Send"},
227         {0, NULL}
228 };
229
230 static const value_string TA_vals_FP[]=
231 {
232         {0, "Ct Next Data Packet"},
233         {1, "Ct First Data Packet"},
234         {2, "Nt Identities Information on Connectionless Bearer"},
235         {3, "Nt Identities Information"},
236         {4, "Qt Multiframe Synchronisation and System Information"},
237         {5, "Escape"},
238         {6, "Mt MAC Layer Control"},
239         {7, "Pt Paging Tail"},
240         {0, NULL}
241 };
242
243 static const value_string TA_vals_PP[]=
244 {
245         {0, "Ct Next Data Packet"},
246         {1, "Ct First Data Packet"},
247         {2, "Nt Identities Information on Connectionless Bearer"},
248         {3, "Nt Identities Information"},
249         {4, "Qt Multiframe Synchronisation and System Information"},
250         {5, "Escape"},
251         {6, "Mt MAC Layer Control"},
252         {7, "Mt MAC Layer Control,first packet"},
253         {0, NULL}
254 };
255
256 static const value_string BA_vals[]=
257 {
258         {0, "U-Type, In, SIn or Ip Packet No. 0 or No Valid Ip_error_detect Channel Data"},
259         {1, "U-Type, Ip_error_detect or Ip Packet No. 1 or SIn or No Valid In Channel Data"},
260         {2, "Double-Slot Required / E-Type, all Cf or CLf, Packet No. 0"},
261         {3, "E-Type, All Cf, Packet No. 1"},
262         {4, "Half-Slot Required / E-Type, not all Cf or CLf, Cf Packet No. 0"},
263         {5, "E-Type, not all Cf, Cf Packet No. 1"},
264         {6, "E-Type, All MAC control (unnumbered)"},
265         {7, "No B-Field"},
266         {0, NULL}
267 };
268
269 static const value_string QTHead_vals[]=
270 { /* EN 300 175-3 V2.3.0  7.2.3.1 */
271         {0, "Static System Info"},
272         {1, "Static System Info"},
273         {2, "Extended RF Carriers Part 1"},
274         {3, "Fixed Part Capabilities"},
275         {4, "Extended Fixed Part Capabilities"},
276         {5, "SARI List Contents"},
277         {6, "Multi-Frame No."},
278         {7, "Escape"},
279         {8, "Obsolete"},
280         {9, "Extended RF Carriers Part 2"},
281         {10, "Reserved("},
282         {11, "Transmit Information"},
283         {12, "Extended Fixed Part Capabilities 2"},
284         {13, "Reserved"},
285         {14, "Reserved"},
286         {15, "Reserved"},
287         {0, NULL}
288 };
289
290 static const value_string QTNormalReverse_vals[]=
291 {
292         {0, "Normal RFP Transmit Half-Frame"},
293         {1, "Normal PP Transmit Half-Frame"},
294         {0, NULL}
295 };
296
297 static const value_string QTSlotNumber_vals[]=
298 {
299         {0, "Slot Pair 0/12"},
300         {1, "Slot Pair 1/13"},
301         {2, "Slot Pair 2/14"},
302         {3, "Slot Pair 3/15"},
303         {4, "Slot Pair 4/16"},
304         {5, "Slot Pair 5/17"},
305         {6, "Slot Pair 6/18"},
306         {7, "Slot Pair 7/19"},
307         {8, "Slot Pair 8/20"},
308         {9, "Slot Pair 9/21"},
309         {10, "Slot Pair 10/22"},
310         {11, "Slot Pair 11/23"},
311         {12, "Reserved"},
312         {13, "Reserved"},
313         {14, "Reserved"},
314         {15, "Reserved"},
315         {0, NULL}
316 };
317
318 static const value_string QTStartPosition_vals[]=
319 {
320         {0, "S-Field starts at Bit F0"},
321         {1, "Reserved for Future Use"},
322         {2, "S-Field starts at Bit F240"},
323         {3, "Reserved for Future Use"},
324         {0, NULL}
325 };
326
327 static const value_string QTEscape_vals[]=
328 {
329         {0, "No QT Escape is broadcast"},
330         {1, "The QT Escape is broadcast"},
331         {0, NULL}
332 };
333
334 static const value_string QTTranceiver_vals[]=
335 {
336         {0, "RFP has 1 Transceiver"},
337         {1, "RFP has 2 Transceiver"},
338         {2, "RFP has 3 Transceiver"},
339         {3, "RFP has 4 or more Transceiver"},
340         {0, NULL}
341 };
342
343 static const value_string QTExtendedCarrier_vals[]=
344 {
345         {0, "No Extended RF Carrier Information Message"},
346         {1, "Extended RF Carrier Information Message shall be transmitted in the next Multiframe"},
347         {0, NULL}
348 };
349
350 static const value_string QTSpr_vals[]=
351 {
352         {0, "OK"},
353         {1, "Reserved"},
354         {2, "Reserved"},
355         {3, "Reserved"},
356         {0, NULL}
357 };
358
359 static const value_string QTCarrierNumber_vals[]=
360 {
361         {0, "RF Carrier 0"},
362         {1, "RF Carrier 1"},
363         {2, "RF Carrier 2"},
364         {3, "RF Carrier 3"},
365         {4, "RF Carrier 4"},
366         {5, "RF Carrier 5"},
367         {6, "RF Carrier 6"},
368         {7, "RF Carrier 7"},
369         {8, "RF Carrier 8"},
370         {9, "RF Carrier 9"},
371         {10, "RF Carrier 10"},
372         {11, "RF Carrier 11"},
373         {12, "RF Carrier 12"},
374         {13, "RF Carrier 13"},
375         {14, "RF Carrier 14"},
376         {15, "RF Carrier 15"},
377         {16, "RF Carrier 16"},
378         {17, "RF Carrier 17"},
379         {18, "RF Carrier 18"},
380         {19, "RF Carrier 19"},
381         {20, "RF Carrier 20"},
382         {21, "RF Carrier 21"},
383         {22, "RF Carrier 22"},
384         {23, "RF Carrier 23"},
385         {24, "RF Carrier 24"},
386         {25, "RF Carrier 25"},
387         {26, "RF Carrier 26"},
388         {27, "RF Carrier 27"},
389         {28, "RF Carrier 28"},
390         {29, "RF Carrier 29"},
391         {30, "RF Carrier 30"},
392         {31, "RF Carrier 31"},
393         {32, "RF Carrier 32"},
394         {33, "RF Carrier 33"},
395         {34, "RF Carrier 34"},
396         {35, "RF Carrier 35"},
397         {36, "RF Carrier 36"},
398         {37, "RF Carrier 37"},
399         {38, "RF Carrier 38"},
400         {39, "RF Carrier 39"},
401         {40, "RF Carrier 40"},
402         {41, "RF Carrier 41"},
403         {42, "RF Carrier 42"},
404         {43, "RF Carrier 43"},
405         {44, "RF Carrier 44"},
406         {45, "RF Carrier 45"},
407         {46, "RF Carrier 46"},
408         {47, "RF Carrier 47"},
409         {48, "RF Carrier 48"},
410         {49, "RF Carrier 49"},
411         {50, "RF Carrier 50"},
412         {51, "RF Carrier 51"},
413         {52, "RF Carrier 52"},
414         {53, "RF Carrier 53"},
415         {54, "RF Carrier 54"},
416         {55, "RF Carrier 55"},
417         {56, "RF Carrier 56"},
418         {57, "RF Carrier 57"},
419         {58, "RF Carrier 58"},
420         {59, "RF Carrier 59"},
421         {60, "RF Carrier 60"},
422         {61, "RF Carrier 61"},
423         {62, "RF Carrier 62"},
424         {63, "RF Carrier 63"},
425         {0, NULL}
426 };
427
428 static const value_string QTScanCarrierNum_vals[]=
429 {
430         {0, "Primary Scan next on RF Carrier 0"},
431         {1, "Primary Scan next on RF Carrier 1"},
432         {2, "Primary Scan next on RF Carrier 2"},
433         {3, "Primary Scan next on RF Carrier 3"},
434         {4, "Primary Scan next on RF Carrier 4"},
435         {5, "Primary Scan next on RF Carrier 5"},
436         {6, "Primary Scan next on RF Carrier 6"},
437         {7, "Primary Scan next on RF Carrier 7"},
438         {8, "Primary Scan next on RF Carrier 8"},
439         {9, "Primary Scan next on RF Carrier 9"},
440         {10, "Primary Scan next on RF Carrier 10"},
441         {11, "Primary Scan next on RF Carrier 11"},
442         {12, "Primary Scan next on RF Carrier 12"},
443         {13, "Primary Scan next on RF Carrier 13"},
444         {14, "Primary Scan next on RF Carrier 14"},
445         {15, "Primary Scan next on RF Carrier 15"},
446         {16, "Primary Scan next on RF Carrier 16"},
447         {17, "Primary Scan next on RF Carrier 17"},
448         {18, "Primary Scan next on RF Carrier 18"},
449         {19, "Primary Scan next on RF Carrier 19"},
450         {20, "Primary Scan next on RF Carrier 20"},
451         {21, "Primary Scan next on RF Carrier 21"},
452         {22, "Primary Scan next on RF Carrier 22"},
453         {23, "Primary Scan next on RF Carrier 23"},
454         {24, "Primary Scan next on RF Carrier 24"},
455         {25, "Primary Scan next on RF Carrier 25"},
456         {26, "Primary Scan next on RF Carrier 26"},
457         {27, "Primary Scan next on RF Carrier 27"},
458         {28, "Primary Scan next on RF Carrier 28"},
459         {29, "Primary Scan next on RF Carrier 29"},
460         {30, "Primary Scan next on RF Carrier 30"},
461         {31, "Primary Scan next on RF Carrier 31"},
462         {32, "Primary Scan next on RF Carrier 32"},
463         {33, "Primary Scan next on RF Carrier 33"},
464         {34, "Primary Scan next on RF Carrier 34"},
465         {35, "Primary Scan next on RF Carrier 35"},
466         {36, "Primary Scan next on RF Carrier 36"},
467         {37, "Primary Scan next on RF Carrier 37"},
468         {38, "Primary Scan next on RF Carrier 38"},
469         {39, "Primary Scan next on RF Carrier 39"},
470         {40, "Primary Scan next on RF Carrier 40"},
471         {41, "Primary Scan next on RF Carrier 41"},
472         {42, "Primary Scan next on RF Carrier 42"},
473         {43, "Primary Scan next on RF Carrier 43"},
474         {44, "Primary Scan next on RF Carrier 44"},
475         {45, "Primary Scan next on RF Carrier 45"},
476         {46, "Primary Scan next on RF Carrier 46"},
477         {47, "Primary Scan next on RF Carrier 47"},
478         {48, "Primary Scan next on RF Carrier 48"},
479         {49, "Primary Scan next on RF Carrier 49"},
480         {50, "Primary Scan next on RF Carrier 50"},
481         {51, "Primary Scan next on RF Carrier 51"},
482         {52, "Primary Scan next on RF Carrier 52"},
483         {53, "Primary Scan next on RF Carrier 53"},
484         {54, "Primary Scan next on RF Carrier 54"},
485         {55, "Primary Scan next on RF Carrier 55"},
486         {56, "Primary Scan next on RF Carrier 56"},
487         {57, "Primary Scan next on RF Carrier 57"},
488         {58, "Primary Scan next on RF Carrier 58"},
489         {59, "Primary Scan next on RF Carrier 59"},
490         {60, "Primary Scan next on RF Carrier 60"},
491         {61, "Primary Scan next on RF Carrier 61"},
492         {62, "Primary Scan next on RF Carrier 62"},
493         {63, "Primary Scan next on RF Carrier 63"},
494         {0, NULL}
495 };
496
497 static const value_string Qt_A12_vals[]=
498 {
499         {0, "   Extended FP Info"},
500         {1, "Extended FP Info"},
501         {0, NULL}
502 };
503
504 static const value_string Qt_A13_vals[]=
505 {
506         {0, "   Double Duplex Bearer Connections"},
507         {1, "Double Duplex Bearer Connections"},
508         {0, NULL}
509 };
510
511 static const value_string Qt_A14_vals[]=
512 {
513         {0, "   Reserved"},
514         {1, "Reserved"},
515         {0, NULL}
516 };
517
518 static const value_string Qt_A15_vals[]=
519 {
520         {0, "   Double Slot"},
521         {1, "Double Slot"},
522         {0, NULL}
523 };
524
525 static const value_string Qt_A16_vals[]=
526 {
527         {0, "   Half Slot"},
528         {1, "Half Slot"},
529         {0, NULL}
530 };
531
532 static const value_string Qt_A17_vals[]=
533 {
534         {0, "   Full Slot"},
535         {1, "Full Slot"},
536         {0, NULL}
537 };
538
539 static const value_string Qt_A18_vals[]=
540 {
541         {0, "   Frequency Control"},
542         {1, "Frequency Control"},
543         {0, NULL}
544 };
545
546 static const value_string Qt_A19_vals[]=
547 {
548         {0, "   Page Repetition"},
549         {1, "Page Repetition"},
550         {0, NULL}
551 };
552
553 static const value_string Qt_A20_vals[]=
554 {
555         {0, "   C/O Setup on Dummy allowed"},
556         {1, "C/O Setup on Dummy allowed"},
557         {0, NULL}
558 };
559
560 static const value_string Qt_A21_vals[]=
561 {
562         {0, "   C/L Uplink"},
563         {1, "C/L Uplink"},
564         {0, NULL}
565 };
566
567 static const value_string Qt_A22_vals[]=
568 {
569         {0, "   C/L Downlink"},
570         {1, "C/L Downlink"},
571         {0, NULL}
572 };
573
574 static const value_string Qt_A23_vals[]=
575 {
576         {0, "   Basic A-Field Set-Up"},
577         {1, "Basic A-Field Set-Up"},
578         {0, NULL}
579 };
580
581 static const value_string Qt_A24_vals[]=
582 {
583         {0, "   Advanced A-Field Set-Up"},
584         {1, "Advanced A-Field Set-Up"},
585         {0, NULL}
586 };
587
588 static const value_string Qt_A25_vals[]=
589 {
590         {0, "   B-field Set-Up"},
591         {1, "B-field Set-Up"},
592         {0, NULL}
593 };
594
595 static const value_string Qt_A26_vals[]=
596 {
597         {0, "   Cf Messages"},
598         {1, "Cf Messages"},
599         {0, NULL}
600 };
601
602 static const value_string Qt_A27_vals[]=
603 {
604         {0, "   In Minimum Delay"},
605         {1, "In Minimum Delay"},
606         {0, NULL}
607 };
608
609 static const value_string Qt_A28_vals[]=
610 {
611         {0, "   In Normal Delay"},
612         {1, "In Normal Delay"},
613         {0, NULL}
614 };
615
616 static const value_string Qt_A29_vals[]=
617 {
618         {0, "   Ip Error Detection"},
619         {1, "Ip Error Detection"},
620         {0, NULL}
621 };
622
623 static const value_string Qt_A30_vals[]=
624 {
625         {0, "   Ip Error Correction"},
626         {1, "Ip Error Correction"},
627         {0, NULL}
628 };
629
630 static const value_string Qt_A31_vals[]=
631 {
632         {0, "   Multibearer Connections"},
633         {1, "Multibearer Connections"},
634         {0, NULL}
635 };
636
637 static const value_string Qt_A32_vals[]=
638 {
639         {0, "   ADPCM/G.726 Voice service"},
640         {1, "ADPCM/G.726 Voice service"},
641         {0, NULL}
642 };
643
644 static const value_string Qt_A33_vals[]=
645 {
646         {0, "   GAP basic speech"},
647         {1, "GAP basic speech"},
648         {0, NULL}
649 };
650
651 static const value_string Qt_A34_vals[]=
652 {
653         {0, "   Non-voice circuit switched service"},
654         {1, "Non-voice circuit switched service"},
655         {0, NULL}
656 };
657
658 static const value_string Qt_A35_vals[]=
659 {
660         {0, "   Non-voice packet switched service"},
661         {1, "Non-voice packet switched service"},
662         {0, NULL}
663 };
664
665 static const value_string Qt_A36_vals[]=
666 {
667         {0, "   Standard authentication required"},
668         {1, "Standard authentication required"},
669         {0, NULL}
670 };
671
672 static const value_string Qt_A37_vals[]=
673 {
674         {0, "   Standard ciphering supported"},
675         {1, "Standard ciphering supported"},
676         {0, NULL}
677 };
678
679 static const value_string Qt_A38_vals[]=
680 {
681         {0, "   Location registration supported"},
682         {1, "Location registration supported"},
683         {0, NULL}
684 };
685
686 static const value_string Qt_A39_vals[]=
687 {
688         {0, "   SIM services available"},
689         {1, "SIM services available"},
690         {0, NULL}
691 };
692
693 static const value_string Qt_A40_vals[]=
694 {
695         {0, "   Non-static Fixed Part (FP)"},
696         {1, "Non-static Fixed Part (FP)"},
697         {0, NULL}
698 };
699
700 static const value_string Qt_A41_vals[]=
701 {
702         {0, "   CISS services available"},
703         {1, "CISS services available"},
704         {0, NULL}
705 };
706
707 static const value_string Qt_A42_vals[]=
708 {
709         {0, "   CLMS service available"},
710         {1, "CLMS service available"},
711         {0, NULL}
712 };
713
714 static const value_string Qt_A43_vals[]=
715 {
716         {0, "   COMS service available"},
717         {1, "COMS service available"},
718         {0, NULL}
719 };
720
721 static const value_string Qt_A44_vals[]=
722 {
723         {0, "   Access rights requests supported"},
724         {1, "Access rights requests supported"},
725         {0, NULL}
726 };
727
728 static const value_string Qt_A45_vals[]=
729 {
730         {0, "   External handover supported"},
731         {1, "External handover supported"},
732         {0, NULL}
733 };
734
735 static const value_string Qt_A46_vals[]=
736 {
737         {0, "   Connection handover supported"},
738         {1, "Connection handover supported"},
739         {0, NULL}
740 };
741
742 static const value_string Qt_A47_vals[]=
743 {
744         {0, "   Reserved"},
745         {1, "Reserved"},
746         {0, NULL}
747 };
748
749
750 static const value_string Qt_EA20_vals[]=
751 {
752         {0, "   Reserved"},
753         {1, "Reserved"},
754         {0, NULL}
755 };
756
757 static const value_string Qt_CRFPHops_vals[]=
758 {
759         {0, "1 CRFP is allowed"},
760         {1, "2 CRFP allowed in cascade"},
761         {2, "3 CRFP allowed in cascade"},
762         {3, "No CRFP allowed"},
763         {0, NULL}
764 };
765
766 static const value_string Qt_CRFPEnc_vals[]=
767 {
768         {0, "CRFP encryption not supported"},
769         {1, "CRFP encryption supported"},
770         {0, NULL}
771 };
772
773 static const value_string Qt_REPHops_vals[]=
774 {
775         {0, "REP not supported"},
776         {1, "1 REP is allowed"},
777         {2, "2 REP are allowed in cascade"},
778         {3, "3 REP are allowed in cascade"},
779         {0, NULL}
780 };
781
782 static const value_string Qt_REPCap_vals[]=
783 {
784         {0, "REP interlacing not supported"},
785         {1, "REP interlacing supported"},
786         {0, NULL}
787 };
788
789 static const value_string Qt_Sync_vals[]=
790 {
791         {0, "standard, see EN 300 175-2 [2], clauses 4.6 and 5.2"},
792         {1, "prolonged preamble, see EN 300 175-2 [2], annex C (see note)"},
793         {2, "reserved"},
794         {3, "reserved"},
795         {0, NULL}
796 };
797
798 static const value_string Qt_MACSusp_vals[]=
799 {
800         {0, "Suspend and Resume not supported"},
801         {1, "Suspend and Resume supported"},
802         {0, NULL}
803 };
804
805 static const value_string Qt_MACIpq_vals[]=
806 {
807         {0, "Ipq not supported"},
808         {1, "Ipq supported"},
809         {0, NULL}
810 };
811
812 static const value_string Qt_EA23_vals[]=
813 {
814         {0, "   Extended Fixed Part Info 2"},
815         {1, "Extended Fixed Part Info 2"},
816         {0, NULL}
817 };
818
819 static const value_string Qt_EA24_vals[]=
820 {
821         {0, "   Unused"},
822         {1, "Unused"},
823         {0, NULL}
824 };
825
826 static const value_string Qt_EA25_vals[]=
827 {
828         {0, "   F-MMS Interworking profile supported"},
829         {1, "F-MMS Interworking profile supported"},
830         {0, NULL}
831 };
832
833 static const value_string Qt_EA26_vals[]=
834 {
835         {0, "   Basic ODAP supported"},
836         {1, "Basic ODAP supported"},
837         {0, NULL}
838 };
839
840 static const value_string Qt_EA27_vals[]=
841 {
842         {0, "   Generic Media Encapsulation transport (DPRS) supported"},
843         {1, "Generic Media Encapsulation transport (DPRS) supported"},
844         {0, NULL}
845 };
846
847 static const value_string Qt_EA28_vals[]=
848 {
849         {0, "   IP Roaming unrestricted supported"},
850         {1, "IP Roaming unrestricted supported"},
851         {0, NULL}
852 };
853
854 static const value_string Qt_EA29_vals[]=
855 {
856         {0, "   Ethernet"},
857         {1, "Ethernet"},
858         {0, NULL}
859 };
860
861 static const value_string Qt_EA30_vals[]=
862 {
863         {0, "   Token Ring"},
864         {1, "Token Ring"},
865         {0, NULL}
866 };
867
868 static const value_string Qt_EA31_vals[]=
869 {
870         {0, "   IP"},
871         {1, "IP"},
872         {0, NULL}
873 };
874
875 static const value_string Qt_EA32_vals[]=
876 {
877         {0, "   PPP"},
878         {1, "PPP"},
879         {0, NULL}
880 };
881
882 static const value_string Qt_EA33_vals[]=
883 {
884         {0, "   V.24"},
885         {1, "V.24"},
886         {0, NULL}
887 };
888
889 static const value_string Qt_EA34_vals[]=
890 {
891         {0, "   Reserved"},
892         {1, "Reserved"},
893         {0, NULL}
894 };
895
896 static const value_string Qt_EA35_vals[]=
897 {
898         {0, "   Reserved"},
899         {1, "Reserved"},
900         {0, NULL}
901 };
902
903 static const value_string Qt_EA36_vals[]=
904 {
905         {0, "   RAP Part 1 Profile"},
906         {1, "RAP Part 1 Profile"},
907         {0, NULL}
908 };
909
910 static const value_string Qt_EA37_vals[]=
911 {
912         {0, "   ISDN intermediate system"},
913         {1, "ISDN intermediate system"},
914         {0, NULL}
915 };
916
917 static const value_string Qt_EA38_vals[]=
918 {
919         {0, "   Synchronization to GPS achieved"},
920         {1, "Synchronization to GPS achieved"},
921         {0, NULL}
922 };
923
924 static const value_string Qt_EA39_vals[]=
925 {
926         {0, "   Location registration with TPUI allowed"},
927         {1, "Location registration with TPUI allowed"},
928         {0, NULL}
929 };
930
931 static const value_string Qt_EA40_vals[]=
932 {
933         {0, "   Emergency call supported"},
934         {1, "Emergency call supported"},
935         {0, NULL}
936 };
937
938 static const value_string Qt_EA41_vals[]=
939 {
940         {0, "   Asymmetric bearers supported"},
941         {1, "Asymmetric bearers supported"},
942         {0, NULL}
943 };
944
945 static const value_string Qt_EA42_vals[]=
946 {
947         {0, "   Reserved"},
948         {1, "Reserved"},
949         {0, NULL}
950 };
951
952 static const value_string Qt_EA43_vals[]=
953 {
954         {0, "   LRMS"},
955         {1, "LRMS"},
956         {0, NULL}
957 };
958
959 static const value_string Qt_EA44_vals[]=
960 {
961         {0, "   Data Service Profile D"},
962         {1, "Data Service Profile D"},
963         {0, NULL}
964 };
965
966 static const value_string Qt_EA45_vals[]=
967 {
968         {0, "   DPRS Stream"},
969         {1, "DPRS Stream"},
970         {0, NULL}
971 };
972
973 static const value_string Qt_EA46_vals[]=
974 {
975         {0, "   DPRS FREL"},
976         {1, "DPRS FREL"},
977         {0, NULL}
978 };
979
980 static const value_string Qt_EA47_vals[]=
981 {
982         {0, "   ISDN Data Services"},
983         {1, "ISDN Data Services"},
984         {0, NULL}
985 };
986
987
988
989
990 static const value_string MTHead_vals[]=
991 {
992         {0, "Basic Connection Control"},
993         {1, "Advanced Connection Control"},
994         {2, "MAC Layer Test Messages"},
995         {3, "Quality Control"},
996         {4, "Broadcast and Connectionless Services"},
997         {5, "Encryption Control"},
998         {6, "Tail for use with the first Transmission of a B-Field \"bearer request\" Message"},
999         {7, "Escape"},
1000         {8, "TARI Message"},
1001         {9, "REP Connection Control"},
1002         {10, "Reserved"},
1003         {11, "Reserved"},
1004         {12, "Reserved"},
1005         {13, "Reserved"},
1006         {14, "Reserved"},
1007         {15, "Reserved"},
1008         {0, NULL}
1009 };
1010
1011 static const value_string MTBasicConCtrl_vals[]=
1012 {
1013         {0, "Access Request"},
1014         {1, "Bearer Handover Request"},
1015         {2, "Connection Handover Request"},
1016         {3, "Unconfirmed Access Request"},
1017         {4, "Bearer Confirm"},
1018         {5, "Wait"},
1019         {6, "Attributes T Request"},
1020         {7, "Attributes T Confirm"},
1021         {8, "Reserved"},
1022         {9, "Reserved"},
1023         {10, "Reserved"},
1024         {11, "Reserved"},
1025         {12, "Reserved"},
1026         {13, "Reserved"},
1027         {14, "Reserved"},
1028         {15, "Release"},
1029         {0, NULL}
1030 };
1031
1032 static const value_string MTEncrCmd1_vals[]=
1033 {
1034         {0, "Start Encryption"},
1035         {1, "Stop Encryption"},
1036         {2, "reserved"},
1037         {3, "reserved"},
1038         {0, NULL}
1039 };
1040
1041 static const value_string MTEncrCmd2_vals[]=
1042 {
1043         {0, "Request"},
1044         {1, "Confirm"},
1045         {2, "Grant"},
1046         {3, "Reserved"},
1047         {0, NULL}
1048 };
1049
1050 static const value_string PTExtFlag_vals[]=             
1051 {       /* EN 300 175-3 V2.3.0   7.2.4.2.2 */
1052         {0, "Next normal Page in Frame 0"},
1053         {1, "Another Page in next Frame"},
1054         {0, NULL}
1055 };
1056
1057 static const value_string PTSDU_vals[]=
1058 {       /* EN 300 175-3 V2.3.0   7.2.4.2.3 */
1059         {0, "Zero Length Page"},
1060         {1, "Short Page"},
1061         {2, "Full Page"},
1062         {3, "MAC resume page"},
1063         {4, "Not the last 36 Bits of a Long Page"},
1064         {5, "The first 36 Bits of a Long Page"},
1065         {6, "The last 36 Bits of a Long Page"},
1066         {7, "All of a Long Page (first and last)"},
1067         {0, NULL}
1068 };
1069
1070 static const value_string PTInfoType_vals[]=
1071 {
1072         {0, "Fill Bits"},
1073         {1, "Blind Full Slot Information for Circuit Mode Service"},
1074         {2, "Other Bearer"},
1075         {3, "Recommended Other Bearer"},
1076         {4, "Good RFP Bearer"},
1077         {5, "Dummy or connectionless Bearer Position"},
1078         {6, "Extended Modulation Types"},
1079         {7, "Escape"},
1080         {8, "Dummy or connectionless Bearer Marker"},
1081         {9, "Bearer Handover/Replacement Information"},
1082         {10, "RFP Status and Modulation Types"},
1083         {11, "Active Carriers"},
1084         {12, "Connectionless Bearer Position"},
1085         {13, "RFP Power Level"},
1086         {14, "Blind Double Slot/RFP-FP Interface Resource Information"},
1087         {15, "Blind Full Slot Information for Packet Mode Service"},
1088         {0, NULL}
1089 };
1090
1091 static const value_string PTRFPPower_vals[]=
1092 {
1093         {0, "0 dBm"},
1094         {1, "2 dBm"},
1095         {2, "4 dBm"},
1096         {3, "6 dBm"},
1097         {4, "8 dBm"},
1098         {5, "10 dBm"},
1099         {6, "12 dBm"},
1100         {7, "14 dBm"},
1101         {8, "16 dBm"},
1102         {9, "18 dBm"},
1103         {10, "20 dBm"},
1104         {11, "22 dBm"},
1105         {12, "24 dBm"},
1106         {13, "26 dBm"},
1107         {14, "28 dBm"},
1108         {15, "30 dBm"},
1109         {0, NULL}
1110 };
1111
1112 static unsigned char
1113 dect_getbit(guint8 *data, int bit)
1114 {
1115         guint8 c;
1116         guint8 byte=data[bit/8];
1117
1118         c=1;
1119         c<<=bit%8;
1120
1121         return (byte&c)>>bit%8;
1122 }
1123
1124 static void
1125 dect_setbit(guint8 *data, int bit, guint8 value)
1126 {
1127         if(!value)
1128                 data[bit/8]&=~(1<<(bit%8));
1129         else
1130                 data[bit/8]|=(1<<(bit%8));
1131 }
1132
1133 static guint8
1134 calc_xcrc(guint8* data, guint8 length)
1135 {
1136         guint8 bits[21];
1137         guint8 gp=0x1;
1138         guint8 crc;
1139         guint8 next;
1140         int y, x;
1141
1142         for(y=0;y<80;y++)
1143         {
1144                 dect_setbit(bits, y, dect_getbit(data, y+48*(1+(int)(y/16))));
1145         }
1146         length=10;
1147         crc=bits[0];
1148         y=0;
1149         while(y<length)
1150         {
1151                 if(y<(length-1))
1152                         next=bits[y+1];
1153                 else
1154                         next=0;
1155                 y++;
1156                 x=0;
1157                 while(x<8)
1158                 {
1159                         while(!(crc&0x80))
1160                         {
1161                                 crc<<=1;
1162                                 crc|=!!(next&0x80);
1163                                 next<<=1;
1164                                 x++;
1165                                 if(x>7)
1166                                         break;
1167                         }
1168                         if(x>7)
1169                                 break;
1170                         crc<<=1;
1171                         crc|=!!(next&0x80);
1172                         next<<=1;
1173                         x++;
1174                         crc^=(gp<<4);
1175                 }
1176         }
1177 /*      crc^=0x10; */
1178         return crc;
1179 }
1180
1181 /* XXX - This should be moved to epan/crc/ */
1182 static guint16
1183 calc_rcrc(guint8* data)
1184 {
1185         guint16 gp=0x0589;              /* 10000010110001001 without the leading 1 */
1186
1187         guint16 crc;
1188         guint8 next;
1189         int y, x;
1190
1191         crc=data[0]<<8|data[1];
1192         y=0;
1193         while(y<6)
1194         {
1195                 next=data[2+y];
1196                 y++;
1197                 x=0;
1198                 while(x<8)
1199                 {
1200                         while(!(crc&0x8000))
1201                         {
1202                                 crc<<=1;
1203                                 crc|=!!(next&0x80);
1204                                 next<<=1;
1205                                 x++;
1206                                 if(x>7)
1207                                         break;
1208                         }
1209                         if(x>7)
1210                                 break;
1211                         crc<<=1;
1212                         crc|=!!(next&0x80);
1213                         next<<=1;
1214                         x++;
1215                         crc^=gp;
1216                 }
1217         }
1218         crc^=1;
1219         return crc;
1220 }
1221
1222 static gint
1223 dissect_bfield(gboolean dect_packet_type _U_, guint8 a_header,
1224         struct dect_bfield *pkt_bfield, packet_info *pinfo _U_,
1225         tvbuff_t *tvb, proto_item *ti _U_, proto_tree *DectTree, gint offset, proto_tree *ColumnsTree)
1226 {
1227         guint8 xcrc, xcrclen;
1228         guint16 blen;
1229         gint oldoffset, fn;
1230         char *bfield_str;
1231         char *bfield_short_str;
1232         proto_item *bfieldti        = NULL;
1233         proto_tree *BField          = NULL;
1234
1235         proto_item *bfdescrdatati   = NULL;
1236         proto_tree *BFDescrData     = NULL;
1237
1238         /* B-Field */
1239         switch((a_header&0x0E)>>1)
1240         {
1241         case 0:
1242         case 1:
1243         case 3:
1244         case 5:
1245         case 6:
1246                 blen=40;
1247                 xcrclen=4;
1248
1249                 bfield_short_str="Full Slot";
1250                 bfield_str="Full Slot (320 bit data, 4 bit xcrc)";
1251                 break;
1252         case 2:
1253                 blen=100;
1254                 xcrclen=4;
1255
1256                 bfield_short_str="Double Slot";
1257                 bfield_str="Double Slot (800 bit data, 4 bit xcrc)";
1258                 break;
1259         case 4:
1260                 blen=10;
1261                 xcrclen=4;
1262
1263                 bfield_short_str="Half Slot";
1264                 bfield_str="Half Slot (80 bit data, 4 bit xcrc)";
1265                 break;
1266         case 7:
1267         default:
1268                 blen=0;
1269                 xcrclen=0;
1270
1271                 bfield_short_str="No B-Field";
1272                 bfield_str="No B-Field";
1273                 break;
1274
1275         }
1276
1277         proto_tree_add_string(ColumnsTree, hf_dect_cc_BField, tvb, offset, 1, bfield_short_str);
1278
1279         if(blen)
1280         {
1281                 bfieldti                = proto_tree_add_item(DectTree, hf_dect_B, tvb, offset, 40, FALSE);
1282                 BField                  = proto_item_add_subtree(bfieldti, ett_bfield);
1283
1284                 proto_tree_add_none_format(BField, hf_dect_B_Data, tvb, offset, 40, "%s", bfield_str);
1285
1286                 bfdescrdatati   = proto_tree_add_item(BField, hf_dect_B_DescrambledData, tvb, offset, 40, FALSE);
1287                 BFDescrData             = proto_item_add_subtree(bfdescrdatati, ett_bfdescrdata);
1288         }
1289
1290         oldoffset=offset;
1291
1292         if(blen<=pkt_bfield->Length)
1293         {
1294                 guint16 x, y;
1295                 for(fn=0;fn<8;fn++)
1296                 {
1297                         guint16 bytecount=0;
1298
1299                         offset=oldoffset;
1300
1301                         proto_tree_add_none_format(BFDescrData, hf_dect_B_fn, tvb, offset, 0, "Framenumber %u/%u", fn, fn+8);
1302                         for(x=0;x<blen;x+=16)
1303                         {
1304                                 /*
1305                                  * XXX - should this just be an FTYPE_BYTES
1306                                  * field, and possibly just displayed as
1307                                  * "Data: N bytes" rather than giving all
1308                                  * the bytes of data?
1309                                  *
1310                                  * No, it gives you the bytes in descrambled
1311                                  * form depending on the framenumber. Sometimes,
1312                                  * you doesn't know the real framenumber, so you need
1313                                  * the range of all possible descramblings. (a.schuler)
1314                                  */
1315                                 emem_strbuf_t *string;
1316                                 string = ep_strbuf_new(NULL);
1317                                 for(y=0;y<16;y++)
1318                                 {
1319                                         if((x+y)>=blen)
1320                                                 break;
1321
1322                                         ep_strbuf_append_printf(string,"%.2x ", pkt_bfield->Data[x+y]^scrt[fn][bytecount%31]);
1323                                         bytecount++;
1324                                 }
1325                                 proto_tree_add_none_format(BFDescrData, hf_dect_B_Data, tvb, offset, y, "Data: %s", string->str);
1326                                 offset+=y;
1327                         }
1328                 }
1329         }
1330         else
1331                 proto_tree_add_none_format(BField, hf_dect_B_Data, tvb, offset, 0, "Data too Short");
1332
1333         xcrc=calc_xcrc(pkt_bfield->Data, 83);
1334
1335         if((blen+1)<=pkt_bfield->Length)
1336         {
1337                 if(xcrc!=(pkt_bfield->Data[40]&0xf0))
1338                         /* XXX: pkt_bfield->Data[40]&0xf0 isn't really the Recv value?? */
1339                         proto_tree_add_uint_format(bfieldti, hf_dect_B_XCRC, tvb, offset, 1, 0, "X-CRC Error (Calc:%.2x, Recv:%.2x)",xcrc, pkt_bfield->Data[40]&0xf0);
1340                 else
1341                         /* XXX: pkt_bfield->Data[40]&0xf0 isn't really the Recv value?? */
1342                         proto_tree_add_uint_format(bfieldti, hf_dect_B_XCRC, tvb, offset, 1, 1, "X-CRC Match (Calc:%.2x, Recv:%.2x)", xcrc, pkt_bfield->Data[40]&0xf0);
1343         }
1344         else
1345                 proto_tree_add_uint_format(bfieldti, hf_dect_B_XCRC, tvb, offset, 1, 0, "No X-CRC logged (Calc:%.2x)", xcrc);
1346
1347         return offset;
1348 }
1349
1350 static void
1351 dissect_decttype(gboolean dect_packet_type, struct dect_afield *pkt_afield,
1352         struct dect_bfield *pkt_bfield, packet_info *pinfo,
1353         tvbuff_t *tvb, proto_item *ti, proto_tree *DectTree)
1354 {
1355         guint16 rcrc;
1356         guint8 rcrcdat[8];
1357         gint offset                     = DECT_PACKET_INFO_LEN;
1358         guint8 tailtype         = 0;
1359         emem_strbuf_t *afield_str;
1360
1361         proto_tree *ColumnsTree = NULL;
1362         proto_item *columnstreeti = NULL;
1363
1364         proto_item *afieldti    = NULL;
1365         proto_item *aheadti     = NULL;
1366         proto_item *atailti     = NULL;
1367         proto_tree *AField      = NULL;
1368         proto_tree *AHead       = NULL;
1369         proto_tree *ATail       = NULL;
1370
1371         guint8  header, tail_0, tail_1, tail_2, tail_3, tail_4;
1372
1373         /************************** Custom Columns ****************************/
1374         columnstreeti   = proto_tree_add_item(DectTree, hf_dect_cc, tvb,0,0, FALSE);
1375         ColumnsTree             = proto_item_add_subtree(columnstreeti, ett_afield);
1376
1377         afield_str              = ep_strbuf_new(NULL);
1378
1379         col_append_fstr(pinfo->cinfo, COL_INFO, "Use Custom Columns for Infos");
1380
1381         /************************** A-Field ***********************************/
1382
1383         /* A-Field */
1384         header = tvb_get_guint8(tvb, offset+0);
1385         tail_0 = tvb_get_guint8(tvb, offset+1);
1386         tail_1 = tvb_get_guint8(tvb, offset+2);
1387         tail_2 = tvb_get_guint8(tvb, offset+3);
1388         tail_3 = tvb_get_guint8(tvb, offset+4);
1389         tail_4 = tvb_get_guint8(tvb, offset+5);
1390         tailtype        = header >> 5;
1391         afieldti        = proto_tree_add_item(DectTree, hf_dect_A, tvb, offset, 8, FALSE);
1392         AField          = proto_item_add_subtree(afieldti, ett_afield);
1393
1394         /* Header */
1395         aheadti         = proto_tree_add_item(afieldti, hf_dect_A_Head, tvb, offset, 1, FALSE);
1396         AHead           = proto_item_add_subtree(aheadti, ett_ahead);
1397
1398         if(dect_packet_type==DECT_PACKET_FP)
1399                 proto_tree_add_item(AHead, hf_dect_A_Head_TA_FP, tvb, offset, 1, FALSE);
1400         else
1401                 proto_tree_add_item(AHead, hf_dect_A_Head_TA_PP, tvb, offset, 1, FALSE);
1402
1403         proto_tree_add_item(AHead, hf_dect_A_Head_Q1, tvb, offset, 1, FALSE);
1404         proto_tree_add_item(AHead, hf_dect_A_Head_BA, tvb, offset, 1, FALSE);
1405         proto_tree_add_item(AHead, hf_dect_A_Head_Q2, tvb, offset, 1, FALSE);
1406         offset++;
1407
1408         /* Tail */
1409         if(dect_packet_type==DECT_PACKET_FP)
1410         {
1411                 atailti = proto_tree_add_none_format(afieldti, hf_dect_A_Tail, tvb, offset, 5, 
1412                         "FP-Tail: %s", val_to_str(tailtype, TA_vals_FP, "Error, please report: %d"));
1413         }
1414         else
1415         {
1416                 atailti = proto_tree_add_none_format(afieldti, hf_dect_A_Tail, tvb, offset, 5, 
1417                         "PP-Tail: %s", val_to_str(tailtype, TA_vals_PP, "Error, please report: %d"));
1418         }
1419
1420         ATail = proto_item_add_subtree(atailti, ett_atail);
1421
1422         if((tailtype==0)||(tailtype==1))                /* Ct */
1423         {
1424                 proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Ct]");
1425
1426                 if(tailtype==0)
1427                         ep_strbuf_append_printf(afield_str,"C-Channel Next  Data: %s",tvb_bytes_to_str(tvb, offset, 5));
1428                 else
1429                         ep_strbuf_append_printf(afield_str,"C-Channel First Data: %s",tvb_bytes_to_str(tvb, offset, 5));
1430
1431                 proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1432         }
1433         else if((tailtype==2)||(tailtype==3))           /* Nt, Nt connectionless bearer */
1434         {
1435                 proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Nt]");
1436
1437                 ep_strbuf_append_printf(afield_str,"RFPI: %s",tvb_bytes_to_str(tvb, offset, 5));
1438                 proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1439
1440                 proto_tree_add_item(atailti, hf_dect_A_Tail_Nt, tvb, offset, 5, FALSE);
1441         }
1442         else if(tailtype==4)                            /* Qt */
1443         {
1444                 proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Qt]");
1445
1446                 proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_Qh, tvb, offset, 1, FALSE);
1447
1448                 switch(tail_0>>4)
1449                 {
1450                 case 0:         /* Static System Info */
1451                 case 1:
1452                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Static System Info");
1453
1454                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Nr, tvb, offset, 1, FALSE);
1455                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Sn, tvb, offset, 1, FALSE);
1456                         offset++;
1457
1458                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Sp, tvb, offset, 1, FALSE);
1459                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Esc, tvb, offset, 1, FALSE);
1460                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Txs, tvb, offset, 1, FALSE);
1461                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Mc, tvb, offset, 1, FALSE);
1462
1463                         proto_tree_add_none_format(ATail, hf_dect_A_Tail_Qt_0_CA, tvb, offset, 2, " Carrier%s%s%s%s%s%s%s%s%s%s available",
1464                                 (tail_1&0x02)?" 0":"", (tail_1&0x01)?" 1":"", (tail_2&0x80)?" 2":"",
1465                                 (tail_2&0x40)?" 3":"", (tail_2&0x20)?" 4":"", (tail_2&0x10)?" 5":"",
1466                                 (tail_2&0x08)?" 6":"", (tail_2&0x04)?" 7":"", (tail_2&0x02)?" 8":"",
1467                                 (tail_2&0x01)?" 9":"");
1468                         offset+=2;
1469
1470                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Spr1, tvb, offset, 1, FALSE);
1471                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Cn, tvb, offset, 1, FALSE);
1472                         offset++;
1473
1474                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_Spr2, tvb, offset, 1, FALSE);
1475                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_0_PSCN, tvb, offset, 1, FALSE);
1476                         offset++;
1477                         /* due to addition further down */
1478                         offset-=5;
1479                         break;
1480                 case 2:         /* Extended RF Carriers Part 1 */
1481                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Extended RF Carriers Part 1");
1482                         /* TODO: See ETSI EN 300 175-3 V2.3.0  7.2.3.3 */
1483                         break;
1484                 case 3:         /* Fixed Part Capabilities */
1485                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Fixed Part Capabilities");
1486
1487                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A12, tvb, offset, 1, FALSE);
1488                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A13, tvb, offset, 1, FALSE);
1489                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A14, tvb, offset, 1, FALSE);
1490                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A15, tvb, offset, 1, FALSE);
1491                         offset++;
1492
1493                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A16, tvb, offset, 1, FALSE);
1494                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A17, tvb, offset, 1, FALSE);
1495                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A18, tvb, offset, 1, FALSE);
1496                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A19, tvb, offset, 1, FALSE);
1497                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A20, tvb, offset, 1, FALSE);
1498                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A21, tvb, offset, 1, FALSE);
1499                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A22, tvb, offset, 1, FALSE);
1500                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A23, tvb, offset, 1, FALSE);
1501                         offset++;
1502
1503                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A24, tvb, offset, 1, FALSE);
1504                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A25, tvb, offset, 1, FALSE);
1505                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A26, tvb, offset, 1, FALSE);
1506                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A27, tvb, offset, 1, FALSE);
1507                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A28, tvb, offset, 1, FALSE);
1508                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A29, tvb, offset, 1, FALSE);
1509                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A30, tvb, offset, 1, FALSE);
1510                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A31, tvb, offset, 1, FALSE);
1511                         offset++;
1512
1513
1514                         /* higher layer capabilities */
1515                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A32, tvb, offset, 1, FALSE);
1516                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A33, tvb, offset, 1, FALSE);
1517                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A34, tvb, offset, 1, FALSE);
1518                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A35, tvb, offset, 1, FALSE);
1519                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A36, tvb, offset, 1, FALSE);
1520                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A37, tvb, offset, 1, FALSE);
1521                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A38, tvb, offset, 1, FALSE);
1522                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A39, tvb, offset, 1, FALSE);
1523                         offset++;
1524
1525                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A40, tvb, offset, 1, FALSE);
1526                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A41, tvb, offset, 1, FALSE);
1527                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A42, tvb, offset, 1, FALSE);
1528                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A43, tvb, offset, 1, FALSE);
1529                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A44, tvb, offset, 1, FALSE);
1530                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A45, tvb, offset, 1, FALSE);
1531                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A46, tvb, offset, 1, FALSE);
1532                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A47, tvb, offset, 1, FALSE);
1533                         offset++;
1534
1535                         /* due to addition further down */
1536                         offset-=5;
1537                         break;
1538                 case 4:         /* Extended Fixed Part Capabilities */
1539                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Extended Fixed Part Capabilities");
1540
1541
1542                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_CRFPHops, tvb, offset, 1, FALSE);
1543                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_CRFPEnc, tvb, offset, 1, FALSE);
1544                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_REFHops, tvb, offset, 2, FALSE);
1545                         offset++;
1546
1547                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_REPCap, tvb, offset, 1, FALSE);
1548                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_Sync, tvb, offset, 1, FALSE);
1549                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A20, tvb, offset, 1, FALSE);
1550                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_MACSusp, tvb, offset, 1, FALSE);
1551                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_MACIpq, tvb, offset, 1, FALSE);
1552                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A23, tvb, offset, 1, FALSE);
1553                         offset++;
1554
1555
1556                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A24, tvb, offset, 1, FALSE);
1557
1558                         /* higher layer capabilities */
1559                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A25, tvb, offset, 1, FALSE);
1560                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A26, tvb, offset, 1, FALSE);
1561                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A27, tvb, offset, 1, FALSE);
1562                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A28, tvb, offset, 1, FALSE);
1563                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A29, tvb, offset, 1, FALSE);
1564                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A30, tvb, offset, 1, FALSE);
1565                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A31, tvb, offset, 1, FALSE);
1566                         offset++;
1567
1568
1569                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A32, tvb, offset, 1, FALSE);
1570                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A33, tvb, offset, 1, FALSE);
1571                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A34, tvb, offset, 1, FALSE);
1572                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A35, tvb, offset, 1, FALSE);
1573                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A36, tvb, offset, 1, FALSE);
1574                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A37, tvb, offset, 1, FALSE);
1575                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A38, tvb, offset, 1, FALSE);
1576                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A39, tvb, offset, 1, FALSE);
1577                         offset++;
1578
1579                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A40, tvb, offset, 1, FALSE);
1580                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A41, tvb, offset, 1, FALSE);
1581                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A42, tvb, offset, 1, FALSE);
1582                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A43, tvb, offset, 1, FALSE);
1583                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A44, tvb, offset, 1, FALSE);
1584                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A45, tvb, offset, 1, FALSE);
1585                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A46, tvb, offset, 1, FALSE);
1586                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_4_A47, tvb, offset, 1, FALSE);
1587                         offset++;
1588
1589                         /* due to addition further down */
1590                         offset-=5;
1591                         break;
1592                 case 5:         /* SARI List Contents */
1593                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "SARI List Contents");
1594                         /* TODO: See ETSI EN 300 175-3 V2.3.0  7.2.3.6 */
1595                         break;
1596                 case 6:         /* Multi-Frame No.    ETSI EN 300 175-3 V2.3.0  7.2.3.7  */
1597                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_6_Spare, tvb, offset, 2, FALSE);
1598                         offset+=2;
1599
1600                         ep_strbuf_append_printf(afield_str,"Multi-Frame No.: %s",tvb_bytes_to_str(tvb, offset, 3));
1601                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1602
1603                         proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_6_Mfn, tvb, offset, 3, FALSE);
1604                         offset+=3;
1605
1606                         /* due to addition further down */
1607                         offset-=5;
1608                         break;
1609                 case 7:         /* Escape    ETSI EN 300 175-3 V2.3.0  7.2.3.8 */
1610                         ep_strbuf_append_printf(afield_str,"Escape Data: %s",tvb_bytes_to_str(tvb, offset, 5));
1611                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1612                         break;
1613                 case 8:         /* Obsolete */
1614                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Obsolete");
1615                         break;
1616                 case 9:         /* Extended RF Carriers Part 2 */
1617                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Extended RF Carriers Part 2");
1618                         /* TODO: See ETSI EN 300 175-3 V2.3.0  7.2.3.9 */
1619                         break;
1620                 case 11:        /* Transmit Information */
1621                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Transmit Information");
1622                         /* TODO: See ETSI EN 300 175-3 V2.3.0  7.2.3.10 */
1623                         break;
1624                 case 12:        /* Extended Fixed Part Capabilities 2 */
1625                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Extended Fixed Part Capabilities 2");
1626                         /* TODO: See ETSI EN 300 175-3 V2.3.0  7.2.3.11 */
1627                         break;
1628                 case 10:        /* Reserved */
1629                 case 13:
1630                 case 14:
1631                 case 15:
1632                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Reserved");
1633                         break;
1634                 }
1635         }
1636         else if(tailtype==5)                            /* Escape */
1637         {
1638         }
1639         else if((tailtype==6)||((tailtype==7)&&(dect_packet_type==DECT_PACKET_PP)))     /* Mt */
1640         {
1641                 proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Mt]");
1642
1643                 proto_tree_add_uint(ATail, hf_dect_A_Tail_Mt_Mh, tvb, offset, 1, tail_0);
1644
1645                 switch(tail_0>>4)
1646                 {
1647                 case 0:         /* Basic Connection Control */
1648                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Basic Connection Control");
1649                         proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_BasicConCtrl, tvb, offset, 1, FALSE);
1650                         offset++;
1651
1652                         if(((tail_0 & 0x0f)==6)||((tail_0 & 0x0f)==7))
1653                         {
1654                                 /* TODO See ETSI EN 300 175-3 V2.3.0  7.2.5.2.4 */
1655                                 proto_tree_add_none_format(ATail, hf_dect_A_Tail_Mt_Mh_attr, tvb, offset, 4, "More infos at ETSI EN 300 175-3 V2.3.0  7.2.5.2.4");
1656                                 offset +=4;
1657                         }
1658                         else
1659                         {
1660                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Mh_fmid, tvb, offset, 2, FALSE);
1661                                 offset++;
1662
1663                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Mh_pmid, tvb, offset, 3, FALSE);
1664                                 offset+=3;
1665                         }
1666
1667                         /* due to addition further down */
1668                         offset-=5;
1669                         break;
1670                 case 1:         /* Advanced Connection Control */
1671                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Advanced Connection Control");
1672                         break;
1673                 case 2:         /* MAC Layer Test Messages */
1674                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "MAC Layer Test Messages");
1675                         break;
1676                 case 3:         /* Quality Control */
1677                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Quality Control");
1678                         break;
1679                 case 4:         /* Broadcast and Connectionless Services */
1680                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Broadcast and Connectionless Services");
1681                         break;
1682                 case 5:         /* Encryption Control */
1683
1684                         ep_strbuf_append_printf(afield_str,"Encryption Control: %s %s",
1685                                 val_to_str((tail_0&0x0c)>>2, MTEncrCmd1_vals, "Error, please report: %d"),
1686                                 val_to_str(tail_0&0x03, MTEncrCmd2_vals, "Error, please report: %d"));
1687
1688                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1689
1690                         proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Encr_Cmd1, tvb, offset, 1, FALSE);
1691                         proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Encr_Cmd2, tvb, offset, 1, FALSE);
1692                         offset++;
1693
1694                         proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Mh_fmid, tvb, offset, 2, FALSE);
1695                         offset++;
1696
1697                         proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Mh_pmid, tvb, offset, 3, FALSE);
1698                         offset+=3;
1699
1700                         /* wegen addition weiter unten */
1701                         offset-=5;
1702                         break;
1703                 case 6:         /* Tail for use with the first Transmission of a B-Field \"bearer request\" Message */
1704                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Tail for use with the first Transmission of a B-Field \"bearer request\" Message");
1705                         break;
1706                 case 7:         /* Escape */
1707                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Escape");
1708                         break;
1709                 case 8:         /* TARI Message */
1710                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "TARI Message");
1711                         break;
1712                 case 9:         /* REP Connection Control */
1713                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "REP Connection Control");
1714                         break;
1715                 case 10:        /* Reserved */
1716                 case 11:
1717                 case 12:
1718                 case 13:
1719                 case 14:
1720                 case 15:
1721                         proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Reserved");
1722                         break;
1723                 }
1724         }
1725         else if((tailtype==7)&&(dect_packet_type==DECT_PACKET_FP))      /* ETSI EN 300 175-3 V2.3.0  7.2.4  Pt */
1726         {
1727                 proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Pt]");
1728
1729                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_ExtFlag, tvb, offset, 1, FALSE);
1730                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_SDU, tvb, offset, 1, FALSE);
1731
1732                 if(((tail_0&0x70)>>4)&0xfe)
1733                         ep_strbuf_append_printf(afield_str,"%s, ",val_to_str((tail_0&0x70)>>4, PTSDU_vals, "Error, please report: %d"));
1734         
1735                 switch((tail_0&0x70)>>4)
1736                 {
1737                 case 0:         /* Zero Length Page */
1738                 case 1:         /* Short Page */
1739                         if(((tail_0&0x70)>>4)==0)
1740 #if 0
1741 XXX: Hier weitermachen
1742 #endif
1743                         {
1744                                 ep_strbuf_append_printf(afield_str,"RFPI: xxxxx%.1x%.2x%.2x, ", (pkt_afield->Tail[0]&0x0f), pkt_afield->Tail[1], pkt_afield->Tail[2]);
1745                                 proto_tree_add_none_format(atailti, hf_dect_A_Tail_Pt_RFPI, tvb, offset, 3, "RFPI: xxxxx%.1x%.2x%.2x", (pkt_afield->Tail[0]&0x0f), pkt_afield->Tail[1], pkt_afield->Tail[2]);
1746                                 offset+=3;
1747
1748                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_InfoType, tvb, offset, 1, FALSE);
1749                         }
1750                         else
1751                         {
1752                                 ep_strbuf_append_printf(afield_str,"Bs Data: %.1x%.2x%.2x, ", (pkt_afield->Tail[0]&0x0f), pkt_afield->Tail[1], pkt_afield->Tail[2]);
1753                                 proto_tree_add_none_format(atailti, hf_dect_A_Tail_Pt_BsData, tvb, offset, 3, "Bs Data: %.1x%.2x%.2x", (pkt_afield->Tail[0]&0x0f), pkt_afield->Tail[1], pkt_afield->Tail[2]);
1754                                 offset+=3;
1755
1756                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_InfoType, tvb, offset, 1, FALSE);
1757                         }
1758
1759                         ep_strbuf_append_printf(afield_str,"%s",val_to_str(pkt_afield->Tail[3]>>4, PTInfoType_vals, "Error, please report: %d"));
1760
1761                         switch(pkt_afield->Tail[3]>>4)
1762                         {
1763                         case 0: /* Fill Bits */
1764                                 proto_tree_add_none_format(ATail, hf_dect_A_Tail_Pt_Fillbits, tvb, offset, 2, "Fillbits: %.1x%.2x", pkt_afield->Tail[3]&0x0f, pkt_afield->Tail[4]);
1765                                 offset+=2;
1766                                 break;
1767                         case 1: /* Blind Full Slot Information for Circuit Mode Service */
1768                                 offset+=2;
1769                                 break;
1770                         case 7: /* Escape */
1771                                 offset+=2;
1772                                 break;
1773                         case 8: /* Dummy or connectionless Bearer Marker */
1774                                 proto_tree_add_none_format(ATail, hf_dect_A_Tail_Pt_SlotPairs, tvb, offset, 2, " Slot-Pairs: %s%s%s%s%s%s%s%s%s%s%s%s available",
1775                                         (pkt_afield->Tail[3]&0x08)?" 0/12":"", (pkt_afield->Tail[3]&0x04)?" 1/13":"", (pkt_afield->Tail[3]&0x02)?" 2/14":"",
1776                                         (pkt_afield->Tail[3]&0x01)?" 3/15":"", (pkt_afield->Tail[4]&0x80)?" 4/16":"", (pkt_afield->Tail[4]&0x40)?" 5/17":"",
1777                                         (pkt_afield->Tail[4]&0x20)?" 6/18":"", (pkt_afield->Tail[4]&0x10)?" 7/19":"", (pkt_afield->Tail[4]&0x08)?" 8/20":"",
1778                                         (pkt_afield->Tail[4]&0x04)?" 9/21":"", (pkt_afield->Tail[4]&0x02)?" 10/22":"", (pkt_afield->Tail[4]&0x01)?" 11/23":"");
1779
1780                                 offset+=2;
1781                                 break;
1782                         case 2: /* Other Bearer */
1783                         case 3: /* Recommended Other Bearer */
1784                         case 4: /* Good RFP Bearer */
1785                         case 5: /* Dummy or connectionless Bearer Position */
1786                         case 12: /* Connectionless Bearer Position */
1787                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_Bearer_Sn, tvb, offset, 1, FALSE);
1788                                 offset++;
1789
1790                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_Bearer_Sp, tvb, offset, 1, FALSE);
1791                                 proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_Bearer_Cn, tvb, offset, 1, FALSE);
1792                                 offset++;
1793                                 break;
1794                         case 6: /* Extended Modulation Types */
1795                                 offset+=2;
1796                                 break;
1797                         case 9: /* Bearer Handover/Replacement Information */
1798                                 offset+=2;
1799                                 break;
1800                         case 10: /* RFP Status and Modulation Types */
1801                                 offset+=2;
1802                                 break;
1803                         case 11: /* Active Carriers */
1804                                 offset+=2;
1805                                 break;
1806                         case 13: /* RFP Power Level */
1807                                 offset+=2;
1808                                 break;
1809                         case 14: /* Blind Double Slot/RFP-FP Interface Resource Information */
1810                                 offset+=2;
1811                                 break;
1812                         case 15: /* Blind Full Slot Information for Packet Mode Service */
1813                                 offset+=2;
1814                                 break;
1815                         }
1816                         /* due to addition further down */
1817                         offset-=5;
1818                         break;
1819                 case 2:         /* Full Page */
1820                         ep_strbuf_append_printf(afield_str,"Full Page");
1821                         break;
1822                 case 3:         /* MAC Resume Page */
1823                         ep_strbuf_append_printf(afield_str,"MAC Resume Page");
1824                         break;
1825                 case 4:         /* Not the Last 36 Bits of a Long Page */
1826                         ep_strbuf_append_printf(afield_str,"Not the Last 36 Bits");
1827                         break;
1828                 case 5:         /* The First 36 Bits of a Long Page */
1829                         ep_strbuf_append_printf(afield_str,"The First 36 Bits");
1830                         break;
1831                 case 6:         /* The Last 36 Bits of a Long Page */
1832                         ep_strbuf_append_printf(afield_str,"The Last 36 Bits");
1833                         break;
1834                 case 7:         /* All of a Long Page */
1835                         ep_strbuf_append_printf(afield_str,"All of a Long Page");
1836                         break;
1837                 }
1838
1839                 proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
1840         }
1841
1842
1843         offset+=5;
1844
1845         /* R-CRC */
1846
1847         tvb_memcpy(tvb, rcrcdat, DECT_PACKET_INFO_LEN, 6);
1848         rcrcdat[6]=0;
1849         rcrcdat[7]=0;
1850         rcrc=calc_rcrc(rcrcdat);
1851         if(rcrc!=pkt_afield->RCRC)
1852                 proto_tree_add_uint_format(afieldti, hf_dect_A_RCRC, tvb, offset, 2, 0, "R-CRC Error (Calc:%.4x, Recv:%.4x)", rcrc, pkt_afield->RCRC);
1853         else
1854                 proto_tree_add_uint_format(afieldti, hf_dect_A_RCRC, tvb, offset, 2, 1, "R-CRC Match (Calc:%.4x, Recv:%.4x)", rcrc, pkt_afield->RCRC);
1855
1856         offset+=2;
1857
1858         /* **************** B-Field ************************************/
1859         offset=dissect_bfield(dect_packet_type, header, pkt_bfield, pinfo, tvb, ti, DectTree, offset, ColumnsTree);
1860 }
1861
1862 static void
1863 dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1864 {
1865         guint16                 type;
1866         guint                   pkt_len;
1867         struct dect_afield      pkt_afield;
1868         struct dect_bfield      pkt_bfield;
1869
1870         pkt_len=tvb_length(tvb);
1871
1872         if(pkt_len<=DECT_PACKET_INFO_LEN)
1873         {
1874                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "No Data");
1875                 return;
1876         }
1877
1878         /* fill A-Field */
1879         pkt_afield.Header = tvb_get_guint8(tvb, DECT_PACKET_INFO_LEN);
1880         tvb_memcpy(tvb, &(pkt_afield.Tail), DECT_PACKET_INFO_LEN+1, DECT_AFIELD_TAIL_SIZE);
1881         pkt_afield.RCRC = tvb_get_ntohs(tvb, DECT_PACKET_INFO_LEN+6);
1882
1883         /* fill B-Field */
1884         pkt_bfield.Length=pkt_len-DECT_PACKET_INFO_LEN-8;
1885
1886         /* XXX - Should we throw an exception here? */
1887         if (pkt_bfield.Length > DECT_BFIELD_DATA_SIZE)
1888                 pkt_bfield.Length = DECT_BFIELD_DATA_SIZE;
1889
1890         if(pkt_len>DECT_PACKET_INFO_LEN+2)
1891                 tvb_memcpy(tvb, &(pkt_bfield.Data), DECT_PACKET_INFO_LEN+8, pkt_bfield.Length);
1892         else
1893                 memset(&(pkt_bfield.Data), 0, DECT_BFIELD_DATA_SIZE);
1894
1895         col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT");
1896
1897         /* Clear out stuff in the info column */
1898         col_clear(pinfo->cinfo, COL_INFO);
1899         if(tree)
1900         {
1901                 proto_item *ti          =NULL;
1902                 proto_item *typeti      =NULL;
1903                 proto_tree *DectTree    =NULL;
1904                 gint offset             =0;
1905
1906                 ti=proto_tree_add_item(tree, proto_dect, tvb, 0, -1, FALSE);
1907
1908                 DectTree=proto_item_add_subtree(ti, ett_dect);
1909                 proto_tree_add_item(DectTree, hf_dect_transceivermode, tvb, offset, 1, FALSE);
1910                 offset++;
1911
1912                 proto_tree_add_item(DectTree, hf_dect_channel, tvb, offset, 1, FALSE);
1913                 offset++;
1914
1915                 proto_tree_add_item(DectTree, hf_dect_slot, tvb, offset, 2, FALSE);
1916                 offset+=2;
1917
1918                 proto_tree_add_item(DectTree, hf_dect_framenumber, tvb, offset, 1, FALSE);
1919                 offset++;
1920
1921                 proto_tree_add_item(DectTree, hf_dect_rssi, tvb, offset, 1, FALSE);
1922                 offset++;
1923
1924                 proto_tree_add_item(DectTree, hf_dect_preamble, tvb, offset, 3, FALSE);
1925                 offset+=3;
1926
1927                 typeti=proto_tree_add_item(DectTree, hf_dect_type, tvb, offset, 2, FALSE);
1928
1929                 type=tvb_get_ntohs(tvb, offset);
1930                 offset+=2;
1931
1932                 switch(type) {
1933                 case 0x1675:
1934                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT PP");
1935                         proto_item_append_text(typeti, " Phone Packet");
1936                         dissect_decttype(DECT_PACKET_PP, &pkt_afield, &pkt_bfield, pinfo, tvb, ti, DectTree);
1937                         break;
1938                 case 0xe98a:
1939                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT RFP");
1940                         proto_item_append_text(typeti, " Station Packet");
1941                         dissect_decttype(DECT_PACKET_FP, &pkt_afield, &pkt_bfield, pinfo, tvb, ti, DectTree);
1942                         break;
1943                 default:
1944                         col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT Unk");
1945                         proto_item_append_text(typeti, " Unknown Packet");
1946                         break;
1947                 }
1948         }
1949 }
1950
1951 void
1952 proto_register_dect(void)
1953 {
1954         static hf_register_info hf[]=
1955         {
1956                 { &hf_dect_transceivermode,
1957                 {"Tranceiver-Mode", "dect.tranceivermode", FT_UINT8, BASE_HEX, VALS(tranceiver_mode),
1958                         0x0, NULL, HFILL}},
1959
1960                 { &hf_dect_channel,
1961                 {"Channel", "dect.channel", FT_UINT8, BASE_DEC, NULL,
1962                         0x0, NULL, HFILL}},
1963
1964                 { &hf_dect_framenumber,
1965                 {"Frame#", "dect.framenumber", FT_UINT16, BASE_DEC, NULL,
1966                         0x0, NULL, HFILL}},
1967
1968                 { &hf_dect_rssi,
1969                 {"RSSI", "dect.rssi", FT_UINT8, BASE_DEC, NULL,
1970                         0x0, NULL, HFILL}},
1971
1972                 { &hf_dect_slot,
1973                 {"Slot", "dect.slot", FT_UINT16, BASE_DEC, NULL,
1974                         0x0, NULL, HFILL}},
1975
1976                 { &hf_dect_preamble,
1977                 {"Preamble", "dect.preamble", FT_BYTES, BASE_NONE, NULL,
1978                         0x0, NULL, HFILL}},
1979
1980                 { &hf_dect_type,
1981                 {"Packet-Type", "dect.type", FT_BYTES, BASE_NONE, NULL,
1982                         0x0, NULL, HFILL}},
1983
1984
1985         /* **************** Custom Columns ***********************/
1986
1987                 { &hf_dect_cc,
1988                 {"Columns", "dect.cc", FT_NONE, BASE_NONE, NULL,
1989                         0x0, NULL, HFILL}},
1990
1991                 { &hf_dect_cc_TA,
1992                 {"TA", "dect.cc.TA", FT_STRING, BASE_NONE, NULL,
1993                         0x0, NULL, HFILL}},
1994
1995                 { &hf_dect_cc_AField,
1996                 {"A-Field", "dect.cc.afield", FT_STRING, BASE_NONE, NULL,
1997                         0x0, NULL, HFILL}},
1998
1999                 { &hf_dect_cc_BField,
2000                 {"B-Field", "dect.cc.bfield", FT_STRING, BASE_NONE, NULL,
2001                         0x0, NULL, HFILL}},
2002
2003         /* **************** A-Field ******************************/
2004         /* ***** Header ***** */
2005                 { &hf_dect_A,
2006                 {"A-Field", "dect.afield", FT_BYTES, BASE_NONE, NULL,
2007                         0x0, NULL, HFILL}},
2008
2009                 { &hf_dect_A_Head,
2010                 {"A-Field Header", "dect.afield.head", FT_UINT8, BASE_HEX, NULL,
2011                         0x0, NULL, HFILL}},
2012
2013                 { &hf_dect_A_Head_TA_FP,
2014                 {"TA", "dect.afield.head.TA", FT_UINT8, BASE_DEC, VALS(TA_vals_FP),
2015                         0xE0, NULL, HFILL}},
2016
2017                 { &hf_dect_A_Head_TA_PP,
2018                 {"TA", "dect.afield.head.TA", FT_UINT8, BASE_DEC, VALS(TA_vals_PP),
2019                         0xE0, NULL, HFILL}},
2020
2021                 { &hf_dect_A_Head_Q1,
2022                 {"Q1", "dect.afield.head.Q1", FT_UINT8, BASE_DEC, NULL,
2023                         0x10, NULL, HFILL}},
2024
2025                 { &hf_dect_A_Head_BA,
2026                 {"BA", "dect.afield.head.BA", FT_UINT8, BASE_DEC, VALS(BA_vals),
2027                         0x0E, NULL, HFILL}},
2028
2029                 { &hf_dect_A_Head_Q2,
2030                 {"Q2", "dect.afield.head.Q2", FT_UINT8, BASE_DEC, NULL,
2031                         0x01, NULL, HFILL}},
2032
2033         /* ***** Tail ***** */
2034                 { &hf_dect_A_Tail,
2035                 {"A-Field Tail", "dect.afield.tail", FT_NONE, BASE_NONE, NULL,
2036                         0x0, NULL, HFILL}},
2037
2038         /* Nt */
2039                 { &hf_dect_A_Tail_Nt,
2040                 {"RFPI", "dect.afield.tail.Nt", FT_BYTES, BASE_NONE, NULL,
2041                         0x0, "A-Field Tail: Nt/RFPI", HFILL}},
2042
2043         /* Qt */
2044                 { &hf_dect_A_Tail_Qt_Qh,
2045                 {"Qh", "dect.afield.tail.Qt.Qh", FT_UINT8, BASE_DEC, VALS(QTHead_vals),
2046                         0xF0, NULL, HFILL}},
2047
2048         /* Qt Static System Information */
2049         /* Byte 0 */
2050                 { &hf_dect_A_Tail_Qt_0_Nr,
2051                 {"NR", "dect.afield.tail.Qt.NR", FT_UINT8, BASE_DEC, VALS(QTNormalReverse_vals),
2052                         0x10, NULL, HFILL}},
2053
2054                 { &hf_dect_A_Tail_Qt_0_Sn,
2055                 {"SN", "dect.afield.tail.Qt.SN", FT_UINT8, BASE_DEC, VALS(QTSlotNumber_vals),
2056                         0x0F, NULL, HFILL}},
2057
2058         /* Byte 1 */
2059                 { &hf_dect_A_Tail_Qt_0_Sp,
2060                 {"SP", "dect.afield.tail.Qt.SP", FT_UINT8, BASE_DEC, VALS(QTStartPosition_vals),
2061                         0xC0, NULL, HFILL}},
2062
2063                 { &hf_dect_A_Tail_Qt_0_Esc,
2064                 {"Esc", "dect.afield.tail.Qt.Esc", FT_UINT8, BASE_DEC, VALS(QTEscape_vals),
2065                         0x20, NULL, HFILL}},
2066
2067                 { &hf_dect_A_Tail_Qt_0_Txs,
2068                 {"Txs", "dect.afield.tail.Qt.Txs", FT_UINT8, BASE_DEC, VALS(QTTranceiver_vals),
2069                         0x18, NULL, HFILL}},
2070
2071                 { &hf_dect_A_Tail_Qt_0_Mc,
2072                 {"Mc", "dect.afield.tail.Qt.Mc", FT_UINT8, BASE_DEC, VALS(QTExtendedCarrier_vals),
2073                         0x04, NULL, HFILL}},
2074
2075         /* Byte 2 */
2076                 { &hf_dect_A_Tail_Qt_0_CA,
2077                 {"CA", "dect.afield.tail.Qt.CA", FT_NONE, BASE_NONE, NULL,
2078                         0x0, NULL, HFILL}},
2079                         
2080         /* Byte 3 */
2081                 { &hf_dect_A_Tail_Qt_0_Spr1,
2082                 {"Spr1", "dect.afield.tail.Qt.Spr1", FT_UINT8, BASE_DEC, VALS(QTSpr_vals),
2083                         0xC0, NULL, HFILL}},
2084
2085                 { &hf_dect_A_Tail_Qt_0_Cn,
2086                 {"CN", "dect.afield.tail.Qt.CN", FT_UINT8, BASE_DEC, VALS(QTCarrierNumber_vals),
2087                         0x3F, NULL, HFILL}},
2088
2089         /* Byte 4 */
2090                 { &hf_dect_A_Tail_Qt_0_Spr2,
2091                 {"Spr2", "dect.afield.tail.Qt.Spr2", FT_UINT8, BASE_DEC, VALS(QTSpr_vals),
2092                         0xC0, NULL, HFILL}},
2093
2094                 { &hf_dect_A_Tail_Qt_0_PSCN,
2095                 {"PSCN", "dect.afield.tail.Qt.PSCN", FT_UINT8, BASE_DEC, VALS(QTScanCarrierNum_vals),
2096                         0x3F, NULL, HFILL}},
2097
2098         /* Qt Fixed Part Capabilities */
2099                 { &hf_dect_A_Tail_Qt_3_A12,
2100                 {"A12", "dect.afield.tail.Qt.Fp.A12", FT_UINT8, BASE_DEC, VALS(Qt_A12_vals),
2101                         0x08, NULL, HFILL}},
2102
2103                 { &hf_dect_A_Tail_Qt_3_A13,
2104                 {"A13", "dect.afield.tail.Qt.Fp.A13", FT_UINT8, BASE_DEC, VALS(Qt_A13_vals),
2105                         0x04, NULL, HFILL}},
2106
2107                 { &hf_dect_A_Tail_Qt_3_A14,
2108                 {"A14", "dect.afield.tail.Qt.Fp.A14", FT_UINT8, BASE_DEC, VALS(Qt_A14_vals),
2109                         0x02, NULL, HFILL}},
2110
2111                 { &hf_dect_A_Tail_Qt_3_A15,
2112                 {"A15", "dect.afield.tail.Qt.Fp.A15", FT_UINT8, BASE_DEC, VALS(Qt_A15_vals),
2113                         0x01, NULL, HFILL}},
2114
2115                 { &hf_dect_A_Tail_Qt_3_A16,
2116                 {"A16", "dect.afield.tail.Qt.Fp.A16", FT_UINT8, BASE_DEC, VALS(Qt_A16_vals),
2117                         0x80, NULL, HFILL}},
2118
2119                 { &hf_dect_A_Tail_Qt_3_A17,
2120                 {"A17", "dect.afield.tail.Qt.Fp.A17", FT_UINT8, BASE_DEC, VALS(Qt_A17_vals),
2121                         0x40, NULL, HFILL}},
2122
2123                 { &hf_dect_A_Tail_Qt_3_A18,
2124                 {"A18", "dect.afield.tail.Qt.Fp.A18", FT_UINT8, BASE_DEC, VALS(Qt_A18_vals),
2125                         0x20, NULL, HFILL}},
2126
2127                 { &hf_dect_A_Tail_Qt_3_A19,
2128                 {"A19", "dect.afield.tail.Qt.Fp.A19", FT_UINT8, BASE_DEC, VALS(Qt_A19_vals),
2129                         0x10, NULL, HFILL}},
2130
2131                 { &hf_dect_A_Tail_Qt_3_A20,
2132                 {"A20", "dect.afield.tail.Qt.Fp.A20", FT_UINT8, BASE_DEC, VALS(Qt_A20_vals),
2133                         0x08, NULL, HFILL}},
2134
2135                 { &hf_dect_A_Tail_Qt_3_A21,
2136                 {"A21", "dect.afield.tail.Qt.Fp.A21", FT_UINT8, BASE_DEC, VALS(Qt_A21_vals),
2137                         0x04, NULL, HFILL}},
2138
2139                 { &hf_dect_A_Tail_Qt_3_A22,
2140                 {"A22", "dect.afield.tail.Qt.Fp.A22", FT_UINT8, BASE_DEC, VALS(Qt_A22_vals),
2141                         0x02, NULL, HFILL}},
2142
2143                 { &hf_dect_A_Tail_Qt_3_A23,
2144                 {"A23", "dect.afield.tail.Qt.Fp.A23", FT_UINT8, BASE_DEC, VALS(Qt_A23_vals),
2145                         0x01, NULL, HFILL}},
2146
2147                 { &hf_dect_A_Tail_Qt_3_A24,
2148                 {"A24", "dect.afield.tail.Qt.Fp.A24", FT_UINT8, BASE_DEC, VALS(Qt_A24_vals),
2149                         0x80, NULL, HFILL}},
2150
2151                 { &hf_dect_A_Tail_Qt_3_A25,
2152                 {"A25", "dect.afield.tail.Qt.Fp.A25", FT_UINT8, BASE_DEC, VALS(Qt_A25_vals),
2153                         0x40, NULL, HFILL}},
2154
2155                 { &hf_dect_A_Tail_Qt_3_A26,
2156                 {"A26", "dect.afield.tail.Qt.Fp.A26", FT_UINT8, BASE_DEC, VALS(Qt_A26_vals),
2157                         0x20, NULL, HFILL}},
2158
2159                 { &hf_dect_A_Tail_Qt_3_A27,
2160                 {"A27", "dect.afield.tail.Qt.Fp.A27", FT_UINT8, BASE_DEC, VALS(Qt_A27_vals),
2161                         0x10, NULL, HFILL}},
2162
2163                 { &hf_dect_A_Tail_Qt_3_A28,
2164                 {"A28", "dect.afield.tail.Qt.Fp.A28", FT_UINT8, BASE_DEC, VALS(Qt_A28_vals),
2165                         0x08, NULL, HFILL}},
2166
2167                 { &hf_dect_A_Tail_Qt_3_A29,
2168                 {"A29", "dect.afield.tail.Qt.Fp.A29", FT_UINT8, BASE_DEC, VALS(Qt_A29_vals),
2169                         0x04, NULL, HFILL}},
2170
2171                 { &hf_dect_A_Tail_Qt_3_A30,
2172                 {"A30", "dect.afield.tail.Qt.Fp.A30", FT_UINT8, BASE_DEC, VALS(Qt_A30_vals),
2173                         0x02, NULL, HFILL}},
2174
2175                 { &hf_dect_A_Tail_Qt_3_A31,
2176                 {"A31", "dect.afield.tail.Qt.Fp.A31", FT_UINT8, BASE_DEC, VALS(Qt_A31_vals),
2177                         0x01, NULL, HFILL}},
2178
2179
2180                 /* higher layer capabilities */
2181                 { &hf_dect_A_Tail_Qt_3_A32,
2182                 {"A32", "dect.afield.tail.Qt.Fp.A32", FT_UINT8, BASE_DEC, VALS(Qt_A32_vals),
2183                         0x80, NULL, HFILL}},
2184
2185                 { &hf_dect_A_Tail_Qt_3_A33,
2186                 {"A33", "dect.afield.tail.Qt.Fp.A33", FT_UINT8, BASE_DEC, VALS(Qt_A33_vals),
2187                         0x40, NULL, HFILL}},
2188
2189                 { &hf_dect_A_Tail_Qt_3_A34,
2190                 {"A34", "dect.afield.tail.Qt.Fp.A34", FT_UINT8, BASE_DEC, VALS(Qt_A34_vals),
2191                         0x20, NULL, HFILL}},
2192
2193                 { &hf_dect_A_Tail_Qt_3_A35,
2194                 {"A35", "dect.afield.tail.Qt.Fp.A35", FT_UINT8, BASE_DEC, VALS(Qt_A35_vals),
2195                         0x10, NULL, HFILL}},
2196
2197                 { &hf_dect_A_Tail_Qt_3_A36,
2198                 {"A36", "dect.afield.tail.Qt.Fp.A36", FT_UINT8, BASE_DEC, VALS(Qt_A36_vals),
2199                         0x08, NULL, HFILL}},
2200
2201                 { &hf_dect_A_Tail_Qt_3_A37,
2202                 {"A37", "dect.afield.tail.Qt.Fp.A37", FT_UINT8, BASE_DEC, VALS(Qt_A37_vals),
2203                         0x04, NULL, HFILL}},
2204
2205                 { &hf_dect_A_Tail_Qt_3_A38,
2206                 {"A38", "dect.afield.tail.Qt.Fp.A38", FT_UINT8, BASE_DEC, VALS(Qt_A38_vals),
2207                         0x02, NULL, HFILL}},
2208
2209                 { &hf_dect_A_Tail_Qt_3_A39,
2210                 {"A39", "dect.afield.tail.Qt.Fp.A39", FT_UINT8, BASE_DEC, VALS(Qt_A39_vals),
2211                         0x01, NULL, HFILL}},
2212
2213                 { &hf_dect_A_Tail_Qt_3_A40,
2214                 {"A40", "dect.afield.tail.Qt.Fp.A40", FT_UINT8, BASE_DEC, VALS(Qt_A40_vals),
2215                         0x80, NULL, HFILL}},
2216
2217                 { &hf_dect_A_Tail_Qt_3_A41,
2218                 {"A41", "dect.afield.tail.Qt.Fp.A41", FT_UINT8, BASE_DEC, VALS(Qt_A41_vals),
2219                         0x40, NULL, HFILL}},
2220
2221                 { &hf_dect_A_Tail_Qt_3_A42,
2222                 {"A42", "dect.afield.tail.Qt.Fp.A42", FT_UINT8, BASE_DEC, VALS(Qt_A42_vals),
2223                         0x20, NULL, HFILL}},
2224
2225                 { &hf_dect_A_Tail_Qt_3_A43,
2226                 {"A43", "dect.afield.tail.Qt.Fp.A43", FT_UINT8, BASE_DEC, VALS(Qt_A43_vals),
2227                         0x10, NULL, HFILL}},
2228
2229                 { &hf_dect_A_Tail_Qt_3_A44,
2230                 {"A44", "dect.afield.tail.Qt.Fp.A44", FT_UINT8, BASE_DEC, VALS(Qt_A44_vals),
2231                         0x08, NULL, HFILL}},
2232
2233                 { &hf_dect_A_Tail_Qt_3_A45,
2234                 {"A45", "dect.afield.tail.Qt.Fp.A45", FT_UINT8, BASE_DEC, VALS(Qt_A45_vals),
2235                         0x04, NULL, HFILL}},
2236
2237                 { &hf_dect_A_Tail_Qt_3_A46,
2238                 {"A46", "dect.afield.tail.Qt.Fp.A46", FT_UINT8, BASE_DEC, VALS(Qt_A46_vals),
2239                         0x02, NULL, HFILL}},
2240
2241                 { &hf_dect_A_Tail_Qt_3_A47,
2242                 {"A47", "dect.afield.tail.Qt.Fp.A47", FT_UINT8, BASE_DEC, VALS(Qt_A47_vals),
2243                         0x01, NULL, HFILL}},
2244
2245         /* Qt Extended Fixed Part Capabilities */
2246
2247                 { &hf_dect_A_Tail_Qt_4_CRFPHops,
2248                 {"CRFP Hops", "dect.afield.tail.Qt.Efp.CRFPHops", FT_UINT8, BASE_DEC, VALS(Qt_CRFPHops_vals),
2249                         0x0C, NULL, HFILL}},
2250
2251                 { &hf_dect_A_Tail_Qt_4_CRFPEnc,
2252                 {"CRFP Enc", "dect.afield.tail.Qt.Efp.CRFPEnc", FT_UINT8, BASE_DEC, VALS(Qt_CRFPEnc_vals),
2253                         0x02, NULL, HFILL}},
2254
2255                 { &hf_dect_A_Tail_Qt_4_REFHops,
2256                 {"REP Hops", "dect.afield.tail.Qt.Efp.REPHops", FT_UINT16, BASE_DEC, VALS(Qt_REPHops_vals),
2257                         0x0180, NULL, HFILL}},
2258
2259                 { &hf_dect_A_Tail_Qt_4_REPCap,
2260                 {"REP Cap.", "dect.afield.tail.Qt.Efp.REPCap", FT_UINT8, BASE_DEC, VALS(Qt_REPCap_vals),
2261                         0x40, NULL, HFILL}},
2262
2263                 { &hf_dect_A_Tail_Qt_4_Sync,
2264                 {"Sync", "dect.afield.tail.Qt.Efp.Sync", FT_UINT8, BASE_DEC, VALS(Qt_Sync_vals),
2265                         0x30, NULL, HFILL}},
2266
2267                 { &hf_dect_A_Tail_Qt_4_A20,
2268                 {"A20", "dect.afield.tail.Qt.Efp.A20", FT_UINT8, BASE_DEC, VALS(Qt_EA20_vals),
2269                         0x08, NULL, HFILL}},
2270
2271                 { &hf_dect_A_Tail_Qt_4_MACSusp,
2272                 {"MAC Suspend", "dect.afield.tail.Qt.Efp.MACSusp", FT_UINT8, BASE_DEC, VALS(Qt_MACSusp_vals),
2273                         0x04, NULL, HFILL}},
2274
2275                 { &hf_dect_A_Tail_Qt_4_MACIpq,
2276                 {"MAC Ipq", "dect.afield.tail.Qt.Efp.MACIpq", FT_UINT8, BASE_DEC, VALS(Qt_MACIpq_vals),
2277                         0x02, NULL, HFILL}},
2278
2279                 { &hf_dect_A_Tail_Qt_4_A23,
2280                 {"A23", "dect.afield.tail.Qt.Efp.A23", FT_UINT8, BASE_DEC, VALS(Qt_EA23_vals),
2281                         0x01, NULL, HFILL}},
2282
2283                 { &hf_dect_A_Tail_Qt_4_A24,
2284                 {"A24", "dect.afield.tail.Qt.Efp.A24", FT_UINT8, BASE_DEC, VALS(Qt_EA24_vals),
2285                         0x80, NULL, HFILL}},
2286
2287
2288                 /* Higher Layer Capabilities */
2289
2290                 { &hf_dect_A_Tail_Qt_4_A25,
2291                 {"A25", "dect.afield.tail.Qt.Efp.A25", FT_UINT8, BASE_DEC, VALS(Qt_EA25_vals),
2292                         0x40, NULL, HFILL}},
2293
2294                 { &hf_dect_A_Tail_Qt_4_A26,
2295                 {"A26", "dect.afield.tail.Qt.Efp.A26", FT_UINT8, BASE_DEC, VALS(Qt_EA26_vals),
2296                         0x20, NULL, HFILL}},
2297
2298                 { &hf_dect_A_Tail_Qt_4_A27,
2299                 {"A27", "dect.afield.tail.Qt.Efp.A27", FT_UINT8, BASE_DEC, VALS(Qt_EA27_vals),
2300                         0x10, NULL, HFILL}},
2301
2302                 { &hf_dect_A_Tail_Qt_4_A28,
2303                 {"A28", "dect.afield.tail.Qt.Efp.A28", FT_UINT8, BASE_DEC, VALS(Qt_EA28_vals),
2304                         0x08, NULL, HFILL}},
2305
2306                 { &hf_dect_A_Tail_Qt_4_A29,
2307                 {"A29", "dect.afield.tail.Qt.Efp.A29", FT_UINT8, BASE_DEC, VALS(Qt_EA29_vals),
2308                         0x04, NULL, HFILL}},
2309
2310                 { &hf_dect_A_Tail_Qt_4_A30,
2311                 {"A30", "dect.afield.tail.Qt.Efp.A30", FT_UINT8, BASE_DEC, VALS(Qt_EA30_vals),
2312                         0x02, NULL, HFILL}},
2313
2314                 { &hf_dect_A_Tail_Qt_4_A31,
2315                 {"A31", "dect.afield.tail.Qt.Efp.A31", FT_UINT8, BASE_DEC, VALS(Qt_EA31_vals),
2316                         0x01, NULL, HFILL}},
2317
2318                 { &hf_dect_A_Tail_Qt_4_A32,
2319                 {"A32", "dect.afield.tail.Qt.Efp.A32", FT_UINT8, BASE_DEC, VALS(Qt_EA32_vals),
2320                         0x80, NULL, HFILL}},
2321
2322                 { &hf_dect_A_Tail_Qt_4_A33,
2323                 {"A33", "dect.afield.tail.Qt.Efp.A33", FT_UINT8, BASE_DEC, VALS(Qt_EA33_vals),
2324                         0x40, NULL, HFILL}},
2325
2326                 { &hf_dect_A_Tail_Qt_4_A34,
2327                 {"A34", "dect.afield.tail.Qt.Efp.A34", FT_UINT8, BASE_DEC, VALS(Qt_EA34_vals),
2328                         0x20, NULL, HFILL}},
2329
2330                 { &hf_dect_A_Tail_Qt_4_A35,
2331                 {"A35", "dect.afield.tail.Qt.Efp.A35", FT_UINT8, BASE_DEC, VALS(Qt_EA35_vals),
2332                         0x10, NULL, HFILL}},
2333
2334                 { &hf_dect_A_Tail_Qt_4_A36,
2335                 {"A36", "dect.afield.tail.Qt.Efp.A36", FT_UINT8, BASE_DEC, VALS(Qt_EA36_vals),
2336                         0x08, NULL, HFILL}},
2337
2338                 { &hf_dect_A_Tail_Qt_4_A37,
2339                 {"A37", "dect.afield.tail.Qt.Efp.A37", FT_UINT8, BASE_DEC, VALS(Qt_EA37_vals),
2340                         0x04, NULL, HFILL}},
2341
2342                 { &hf_dect_A_Tail_Qt_4_A38,
2343                 {"A38", "dect.afield.tail.Qt.Efp.A38", FT_UINT8, BASE_DEC, VALS(Qt_EA38_vals),
2344                         0x02, NULL, HFILL}},
2345
2346                 { &hf_dect_A_Tail_Qt_4_A39,
2347                 {"A39", "dect.afield.tail.Qt.Efp.A39", FT_UINT8, BASE_DEC, VALS(Qt_EA39_vals),
2348                         0x01, NULL, HFILL}},
2349
2350                 { &hf_dect_A_Tail_Qt_4_A40,
2351                 {"A40", "dect.afield.tail.Qt.Efp.A40", FT_UINT8, BASE_DEC, VALS(Qt_EA40_vals),
2352                         0x80, NULL, HFILL}},
2353
2354                 { &hf_dect_A_Tail_Qt_4_A41,
2355                 {"A41", "dect.afield.tail.Qt.Efp.A41", FT_UINT8, BASE_DEC, VALS(Qt_EA41_vals),
2356                         0x40, NULL, HFILL}},
2357
2358                 { &hf_dect_A_Tail_Qt_4_A42,
2359                 {"A42", "dect.afield.tail.Qt.Efp.A42", FT_UINT8, BASE_DEC, VALS(Qt_EA42_vals),
2360                         0x20, NULL, HFILL}},
2361
2362                 { &hf_dect_A_Tail_Qt_4_A43,
2363                 {"A43", "dect.afield.tail.Qt.Efp.A43", FT_UINT8, BASE_DEC, VALS(Qt_EA43_vals),
2364                         0x10, NULL, HFILL}},
2365
2366                 { &hf_dect_A_Tail_Qt_4_A44,
2367                 {"A44", "dect.afield.tail.Qt.Efp.A44", FT_UINT8, BASE_DEC, VALS(Qt_EA44_vals),
2368                         0x08, NULL, HFILL}},
2369
2370                 { &hf_dect_A_Tail_Qt_4_A45,
2371                 {"A45", "dect.afield.tail.Qt.Efp.A45", FT_UINT8, BASE_DEC, VALS(Qt_EA45_vals),
2372                         0x04, NULL, HFILL}},
2373
2374                 { &hf_dect_A_Tail_Qt_4_A46,
2375                 {"A46", "dect.afield.tail.Qt.Efp.A46", FT_UINT8, BASE_DEC, VALS(Qt_EA46_vals),
2376                         0x02, NULL, HFILL}},
2377
2378                 { &hf_dect_A_Tail_Qt_4_A47,
2379                 {"A47", "dect.afield.tail.Qt.Efp.A47", FT_UINT8, BASE_DEC, VALS(Qt_EA47_vals),
2380                         0x01, NULL, HFILL}},
2381
2382
2383         /* Qt Multiframe  Number */
2384                 { &hf_dect_A_Tail_Qt_6_Spare,
2385                 {"Spare Bits", "dect.afield.tail.Qt.Mfn.Spare", FT_UINT16, BASE_HEX, NULL,
2386                         0x0FFF, NULL, HFILL}},
2387
2388                 { &hf_dect_A_Tail_Qt_6_Mfn,
2389                 {"Multiframe Number", "dect.afield.tail.Qt.Mfn.Mfn", FT_BYTES, BASE_NONE, NULL,
2390                         0, NULL, HFILL}},
2391
2392
2393         /* Mt */
2394                 { &hf_dect_A_Tail_Mt_Mh,
2395                 {"Mh", "dect.afield.tail.Mt.Mh", FT_UINT8, BASE_DEC, VALS(MTHead_vals),
2396                         0xF0, NULL, HFILL}},
2397
2398                 { &hf_dect_A_Tail_Mt_Mh_attr,
2399                 {"Mh", "dect.afield.tail.Mt.Mh.attr", FT_NONE, BASE_NONE, NULL,
2400                         0x0, NULL, HFILL}},
2401
2402                 { &hf_dect_A_Tail_Mt_Mh_fmid,
2403                 {"Mh/FMID", "dect.afield.tail.Mt.Mh.fmid", FT_UINT16, BASE_HEX, NULL,
2404                         0x0FF0, NULL, HFILL}},
2405
2406                 { &hf_dect_A_Tail_Mt_Mh_pmid,
2407                 {"Mh/PMID", "dect.afield.tail.Mt.Mh.pmid", FT_UINT24, BASE_HEX, NULL,
2408                         0x0FFFFF, NULL, HFILL}},
2409
2410         /* Mt Basic Connection Control */
2411                 { &hf_dect_A_Tail_Mt_BasicConCtrl,
2412                 {"Cmd", "dect.afield.tail.Mt.BasicConCtrl", FT_UINT8, BASE_DEC, VALS(MTBasicConCtrl_vals),
2413                         0x0F, NULL, HFILL}},
2414
2415         /* Mt Encryption Control */
2416                 { &hf_dect_A_Tail_Mt_Encr_Cmd1,
2417                 {"Cmd1", "dect.afield.tail.Mt.Encr.Cmd1", FT_UINT8, BASE_DEC, VALS(MTEncrCmd1_vals),
2418                         0x0C, NULL, HFILL}},
2419
2420                 { &hf_dect_A_Tail_Mt_Encr_Cmd2,
2421                 {"Cmd2", "dect.afield.tail.Mt.Encr.Cmd2", FT_UINT8, BASE_DEC, VALS(MTEncrCmd2_vals),
2422                         0x03, NULL, HFILL}},
2423
2424         /* Pt */
2425                 { &hf_dect_A_Tail_Pt_ExtFlag,
2426                 {"ExtFlag", "dect.afield.tail.Pt.ExtFlag", FT_UINT8, BASE_DEC, VALS(PTExtFlag_vals),
2427                         0x80, NULL, HFILL}},
2428
2429                 { &hf_dect_A_Tail_Pt_SDU,
2430                 {"Bs SDU", "dect.afield.tail.Pt.SDU", FT_UINT8, BASE_DEC, VALS(PTSDU_vals),
2431                         0x70, NULL, HFILL}},
2432
2433                 { &hf_dect_A_Tail_Pt_RFPI,
2434                 {"InfoType", "dect.afield.tail.Pt.RFPI", FT_NONE, BASE_NONE, NULL,
2435                         0x0, NULL, HFILL}},
2436
2437                 { &hf_dect_A_Tail_Pt_BsData,
2438                 {"Bs Data", "dect.afield.tail.Pt.BsData", FT_NONE, BASE_NONE, NULL,
2439                         0x0, NULL, HFILL}},
2440
2441                 { &hf_dect_A_Tail_Pt_InfoType,
2442                 {"InfoType", "dect.afield.tail.Pt.InfoType", FT_UINT8, BASE_DEC, VALS(PTInfoType_vals),
2443                         0xF0, NULL, HFILL}},
2444
2445                 { &hf_dect_A_Tail_Pt_Fillbits,
2446                 {"FillBits", "dect.afield.tail.Pt.FillBits", FT_NONE, BASE_NONE, NULL,
2447                         0x0, NULL, HFILL}},
2448
2449                 { &hf_dect_A_Tail_Pt_SlotPairs,
2450                 {"SlotPairs", "dect.afield.tail.Pt.SlotPairs", FT_NONE, BASE_NONE, NULL,
2451                         0x0, NULL, HFILL}},
2452
2453                 { &hf_dect_A_Tail_Pt_Bearer_Sn,
2454                 {"SN", "dect.afield.tail.Pt.SN", FT_UINT8, BASE_DEC, VALS(QTSlotNumber_vals),
2455                         0x0F, NULL, HFILL}},
2456
2457                 { &hf_dect_A_Tail_Pt_Bearer_Sp,
2458                 {"SP", "dect.afield.tail.Pt.SP", FT_UINT8, BASE_DEC, VALS(QTStartPosition_vals),
2459                         0xC0, NULL, HFILL}},
2460
2461                 { &hf_dect_A_Tail_Pt_Bearer_Cn,
2462                 {"CN", "dect.afield.tail.Pt.CN", FT_UINT8, BASE_DEC, VALS(QTCarrierNumber_vals),
2463                         0x3F, NULL, HFILL}},
2464
2465         /* ***** R-CRC ***** */
2466                 { &hf_dect_A_RCRC,
2467                 {"A-Field R-CRC", "dect.afield.rcrc", FT_UINT8, BASE_DEC, NULL,
2468                         0x0, NULL, HFILL}},
2469
2470         /* ***************** B-Field *************************** */
2471                 { &hf_dect_B,
2472                 {"B-Field", "dect.bfield", FT_BYTES, BASE_NONE,
2473                         0x0, 0x0, NULL, HFILL}},
2474
2475                 { &hf_dect_B_Data,
2476                 {"B-Field", "dect.bfield.data", FT_NONE, BASE_NONE, NULL,
2477                         0x0, NULL, HFILL}},
2478
2479                 { &hf_dect_B_DescrambledData,
2480                 {"Descrambled Data", "dect.bfield.descrdata", FT_NONE, BASE_NONE,
2481                         0x0, 0x0, NULL, HFILL}},
2482
2483                 { &hf_dect_B_fn,
2484                 {"B-Field", "dect.bfield.framenumber", FT_NONE, BASE_NONE, NULL,
2485                         0x0, NULL, HFILL}},
2486
2487         /* ***** X-CRC ***** */
2488                 { &hf_dect_B_XCRC,
2489                 {"B-Field X-CRC", "dect.bfield.xcrc", FT_UINT8, BASE_DEC, NULL,
2490                         0x0, NULL, HFILL}}
2491         };
2492
2493
2494         /* Setup protocol subtree array */
2495         static gint *ett[]=
2496         {
2497                 &ett_dect,
2498                 &ett_columns,
2499                 &ett_ahead,
2500                 &ett_afield,
2501                 &ett_atail,
2502                 &ett_aqt,
2503                 &ett_bfield,
2504                 &ett_bfdescrdata
2505         };
2506
2507         proto_dect=proto_register_protocol("DECT Protocol", "DECT", "dect");
2508         proto_register_field_array(proto_dect, hf, array_length(hf));
2509         proto_register_subtree_array(ett, array_length(ett));
2510 }
2511
2512 void
2513 proto_reg_handoff_dect(void)
2514 {
2515         dissector_handle_t dect_handle;
2516
2517         dect_handle = create_dissector_handle(dissect_dect, proto_dect);
2518         dissector_add_uint("ethertype", ETHERTYPE_DECT , dect_handle);
2519 }
2520