checkAPIs.pl: support for new-style dissectors in check_hf_entries
[metze/wireshark/wip.git] / epan / dissectors / packet-dect.c
index 39efe29950602260d6ce5ce04fc8daca44f9292f..4260f10bb6f4789a4197203db1b75756aaa486d8 100644 (file)
@@ -3,8 +3,6 @@
  * Dissector for the Digital Enhanced Cordless Telecommunications
  * protocol.
  *
- * $Id$
- *
  * Copyright 2008-2009:
  * - Andreas Schuler <andreas (A) schulerdev.de>
  * - Matthias Wenzel <dect (A) mazzoo.de>
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 /*
    hack and use a proper capture type.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <string.h>
+#include "config.h"
 
-#include <glib.h>
 
 #include <epan/packet.h>
-#include <epan/etypes.h>
-
 #define ETHERTYPE_DECT 0x2323
 
 #define DECT_PACKET_INFO_LEN 11
@@ -91,6 +70,8 @@ static const guint8 scrt[8][31]=
        {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}
 };
 
+void proto_register_dect (void);
+void proto_reg_handoff_dect (void);
 
 static int proto_dect = -1;
 
@@ -1124,6 +1105,7 @@ static const value_string PTInfoType_vals[]=
        {0, NULL}
 };
 
+#if 0
 /* ETSI EN 300 175-3 V2.3.0  7.2.4.3.10 */
 static const value_string PTRFPPower_vals[]=
 {
@@ -1145,6 +1127,7 @@ static const value_string PTRFPPower_vals[]=
        {15, "30 dBm"},
        {0, NULL}
 };
+#endif
 
 
 static unsigned char
@@ -1174,6 +1157,7 @@ calc_xcrc(guint8* data, guint8 length)
        guint8 next;
        int y, x;
 
+       memset(bits, 0, sizeof(bits));
        for(y=0;y<=length-4;y++)
        {
                dect_setbit(bits, y, dect_getbit(data, y+48*(1+(int)(y/16))));
@@ -1261,8 +1245,8 @@ dissect_bfield(gboolean dect_packet_type _U_, guint8 ba,
        guint8 xcrc/*, xcrclen*/;
        guint16 blen;
        gint start_offset;
-       char *bfield_str;
-       char *bfield_short_str;
+       const char *bfield_str;
+       const char *bfield_short_str;
 
        proto_item *bfieldti        = NULL;
        proto_tree *BField          = NULL;
@@ -1271,13 +1255,17 @@ dissect_bfield(gboolean dect_packet_type _U_, guint8 ba,
        proto_tree *BFDescrData     = NULL;
 
        guint8 bfield_data[DECT_BFIELD_DATA_SIZE];
-       guint bfield_length = tvb_length_remaining(tvb, offset);
+       guint bfield_length = tvb_reported_length_remaining(tvb, offset);
 
        if (bfield_length > DECT_BFIELD_DATA_SIZE)
                bfield_length = DECT_BFIELD_DATA_SIZE;
 
        if (bfield_length)
+       {
                tvb_memcpy(tvb, bfield_data, offset, bfield_length);
+               if (bfield_length < DECT_BFIELD_DATA_SIZE)
+                       memset(&bfield_data[bfield_length], 0, DECT_BFIELD_DATA_SIZE - bfield_length);
+       }
        else
                memset(bfield_data, 0, DECT_BFIELD_DATA_SIZE);
 
@@ -1358,17 +1346,18 @@ dissect_bfield(gboolean dect_packet_type _U_, guint8 ba,
                                 * you doesn't know the real framenumber, so you need
                                 * the range of all possible descramblings. (a.schuler)
                                 */
-                               emem_strbuf_t *string;
-                               string = ep_strbuf_new(NULL);
+                               wmem_strbuf_t *string;
+                               string = wmem_strbuf_new(wmem_packet_scope(), NULL);
                                for(y=0;y<16;y++)
                                {
                                        if((x+y)>=blen)
                                                break;
 
-                                       ep_strbuf_append_printf(string,"%.2x ", bfield_data[x+y]^scrt[fn][bytecount%31]);
+                                       wmem_strbuf_append_printf(string,"%.2x ", bfield_data[x+y]^scrt[fn][bytecount%31]);
                                        bytecount++;
                                }
-                               proto_tree_add_none_format(BFDescrData, hf_dect_B_Data, tvb, offset, y, "Data: %s", string->str);
+                               proto_tree_add_none_format(BFDescrData, hf_dect_B_Data, tvb, offset,
+                                                                                       y, "Data: %s", wmem_strbuf_get_str(string));
                                offset+=y;
                        }
                }
@@ -1404,7 +1393,7 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
        guint8 ta;
        guint8 rcrcdat[8];
        guint16 computed_rcrc;
-       emem_strbuf_t *afield_str;
+       wmem_strbuf_t *afield_str;
 
        proto_item *afieldti    = NULL;
        proto_item *aheadti     = NULL;
@@ -1416,7 +1405,7 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
        guint8  header, tail_0, tail_1, tail_2, tail_3, tail_4;
        guint16 rcrc;
 
-       afield_str = ep_strbuf_new(NULL);
+       afield_str = wmem_strbuf_new(wmem_packet_scope(), NULL);
 
        /************************** A-Field ***********************************/
 
@@ -1476,19 +1465,19 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Ct]");
 
                if(ta==DECT_TA_CT0)
-                       ep_strbuf_append_printf(afield_str,"C-Channel Next  Data: %s",tvb_bytes_to_str(tvb, offset, 5));
+                       wmem_strbuf_append_printf(afield_str,"C-Channel Next  Data: %s",tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, 5));
                else
-                       ep_strbuf_append_printf(afield_str,"C-Channel First Data: %s",tvb_bytes_to_str(tvb, offset, 5));
+                       wmem_strbuf_append_printf(afield_str,"C-Channel First Data: %s",tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, 5));
 
-               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
        }
        else if((ta==DECT_TA_NT)||(ta==DECT_TA_NT_CL))
        {
                /* ETSI EN 300 175-3 V2.3.0  7.2.2 */
                proto_tree_add_string(ColumnsTree, hf_dect_cc_TA, tvb, offset, 1, "[Nt]");
 
-               ep_strbuf_append_printf(afield_str,"RFPI: %s",tvb_bytes_to_str(tvb, offset, 5));
-               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+               wmem_strbuf_append_printf(afield_str,"RFPI: %s",tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, 5));
+               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
 
                proto_tree_add_item(atailti, hf_dect_A_Tail_Nt, tvb, offset, 5, ENC_NA);
        }
@@ -1538,59 +1527,72 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        /* TODO */
                        break;
                case 3:         /* Fixed Part Capabilities */
+                       {
+                       static const int * cap1_flags[] = {
+                               &hf_dect_A_Tail_Qt_3_A12,
+                               &hf_dect_A_Tail_Qt_3_A13,
+                               &hf_dect_A_Tail_Qt_3_A14,
+                               &hf_dect_A_Tail_Qt_3_A15,
+                               NULL
+                       };
+                       static const int * cap2_flags[] = {
+                               &hf_dect_A_Tail_Qt_3_A16,
+                               &hf_dect_A_Tail_Qt_3_A17,
+                               &hf_dect_A_Tail_Qt_3_A18,
+                               &hf_dect_A_Tail_Qt_3_A19,
+                               &hf_dect_A_Tail_Qt_3_A20,
+                               &hf_dect_A_Tail_Qt_3_A21,
+                               &hf_dect_A_Tail_Qt_3_A22,
+                               &hf_dect_A_Tail_Qt_3_A23,
+                               NULL
+                       };
+                       static const int * cap3_flags[] = {
+                               &hf_dect_A_Tail_Qt_3_A24,
+                               &hf_dect_A_Tail_Qt_3_A25,
+                               &hf_dect_A_Tail_Qt_3_A26,
+                               &hf_dect_A_Tail_Qt_3_A27,
+                               &hf_dect_A_Tail_Qt_3_A28,
+                               &hf_dect_A_Tail_Qt_3_A29,
+                               &hf_dect_A_Tail_Qt_3_A30,
+                               &hf_dect_A_Tail_Qt_3_A31,
+                               NULL
+                       };
+                       static const int * cap4_flags[] = {
+                               &hf_dect_A_Tail_Qt_3_A32,
+                               &hf_dect_A_Tail_Qt_3_A33,
+                               &hf_dect_A_Tail_Qt_3_A34,
+                               &hf_dect_A_Tail_Qt_3_A35,
+                               &hf_dect_A_Tail_Qt_3_A36,
+                               &hf_dect_A_Tail_Qt_3_A37,
+                               &hf_dect_A_Tail_Qt_3_A38,
+                               &hf_dect_A_Tail_Qt_3_A39,
+                               NULL
+                       };
+
+                       static const int * cap5_flags[] = {
+                               &hf_dect_A_Tail_Qt_3_A40,
+                               &hf_dect_A_Tail_Qt_3_A41,
+                               &hf_dect_A_Tail_Qt_3_A42,
+                               &hf_dect_A_Tail_Qt_3_A43,
+                               &hf_dect_A_Tail_Qt_3_A44,
+                               &hf_dect_A_Tail_Qt_3_A45,
+                               &hf_dect_A_Tail_Qt_3_A46,
+                               &hf_dect_A_Tail_Qt_3_A47,
+                               NULL
+                       };
+
                        /* ETSI EN 300 175-3 V2.3.0  7.2.3.4 */
                        proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, "Fixed Part Capabilities");
 
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A12, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A13, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A14, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A15, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       offset++;
-
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A16, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A17, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A18, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A19, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A20, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A21, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A22, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A23, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       offset++;
-
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A24, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A25, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A26, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A27, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A28, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A29, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A30, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A31, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       offset++;
-
+                       proto_tree_add_bitmask_list(ATail, tvb, offset, 1, cap1_flags, ENC_BIG_ENDIAN);
+                       proto_tree_add_bitmask_list(ATail, tvb, offset+1, 1, cap2_flags, ENC_BIG_ENDIAN);
+                       proto_tree_add_bitmask_list(ATail, tvb, offset+2, 1, cap3_flags, ENC_BIG_ENDIAN);
 
                        /* higher layer capabilities */
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A32, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A33, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A34, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A35, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A36, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A37, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A38, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A39, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       offset++;
+                       proto_tree_add_bitmask_list(ATail, tvb, offset+3, 1, cap4_flags, ENC_BIG_ENDIAN);
+                       proto_tree_add_bitmask_list(ATail, tvb, offset+4, 1, cap5_flags, ENC_BIG_ENDIAN);
 
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A40, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A41, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A42, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A43, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A44, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A45, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A46, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_3_A47, tvb, offset, 1, ENC_BIG_ENDIAN);
-                       offset++;
-
-                       /* due to addition further down */
-                       offset-=5;
+                       }
                        break;
                case 4:         /* Extended Fixed Part Capabilities */
                        /* ETSI EN 300 175-3 V2.3.0  7.2.3.5 */
@@ -1657,8 +1659,8 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_6_Spare, tvb, offset, 2, ENC_BIG_ENDIAN);
                        offset+=2;
 
-                       ep_strbuf_append_printf(afield_str,"Multi-Frame No.: %s",tvb_bytes_to_str(tvb, offset, 3));
-                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+                       wmem_strbuf_append_printf(afield_str,"Multi-Frame No.: %s",tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, 3));
+                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
 
                        proto_tree_add_item(ATail, hf_dect_A_Tail_Qt_6_Mfn, tvb, offset, 3, ENC_NA);
                        offset+=3;
@@ -1668,8 +1670,8 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        break;
                case 7:         /* Escape */
                        /* ETSI EN 300 175-3 V2.3.0  7.2.3.8 */
-                       ep_strbuf_append_printf(afield_str,"Escape Data: %s",tvb_bytes_to_str(tvb, offset, 5));
-                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+                       wmem_strbuf_append_printf(afield_str,"Escape Data: %s",tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, 5));
+                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
                        break;
                case 8:         /* Obsolete */
                        /* ETSI EN 300 175-3 V2.3.0  7.2.3.1 */
@@ -1754,11 +1756,11 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        break;
                case 5:         /* Encryption Control */
                        /* ETSI EN 300 175-3 V2.3.0  7.2.5.7 */
-                       ep_strbuf_append_printf(afield_str,"Encryption Control: %s %s",
+                       wmem_strbuf_append_printf(afield_str,"Encryption Control: %s %s",
                                val_to_str((tail_0&0x0c)>>2, MTEncrCmd1_vals, "Error, please report: %d"),
                                val_to_str(tail_0&0x03, MTEncrCmd2_vals, "Error, please report: %d"));
 
-                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+                       proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
 
                        proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Encr_Cmd1, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(ATail, hf_dect_A_Tail_Mt_Encr_Cmd2, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -1808,7 +1810,7 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_SDU, tvb, offset, 1, ENC_BIG_ENDIAN);
 
                if(((tail_0&0x70)>>4)&0xfe)
-                       ep_strbuf_append_printf(afield_str,"%s, ",val_to_str((tail_0&0x70)>>4, PTSDU_vals, "Error, please report: %d"));
+                       wmem_strbuf_append_printf(afield_str,"%s, ",val_to_str((tail_0&0x70)>>4, PTSDU_vals, "Error, please report: %d"));
 
                switch((tail_0&0x70)>>4)
                {
@@ -1816,7 +1818,7 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                case 1:         /* Short Page */
                        if(((tail_0&0x70)>>4)==0)
                        {
-                               ep_strbuf_append_printf(afield_str,"RFPI: xxxxx%.1x%.2x%.2x, ", (tail_0&0x0f), tail_1, tail_2);
+                               wmem_strbuf_append_printf(afield_str,"RFPI: xxxxx%.1x%.2x%.2x, ", (tail_0&0x0f), tail_1, tail_2);
                                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);
                                offset+=3;
 
@@ -1824,14 +1826,14 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        }
                        else
                        {
-                               ep_strbuf_append_printf(afield_str,"Bs Data: %.1x%.2x%.2x, ", (tail_0&0x0f), tail_1, tail_2);
+                               wmem_strbuf_append_printf(afield_str,"Bs Data: %.1x%.2x%.2x, ", (tail_0&0x0f), tail_1, tail_2);
                                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);
                                offset+=3;
 
                                proto_tree_add_item(ATail, hf_dect_A_Tail_Pt_InfoType, tvb, offset, 1, ENC_BIG_ENDIAN);
                        }
 
-                       ep_strbuf_append_printf(afield_str,"%s",val_to_str(tail_3>>4, PTInfoType_vals, "Error, please report: %d"));
+                       wmem_strbuf_append_printf(afield_str,"%s",val_to_str(tail_3>>4, PTInfoType_vals, "Error, please report: %d"));
 
                        switch(tail_3>>4)
                        {
@@ -1892,26 +1894,26 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
                        offset-=5;
                        break;
                case 2:         /* Full Page */
-                       ep_strbuf_append_printf(afield_str,"Full Page");
+                       wmem_strbuf_append_printf(afield_str,"Full Page");
                        break;
                case 3:         /* MAC Resume Page */
-                       ep_strbuf_append_printf(afield_str,"MAC Resume Page");
+                       wmem_strbuf_append_printf(afield_str,"MAC Resume Page");
                        break;
                case 4:         /* Not the Last 36 Bits of a Long Page */
-                       ep_strbuf_append_printf(afield_str,"Not the Last 36 Bits");
+                       wmem_strbuf_append_printf(afield_str,"Not the Last 36 Bits");
                        break;
                case 5:         /* The First 36 Bits of a Long Page */
-                       ep_strbuf_append_printf(afield_str,"The First 36 Bits");
+                       wmem_strbuf_append_printf(afield_str,"The First 36 Bits");
                        break;
                case 6:         /* The Last 36 Bits of a Long Page */
-                       ep_strbuf_append_printf(afield_str,"The Last 36 Bits");
+                       wmem_strbuf_append_printf(afield_str,"The Last 36 Bits");
                        break;
                case 7:         /* All of a Long Page */
-                       ep_strbuf_append_printf(afield_str,"All of a Long Page");
+                       wmem_strbuf_append_printf(afield_str,"All of a Long Page");
                        break;
                }
 
-               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, afield_str->str);
+               proto_tree_add_string(ColumnsTree, hf_dect_cc_AField, tvb, offset, 1, wmem_strbuf_get_str(afield_str));
        }
 
        offset+=5;
@@ -1927,11 +1929,11 @@ dissect_afield(gboolean dect_packet_type, guint8 *ba,
        else
                proto_tree_add_uint_format(afieldti, hf_dect_A_RCRC, tvb, offset, 2, 1, "R-CRC Match (Calc:%.4x, Recv:%.4x)", computed_rcrc, rcrc);
 
-       offset+=2;
+       /*offset+=2;*/
 }
 
-static void
-dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static int
+dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
 {
        proto_item *ti          =NULL;
        proto_item *typeti      =NULL;
@@ -1946,20 +1948,19 @@ dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        proto_item *columnstreeti;
        proto_tree *ColumnsTree;
 
-       col_clear(pinfo->cinfo, COL_INFO);
-       col_append_fstr(pinfo->cinfo, COL_INFO, "Use Custom Columns for Infos");
+       col_set_str(pinfo->cinfo, COL_INFO, "Use Custom Columns for Infos");
 
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "DECT");
 
-       pkt_len=tvb_length(tvb);
+       pkt_len=tvb_reported_length(tvb);
 
        if(pkt_len<=DECT_PACKET_INFO_LEN)
        {
                col_set_str(pinfo->cinfo, COL_INFO, "No Data");
-               return;
+               return tvb_captured_length(tvb);
        }
 
-       ti=proto_tree_add_item(tree, proto_dect, tvb, 0, -1, FALSE);
+       ti=proto_tree_add_item(tree, proto_dect, tvb, 0, -1, ENC_NA);
        DectTree=proto_item_add_subtree(ti, ett_dect);
 
        proto_tree_add_item(DectTree, hf_dect_transceivermode, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -2008,6 +2009,7 @@ dissect_dect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                proto_item_append_text(typeti, " Unknown Packet");
                break;
        }
+       return tvb_captured_length(tvb);
 }
 
 void
@@ -2580,3 +2582,15 @@ proto_reg_handoff_dect(void)
        dissector_add_uint("ethertype", ETHERTYPE_DECT , dect_handle);
 }
 
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */