3 * Dissector for the Digital Enhanced Cordless Telecommunications
9 * - Andreas Schuler <krater (A) badterrorist.com>
10 * - Matthias Wenzel <dect (A) mazzoo.de>
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
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.
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.
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.
32 TODO (roughly in that order)
33 - Don't use structs to access the elements in the datastream.
34 - Use tvb_..._item wherever possible
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.
45 #include <epan/packet.h>
46 #include <epan/etypes.h>
49 #define ETHERTYPE_DECT 0x2323 /* move to epan/etypes.h */
51 /* scramble table with corrections by Jakub Hruska */
52 static guint8 scrt[8][31]=
54 {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},
55 {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},
56 {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},
57 {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},
58 {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},
59 {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},
60 {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},
61 {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}
77 static int proto_dect = -1;
80 static int proto_dect2 = -1;
84 static gint ett_dect = -1;
85 static gint ett_afield = -1;
86 static gint ett_ahead = -1;
87 static gint ett_atail = -1;
88 static gint ett_aqt = -1;
89 static gint ett_bfield = -1;
91 static int hf_dect_transceivermode = -1;
92 static int hf_dect_preamble = -1;
93 static int hf_dect_type = -1;
94 static int hf_dect_channel = -1;
95 static int hf_dect_framenumber = -1;
96 static int hf_dect_rssi = -1;
97 static int hf_dect_slot = -1;
98 static int hf_dect_A = -1;
99 static int hf_dect_A_Head = -1;
100 static int hf_dect_A_Head_TA = -1;
101 static int hf_dect_A_Head_Q1 = -1;
102 static int hf_dect_A_Head_BA = -1;
103 static int hf_dect_A_Head_Q2 = -1;
104 static int hf_dect_A_Tail = -1;
105 static int hf_dect_A_Tail_Nt = -1;
106 static int hf_dect_A_Tail_Qt_Qh = -1;
107 static int hf_dect_A_Tail_Qt_0_Sn = -1;
108 static int hf_dect_A_Tail_Qt_0_Nr = -1;
109 static int hf_dect_A_Tail_Qt_0_Sp = -1;
110 static int hf_dect_A_Tail_Qt_0_Esc = -1;
111 static int hf_dect_A_Tail_Qt_0_Txs = -1;
112 static int hf_dect_A_Tail_Qt_0_Mc = -1;
113 static int hf_dect_A_Tail_Qt_0_Spr1 = -1;
114 static int hf_dect_A_Tail_Qt_0_Cn = -1;
115 static int hf_dect_A_Tail_Qt_0_Spr2 = -1;
116 static int hf_dect_A_Tail_Qt_0_PSCN = -1;
117 static int hf_dect_A_Tail_Qt_3_A12 = -1;
118 static int hf_dect_A_Tail_Qt_3_A13 = -1;
119 static int hf_dect_A_Tail_Qt_3_A14 = -1;
120 static int hf_dect_A_Tail_Qt_3_A15 = -1;
121 static int hf_dect_A_Tail_Qt_3_A16 = -1;
122 static int hf_dect_A_Tail_Qt_3_A17 = -1;
123 static int hf_dect_A_Tail_Qt_3_A18 = -1;
124 static int hf_dect_A_Tail_Qt_3_A19 = -1;
125 static int hf_dect_A_Tail_Qt_3_A20 = -1;
126 static int hf_dect_A_Tail_Qt_3_A21 = -1;
127 static int hf_dect_A_Tail_Qt_3_A22 = -1;
128 static int hf_dect_A_Tail_Qt_3_A23 = -1;
129 static int hf_dect_A_Tail_Qt_3_A24 = -1;
130 static int hf_dect_A_Tail_Qt_3_A25 = -1;
131 static int hf_dect_A_Tail_Qt_3_A26 = -1;
132 static int hf_dect_A_Tail_Qt_3_A27 = -1;
133 static int hf_dect_A_Tail_Qt_3_A28 = -1;
134 static int hf_dect_A_Tail_Qt_3_A29 = -1;
135 static int hf_dect_A_Tail_Qt_3_A30 = -1;
136 static int hf_dect_A_Tail_Qt_3_A31 = -1;
137 static int hf_dect_A_Tail_Mt_Mh = -1;
138 static int hf_dect_A_Tail_Mt_BasicConCtrl = -1;
139 static int hf_dect_A_Tail_Mt_Encr_Cmd1 = -1;
140 static int hf_dect_A_Tail_Mt_Encr_Cmd2 = -1;
141 static int hf_dect_A_Tail_Pt_ExtFlag = -1;
142 static int hf_dect_A_Tail_Pt_SDU = -1;
143 static int hf_dect_A_Tail_Pt_InfoType = -1;
144 static int hf_dect_A_Tail_Pt_Fill_Fillbits = -1;
145 static int hf_dect_A_Tail_Pt_Bearer_Sn = -1;
146 static int hf_dect_A_Tail_Pt_Bearer_Cn = -1;
147 static int hf_dect_A_Tail_Pt_Bearer_Sp = -1;
148 static int hf_dect_A_RCRC = -1;
149 static int hf_dect_B = -1;
150 static int hf_dect_B_Data = -1;
151 static int hf_dect_B_XCRC = -1;
153 static const value_string tranceiver_mode[]=
160 static const value_string TA_vals[]=
162 {0,"Ct Next Data Packet"},
163 {1,"Ct First Data Packet"},
164 {2,"Nt Identities Information on Connectionless Bearer"},
165 {3,"Nt Identities Information"},
166 {4,"Qt Multiframe Synchronisation and System Information"},
168 {6,"Mt MAC Layer Control"},
169 {7,"Pt Paging Tail"},
173 static const value_string BA_vals[]=
175 {0,"U-Type, In, SIn or Ip Packet No. 0 or No Valid Ip_error_detect Channel Data"},
176 {1,"U-Type, Ip_error_detect or Ip Packet No. 1 or SIn or No Valid In Channel Data"},
177 {2,"Double-Slot Required / E-Type, all Cf or CLf, Packet No. 0"},
178 {3,"E-Type, All Cf, Packet No. 1"},
179 {4,"Half-Slot Required / E-Type, not all Cf or CLf, Cf Packet No. 0"},
180 {5,"E-Type, not all Cf, Cf Packet No. 1"},
181 {6,"E-Type, All MAC control (unnumbered)"},
186 static const value_string QTHead_vals[]=
188 {0,"Static System Info"},
189 {1,"Static System Info"},
190 {2,"Extended RF Carriers Part 1"},
191 {3,"Fixed Part Capabilities"},
192 {4,"Extended Fixed Part Capabilities"},
193 {5,"SARI List Contents"},
194 {6,"Multi-Frame No."},
197 {9,"Extended RF Carriers Part 2"},
199 {11,"Transmit Information(?)"},
207 static const value_string QTNormalReverse_vals[]=
209 {0,"Normal RFP Transmit Half-Frame"},
210 {1,"Normal PP Transmit Half-Frame"},
214 static const value_string QTSlotNumber_vals[]=
216 {0,"Slot Pair 0/12"},
217 {1,"Slot Pair 1/13"},
218 {2,"Slot Pair 2/14"},
219 {3,"Slot Pair 3/15"},
220 {4,"Slot Pair 4/16"},
221 {5,"Slot Pair 5/17"},
222 {6,"Slot Pair 6/18"},
223 {7,"Slot Pair 7/19"},
224 {8,"Slot Pair 8/20"},
225 {9,"Slot Pair 9/21"},
226 {10,"Slot Pair 10/22"},
227 {11,"Slot Pair 11/23"},
235 static const value_string QTStartPosition_vals[]=
237 {0,"S-Field starts at Bit F0"},
238 {1,"Reserved for Future Use"},
239 {2,"S-Field starts at Bit F240"},
240 {3,"Reserved for Future Use"},
244 static const value_string QTEscape_vals[]=
246 {0,"No QT Escape is broadcast"},
247 {1,"The QT Escape is broadcast"},
251 static const value_string QTTranceiver_vals[]=
253 {0,"RFP has 1 Transceiver"},
254 {1,"RFP has 2 Transceiver"},
255 {2,"RFP has 3 Transceiver"},
256 {3,"RFP has 4 or more Transceiver"},
260 static const value_string QTExtendedCarrier_vals[]=
262 {0,"No Extended RF Carrier Information Message"},
263 {1,"Extended RF Carrier Information Message shall be transmitted in the next Multiframe"},
267 static const value_string QTSpr_vals[]=
276 static const value_string QTCarrierNumber_vals[]=
288 {10,"RF Carrier 10"},
289 {11,"RF Carrier 11"},
290 {12,"RF Carrier 12"},
291 {13,"RF Carrier 13"},
292 {14,"RF Carrier 14"},
293 {15,"RF Carrier 15"},
294 {16,"RF Carrier 16"},
295 {17,"RF Carrier 17"},
296 {18,"RF Carrier 18"},
297 {19,"RF Carrier 19"},
298 {20,"RF Carrier 20"},
299 {21,"RF Carrier 21"},
300 {22,"RF Carrier 22"},
301 {23,"RF Carrier 23"},
302 {24,"RF Carrier 24"},
303 {25,"RF Carrier 25"},
304 {26,"RF Carrier 26"},
305 {27,"RF Carrier 27"},
306 {28,"RF Carrier 28"},
307 {29,"RF Carrier 29"},
308 {30,"RF Carrier 30"},
309 {31,"RF Carrier 31"},
310 {32,"RF Carrier 32"},
311 {33,"RF Carrier 33"},
312 {34,"RF Carrier 34"},
313 {35,"RF Carrier 35"},
314 {36,"RF Carrier 36"},
315 {37,"RF Carrier 37"},
316 {38,"RF Carrier 38"},
317 {39,"RF Carrier 39"},
318 {40,"RF Carrier 40"},
319 {41,"RF Carrier 41"},
320 {42,"RF Carrier 42"},
321 {43,"RF Carrier 43"},
322 {44,"RF Carrier 44"},
323 {45,"RF Carrier 45"},
324 {46,"RF Carrier 46"},
325 {47,"RF Carrier 47"},
326 {48,"RF Carrier 48"},
327 {49,"RF Carrier 49"},
328 {50,"RF Carrier 50"},
329 {51,"RF Carrier 51"},
330 {52,"RF Carrier 52"},
331 {53,"RF Carrier 53"},
332 {54,"RF Carrier 54"},
333 {55,"RF Carrier 55"},
334 {56,"RF Carrier 56"},
335 {57,"RF Carrier 57"},
336 {58,"RF Carrier 58"},
337 {59,"RF Carrier 59"},
338 {60,"RF Carrier 60"},
339 {61,"RF Carrier 61"},
340 {62,"RF Carrier 62"},
341 {63,"RF Carrier 63"},
345 static const value_string QTScanCarrierNum_vals[]=
347 {0,"Primary Scan next on RF Carrier 0"},
348 {1,"Primary Scan next on RF Carrier 1"},
349 {2,"Primary Scan next on RF Carrier 2"},
350 {3,"Primary Scan next on RF Carrier 3"},
351 {4,"Primary Scan next on RF Carrier 4"},
352 {5,"Primary Scan next on RF Carrier 5"},
353 {6,"Primary Scan next on RF Carrier 6"},
354 {7,"Primary Scan next on RF Carrier 7"},
355 {8,"Primary Scan next on RF Carrier 8"},
356 {9,"Primary Scan next on RF Carrier 9"},
357 {10,"Primary Scan next on RF Carrier 10"},
358 {11,"Primary Scan next on RF Carrier 11"},
359 {12,"Primary Scan next on RF Carrier 12"},
360 {13,"Primary Scan next on RF Carrier 13"},
361 {14,"Primary Scan next on RF Carrier 14"},
362 {15,"Primary Scan next on RF Carrier 15"},
363 {16,"Primary Scan next on RF Carrier 16"},
364 {17,"Primary Scan next on RF Carrier 17"},
365 {18,"Primary Scan next on RF Carrier 18"},
366 {19,"Primary Scan next on RF Carrier 19"},
367 {20,"Primary Scan next on RF Carrier 20"},
368 {21,"Primary Scan next on RF Carrier 21"},
369 {22,"Primary Scan next on RF Carrier 22"},
370 {23,"Primary Scan next on RF Carrier 23"},
371 {24,"Primary Scan next on RF Carrier 24"},
372 {25,"Primary Scan next on RF Carrier 25"},
373 {26,"Primary Scan next on RF Carrier 26"},
374 {27,"Primary Scan next on RF Carrier 27"},
375 {28,"Primary Scan next on RF Carrier 28"},
376 {29,"Primary Scan next on RF Carrier 29"},
377 {30,"Primary Scan next on RF Carrier 30"},
378 {31,"Primary Scan next on RF Carrier 31"},
379 {32,"Primary Scan next on RF Carrier 32"},
380 {33,"Primary Scan next on RF Carrier 33"},
381 {34,"Primary Scan next on RF Carrier 34"},
382 {35,"Primary Scan next on RF Carrier 35"},
383 {36,"Primary Scan next on RF Carrier 36"},
384 {37,"Primary Scan next on RF Carrier 37"},
385 {38,"Primary Scan next on RF Carrier 38"},
386 {39,"Primary Scan next on RF Carrier 39"},
387 {40,"Primary Scan next on RF Carrier 40"},
388 {41,"Primary Scan next on RF Carrier 41"},
389 {42,"Primary Scan next on RF Carrier 42"},
390 {43,"Primary Scan next on RF Carrier 43"},
391 {44,"Primary Scan next on RF Carrier 44"},
392 {45,"Primary Scan next on RF Carrier 45"},
393 {46,"Primary Scan next on RF Carrier 46"},
394 {47,"Primary Scan next on RF Carrier 47"},
395 {48,"Primary Scan next on RF Carrier 48"},
396 {49,"Primary Scan next on RF Carrier 49"},
397 {50,"Primary Scan next on RF Carrier 50"},
398 {51,"Primary Scan next on RF Carrier 51"},
399 {52,"Primary Scan next on RF Carrier 52"},
400 {53,"Primary Scan next on RF Carrier 53"},
401 {54,"Primary Scan next on RF Carrier 54"},
402 {55,"Primary Scan next on RF Carrier 55"},
403 {56,"Primary Scan next on RF Carrier 56"},
404 {57,"Primary Scan next on RF Carrier 57"},
405 {58,"Primary Scan next on RF Carrier 58"},
406 {59,"Primary Scan next on RF Carrier 59"},
407 {60,"Primary Scan next on RF Carrier 60"},
408 {61,"Primary Scan next on RF Carrier 61"},
409 {62,"Primary Scan next on RF Carrier 62"},
410 {63,"Primary Scan next on RF Carrier 63"},
414 static const value_string Qt_A12_vals[]=
417 {1,"Extended FP Info"},
421 static const value_string Qt_A13_vals[]=
424 {1,"Double Duplex Bearer Connections"},
428 static const value_string Qt_A14_vals[]=
435 static const value_string Qt_A15_vals[]=
442 static const value_string Qt_A16_vals[]=
449 static const value_string Qt_A17_vals[]=
456 static const value_string Qt_A18_vals[]=
459 {1,"Frequency Control"},
463 static const value_string Qt_A19_vals[]=
466 {1,"Page Repetition"},
470 static const value_string Qt_A20_vals[]=
473 {1,"C/O Setup on Dummy allowed"},
477 static const value_string Qt_A21_vals[]=
484 static const value_string Qt_A22_vals[]=
491 static const value_string Qt_A23_vals[]=
494 {1,"Basic A-Field Set-Up"},
498 static const value_string Qt_A24_vals[]=
501 {1,"Advanced A-Field Set-Up"},
505 static const value_string Qt_A25_vals[]=
508 {1,"B-field Set-Up"},
512 static const value_string Qt_A26_vals[]=
519 static const value_string Qt_A27_vals[]=
522 {1,"In Minimum Delay"},
526 static const value_string Qt_A28_vals[]=
529 {1,"In Normal Delay"},
533 static const value_string Qt_A29_vals[]=
536 {1,"Ip Error Detection"},
540 static const value_string Qt_A30_vals[]=
543 {1,"Ip Error Correction"},
547 static const value_string Qt_A31_vals[]=
550 {1,"Multibearer Connections"},
554 static const value_string MTHead_vals[]=
556 {0,"Basic Connection Control"},
557 {1,"Advanced Connection Control"},
558 {2,"MAC Layer Test Messages"},
559 {3,"Quality Control"},
560 {4,"Broadcast and Connectionless Services"},
561 {5,"Encryption Control"},
562 {6,"Tail for use with the first Transmission of a B-Field \"bearer request\" Message"},
565 {9,"REP Connection Control"},
575 static const value_string MTBasicConCtrl_vals[]=
577 {0,"Access Request"},
578 {1,"Bearer Handover Request"},
579 {2,"Connection Handover Request"},
580 {3,"Unconfirmed Access Request"},
581 {4,"Bearer Confirm"},
583 {6,"Attributes T Request"},
584 {7,"Attributes T Confirm"},
596 static const value_string MTEncrCmd1_vals[]=
598 {0,"Start Encryption"},
599 {1,"Stop Encryption"},
605 static const value_string MTEncrCmd2_vals[]=
614 static const value_string PTExtFlag_vals[]=
621 static const value_string PTSDU_vals[]=
623 {0,"Zero Length Page"},
626 {3,"MAC resume page"},
627 {4,"Not the last 36 Bits of a Long Page"},
628 {5,"The first 36 Bits of a Long Page"},
629 {6,"The last 36 Bits of a Long Page"},
630 {7,"All of a Long Page (first and last)"},
634 static const value_string PTInfoType_vals[]=
637 {1,"Blind Full Slot Information for Circuit Mode Service"},
639 {3,"Recommended Other Bearer"},
640 {4,"Good RFP Bearer"},
641 {5,"Dummy or connectionless Bearer Position"},
642 {6,"Extended Modulation Types"},
644 {8,"Dummy or connectionless Bearer Marker"},
645 {9,"Bearer Handover/Replacement Information"},
646 {10,"RFP Status and Modulation Types"},
647 {11,"Active Carriers"},
648 {12,"Connectionless Bearer Position"},
649 {13,"RFP Power Level"},
650 {14,"Blind Double Slot/RFP-FP Interface Resource Information"},
651 {15,"Blind Full Slot Information for Packet Mode Service"},
655 static const value_string PTRFPPower_vals[]=
677 getbit(guint8 *data,int bit)
680 guint8 byte=data[bit/8];
685 return (byte&c)>>bit%8;
689 setbit(guint8 *data,int bit,guint8 value)
692 data[bit/8]&=~(1<<(bit%8));
694 data[bit/8]|=(1<<(bit%8));
698 calc_xcrc(guint8* data,guint8 length)
708 setbit(bits,y,getbit(data,y+48*(1+(int)(y/16))));
746 calc_rcrc(guint8* data)
748 guint16 gp=0x0589; /* 10000010110001001 without the leading 1 */
754 div=data[0]<<8|data[1];
786 dissect_bfield(gboolean type _U_, struct dect_afield *pkt_afield,
787 struct dect_bfield *pkt_bfield, packet_info *pinfo, guint8 *pkt_ptr _U_,
788 tvbuff_t *tvb,proto_item *ti _U_, proto_tree *DectTree, gint offset)
793 proto_item *bfieldti =NULL;
795 proto_item *bxcrc =NULL;
797 proto_tree *BField =NULL;
800 switch((pkt_afield->Header&0x0E)>>1)
810 if(check_col(pinfo->cinfo,COL_DEF_NET_DST))
812 col_append_str(pinfo->cinfo,COL_DEF_NET_DST,"Full Slot");
819 if(check_col(pinfo->cinfo,COL_DEF_NET_DST))
821 col_append_str(pinfo->cinfo,COL_DEF_NET_DST,"Double Slot");
828 if(check_col(pinfo->cinfo,COL_DEF_NET_DST))
830 col_append_str(pinfo->cinfo,COL_DEF_NET_DST,"Half Slot");
837 if(check_col(pinfo->cinfo,COL_DEF_NET_DST))
839 col_append_str(pinfo->cinfo,COL_DEF_NET_DST,"No B-Field");
843 /* can't happen but makes gcc happy */
850 bfieldti = proto_tree_add_uint_format(DectTree,hf_dect_B,tvb,offset,40,0/*0x2323*/,"B-Field");
851 BField = proto_item_add_subtree(bfieldti,ett_bfield);
856 if((blen+(xcrclen/8)+1)<=pkt_bfield->Length)
859 for(x=0;x<blen;x+=16)
868 sprintf(string,"%s%.2x ",string,pkt_bfield->Data[x+y]);
870 proto_tree_add_uint_format(BField,hf_dect_B_Data,tvb,offset,y,0x2323,"Data: %s",string);
880 proto_tree_add_uint_format(BField,hf_dect_B_Data,tvb,offset,y,0x2323,"\n");
883 proto_tree_add_uint_format(BField,hf_dect_B_Data,tvb,offset,y,0x2323,"Framenumber %u/%u",fn,fn+8);
884 for(x=0;x<blen;x+=16)
893 sprintf(string,"%s%.2x ",string,pkt_bfield->Data[x+y]^scrt[fn][bytecount%31]);
896 proto_tree_add_uint_format(BField,hf_dect_B_Data,tvb,offset,y,0x2323,"Data: %s",string);
903 xcrc=calc_xcrc(pkt_bfield->Data,83);
905 if(xcrc!=(pkt_bfield->Data[40]&0xf0))
906 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);
908 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);
911 proto_tree_add_uint_format(BField,hf_dect_B_Data,tvb,offset,0,0x2323,"Data too Short");
916 dissect_decttype(gboolean type, struct dect_afield *pkt_afield,
917 struct dect_bfield *pkt_bfield, packet_info *pinfo, guint8 *pkt_ptr,
918 tvbuff_t *tvb, proto_item *ti, proto_tree *DectTree)
924 proto_item *afieldti =NULL;
925 proto_item *aheadti =NULL;
926 proto_item *atailti =NULL;
928 proto_item *arcrc =NULL;
929 proto_item *aqtti =NULL;
931 proto_tree *AField =NULL;
932 proto_tree *AHead =NULL;
933 proto_tree *ATail =NULL;
935 proto_tree *AQT =NULL;
938 /************************** A-Field ***********************************/
941 afieldti = proto_tree_add_uint_format(DectTree,hf_dect_A,tvb,offset,8,0/*0x2323*/,"A-Field");
942 AField = proto_item_add_subtree(afieldti,ett_afield);
945 aheadti = proto_tree_add_uint_format(afieldti,hf_dect_A_Head,tvb,offset,1,0x2323,"Header");
946 AHead = proto_item_add_subtree(aheadti,ett_ahead);
948 proto_tree_add_uint(AHead,hf_dect_A_Head_TA,tvb,offset,1,pkt_afield->Header);
949 proto_tree_add_uint(AHead,hf_dect_A_Head_Q1,tvb,offset,1,pkt_afield->Header);
950 proto_tree_add_uint(AHead,hf_dect_A_Head_BA,tvb,offset,1,pkt_afield->Header);
951 proto_tree_add_uint(AHead,hf_dect_A_Head_Q2,tvb,offset,1,pkt_afield->Header);
955 atailti = proto_tree_add_uint_format(afieldti,hf_dect_A_Tail,tvb,offset,5,0x2323,"Tail: %s",TA_vals[(pkt_afield->Header&0xE0)>>5].strptr);
956 ATail = proto_item_add_subtree(atailti,ett_atail);
958 switch((pkt_afield->Header&0xE0)>>5)
962 if(check_col(pinfo->cinfo,COL_HPUX_SUBSYS))
963 col_set_str(pinfo->cinfo,COL_HPUX_SUBSYS,"[Ct]");
966 case 3: /* Nt connectionless bearer */
967 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
969 str_p = ep_strdup_printf("RFPI:%.2x%.2x%.2x%.2x%.2x"
970 ,pkt_afield->Tail[0],pkt_afield->Tail[1],pkt_afield->Tail[2]
971 ,pkt_afield->Tail[3],pkt_afield->Tail[4]);
973 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,str_p);
976 /* due to addition further down */
979 if(check_col(pinfo->cinfo,COL_HPUX_SUBSYS))
980 col_set_str(pinfo->cinfo,COL_HPUX_SUBSYS,"[Nt]");
982 proto_tree_add_uint_format(atailti,hf_dect_A_Tail_Nt,tvb,offset,5,0x2323,"RFPI:%.2x%.2x%.2x%.2x%.2x"
983 ,pkt_afield->Tail[0],pkt_afield->Tail[1],pkt_afield->Tail[2],pkt_afield->Tail[3]
984 ,pkt_afield->Tail[4]);
987 if(check_col(pinfo->cinfo,COL_HPUX_SUBSYS))
988 col_set_str(pinfo->cinfo,COL_HPUX_SUBSYS,"[Qt]");
990 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_Qh,tvb,offset,1,(pkt_afield->Tail[0]));
992 switch(pkt_afield->Tail[0]>>4)
994 case 0: /* Static System Info */
996 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
997 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Static System Info");
999 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Nr,tvb,offset,1,(pkt_afield->Tail[0]));
1000 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Sn,tvb,offset,1,(pkt_afield->Tail[0]));
1003 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Sp,tvb,offset,1,(pkt_afield->Tail[1]));
1004 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Esc,tvb,offset,1,(pkt_afield->Tail[1]));
1005 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Txs,tvb,offset,1,(pkt_afield->Tail[1]));
1006 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Mc,tvb,offset,1,(pkt_afield->Tail[1]));
1009 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,2,0x2323," Carrier%s%s%s%s%s%s%s%s%s%s available",
1010 (pkt_afield->Tail[1]&0x02)?" 0":"",(pkt_afield->Tail[1]&0x01)?" 1":"",(pkt_afield->Tail[2]&0x80)?" 2":"",
1011 (pkt_afield->Tail[2]&0x40)?" 3":"",(pkt_afield->Tail[2]&0x20)?" 4":"",(pkt_afield->Tail[2]&0x10)?" 5":"",
1012 (pkt_afield->Tail[2]&0x08)?" 6":"",(pkt_afield->Tail[2]&0x04)?" 7":"",(pkt_afield->Tail[2]&0x02)?" 8":"",
1013 (pkt_afield->Tail[2]&0x01)?" 9":"");
1016 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Spr1,tvb,offset,1,(pkt_afield->Tail[3]));
1017 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Cn,tvb,offset,1,(pkt_afield->Tail[3]));
1020 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_Spr2,tvb,offset,1,(pkt_afield->Tail[4]));
1021 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_0_PSCN,tvb,offset,1,(pkt_afield->Tail[4]));
1023 /* due to addition further down */
1026 case 2: /* Extended RF Carriers Part 1 */
1027 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1028 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Extended RF Carriers Part 1");
1030 case 3: /* Fixed Part Capabilities */
1031 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1032 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Fixed Part Capabilities");
1034 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A12,tvb,offset,1,(pkt_afield->Tail[0]));
1035 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A13,tvb,offset,1,(pkt_afield->Tail[0]));
1036 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A14,tvb,offset,1,(pkt_afield->Tail[0]));
1037 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A15,tvb,offset,1,(pkt_afield->Tail[0]));
1040 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A16,tvb,offset,1,(pkt_afield->Tail[1]));
1041 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A17,tvb,offset,1,(pkt_afield->Tail[1]));
1042 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A18,tvb,offset,1,(pkt_afield->Tail[1]));
1043 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A19,tvb,offset,1,(pkt_afield->Tail[1]));
1044 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A20,tvb,offset,1,(pkt_afield->Tail[1]));
1045 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A21,tvb,offset,1,(pkt_afield->Tail[1]));
1046 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A22,tvb,offset,1,(pkt_afield->Tail[1]));
1047 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A23,tvb,offset,1,(pkt_afield->Tail[1]));
1050 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A24,tvb,offset,1,(pkt_afield->Tail[2]));
1051 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A25,tvb,offset,1,(pkt_afield->Tail[2]));
1052 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A26,tvb,offset,1,(pkt_afield->Tail[2]));
1053 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A27,tvb,offset,1,(pkt_afield->Tail[2]));
1054 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A28,tvb,offset,1,(pkt_afield->Tail[2]));
1055 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A29,tvb,offset,1,(pkt_afield->Tail[2]));
1056 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A30,tvb,offset,1,(pkt_afield->Tail[2]));
1057 proto_tree_add_uint(ATail,hf_dect_A_Tail_Qt_3_A31,tvb,offset,1,(pkt_afield->Tail[2]));
1060 /* due to addition further down */
1063 case 4: /* Extended Fixed Part Capabilities */
1064 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1065 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Extended Fixed Part Capabilities");
1067 case 5: /* SARI List Contents */
1068 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1069 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"SARI List Contents");
1071 case 6: /* Multi-Frame No. */
1072 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1073 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Multi-Frame No.");
1075 case 7: /* Escape */
1076 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1077 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Escape");
1079 case 8: /* Obsolete */
1080 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1081 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Obsolete");
1083 case 9: /* Extended RF Carriers Part 2 */
1084 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1085 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Extended RF Carriers Part 2");
1087 case 10: /* Reserved(?) */
1088 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1089 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Reserved(?)");
1091 case 11: /* Transmit Information(?) */
1092 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1093 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Transmit Information(?)");
1095 case 12: /* Reserved */
1099 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1100 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Reserved");
1104 case 5: /* Escape */
1107 if(check_col(pinfo->cinfo,COL_HPUX_SUBSYS))
1108 col_set_str(pinfo->cinfo,COL_HPUX_SUBSYS,"[Mt]");
1110 proto_tree_add_uint(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,1,(pkt_afield->Tail[0]));
1112 switch(pkt_afield->Tail[0]>>4)
1114 case 0: /* Basic Connection Control */
1115 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1116 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Basic Connection Control");
1117 proto_tree_add_uint(ATail,hf_dect_A_Tail_Mt_BasicConCtrl,tvb,offset,1,(pkt_afield->Tail[0]));
1120 if(((pkt_afield->Tail[0]&&0x0f)==6)||((pkt_afield->Tail[0]&&0x0f)==7))
1122 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,5,0x2323,"hier sollten attribute stehn...");
1126 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,2,0x2323,"FMID:%.3x",(pkt_afield->Tail[1]<<4)|(pkt_afield->Tail[2]>>4));
1129 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,3,0x2323,"PMID:%.5x",((pkt_afield->Tail[2]&0x0f)<<16)|(pkt_afield->Tail[3]<<8)|pkt_afield->Tail[4]);
1133 /* due to addition further down */
1136 case 1: /* Advanced Connection Control */
1137 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1138 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Advanced Connection Control");
1140 case 2: /* MAC Layer Test Messages */
1141 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1142 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"MAC Layer Test Messages");
1144 case 3: /* Quality Control */
1145 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1146 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Quality Control");
1148 case 4: /* Broadcast and Connectionless Services */
1149 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1150 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Broadcast and Connectionless Services");
1152 case 5: /* Encryption Control */
1153 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1154 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Encryption Control");
1156 proto_tree_add_uint(ATail,hf_dect_A_Tail_Mt_Encr_Cmd1,tvb,offset,1,(pkt_afield->Tail[0]));
1157 proto_tree_add_uint(ATail,hf_dect_A_Tail_Mt_Encr_Cmd2,tvb,offset,1,(pkt_afield->Tail[0]));
1160 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,2,0x2323,"FMID:%.3x",(pkt_afield->Tail[1]<<4)|(pkt_afield->Tail[2]>>4));
1163 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Mt_Mh,tvb,offset,3,0x2323,"PMID:%.5x",((pkt_afield->Tail[2]&0x0f)<<16)|(pkt_afield->Tail[3]<<8)|pkt_afield->Tail[4]);
1166 /* wegen addition weiter unten */
1169 case 6: /* Tail for use with the first Transmission of a B-Field \"bearer request\" Message */
1170 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1171 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Tail for use with the first Transmission of a B-Field \"bearer request\" Message");
1173 case 7: /* Escape */
1174 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1175 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Escape");
1177 case 8: /* TARI Message */
1178 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1179 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"TARI Message");
1181 case 9: /* REP Connection Control */
1182 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1183 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"REP Connection Control");
1185 case 10: /* Reserved */
1191 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1192 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Reserved");
1197 if(check_col(pinfo->cinfo,COL_HPUX_SUBSYS))
1198 col_set_str(pinfo->cinfo,COL_HPUX_SUBSYS,"[Pt]");
1200 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_ExtFlag,tvb,offset,1,(pkt_afield->Tail[0]));
1201 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_SDU,tvb,offset,1,(pkt_afield->Tail[0]));
1202 switch((pkt_afield->Tail[0]&0x70)>>4)
1204 case 0: /* Zero Length Page */
1205 case 1: /* Short Page */
1206 if(((pkt_afield->Tail[0]&0x70)>>4)==0)
1208 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1209 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Zero Length Page: ");
1210 proto_tree_add_uint_format(atailti,hf_dect_A_Tail_Pt_InfoType,tvb,offset,3,0x2323,"RFPI:xxxxx%.1x%.2x%.2x",(pkt_afield->Tail[0]&0x0f),pkt_afield->Tail[1],pkt_afield->Tail[2]);
1213 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_InfoType,tvb,offset,1,(pkt_afield->Tail[3]));
1217 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1218 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Short Page: ");
1219 proto_tree_add_uint_format(atailti,hf_dect_A_Tail_Pt_InfoType,tvb,offset,3,0x2323,"Bs Data:%.1x%.2x%.2x",(pkt_afield->Tail[0]&0x0f),pkt_afield->Tail[1],pkt_afield->Tail[2]);
1222 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_InfoType,tvb,offset,1,(pkt_afield->Tail[3]));
1224 switch(pkt_afield->Tail[3]>>4)
1226 case 0: /* Fill Bits */
1227 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Pt_Fill_Fillbits,tvb,offset,2,0x2323,"Fillbits:%.1x%.2x",pkt_afield->Tail[3]&0x0f,pkt_afield->Tail[4]);
1230 case 1: /* Blind Full Slot Information for Circuit Mode Service */
1231 case 7: /* Escape */
1232 case 8: /* Dummy or connectionless Bearer Marker */
1233 proto_tree_add_uint_format(ATail,hf_dect_A_Tail_Pt_InfoType,tvb,offset,2,0x2323," Slot-Pairs:%s%s%s%s%s%s%s%s%s%s%s%s available",
1234 (pkt_afield->Tail[3]&0x08)?" 0/12":"",(pkt_afield->Tail[3]&0x04)?" 1/13":"",(pkt_afield->Tail[3]&0x02)?" 2/14":"",
1235 (pkt_afield->Tail[3]&0x01)?" 3/15":"",(pkt_afield->Tail[4]&0x80)?" 4/16":"",(pkt_afield->Tail[4]&0x40)?" 5/17":"",
1236 (pkt_afield->Tail[4]&0x20)?" 6/18":"",(pkt_afield->Tail[4]&0x10)?" 7/19":"",(pkt_afield->Tail[4]&0x08)?" 8/20":"",
1237 (pkt_afield->Tail[4]&0x04)?" 9/21":"",(pkt_afield->Tail[4]&0x02)?" 10/22":"",(pkt_afield->Tail[4]&0x01)?" 11/23":"");
1241 case 2: /* Other Bearer */
1242 case 3: /* Recommended Other Bearer */
1243 case 4: /* Good RFP Bearer */
1244 case 5: /* Dummy or connectionless Bearer Position */
1245 case 12: /* Connectionless Bearer Position */
1246 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_Bearer_Sn,tvb,offset,1,(pkt_afield->Tail[3]));
1249 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_Bearer_Sp,tvb,offset,1,(pkt_afield->Tail[4]));
1250 proto_tree_add_uint(ATail,hf_dect_A_Tail_Pt_Bearer_Cn,tvb,offset,1,(pkt_afield->Tail[4]));
1253 case 6: /* Extended Modulation Types */
1257 case 9: /* Bearer Handover/Replacement Information */
1260 case 10: /* RFP Status and Modulation Types */
1263 case 11: /* Active Carriers */
1266 case 13: /* RFP Power Level */
1269 case 14: /* Blind Double Slot/RFP-FP Interface Resource Information */
1272 case 15: /* Blind Full Slot Information for Packet Mode Service */
1276 /* due to addition further down */
1279 case 2: /* Full Page */
1280 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1281 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Full Page: ");
1283 case 3: /* MAC Resume Page */
1284 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1285 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"MAC Resume Page: ");
1287 case 4: /* Not the Last 36 Bits of a Long Page */
1288 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1289 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"Not the Last 36 Bits: ");
1291 case 5: /* The First 36 Bits of a Long Page */
1292 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1293 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"The First 36 Bits: ");
1295 case 6: /* The Last 36 Bits of a Long Page */
1296 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1297 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"The Last 36 Bits: ");
1299 case 7: /* All of a Long Page */
1300 if(check_col(pinfo->cinfo,COL_DEF_NET_SRC))
1301 col_append_str(pinfo->cinfo,COL_DEF_NET_SRC,"All of a Long Page: ");
1310 memcpy(rcrcdat,pkt_ptr,6);
1313 rcrc=calc_rcrc(rcrcdat);
1314 if(rcrc!=pkt_afield->RCRC)
1315 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);
1317 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);
1321 /* **************** B-Field ************************************/
1322 offset=dissect_bfield(type,pkt_afield,pkt_bfield,pinfo,pkt_ptr,tvb,ti,DectTree,offset);
1326 dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1331 struct dect_afield pkt_afield;
1332 struct dect_bfield pkt_bfield;
1334 /* Packet pointer holen */
1335 pkt_len=tvb_length(tvb);
1342 if(check_col(pinfo->cinfo,COL_PROTOCOL))
1344 col_set_str(pinfo->cinfo,COL_PROTOCOL,"No Data");
1349 pkt_ptr=(guint8*)tvb_get_ptr(tvb,11,pkt_len-11);
1352 pkt_afield.Header=pkt_ptr[0];
1353 memcpy((char*)(&(pkt_afield.Tail)),(char*)(pkt_ptr+1),5);
1354 pkt_afield.RCRC=(((guint16)pkt_ptr[6])<<8)|pkt_ptr[7];
1359 memcpy((char*)(&(pkt_bfield.Data)),(char*)(pkt_ptr+8),pkt_len-5-8);
1361 memset((char*)(&(pkt_bfield.Data)),0,128);
1362 pkt_bfield.Length=pkt_len-13;
1364 if(check_col(pinfo->cinfo,COL_PROTOCOL))
1365 col_set_str(pinfo->cinfo, COL_PROTOCOL,"DECT");
1367 /* Clear out stuff in the info column */
1368 if(check_col(pinfo->cinfo,COL_INFO))
1370 col_clear(pinfo->cinfo,COL_INFO);
1374 proto_item *ti =NULL;
1375 proto_item *typeti =NULL;
1376 proto_tree *DectTree =NULL;
1379 ti=proto_tree_add_item(tree,proto_dect,tvb,0,-1,FALSE);
1381 DectTree=proto_item_add_subtree(ti,ett_dect);
1382 proto_tree_add_item(DectTree,hf_dect_transceivermode,tvb,offset,1,FALSE);
1385 proto_tree_add_item(DectTree,hf_dect_channel,tvb,offset,1,FALSE);
1388 proto_tree_add_item(DectTree,hf_dect_slot,tvb,offset,2,FALSE);
1391 proto_tree_add_item(DectTree,hf_dect_framenumber,tvb,offset,1,FALSE);
1394 proto_tree_add_item(DectTree,hf_dect_rssi,tvb,offset,1,FALSE);
1397 proto_tree_add_item(DectTree,hf_dect_preamble,tvb,offset,3,FALSE);
1400 typeti=proto_tree_add_item(DectTree,hf_dect_type,tvb,offset,2,FALSE);
1402 type=tvb_get_ntohs(tvb, offset);
1407 if(check_col(pinfo->cinfo,COL_PROTOCOL))
1409 col_set_str(pinfo->cinfo,COL_PROTOCOL,"DECT PP");
1411 proto_item_append_text(typeti," Phone Packet");
1412 dissect_decttype(0,&pkt_afield,&pkt_bfield,pinfo,pkt_ptr,tvb,ti,DectTree);
1415 if(check_col(pinfo->cinfo,COL_PROTOCOL))
1417 col_set_str(pinfo->cinfo,COL_PROTOCOL,"DECT RFP");
1419 proto_item_append_text(typeti," Station Packet");
1420 dissect_decttype(1,&pkt_afield,&pkt_bfield,pinfo,pkt_ptr,tvb,ti,DectTree);
1423 if(check_col(pinfo->cinfo,COL_PROTOCOL))
1425 col_set_str(pinfo->cinfo,COL_PROTOCOL,"DECT Unk");
1427 proto_item_append_text(typeti," Unknown Packet");
1434 proto_register_dect(void)
1436 static hf_register_info hf[]=
1438 { &hf_dect_transceivermode,
1439 {"Tranceiver-Mode","dect.tranceivermode",FT_UINT8,BASE_HEX,VALS(tranceiver_mode),
1443 {"Channel","dect.channel",FT_UINT8,BASE_DEC,NULL,
1446 { &hf_dect_framenumber,
1447 {"Frame#","dect.framenumber",FT_UINT16,BASE_DEC,NULL,
1451 {"RSSI","dect.rssi",FT_UINT8,BASE_DEC,NULL,
1455 {"Slot","dect.slot",FT_UINT16,BASE_DEC,NULL,
1458 { &hf_dect_preamble,
1459 {"Preamble","dect.preamble",FT_BYTES,BASE_NONE,NULL,
1463 {"Packet-Type","dect.type",FT_BYTES,BASE_NONE,NULL,
1466 /* **************** A-Field ******************************/
1467 /* ***** Header ***** */
1469 {"A-Field","dect.afield", FT_UINT8, BASE_DEC, NULL,
1473 {"A-Field Header","dect.afield.head",FT_UINT8,BASE_DEC, NULL,
1476 { &hf_dect_A_Head_TA,
1477 {"TA","dect.afield.head.TA",FT_UINT8,BASE_DEC,VALS(TA_vals),
1480 { &hf_dect_A_Head_Q1,
1481 {"Q1","dect.afield.head.Q1",FT_UINT8,BASE_DEC,NULL,
1484 { &hf_dect_A_Head_BA,
1485 {"BA","dect.afield.head.BA",FT_UINT8,BASE_DEC,VALS(BA_vals),
1488 { &hf_dect_A_Head_Q2,
1489 {"Q2","dect.afield.head.Q2",FT_UINT8,BASE_DEC,NULL,
1492 /* ***** Tail ***** */
1494 {"A-Field Tail","dect.afield.tail",FT_UINT8,BASE_DEC, NULL,
1498 { &hf_dect_A_Tail_Nt,
1499 {"A-Field Header","dect.afield.tail.Nt",FT_UINT8,BASE_DEC, NULL,
1503 { &hf_dect_A_Tail_Qt_Qh,
1504 {"Qh","dect.afield.tail.Qt.Qh",FT_UINT8,BASE_DEC,VALS(QTHead_vals),
1507 /* Qt Static System Information */
1509 { &hf_dect_A_Tail_Qt_0_Nr,
1510 {"NR","dect.afield.tail.Qt.NR",FT_UINT8,BASE_DEC,VALS(QTNormalReverse_vals),
1513 { &hf_dect_A_Tail_Qt_0_Sn,
1514 {"SN","dect.afield.tail.Qt.SN",FT_UINT8,BASE_DEC,VALS(QTSlotNumber_vals),
1518 { &hf_dect_A_Tail_Qt_0_Sp,
1519 {"SP","dect.afield.tail.Qt.SP",FT_UINT8,BASE_DEC,VALS(QTStartPosition_vals),
1522 { &hf_dect_A_Tail_Qt_0_Esc,
1523 {"Esc","dect.afield.tail.Qt.Esc",FT_UINT8,BASE_DEC,VALS(QTEscape_vals),
1526 { &hf_dect_A_Tail_Qt_0_Txs,
1527 {"Txs","dect.afield.tail.Qt.Txs",FT_UINT8,BASE_DEC,VALS(QTTranceiver_vals),
1530 { &hf_dect_A_Tail_Qt_0_Mc,
1531 {"Mc","dect.afield.tail.Qt.Mc",FT_UINT8,BASE_DEC,VALS(QTExtendedCarrier_vals),
1535 { &hf_dect_A_Tail_Qt_0_Spr1,
1536 {"Spr","dect.afield.tail.Qt.Spr1",FT_UINT8,BASE_DEC,VALS(QTSpr_vals),
1539 { &hf_dect_A_Tail_Qt_0_Cn,
1540 {"CN","dect.afield.tail.Qt.CN",FT_UINT8,BASE_DEC,VALS(QTCarrierNumber_vals),
1544 { &hf_dect_A_Tail_Qt_0_Spr2,
1545 {"Spr","dect.afield.tail.Qt.Spr2",FT_UINT8,BASE_DEC,VALS(QTSpr_vals),
1548 { &hf_dect_A_Tail_Qt_0_PSCN,
1549 {"PSCN","dect.afield.tail.Qt.PSCN",FT_UINT8,BASE_DEC,VALS(QTScanCarrierNum_vals),
1552 /* Qt Fixed Part Capabilities */
1553 { &hf_dect_A_Tail_Qt_3_A12,
1554 {"A12","dect.afield.tail.Qt.Fp.A12",FT_UINT8,BASE_DEC,VALS(Qt_A12_vals),
1557 { &hf_dect_A_Tail_Qt_3_A13,
1558 {"A13","dect.afield.tail.Qt.Fp.A13",FT_UINT8,BASE_DEC,VALS(Qt_A13_vals),
1561 { &hf_dect_A_Tail_Qt_3_A14,
1562 {"A14","dect.afield.tail.Qt.Fp.A14",FT_UINT8,BASE_DEC,VALS(Qt_A14_vals),
1565 { &hf_dect_A_Tail_Qt_3_A15,
1566 {"A15","dect.afield.tail.Qt.Fp.A15",FT_UINT8,BASE_DEC,VALS(Qt_A15_vals),
1569 { &hf_dect_A_Tail_Qt_3_A16,
1570 {"A16","dect.afield.tail.Qt.Fp.A16",FT_UINT8,BASE_DEC,VALS(Qt_A16_vals),
1573 { &hf_dect_A_Tail_Qt_3_A17,
1574 {"A17","dect.afield.tail.Qt.Fp.A17",FT_UINT8,BASE_DEC,VALS(Qt_A17_vals),
1577 { &hf_dect_A_Tail_Qt_3_A18,
1578 {"A18","dect.afield.tail.Qt.Fp.A18",FT_UINT8,BASE_DEC,VALS(Qt_A18_vals),
1581 { &hf_dect_A_Tail_Qt_3_A19,
1582 {"A19","dect.afield.tail.Qt.Fp.A19",FT_UINT8,BASE_DEC,VALS(Qt_A19_vals),
1585 { &hf_dect_A_Tail_Qt_3_A20,
1586 {"A20","dect.afield.tail.Qt.Fp.A20",FT_UINT8,BASE_DEC,VALS(Qt_A20_vals),
1589 { &hf_dect_A_Tail_Qt_3_A21,
1590 {"A21","dect.afield.tail.Qt.Fp.A21",FT_UINT8,BASE_DEC,VALS(Qt_A21_vals),
1593 { &hf_dect_A_Tail_Qt_3_A22,
1594 {"A22","dect.afield.tail.Qt.Fp.A22",FT_UINT8,BASE_DEC,VALS(Qt_A22_vals),
1597 { &hf_dect_A_Tail_Qt_3_A23,
1598 {"A23","dect.afield.tail.Qt.Fp.A23",FT_UINT8,BASE_DEC,VALS(Qt_A23_vals),
1601 { &hf_dect_A_Tail_Qt_3_A24,
1602 {"A24","dect.afield.tail.Qt.Fp.A24",FT_UINT8,BASE_DEC,VALS(Qt_A24_vals),
1605 { &hf_dect_A_Tail_Qt_3_A25,
1606 {"A25","dect.afield.tail.Qt.Fp.A25",FT_UINT8,BASE_DEC,VALS(Qt_A25_vals),
1609 { &hf_dect_A_Tail_Qt_3_A26,
1610 {"A26","dect.afield.tail.Qt.Fp.A26",FT_UINT8,BASE_DEC,VALS(Qt_A26_vals),
1613 { &hf_dect_A_Tail_Qt_3_A27,
1614 {"A27","dect.afield.tail.Qt.Fp.A27",FT_UINT8,BASE_DEC,VALS(Qt_A27_vals),
1617 { &hf_dect_A_Tail_Qt_3_A28,
1618 {"A28","dect.afield.tail.Qt.Fp.A28",FT_UINT8,BASE_DEC,VALS(Qt_A28_vals),
1621 { &hf_dect_A_Tail_Qt_3_A29,
1622 {"A29","dect.afield.tail.Qt.Fp.A29",FT_UINT8,BASE_DEC,VALS(Qt_A29_vals),
1625 { &hf_dect_A_Tail_Qt_3_A30,
1626 {"A30","dect.afield.tail.Qt.Fp.A30",FT_UINT8,BASE_DEC,VALS(Qt_A30_vals),
1629 { &hf_dect_A_Tail_Qt_3_A31,
1630 {"A31","dect.afield.tail.Qt.Fp.A31",FT_UINT8,BASE_DEC,VALS(Qt_A31_vals),
1634 { &hf_dect_A_Tail_Mt_Mh,
1635 {"Mh","dect.afield.tail.Mt.Mh",FT_UINT8,BASE_DEC,VALS(MTHead_vals),
1638 /* Mt Basic Connection Control */
1639 { &hf_dect_A_Tail_Mt_BasicConCtrl,
1640 {"Cmd","dect.afield.tail.Mt.BasicConCtrl",FT_UINT8,BASE_DEC,VALS(MTBasicConCtrl_vals),
1643 /* Mt Encryption Control */
1644 { &hf_dect_A_Tail_Mt_Encr_Cmd1,
1645 {"Cmd1","dect.afield.tail.Mt.Encr.Cmd1",FT_UINT8,BASE_DEC,VALS(MTEncrCmd1_vals),
1648 { &hf_dect_A_Tail_Mt_Encr_Cmd2,
1649 {"Cmd2","dect.afield.tail.Mt.Encr.Cmd2",FT_UINT8,BASE_DEC,VALS(MTEncrCmd2_vals),
1650 0x03, NULL, HFILL}},
1653 { &hf_dect_A_Tail_Pt_ExtFlag,
1654 {"ExtFlag","dect.afield.tail.Pt.ExtFlag",FT_UINT8,BASE_DEC,VALS(PTExtFlag_vals),
1655 0x80, NULL, HFILL}},
1657 { &hf_dect_A_Tail_Pt_SDU,
1658 {"SDU","dect.afield.tail.Pt.SDU",FT_UINT8,BASE_DEC,VALS(PTSDU_vals),
1659 0x70, NULL, HFILL}},
1661 { &hf_dect_A_Tail_Pt_InfoType,
1662 {"InfoType","dect.afield.tail.Pt.InfoType",FT_UINT8,BASE_DEC,VALS(PTInfoType_vals),
1663 0xF0, NULL, HFILL}},
1665 { &hf_dect_A_Tail_Pt_Fill_Fillbits,
1666 {"FillBits","dect.afield.tail.Pt.InfoType.FillBits",FT_UINT8,BASE_DEC,NULL,
1669 { &hf_dect_A_Tail_Pt_Bearer_Sn,
1670 {"SN","dect.afield.tail.Pt.SN",FT_UINT8,BASE_DEC,VALS(QTSlotNumber_vals),
1673 { &hf_dect_A_Tail_Pt_Bearer_Sp,
1674 {"SP","dect.afield.tail.Pt.SP",FT_UINT8,BASE_DEC,VALS(QTStartPosition_vals),
1675 0xC0, NULL, HFILL}},
1677 { &hf_dect_A_Tail_Pt_Bearer_Cn,
1678 {"CN", "dect.afield.tail.Pt.CN", FT_UINT8,BASE_DEC,VALS(QTCarrierNumber_vals),
1679 0x3F, NULL, HFILL}},
1681 /* ***** R-CRC ***** */
1683 {"A-Field R-CRC", "dect.afield.rcrc", FT_UINT8, BASE_DEC, NULL,
1686 /* ***************** B-Field *************************** */
1688 {"B-Field", "dect.bfield", FT_UINT8, BASE_DEC,
1689 NULL, 0x0,NULL, HFILL}},
1692 {"B-Field","dect.bfield.data", FT_UINT8, BASE_DEC, NULL,
1695 /* ***** X-CRC ***** */
1697 {"B-Field X-CRC", "dect.bfield.xcrc", FT_UINT8,BASE_DEC, NULL,
1702 /* Setup protocol subtree array */
1713 proto_dect=proto_register_protocol("DECT Protocol","DECT","dect");
1714 proto_register_field_array(proto_dect,hf,array_length(hf));
1715 proto_register_subtree_array(ett,array_length(ett));
1719 proto_reg_handoff_dect(void)
1721 dissector_handle_t dect_handle;
1723 dect_handle = create_dissector_handle(dissect_dect,proto_dect);
1724 dissector_add("ethertype",ETHERTYPE_DECT ,dect_handle);