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