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