Add FT_EUI64 Field Type
authoralagoutte <alagoutte@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 8 May 2011 10:23:53 +0000 (10:23 +0000)
committeralagoutte <alagoutte@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 8 May 2011 10:23:53 +0000 (10:23 +0000)
* Remove proto_tree_add_eui64 function from 802.15.4 Dissector
* Replace print_eui64/print_eui64 by eui64_to_str/get_eui64_name
* Update Documentation (README.dev)
* Add new function in libwireshark.def
* Support of encoding for tvb_eui64_to_str
* Use FT_EUI64 for ICMPv6, CAPWAP, Zbee ... dissector

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37015 f5534014-38df-0310-8fa8-9805f1628bb7

23 files changed:
AUTHORS
doc/README.developer
epan/addr_resolv.c
epan/addr_resolv.h
epan/address_to_str.c
epan/dfilter/semcheck.c
epan/dissectors/packet-capwap.c
epan/dissectors/packet-icmpv6.c
epan/dissectors/packet-ieee802154.c
epan/dissectors/packet-ieee802154.h
epan/dissectors/packet-zbee-aps.c
epan/dissectors/packet-zbee-nwk.c
epan/dissectors/packet-zbee-security.c
epan/dissectors/packet-zbee-zdp-binding.c
epan/dissectors/packet-zbee-zdp-discovery.c
epan/dissectors/packet-zbee-zdp-management.c
epan/dissectors/packet-zbee-zdp.c
epan/ftypes/ftype-integer.c
epan/ftypes/ftypes.h
epan/libwireshark.def
epan/proto.c
epan/proto.h
epan/to_str.h

diff --git a/AUTHORS b/AUTHORS
index b193432..37e5c36 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -2953,6 +2953,7 @@ Samu Varjonen             <samu.varjonen [AT] hiit.fi> {
 }
 
 Alexis La Goutte       <alexis.lagoutte [AT] gmail.com> {
+       Add FT_EUI64 Field Type
        Aruba ERM dissector
        ATMTCP dissector
        CAPWAP dissector
index 41f7db9..df4a3c2 100644 (file)
@@ -1122,7 +1122,7 @@ FIELDABBREV       The abbreviated name for the header field. (NO SPACES)
 FIELDTYPE      FT_NONE, FT_BOOLEAN, FT_UINT8, FT_UINT16, FT_UINT24,
                FT_UINT32, FT_UINT64, FT_INT8, FT_INT16, FT_INT24, FT_INT32,
                FT_INT64, FT_FLOAT, FT_DOUBLE, FT_ABSOLUTE_TIME,
-               FT_RELATIVE_TIME, FT_STRING, FT_STRINGZ, FT_EBCDIC,
+               FT_RELATIVE_TIME, FT_STRING, FT_STRINGZ, FT_EBCDIC, FT_EUI64
                FT_UINT_STRING, FT_ETHER, FT_BYTES, FT_UINT_BYTES, FT_IPv4,
                FT_IPv6, FT_IPXNET, FT_FRAMENUM, FT_PROTOCOL, FT_GUID, FT_OID
 FIELDDISPLAY   For FT_UINT{8,16,24,32,64} and FT_INT{8,16,24,32,64):
@@ -1785,6 +1785,7 @@ The type of value this field holds. The current field types are:
                                address.
        FT_GUID                 A Globally Unique Identifier
        FT_OID                  An ASN.1 Object Identifier
+       FT_EUI64                A EUI-64 Address
 
 Some of these field types are still not handled in the display filter
 routines, but the most common ones are. The FT_UINT* variables all
@@ -2294,6 +2295,17 @@ protocol or field labels to the proto_tree:
        proto_tree_add_oid_format(tree, id, tvb, start, length, value_ptr,
                format, ...);
 
+       proto_item *
+       proto_tree_add_eui64(tree, id, tvb, start, length, value);
+
+       proto_item *
+       proto_tree_add_eui64_format(tree, id, tvb, start, length, value,
+               format, ...);
+
+       proto_item *
+       proto_tree_add_eui64_format_value(tree, id, tvb, start, length,
+               value, format, ...);
+
        proto_item *
        proto_tree_add_oid_format_value(tree, id, tvb, start, length,
                value_ptr, format, ...);
@@ -2424,6 +2436,7 @@ proto_tree_add_int()
 proto_tree_add_int64()
 proto_tree_add_guid()
 proto_tree_add_oid()
+proto_tree_add_eui64()
 ------------------------
 These routines are used to add items to the protocol tree if either:
 
@@ -2499,6 +2512,9 @@ e_guid_t structure.
 For proto_tree_add_oid(), the 'value_ptr' argument is a pointer to an
 ASN.1 Object Identifier.
 
+For proto_tree_add_eui64(), the 'value' argument is a 64-bit integer 
+value
+
 proto_tree_add_bytes_format()
 proto_tree_add_time_format()
 proto_tree_add_ipxnet_format()
@@ -2515,6 +2531,7 @@ proto_tree_add_int_format()
 proto_tree_add_int64_format()
 proto_tree_add_guid_format()
 proto_tree_add_oid_format()
+proto_tree_add_eui64_format()
 ----------------------------
 These routines are used to add items to the protocol tree when the
 dissector routine wants complete control over how the field and value
@@ -2540,6 +2557,7 @@ proto_tree_add_int_format_value()
 proto_tree_add_int64_format_value()
 proto_tree_add_guid_format_value()
 proto_tree_add_oid_format_value()
+proto_tree_add_eui64_format_value()
 ------------------------------------
 
 These routines are used to add items to the protocol tree when the
index 8b662f7..1837241 100644 (file)
@@ -3051,6 +3051,54 @@ get_manuf_name_if_known(const guint8 *addr)
 
 } /* get_manuf_name_if_known */
 
+extern const gchar *
+get_eui64_name(const guint64 addr_eui64)
+{
+  gchar *cur;
+  hashmanuf_t  *mtp;
+  guint8 *addr = ep_alloc(8);
+  
+  /* Copy and convert the address to network byte order. */
+  *(guint64 *)(addr) = pntoh64(&(addr_eui64));
+
+  if ((gbl_resolv_flags & RESOLV_MAC) && !eth_resolution_initialized) {
+    initialize_ethers();
+    eth_resolution_initialized = TRUE;
+  }
+
+  if (!(gbl_resolv_flags & RESOLV_MAC) || ((mtp = manuf_name_lookup(addr)) == NULL)) {
+    cur=ep_strdup_printf("%02x:%02x:%02x%02x:%02x:%02x%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], addr[6], addr[7]);
+    return cur;
+  }
+  cur=ep_strdup_printf("%s_%02x:%02x:%02x:%02x:%02x", mtp->name, addr[3], addr[4], addr[5], addr[6], addr[7]);
+  return cur;
+
+} /* get_eui64_name */
+
+
+const gchar *
+get_eui64_name_if_known(const guint64 addr_eui64)
+{
+  gchar *cur;
+  hashmanuf_t  *mtp;
+  guint8 *addr = ep_alloc(8);
+
+  /* Copy and convert the address to network byte order. */
+  *(guint64 *)(addr) = pntoh64(&(addr_eui64));
+
+  if (!eth_resolution_initialized) {
+    initialize_ethers();
+    eth_resolution_initialized = TRUE;
+  }
+
+  if ((mtp = manuf_name_lookup(addr)) == NULL) {
+    return NULL;
+  }
+
+  cur=ep_strdup_printf("%s_%02x:%02x:%02x:%02x:%02x", mtp->name, addr[3], addr[4], addr[5], addr[6], addr[7]);
+  return cur;
+
+} /* get_eui64_name_if_known */
 
 #ifdef HAVE_C_ARES
 #define GHI_TIMEOUT (250 * 1000)
index 76fb481..c33228d 100644 (file)
@@ -158,6 +158,14 @@ extern const gchar *get_manuf_name(const guint8 *addr);
 /* get_manuf_name returns the vendor name or NULL if not known */
 extern const gchar *get_manuf_name_if_known(const guint8 *addr);
 
+/* get_eui64_name returns "<vendor>_%02x:%02x:%02x:%02x:%02x:%02x" if the vendor code is known 
+   "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" */
+extern const gchar *get_eui64_name(const guint64 addr);
+
+/* get_eui64_name_if_known returns "<vendor>_%02x:%02x:%02x:%02x:%02x:%02x" if the vendor code is known else NULL */
+extern const gchar *get_eui64_name_if_known(const guint64 addr);
+
+
 /* get_ipxnet_name returns the logical name if found in an ipxnets file,
  * or a string formatted with "%X" if not */
 extern const gchar *get_ipxnet_name(const guint32 addr);
index a1eafe8..16831ee 100644 (file)
@@ -321,6 +321,37 @@ tvb_vines_addr_to_str(tvbuff_t *tvb, const gint offset)
   return buf;
 }
 
+/*
+ This function is very fast and this function is called a lot.
+ XXX update the ep_address_to_str stuff to use this function.
+*/
+gchar *
+eui64_to_str(const guint64 ad) {
+  gchar *buf;
+  guint8 *p_eui64;
+
+  p_eui64 = ep_alloc(8);
+  buf=ep_alloc(EUI64_STR_LEN);
+
+  /* Copy and convert the address to network byte order. */
+  *(guint64 *)(p_eui64) = pntoh64(&(ad));
+
+  sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 
+  p_eui64[0], p_eui64[1], p_eui64[2], p_eui64[3],
+  p_eui64[4], p_eui64[5], p_eui64[6], p_eui64[7] );
+  return buf;
+}
+gchar *
+tvb_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding)
+{
+  if(encoding)
+  {
+    return eui64_to_str(tvb_get_letoh64(tvb, offset));
+  }else {
+    return eui64_to_str(tvb_get_ntoh64(tvb, offset));
+  }
+}
+
 static void
 usb_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
 {
index 6800262..e3904f0 100644 (file)
@@ -75,6 +75,7 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
                case FT_IPXNET:
                case FT_INT64:          /* XXX - should be able to compare with INT */
                case FT_UINT64:         /* XXX - should be able to compare with INT */
+               case FT_EUI64:          /* XXX - should be able to compare with INT */
                        return a == b;
 
                case FT_ETHER:
@@ -82,6 +83,7 @@ compatible_ftypes(ftenum_t a, ftenum_t b)
                case FT_UINT_BYTES:
                case FT_GUID:
                case FT_OID:
+
                        return (b == FT_ETHER || b == FT_BYTES || b == FT_UINT_BYTES || b == FT_GUID || b == FT_OID);
 
                case FT_BOOLEAN:
@@ -173,6 +175,7 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s)
                case FT_UINT_STRING:
                case FT_UINT64:
                case FT_INT64:
+               case FT_EUI64:
                case FT_PCRE:
                case FT_GUID:
                case FT_OID:
@@ -295,6 +298,7 @@ is_bytes_type(enum ftenum type)
                case FT_INT32:
                case FT_INT64:
                case FT_PCRE:
+               case FT_EUI64:
                        return FALSE;
 
                case FT_NUM_TYPES:
index 551dab4..d69fab1 100644 (file)
@@ -1602,7 +1602,7 @@ proto_register_capwap_control(void)
                        NULL, HFILL }},
                { &hf_capwap_header_mac_eui64,
                { "MAC address",        "capwap.header.mac.eui64",
-                       FT_BYTES, BASE_NONE, NULL, 0x00,
+                       FT_EUI64, BASE_NONE, NULL, 0x00,
                        NULL, HFILL }},
                { &hf_capwap_header_mac_data,
                { "MAC address",        "capwap.header.mac.data",
index 62d1e22..0e842b9 100644 (file)
@@ -1975,7 +1975,6 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
             {
                 /* 6lowpan-ND */
                 guint8 status;
-                gchar *eui64;
 
                 /* Status */
                 proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_aro_status, tvb, opt_offset, 1, FALSE);
@@ -1992,8 +1991,7 @@ dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
 
                 /* EUI-64 */
                 proto_tree_add_item(icmp6opt_tree, hf_icmpv6_opt_aro_eui64, tvb, opt_offset, 8, FALSE);
-                eui64 = tvb_bytes_to_str_punct(tvb, opt_offset, 8, ':');
-                proto_item_append_text(ti, " : Register %s %s", eui64, val_to_str(status, nd_opt_6lowpannd_status_val, "Unknown %d"));
+                proto_item_append_text(ti, " : Register %s %s", tvb_eui64_to_str(tvb, opt_offset, FALSE), val_to_str(status, nd_opt_6lowpannd_status_val, "Unknown %d"));
                 opt_offset += 8;
 
             }
@@ -4037,8 +4035,8 @@ proto_register_icmpv6(void)
         { &hf_icmpv6_opt_aro_registration_lifetime,
           { "Registration  Lifetime", "icmpv6.opt.aro.registration_lifetime", FT_UINT16, BASE_DEC, NULL, 0x00,
             "The amount of time (in a unit of 60 seconds) that the router should retain the Neighbor Cache entry", HFILL }},
-        { &hf_icmpv6_opt_aro_eui64, /*  TODO: add a FT_EUI64 Type ? */
-          { "EUI-64", "icmpv6.opt.aro.eui64", FT_BYTES, BASE_NONE, NULL, 0x00,
+        { &hf_icmpv6_opt_aro_eui64,
+          { "EUI-64", "icmpv6.opt.aro.eui64", FT_EUI64, BASE_NONE, NULL, 0x00,
             "This field is used to uniquely identify the interface of the registered address", HFILL }},
         { &hf_icmpv6_opt_6co_context_length,
           { "Context Length", "icmpv6.opt.6co.context_length", FT_UINT8, BASE_DEC, NULL, 0x00,
index cf8f2e5..ce9f956 100644 (file)
@@ -358,74 +358,6 @@ static const true_false_string ieee802154_gts_direction_tfs = {
 #define IEEE802154_CRC_XOROUT   0xFFFF
 #define ieee802154_crc_tvb(tvb, offset)   (crc16_ccitt_tvb_seed(tvb, offset, IEEE802154_CRC_SEED) ^ IEEE802154_CRC_XOROUT)
 
-#define EUI64_STRLEN    (3*(sizeof(guint64)+1))
-/*FUNCTION:------------------------------------------------------
- *  NAME
- *      print_eui64
- *  DESCRIPTION
- *      Prints an EUI-64 address in a string. Does not attempt to
- *      resolve the OUI value.
- *
- *  PARAMETERS
- *      guint64 addr
- *  RETURNS
- *      gchar*
- *---------------------------------------------------------------
- */
-gchar *
-print_eui64(guint64 addr)
-{
-    address         eui64addr;
-
-    /* Endian-swap the address to put it into network order. */
-    addr = pntoh64(&addr);
-    /* Fill in the address struct. */
-    eui64addr.type = AT_EUI64;
-    eui64addr.len = sizeof(guint64);
-    eui64addr.data = &addr;
-    /* Print the address. */
-    return ep_address_to_str(&eui64addr);
-} /* print_eui64 */
-
-/*FUNCTION:------------------------------------------------------
- *  NAME
- *      print_eui64_oui
- *  DESCRIPTION
- *      Prints an EUI-64 address in a string. Attempts to lookup
- *      the vendor name from the OUI,
- *
- *  PARAMETERS
- *      guint64 addr
- *  RETURNS
- *      gchar*
- *---------------------------------------------------------------
- */
-gchar *
-print_eui64_oui(guint64 addr)
-{
-    const gchar     *manuf_name;
-    address         eui64addr;
-
-    /* Endian-swap the address to put it into network order. */
-    addr = pntoh64(&addr);
-    /* Fill in the address struct. */
-    eui64addr.type = AT_EUI64;
-    eui64addr.len = sizeof(guint64);
-    eui64addr.data = &addr;
-    /* Attempt an OUI lookup. */
-    manuf_name = get_manuf_name_if_known(eui64addr.data);
-    if (manuf_name == NULL) {
-        /* Could not find an OUI. */
-        return ep_address_to_str(&eui64addr);
-    }
-    else {
-        /* Found an address string. */
-        return ep_strdup_printf("%s_%02x:%02x:%02x:%02x:%02x", manuf_name,
-            ((guint8 *)(eui64addr.data))[3], ((guint8 *)(eui64addr.data))[4],
-            ((guint8 *)(eui64addr.data))[5], ((guint8 *)(eui64addr.data))[6],
-            ((guint8 *)(eui64addr.data))[7]);
-    }
-} /* print_eui64_oui */
 
 /*FUNCTION:------------------------------------------------------
  *  NAME
@@ -778,15 +710,10 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
     else if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) {
         /* Dynamic (not stack) memory required for address column. */
         void     *addr = ep_alloc(8);
-        gchar    *dst, *dst_oui;
 
         /* Get the address */
         packet->dst64 = tvb_get_letoh64(tvb, offset);
 
-        /* print the address strings. */
-        dst = print_eui64(packet->dst64);
-        dst_oui = print_eui64_oui(packet->dst64);
-
         /* Copy and convert the address to network byte order. */
         *(guint64 *)(addr) = pntoh64(&(packet->dst64));
 
@@ -798,12 +725,11 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
         SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, addr);
         SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, addr);
         if (tree) {
-            proto_tree_add_uint64_format_value(ieee802154_tree, hf_ieee802154_dst_addr64, tvb, offset,
-                    8, packet->dst64, "%s (%s)", dst_oui, dst);
-            proto_item_append_text(proto_root, ", Dst: %s", dst_oui);
+            proto_tree_add_item(ieee802154_tree, hf_ieee802154_dst_addr64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
+            proto_item_append_text(proto_root, ", Dst: %s", get_eui64_name(packet->dst64));
         }
         if (check_col(pinfo->cinfo, COL_INFO)) {
-            col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", dst_oui);
+            col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst: %s", get_eui64_name(packet->dst64));
         }
         offset += 8;
     }
@@ -898,15 +824,10 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
     else if (packet->src_addr_mode == IEEE802154_FCF_ADDR_EXT) {
         /* Dynamic (not stack) memory required for address column. */
         void    *addr = ep_alloc(8);
-        gchar   *src, *src_oui;
 
         /* Get the address. */
         packet->src64 = tvb_get_letoh64(tvb, offset);
 
-        /* Print the address strings. */
-        src = print_eui64(packet->src64);
-        src_oui = print_eui64_oui(packet->src64);
-
         /* Copy and convert the address to network byte order. */
         *(guint64 *)(addr) = pntoh64(&(packet->src64));
 
@@ -918,13 +839,12 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
         SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, addr);
         SET_ADDRESS(&pinfo->src, AT_EUI64, 8, addr);
         if (tree) {
-            proto_tree_add_uint64_format_value(ieee802154_tree, hf_ieee802154_src64, tvb, offset,
-                                               8, packet->src64, "%s (%s)", src_oui, src);
-            proto_item_append_text(proto_root, ", Src: %s", src_oui);
+            proto_tree_add_item(ieee802154_tree, hf_ieee802154_src64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
+            proto_item_append_text(proto_root, ", Src: %s", get_eui64_name(packet->src64));
         }
 
         if (check_col(pinfo->cinfo, COL_INFO)) {
-            col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", src_oui);
+            col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: %s", get_eui64_name(packet->src64));
         }
         offset += 8;
     }
@@ -1006,7 +926,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
         if (packet->key_id_mode == KEY_ID_MODE_KEY_EXPLICIT_8) {
           packet->key_source.addr64 = tvb_get_ntoh64(tvb, offset);
           proto_tree_add_uint64(field_tree, hf_ieee802154_aux_sec_key_source, tvb, offset, 8, packet->key_source.addr64);
-          proto_item_set_len(ti,1 + 8);
+          proto_item_set_len(ti, 1 + 8);
           offset += 4;
         }
         /* Add key identifier. */
@@ -1474,8 +1394,7 @@ dissect_ieee802154_pendaddr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
         (*offset) += 2;
     } /* for */
     for (i=0; i<pend_num64; i++) {
-        guint64 addr = tvb_get_letoh64(tvb, *offset);
-        proto_tree_add_uint64_format_value(subtree, hf_ieee802154_pending64, tvb, *offset, 8, addr, "%s (%s)", print_eui64_oui(addr), print_eui64(addr));
+        proto_tree_add_item(subtree, hf_ieee802154_pending64, tvb, *offset, 8, ENC_LITTLE_ENDIAN);
         (*offset) += 8;
     } /* for */
 } /* dissect_ieee802154_pendaddr */
@@ -2381,29 +2300,6 @@ gboolean ieee802154_long_addr_invalidate(guint64 long_addr, guint fnum)
     return FALSE;
 } /* ieee802154_long_addr_invalidate */
 
-/*FUNCTION:------------------------------------------------------
- *  NAME
- *      proto_tree_add_eui64
- *  DESCRIPTION
- *      Helper function to display an EUI-64 address to the tree.
- *  PARAMETERS
- *      proto_tree  *tree
- *      int         hfindex
- *      tvbuff_t    *tvb
- *      gint        start
- *      gint        length
- *      guint64     value;
- *  RETURNS
- *      proto_item *
- *---------------------------------------------------------------
- */
-proto_item *
-proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gint length, gint64 value)
-{
-    header_field_info *hf = proto_registrar_get_nth(hfindex);
-    return proto_tree_add_uint64_format(tree, hfindex, tvb, start, length, value, "%s: %s (%s)",
-            hf->name, print_eui64_oui(value), print_eui64(value));
-}
 
 /*FUNCTION:------------------------------------------------------
  *  NAME
@@ -2481,7 +2377,7 @@ void proto_register_ieee802154(void)
             NULL, HFILL }},
 
         { &hf_ieee802154_dst_addr64,
-        { "Destination",                    "wpan.dst_addr64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Destination",                    "wpan.dst_addr64", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_ieee802154_src_panID,
@@ -2493,7 +2389,7 @@ void proto_register_ieee802154(void)
             NULL, HFILL }},
 
         { &hf_ieee802154_src64,
-        { "Extended Source",                "wpan.src64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Extended Source",                "wpan.src64", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_ieee802154_src64_origin,
@@ -2638,7 +2534,7 @@ void proto_register_ieee802154(void)
             "Device with pending data to receive.", HFILL }},
 
         { &hf_ieee802154_pending64,
-        { "Address",                    "wpan.pending64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Address",                    "wpan.pending64", FT_EUI64, BASE_NONE, NULL, 0x0,
             "Device with pending data to receive.", HFILL }},
 
             /* Auxiliary Security Header Fields */
index ab7b999..82313de 100644 (file)
@@ -238,11 +238,6 @@ typedef struct {
     ieee802154_map_rec *map_rec;
 } ieee802154_hints_t;
 
-/* Some Helper Function Definitions. */
-extern gchar       *print_eui64(guint64);
-extern gchar       *print_eui64_oui(guint64);
-extern proto_item  *proto_tree_add_eui64(proto_tree *, int, tvbuff_t *, gint, gint, gint64);
-
 /* Short to Extended Address Prototypes */
 extern ieee802154_map_rec *ieee802154_addr_update(ieee802154_map_tab_t *, guint16, guint16, guint64,
         const char *, guint);
index 847ba76..bfb47b0 100644 (file)
@@ -1080,22 +1080,18 @@ static void dissect_zbee_aps_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
 static guint
 dissect_zbee_aps_skke_challenge(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
 {
-    guint64 init;
-    guint64 resp;
 
     /* Get and display the initiator address. */
-    init = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_initiator, tvb, offset, sizeof(guint64), init);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_initiator, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the responder address. */
-    resp = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_responder, tvb, offset, sizeof(guint64), resp);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_responder, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the SKKE data. */
     if (tree) {
@@ -1125,22 +1121,19 @@ dissect_zbee_aps_skke_challenge(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
 static guint
 dissect_zbee_aps_skke_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
 {
-    guint64 init;
-    guint64 resp;
 
     /* Get and display the initiator address. */
-    init = tvb_get_letoh64(tvb, offset);
+
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_initiator, tvb, offset, sizeof(guint64), init);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_initiator, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the responder address. */
-    resp = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_responder, tvb, offset, sizeof(guint64), resp);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_responder, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the SKKE data. */
     if (tree) {
@@ -1228,8 +1221,6 @@ dissect_zbee_aps_transport_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
         case ZBEE_APS_CMD_KEY_HIGH_SEC_NWK: {
             /* Network Key */
             guint8  seqno;
-            guint64 src;
-            guint64 dst;
 
             /* Get and display the sequence number. */
             seqno = tvb_get_guint8(tvb, offset);
@@ -1239,55 +1230,47 @@ dissect_zbee_aps_transport_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
             offset += 1;
 
             /* Get and display the destination address. */
-            dst = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_dst, tvb, offset, sizeof(guint64), dst);
+                proto_tree_add_item(tree, hf_zbee_aps_cmd_dst, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
-            offset += sizeof(guint64);
+            offset += 8;
 
             /* Get and display the source address. */
-            src = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_src, tvb, offset, sizeof(guint64), src);
+                proto_tree_add_item(tree, hf_zbee_aps_cmd_src, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
-            offset += sizeof(guint64);
+            offset += 8;
 
             break;
         }
         case ZBEE_APS_CMD_KEY_TC_MASTER:
         case ZBEE_APS_CMD_KEY_TC_LINK:{
             /* Trust Center master key. */
-            guint64 src;
-            guint64 dst;
 
             /* Get and display the destination address. */
-            dst = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_dst, tvb, offset, sizeof(guint64), dst);
+                proto_tree_add_item(tree, hf_zbee_aps_cmd_dst, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
-            offset += sizeof(guint64);
+            offset += 8;
 
             /* Get and display the source address. */
-            src = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_src, tvb, offset, sizeof(guint64), src);
+                proto_tree_add_item(tree, hf_zbee_aps_cmd_src, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
-            offset += sizeof(guint64);
+            offset += 8;
 
             break;
         }
         case ZBEE_APS_CMD_KEY_APP_MASTER:
         case ZBEE_APS_CMD_KEY_APP_LINK:{
             /* Application master or link key, both have the same format. */
-            guint64 partner;
             guint8  initiator;
 
             /* get and display the partner address.  */
-            partner = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_partner, tvb, offset, sizeof(guint64), partner);
+                proto_tree_add_eui64(tree, hf_zbee_aps_cmd_partner, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
-            offset += sizeof(guint64);
+            offset += 8;
 
             /* get and display the initiator flag. */
             initiator = tvb_get_guint8(tvb, offset);
@@ -1323,22 +1306,20 @@ dissect_zbee_aps_transport_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
 static guint
 dissect_zbee_aps_update_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
 {
-    guint64 device;
     guint16 short_addr;
     guint8  status;
 
     /* Get and display the device address. */
-    device = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_device, tvb, offset, sizeof(guint64), device);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_device, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the short address. Only on ZigBee 2006 and later. */
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
         short_addr = tvb_get_letohs(tvb, offset);
         if (tree) {
-            proto_tree_add_uint(tree, hf_zbee_aps_cmd_short_addr, tvb, offset,2, short_addr);
+            proto_tree_add_uint(tree, hf_zbee_aps_cmd_short_addr, tvb, offset, 2, short_addr);
         }
         offset +=2;
     }
@@ -1371,14 +1352,12 @@ dissect_zbee_aps_update_device(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
 static guint
 dissect_zbee_aps_remove_device(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
 {
-    guint64 device;
 
     /* Get and display the device address. */
-    device = tvb_get_letoh64(tvb, offset);
     if(tree){
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_device, tvb, offset, sizeof(guint64), device);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_device, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Done */
     return offset;
@@ -1402,7 +1381,6 @@ static guint
 dissect_zbee_aps_request_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
 {
     guint8  key_type;
-    guint64 partner;
 
     /* Get and display the key type. */
     key_type = tvb_get_guint8(tvb, offset);
@@ -1413,11 +1391,10 @@ dissect_zbee_aps_request_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
 
     /* Get and display the partner address. Only present on application master key. */
     if (key_type == ZBEE_APS_CMD_KEY_APP_MASTER) {
-        partner = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(tree, hf_zbee_aps_cmd_partner, tvb, offset, sizeof(guint64), partner);
+            proto_tree_add_eui64(tree, hf_zbee_aps_cmd_partner, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
-        offset += sizeof(guint64);
+        offset += 8;
     }
 
     /* Done */
@@ -1474,8 +1451,6 @@ dissect_zbee_aps_auth_challenge(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
 {
     guint8  key_type;
     guint8  key_seqno;
-    guint64 initiator;
-    guint64 responder;
 
     /* Get and display the key type. */
     key_type = tvb_get_guint8(tvb, offset);
@@ -1494,18 +1469,16 @@ dissect_zbee_aps_auth_challenge(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
     }
 
     /* Get and display the initiator address. */
-    initiator = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_initiator, tvb, offset, sizeof(guint64), initiator);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_initiator, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the responder address. */
-    responder = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_responder, tvb, offset, sizeof(guint64), responder);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_responder, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* Get and display the challenge. */
     if (tree) {
@@ -1583,16 +1556,14 @@ dissect_zbee_aps_auth_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
 static guint
 dissect_zbee_aps_tunnel(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
 {
-    guint64     dst;
     proto_tree  *root = NULL;
     tvbuff_t    *tunnel_tvb;
 
     /* Get and display the destination address. */
-    dst = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_eui64(tree, hf_zbee_aps_cmd_dst, tvb, offset, sizeof(guint64), dst);
+        proto_tree_add_item(tree, hf_zbee_aps_cmd_dst, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
-    offset += sizeof(guint64);
+    offset += 8;
 
     /* The remainder is a tunneled APS frame. */
     tunnel_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset),
@@ -1848,15 +1819,15 @@ void proto_register_zbee_aps(void)
                 NULL, HFILL }},
 
             { &hf_zbee_aps_cmd_initiator,
-            { "Initiator Address",      "zbee.aps.cmd.initiator", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Initiator Address",      "zbee.aps.cmd.initiator", FT_EUI64, BASE_NONE, NULL, 0x0,
                 "The extended address of the device to initiate the SKKE procedure", HFILL }},
 
             { &hf_zbee_aps_cmd_responder,
-            { "Responder Address",      "zbee.aps.cmd.responder", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Responder Address",      "zbee.aps.cmd.responder", FT_EUI64, BASE_NONE, NULL, 0x0,
                 "The extended address of the device responding to the SKKE procedure", HFILL }},
 
             { &hf_zbee_aps_cmd_partner,
-            { "Partner Address",        "zbee.aps.cmd.partner", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Partner Address",        "zbee.aps.cmd.partner", FT_EUI64, BASE_NONE, NULL, 0x0,
                 "The partner to use this key with for link-level security.", HFILL }},
 
             { &hf_zbee_aps_cmd_initiator_flag,
@@ -1864,7 +1835,7 @@ void proto_register_zbee_aps(void)
                 "Inidicates the destination of the transport-key command requested this key.", HFILL }},
 
             { &hf_zbee_aps_cmd_device,
-            { "Device Address",         "zbee.aps.cmd.device", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Device Address",         "zbee.aps.cmd.device", FT_EUI64, BASE_NONE, NULL, 0x0,
                 "The device whose status is being updated.", HFILL }},
 
             { &hf_zbee_aps_cmd_challenge,
@@ -1884,11 +1855,11 @@ void proto_register_zbee_aps(void)
                     VALS(zbee_aps_key_names), 0x0, NULL, HFILL }},
 
             { &hf_zbee_aps_cmd_dst,
-            { "Extended Destination",    "zbee.aps.cmd.dst", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Destination",    "zbee.aps.cmd.dst", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_aps_cmd_src,
-            { "Extended Source",         "zbee.aps.cmd.src", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Source",         "zbee.aps.cmd.src", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_aps_cmd_seqno,
index a380d8b..f23c8ca 100644 (file)
@@ -535,7 +535,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) && packet.ext_dst) {
         packet.dst64 = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(nwk_tree, hf_zbee_nwk_dst64, tvb, offset, 8, packet.dst64);
+            proto_tree_add_item(nwk_tree, hf_zbee_nwk_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
         offset += 8;
     }
@@ -547,7 +547,7 @@ dissect_zbee_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         if (packet.ext_src) {
             packet.src64 = tvb_get_letoh64(tvb, offset);
             if (tree) {
-                proto_tree_add_eui64(nwk_tree, hf_zbee_nwk_src64, tvb, offset, 8, packet.src64);
+                proto_tree_add_item(nwk_tree, hf_zbee_nwk_src64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
             }
             offset += 8;
 
@@ -842,7 +842,6 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     guint8  route_options;
     guint8  route_id;
     guint16 dest_addr;
-    guint64 dest_ext_addr;
     guint8  path_cost;
 
     /* Get and display the route options field. */
@@ -890,9 +889,8 @@ dissect_zbee_nwk_route_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
     /* Get and display the extended destination address. */
     if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_DEST_EXT) {
-        dest_ext_addr = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(tree, hf_zbee_nwk_cmd_route_dest_ext, tvb, offset, 8, dest_ext_addr);
+            proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_dest_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
         offset += 8;
     }
@@ -928,8 +926,6 @@ dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
     guint8  route_id;
     guint16 orig_addr;
     guint16 resp_addr;
-    guint64 orig_ext_addr;
-    guint64 resp_ext_addr;
     guint8  path_cost;
 
     /* Get and display the route options field. */
@@ -980,18 +976,16 @@ dissect_zbee_nwk_route_rep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 
     /* Get and display the originator extended address. */
     if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_ORIG_EXT) {
-        orig_ext_addr = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(tree, hf_zbee_nwk_cmd_route_orig_ext, tvb, offset, 8, orig_ext_addr);
+            proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_orig_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
         offset += 8;
     }
 
     /* Get and display the responder extended address. */
     if (route_options & ZBEE_NWK_CMD_ROUTE_OPTION_RESP_EXT) {
-        resp_ext_addr = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(tree, hf_zbee_nwk_cmd_route_resp_ext, tvb, offset, 8, resp_ext_addr);
+            proto_tree_add_item(tree, hf_zbee_nwk_cmd_route_resp_ext, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
         offset += 8;
     }
@@ -1293,7 +1287,6 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
 {
     guint8  options;
     guint8  report_type;
-    guint64 epid;
     int     report_count;
     int     i;
 
@@ -1308,9 +1301,8 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
     offset += 1;
 
     /* Get and display the epid. */
-    epid = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_uint64_format_value(tree, hf_zbee_nwk_cmd_epid, tvb, offset, 8, epid, "%s", print_eui64(epid));
+        proto_tree_add_item(tree, hf_zbee_nwk_cmd_epid, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
     offset += 8;
 
@@ -1354,7 +1346,6 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
     guint8  options;
     guint8  update_type;
     guint8  update_id;
-    guint64 epid;
     int     update_count;
     int     i;
 
@@ -1369,9 +1360,8 @@ dissect_zbee_nwk_update(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui
     offset += 1;
 
     /* Get and display the epid. */
-    epid = tvb_get_letoh64(tvb, offset);
     if (tree) {
-        proto_tree_add_uint64_format_value(tree, hf_zbee_nwk_cmd_epid, tvb, offset, 8, epid, "%s", print_eui64(epid));
+        proto_tree_add_item(tree, hf_zbee_nwk_cmd_epid, tvb, offset, 8, ENC_LITTLE_ENDIAN);
     }
     offset += 8;
 
@@ -1473,13 +1463,12 @@ static void dissect_zbee_beacon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
         /* In ZigBee 2006 and later, the beacon contains an extended PAN ID. */
         epid = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_uint64_format_value(beacon_tree, hf_zbee_beacon_epid, tvb, offset, 8,
-                    epid, "%s", print_eui64(epid));
+            proto_tree_add_item(beacon_tree, hf_zbee_beacon_epid, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
         offset += 8;
 
         /* Update the Info Column with the EPID. */
-        col_append_fstr(pinfo->cinfo, COL_INFO, ", EPID: %s", print_eui64(epid));
+        col_append_fstr(pinfo->cinfo, COL_INFO, ", EPID: %s", get_eui64_name(epid));
 
         /*
          * In ZigBee 2006 the Tx-Offset is optional, while in the 2007 and
@@ -1608,11 +1597,11 @@ void proto_register_zbee_nwk(void)
                 ZBEE_NWK_MCAST_MAX_RADIUS, NULL, HFILL }},
 
             { &hf_zbee_nwk_dst64,
-            { "Destination",   "zbee.nwk.dst64", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Destination",   "zbee.nwk.dst64", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_src64,
-            { "Extended Source",        "zbee.nwk.src64", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Source",        "zbee.nwk.src64", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_src64_origin,
@@ -1652,15 +1641,15 @@ void proto_register_zbee_nwk(void)
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_cmd_route_dest_ext,
-            { "Extended Destination",   "zbee.nwk.cmd.route.dest_ext", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Destination",   "zbee.nwk.cmd.route.dest_ext", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_cmd_route_orig_ext,
-            { "Extended Originator",    "zbee.nwk.cmd.route.orig_ext", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Originator",    "zbee.nwk.cmd.route.orig_ext", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_cmd_route_resp_ext,
-            { "Extended Responder",     "zbee.nwk.cmd.route.resp_ext", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Responder",     "zbee.nwk.cmd.route.resp_ext", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_cmd_route_cost,
@@ -1783,7 +1772,7 @@ void proto_register_zbee_nwk(void)
                 NULL, HFILL }},
 
             { &hf_zbee_nwk_cmd_epid,
-            { "Extended PAN ID",        "zbee.nwk.cmd.epid", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended PAN ID",        "zbee.nwk.cmd.epid", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_beacon_protocol,
@@ -1811,7 +1800,7 @@ void proto_register_zbee_nwk(void)
                 "Whether the device can accept join requests from ZigBee end devices.", HFILL }},
 
             { &hf_zbee_beacon_epid,
-            { "Extended PAN ID",        "zbee.beacon.ext_panid", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended PAN ID",        "zbee.beacon.ext_panid", FT_EUI64, BASE_NONE, NULL, 0x0,
                 "Extended PAN identifier.", HFILL }},
 
             { &hf_zbee_beacon_tx_offset,
index e2812a3..fb8e721 100644 (file)
@@ -227,7 +227,7 @@ void zbee_security_register(module_t *zbee_prefs, int proto)
                 NULL, HFILL }},
 
             { &hf_zbee_sec_src64,
-            { "Extended Source",                 "zbee.sec.src64", FT_UINT64, BASE_HEX, NULL, 0x0,
+            { "Extended Source",                 "zbee.sec.src64", FT_EUI64, BASE_NONE, NULL, 0x0,
                 NULL, HFILL }},
 
             { &hf_zbee_sec_key_seqno,
@@ -503,7 +503,7 @@ dissect_zbee_secure(tvbuff_t *tvb, packet_info *pinfo, proto_tree* tree, guint o
         /* Get and display the source address of the device that secured this payload. */
         packet.src64 = tvb_get_letoh64(tvb, offset);
         if (tree) {
-            proto_tree_add_eui64(sec_tree, hf_zbee_sec_src64, tvb, offset, 8, packet.src64);
+            proto_tree_add_item(sec_tree, hf_zbee_sec_src64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
         }
 #if 1
         if (!pinfo->fd->flags.visited) {
index 3d63a9c..3086f18 100644 (file)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include <gmodule.h>
 #include <epan/packet.h>
+#include <epan/addr_resolv.h>
 
 #include "packet-zbee.h"
 #include "packet-zbee-zdp.h"
@@ -71,7 +72,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe
 
     /* Add the source address. */
     src64 = tvb_get_letoh64(tvb, *offset + len);
-    if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", print_eui64_oui(src64));
+    if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", get_eui64_name(src64));
     len += sizeof(guint64);
 
     /* Add the source endpoint. */
@@ -108,7 +109,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe
     }
     else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) {
         dst64 = tvb_get_letoh64(tvb, *offset + len);
-        if (tree) proto_item_append_text(ti, ", Dst: %s", print_eui64_oui(dst64));
+        if (tree) proto_item_append_text(ti, ", Dst: %s", get_eui64_name(dst64));
         len += sizeof(guint64);
 
         dst_ep = tvb_get_guint8(tvb, *offset + len);
@@ -182,7 +183,7 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr
     for (i=0; i<out_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_out_cluster, tvb, &offset, sizeof_cluster, NULL);
 
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
-        zbee_append_info(tree, pinfo, " Src: %s", print_eui64_oui(ext_addr));
+        zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(ext_addr));
     }
     zbee_append_info(tree, pinfo, ", Target: 0x%04x", target);
 
@@ -243,13 +244,13 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     }
 
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
-        zbee_append_info(tree, pinfo, " Src: %s", print_eui64_oui(src64));
+        zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
     }
     if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
         zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
     }
     else {
-        zbee_append_info(tree, pinfo, ", Dst: %s", print_eui64(dst64));
+        zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
     }
 
     /* Dump any leftover bytes. */
@@ -309,13 +310,13 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     }
 
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
-        zbee_append_info(tree, pinfo, " Src: %s", print_eui64_oui(src64));
+        zbee_append_info(tree, pinfo, " Src: %s", get_eui64_name(src64));
     }
     if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) {
         zbee_append_info(tree, pinfo, ", Dst: 0x%04x", dst);
     }
     else {
-        zbee_append_info(tree, pinfo, ", Dst: %s", print_eui64(dst64));
+        zbee_append_info(tree, pinfo, ", Dst: %s", eui64_to_str(dst64));
     }
 
     /* Dump any leftover bytes. */
@@ -344,7 +345,7 @@ dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree
 
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -378,8 +379,8 @@ dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tre
     new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, sizeof(guint64), NULL);
     new_ep   = zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, sizeof(guint8), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
-    zbee_append_info(tree, pinfo, ", Replacement: %s", print_eui64_oui(new_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
+    zbee_append_info(tree, pinfo, ", Replacement: %s", get_eui64_name(new_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -429,7 +430,7 @@ dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pro
     }
     else if (tree) proto_item_append_text(ti, " (Reserved)");
 
-    zbee_append_info(tree, pinfo, ", Src: %s", print_eui64_oui(src64));
+    zbee_append_info(tree, pinfo, ", Src: %s", get_eui64_name(src64));
     zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
     zbee_append_info(tree, pinfo, ", Cluster: %d", cluster);
 
@@ -481,7 +482,7 @@ dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pr
     }
     else if (tree) proto_item_append_text(ti, " (Reserved)");
 
-    zbee_append_info(tree, pinfo, ", Src: %s", print_eui64_oui(src64));
+    zbee_append_info(tree, pinfo, ", Src: %s", get_eui64_name(src64));
     zbee_append_info(tree, pinfo, ", Src Endpoint: %d", src_ep);
     zbee_append_info(tree, pinfo, ", Cluster: %d", cluster);
 
index 576c570..5e366a8 100644 (file)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include <gmodule.h>
 #include <epan/packet.h>
+#include <epan/addr_resolv.h>
 
 #include "packet-zbee.h"
 #include "packet-zbee-zdp.h"
@@ -68,7 +69,7 @@ dissect_zbee_zdp_req_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
     req_type = zbee_parse_uint(tree, hf_zbee_zdp_req_type, tvb, &offset, sizeof(guint8), NULL);
     idx      = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -353,7 +354,7 @@ dissect_zbee_zdp_req_discovery_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr
     device   = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL);
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -385,7 +386,7 @@ dissect_zbee_zdp_device_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
     ext_addr    = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
     capability  = zdp_parse_cinfo(tree, ett_zbee_zdp_cinfo, tvb, &offset);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -505,7 +506,7 @@ dissect_zbee_zdp_req_store_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tr
         zbee_parse_uint(field_tree, hf_zbee_zdp_disc_simple_size, tvb, &offset, sizeof(guint8), NULL);
     }
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -536,7 +537,7 @@ dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
     zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, pinfo);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -567,7 +568,7 @@ dissect_zbee_zdp_req_store_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_t
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
     zdp_parse_power_desc(tree, ett_zbee_zdp_power, tvb, &offset);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -611,7 +612,7 @@ dissect_zbee_zdp_req_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tr
         (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL);
     }
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -644,7 +645,7 @@ dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_
     simple_len  = zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, sizeof(guint8), NULL);
     zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, pinfo);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -674,7 +675,7 @@ dissect_zbee_zdp_req_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_
     device   = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL);
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -704,7 +705,7 @@ dissect_zbee_zdp_req_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr
     device   = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL);
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -824,7 +825,7 @@ dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
 
     zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
     if (status == ZBEE_ZDP_STATUS_SUCCESS) {
-        zbee_append_info(tree, pinfo, ", Device: %s = 0x%04x", print_eui64_oui(ext_addr), device);
+        zbee_append_info(tree, pinfo, ", Device: %s = 0x%04x", get_eui64_name(ext_addr), device);
     }
 
     /* Dump any leftover bytes. */
@@ -879,7 +880,7 @@ dissect_zbee_zdp_rsp_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
 
     zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
     if (status == ZBEE_ZDP_STATUS_SUCCESS) {
-        zbee_append_info(tree, pinfo, ", Device: 0x%04x = %s", device, print_eui64_oui(ext_addr));
+        zbee_append_info(tree, pinfo, ", Device: 0x%04x = %s", device, get_eui64_name(ext_addr));
     }
 
     /* Dump any leftover bytes. */
index e6dde05..556cb91 100644 (file)
@@ -33,6 +33,7 @@
 #include <glib.h>
 #include <gmodule.h>
 #include <epan/packet.h>
+#include <epan/addr_resolv.h>
 
 #include "packet-zbee.h"
 #include "packet-zbee-zdp.h"
@@ -72,7 +73,7 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info *
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
         /* Extended PAN Identifiers are used in ZigBee 2006 & later. */
         ext_pan = tvb_get_letoh64(tvb, *offset + len);
-        if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: %s", print_eui64(ext_pan));
+        if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: %s", eui64_to_str(ext_pan));
         len += sizeof(guint64);
     }
     else {
@@ -142,7 +143,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
     if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) {
         /* ZigBee 2006 & later use an extended PAN Identifier. */
         ext_pan = tvb_get_letoh64(tvb, *offset + len);
-        if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", print_eui64(ext_pan));
+        if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", eui64_to_str(ext_pan));
         len += sizeof(guint64);
     }
     else {
@@ -153,7 +154,7 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p
     }
 
     ext_addr = tvb_get_letoh64(tvb, *offset + len);
-    if (tree) proto_item_append_text(ti, ", Extended Addr: %s", print_eui64_oui(ext_addr));
+    if (tree) proto_item_append_text(ti, ", Extended Addr: %s", get_eui64_name(ext_addr));
     len += sizeof(guint64);
 
     device = tvb_get_letohs(tvb, *offset + len);
@@ -444,7 +445,7 @@ dissect_zbee_zdp_req_mgmt_leave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
         offset += sizeof(guint8);
     }
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -474,7 +475,7 @@ dissect_zbee_zdp_req_mgmt_direct_join(tvbuff_t *tvb, packet_info *pinfo, proto_t
     ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL);
     cinfo    = zdp_parse_cinfo(tree, ett_zbee_zdp_cinfo, tvb, &offset);
 
-    zbee_append_info(tree, pinfo, ", Device: %s", print_eui64_oui(ext_addr));
+    zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr));
 
     /* Dump any leftover bytes. */
     zdp_dump_excess(tvb, offset, pinfo, tree);
@@ -888,7 +889,7 @@ dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
         guint16 addr16 = tvb_get_letohs(tvb, offset+sizeof(guint64));
 
         if (tree) {
-            proto_tree_add_text(tree, tvb, offset, sizeof(guint16)+sizeof(guint64), "{%s = 0x%04x}", print_eui64_oui(addr64), addr16);
+            proto_tree_add_text(tree, tvb, offset, sizeof(guint16)+sizeof(guint64), "{%s = 0x%04x}", get_eui64_name(addr64), addr16);
         }
         offset += sizeof(guint16)+sizeof(guint64);
     } /* for */
index dd3969d..18b64a9 100644 (file)
@@ -1406,7 +1406,7 @@ void proto_register_zbee_zdp(void)
             NULL, HFILL }},
 
         { &hf_zbee_zdp_ext_addr,
-        { "Extended Address",           "zbee.zdp.ext_addr", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Extended Address",           "zbee.zdp.ext_addr", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_zbee_zdp_device,
@@ -1650,7 +1650,7 @@ void proto_register_zbee_zdp(void)
             NULL, HFILL }},
 
         { &hf_zbee_zdp_target64,
-        { "Target",                     "zbee.zdp.target64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Target",                     "zbee.zdp.target64", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_zbee_zdp_target_ep,
@@ -1658,7 +1658,7 @@ void proto_register_zbee_zdp(void)
             NULL, HFILL }},
 
         { &hf_zbee_zdp_replacement,
-        { "Replacement",                "zbee.zdp.replacement", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Replacement",                "zbee.zdp.replacement", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_zbee_zdp_replacement_ep,
@@ -1670,7 +1670,7 @@ void proto_register_zbee_zdp(void)
             NULL, HFILL }},
 
         { &hf_zbee_zdp_bind_src64,
-        { "Source",                     "zbee.zdp.bind.src64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Source",                     "zbee.zdp.bind.src64", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_zbee_zdp_bind_src_ep,
@@ -1682,7 +1682,7 @@ void proto_register_zbee_zdp(void)
             NULL, HFILL }},
 
         { &hf_zbee_zdp_bind_dst64,
-        { "Destination",                "zbee.zdp.bind.dst64", FT_UINT64, BASE_HEX, NULL, 0x0,
+        { "Destination",                "zbee.zdp.bind.dst64", FT_EUI64, BASE_NONE, NULL, 0x0,
             NULL, HFILL }},
 
         { &hf_zbee_zdp_bind_dst_ep,
index e82b0cc..60a10e2 100644 (file)
@@ -498,7 +498,42 @@ bool_ne(fvalue_t *a, fvalue_t *b)
        return (!bool_eq(a,b));
 }
 
+/* EUI64-specific */
+static gboolean
+eui64_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFunc logfunc)
+{
+
+       /*
+        * Don't log a message if this fails; we'll try looking it
+        * up as an EUI64 Address if it does, and if that fails,
+        * we'll log a message.
+        */
+       if (val64_from_unparsed(fv, s, TRUE, NULL)) {
+               return TRUE;
+       }
+
+       logfunc("\"%s\" is not a valid EUI64 Address", s);
+       return FALSE;
+}
 
+static int
+eui64_repr_len(fvalue_t *fv _U_, ftrepr_t rtype _U_)
+{
+       return 8*3-1;   /* XX:XX:XX:XX:XX:XX:XX:XX */
+}
+
+static void
+eui64_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, char *buf)
+{
+       guint8 *p_eui64 = ep_alloc(8);
+
+       /* Copy and convert the address to network byte order. */
+       *(guint64 *)(p_eui64) = pntoh64(&(fv->value.integer64));
+
+       sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", 
+       p_eui64[0], p_eui64[1], p_eui64[2], p_eui64[3],
+       p_eui64[4], p_eui64[5], p_eui64[6], p_eui64[7] );
+}
 
 void
 ftype_register_integers(void)
@@ -988,6 +1023,44 @@ ftype_register_integers(void)
                NULL,                           /* slice */
        };
 
+       static ftype_t eui64_type = {
+               FT_EUI64,                       /* ftype */
+               "FT_EUI64",                     /* name */
+               "EUI64 address",                /* pretty_name */
+               FT_EUI64_LEN,                   /* wire_size */
+               int64_fvalue_new,               /* new_value */
+               NULL,                           /* free_value */
+               eui64_from_unparsed,            /* val_from_unparsed */
+               NULL,                           /* val_from_string */
+               eui64_to_repr,          /* val_to_string_repr */
+               eui64_repr_len,         /* len_string_repr */
+
+               NULL,                           /* set_value */
+               NULL,                           /* set_value_uinteger */
+               NULL,                           /* set_value_sinteger */
+               set_integer64,                  /* set_value_integer64 */
+               NULL,                           /* set_value_floating */
+
+               NULL,                           /* get_value */
+               NULL,                           /* get_value_uinteger */
+               NULL,                           /* get_value_sinteger */
+               get_integer64,                  /* get_value_integer64 */
+               NULL,                           /* get_value_floating */
+
+               cmp_eq64,
+               cmp_ne64,
+               u_cmp_gt64,
+               u_cmp_ge64,
+               u_cmp_lt64,
+               u_cmp_le64,
+               cmp_bitwise_and64,
+               NULL,                           /* cmp_contains */
+               NULL,                           /* cmp_matches */
+
+               NULL,
+               NULL,
+       };
+       
        ftype_register(FT_UINT8, &uint8_type);
        ftype_register(FT_UINT16, &uint16_type);
        ftype_register(FT_UINT24, &uint24_type);
@@ -1001,4 +1074,5 @@ ftype_register_integers(void)
        ftype_register(FT_BOOLEAN, &boolean_type);
        ftype_register(FT_IPXNET, &ipxnet_type);
        ftype_register(FT_FRAMENUM, &framenum_type);
+       ftype_register(FT_EUI64, &eui64_type);
 }
index ca3722f..994fe0f 100644 (file)
@@ -63,6 +63,7 @@ enum ftenum {
        FT_PCRE,        /* a compiled Perl-Compatible Regular Expression object */
        FT_GUID,        /* GUID, UUID */
        FT_OID,         /* OBJECT IDENTIFIER */
+       FT_EUI64,       
        FT_NUM_TYPES /* last item number plus one */
 };
 
@@ -77,6 +78,7 @@ enum ftenum {
 #define FT_IPv4_LEN         4
 #define FT_IPv6_LEN         16
 #define FT_IPXNET_LEN       4
+#define FT_EUI64_LEN        8
 
 typedef enum ftenum ftenum_t;
 typedef struct _ftype_t ftype_t;
index e7cb1dd..2ceb9a8 100644 (file)
@@ -403,6 +403,7 @@ epan_get_runtime_version_info
 epan_get_version
 epan_init
 epan_strcasestr
+eui64_to_str
 escape_string
 escape_string_len
 ethertype
@@ -800,6 +801,9 @@ proto_tree_add_debug_text
 proto_tree_add_double
 proto_tree_add_double_format
 proto_tree_add_double_format_value
+proto_tree_add_eui64
+proto_tree_add_eui64_format
+proto_tree_add_eui64_format_value
 proto_tree_add_ether_format
 proto_tree_add_ether
 proto_tree_add_ether_format_value
@@ -1050,6 +1054,7 @@ tvb_bytes_to_str
 tvb_bytes_to_str_punct
 tvb_ensure_bytes_exist
 tvb_ensure_length_remaining
+tvb_eui64_to_str
 tvb_ether_to_str
 tvb_fake_unicode
 tvb_fc_to_str
index 90bdebf..97aa9d3 100644 (file)
@@ -231,6 +231,10 @@ static void
 proto_tree_set_uint64(field_info *fi, guint64 value);
 static void
 proto_tree_set_uint64_tvb(field_info *fi, tvbuff_t *tvb, gint start, guint length, const guint encoding);
+static void
+proto_tree_set_eui64(field_info *fi, const guint64 value);
+static void
+proto_tree_set_eui64_tvb(field_info *fi, tvbuff_t *tvb, gint start, const guint encoding);
 static gboolean
 proto_item_add_bitmask_tree(proto_item *item, tvbuff_t *tvb, const int offset,
                            const int len, const gint ett, const gint **fields,
@@ -1362,6 +1366,16 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree,
                        proto_tree_set_ether_tvb(new_fi, tvb, start);
                        break;
 
+               case FT_EUI64:
+                       /*
+                        * Map all non-zero values to little-endian for
+                        * backwards compatibility.
+                        */
+                       if (encoding)
+                               encoding = ENC_LITTLE_ENDIAN;
+                       DISSECTOR_ASSERT(length == FT_EUI64_LEN);
+                       proto_tree_set_eui64_tvb(new_fi, tvb, start, encoding);
+                       break;
                case FT_GUID:
                        /*
                         * Map all non-zero values to little-endian for
@@ -3261,6 +3275,89 @@ proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
 
        return pi;
 }
+/* Add a FT_EUI64 to a proto_tree */
+proto_item *
+proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+                    gint length, const guint64 value)
+{
+       proto_item              *pi;
+       field_info              *new_fi;
+       header_field_info       *hfinfo;
+
+       TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo);
+
+       DISSECTOR_ASSERT(hfinfo->type == FT_EUI64);
+
+       pi = proto_tree_add_pi(tree, hfindex, tvb, start, &length, &new_fi);
+       proto_tree_set_eui64(new_fi, value);
+
+       return pi;
+}
+
+proto_item *
+proto_tree_add_eui64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+                                 gint start, gint length, const guint64 value,
+                                 const char *format, ...)
+{
+       proto_item              *pi;
+       va_list                 ap;
+       header_field_info       *hfinfo;
+
+       TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo);
+
+       pi = proto_tree_add_eui64(tree, hfindex, tvb, start, length, value);
+       if (pi == NULL)
+               return (NULL);
+
+       TRY_TO_FAKE_THIS_REPR(tree, pi);
+
+       va_start(ap, format);
+       proto_tree_set_representation_value(pi, format, ap);
+       va_end(ap);
+
+       return pi;
+}
+
+proto_item *
+proto_tree_add_eui64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+                           gint start, gint length, const guint64 value,
+                           const char *format, ...)
+{
+       proto_item              *pi;
+       va_list                 ap;
+       header_field_info       *hfinfo;
+
+       TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo);
+
+       pi = proto_tree_add_eui64(tree, hfindex, tvb, start, length, value);
+       if (pi == NULL)
+               return (NULL);
+
+       TRY_TO_FAKE_THIS_REPR(tree, pi);
+
+       va_start(ap, format);
+       proto_tree_set_representation(pi, format, ap);
+       va_end(ap);
+
+       return pi;
+}
+
+/* Set the FT_EUI64 value */
+static void
+proto_tree_set_eui64(field_info *fi, const guint64 value)
+{
+       fvalue_set_integer64(&fi->value, value);
+}
+static void
+proto_tree_set_eui64_tvb(field_info *fi, tvbuff_t *tvb, gint start, const guint encoding)
+{
+       if(encoding)
+       {
+               proto_tree_set_eui64(fi, tvb_get_letoh64(tvb, start));
+       }else {
+               proto_tree_set_eui64(fi, tvb_get_ntoh64(tvb, start));
+       }
+}
 
 /* Add a field_info struct to the proto_tree, encapsulating it in a proto_node */
 static proto_item *
@@ -3759,7 +3856,9 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
                                 g_snprintf(result+offset_r, size-offset_r, "%" G_GINT64_MODIFIER "u", fvalue_get_integer64(&finfo->value));
                                 offset_r = (int)strlen(result);
                                 break;
-
+                        case FT_EUI64:
+                               offset_r += (int)g_strlcpy(result+offset_r, eui64_to_str(fvalue_get_integer64(&finfo->value)), size-offset_r);
+                                break;
                         /* XXX - make these just FT_INT? */
                         case FT_INT8:
                         case FT_INT16:
@@ -3800,7 +3899,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence,
                                 break;
 
                         case FT_ETHER:
-                                offset_r += (int)g_strlcpy(result+offset_r, bytes_to_str_punct(fvalue_get(&finfo->value), 6, ':'), size-offset_r);
+                                offset_r += (int)g_strlcpy(result+offset_r, bytes_to_str_punct(fvalue_get(&finfo->value), FT_ETHER_LEN, ':'), size-offset_r);
                                 break;
 
                         case FT_GUID:
@@ -4639,6 +4738,7 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
            { FT_INT24,         "FT_INT24" },
            { FT_INT32,         "FT_INT32" },
            { FT_INT64,         "FT_INT64" },
+           { FT_EUI64,         "FT_EUI64" },
            { FT_FLOAT,         "FT_FLOAT" },
            { FT_DOUBLE,        "FT_DOUBLE" },
            { FT_ABSOLUTE_TIME, "FT_ABSOLUTE_TIME" },
@@ -4943,6 +5043,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
 
        guint8                          *bytes;
        guint32                         integer;
+       guint64                         integer64;
        ipv4_addr                       *ipv4;
        e_guid_t                        *guid;
        guint32                         n_addr; /* network-order IPv4 address */
@@ -5103,7 +5204,13 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
                                         oid_encoded2string(bytes, fvalue_length(&fi->value)));
                        }
                        break;
-
+               case FT_EUI64:
+                       integer64 = fvalue_get_integer64(&fi->value);
+                       g_snprintf(label_str, ITEM_LABEL_LENGTH,
+                                  "%s: %s (%s)", hfinfo->name, 
+                                  get_eui64_name(integer64), 
+                                  eui64_to_str(integer64)); 
+                       break;
                case FT_STRING:
                case FT_STRINGZ:
                case FT_EBCDIC:
index ce36314..006770b 100644 (file)
@@ -1423,6 +1423,51 @@ extern proto_item *
 proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
        gint length, gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
 
+/** Add a FT_EUI64 to a proto_tree.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+       gint length, const guint64 value);
+
+/** Add a formatted FT_EUI64 to a proto_tree, with the format generating
+    the string for the value and with the field name being included
+    automatically.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_eui64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
+       gint start, gint length, const guint64 value, const char *format, ...)
+       G_GNUC_PRINTF(7,8);
+
+/** Add a formatted FT_EUI64 to a proto_tree, with the format generating
+    the entire string for the entry, including any field name.
+ @param tree the tree to append this item to
+ @param hfindex field index
+ @param tvb the tv buffer of the current data
+ @param start start of data in tvb
+ @param length length of data in tvb
+ @param value data to display
+ @param format printf like format string
+ @param ... printf like parameters
+ @return the newly created item */
+extern proto_item *
+proto_tree_add_eui64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
+       gint length, const guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
+
+
 /** Useful for quick debugging. Also sends string to STDOUT, so don't
     leave call to this function in production code.
  @param tree the tree to append the text to
index 9467c4e..fb1cad9 100644 (file)
@@ -36,6 +36,7 @@
 #define MAX_IP6_STR_LEN 40
 #define MAX_ADDR_STR_LEN 256
 #define VINES_ADDR_LEN 6
+#define EUI64_STR_LEN 24
 
 /*
  * These are utility functions which convert various types to strings,
@@ -66,6 +67,8 @@ extern gchar* ipx_addr_to_str(const guint32, const guint8 *);
 extern gchar*  ipxnet_to_string(const guint8 *ad);
 extern gchar*  ipxnet_to_str_punct(const guint32 ad, const char punct);
 extern gchar*  tvb_vines_addr_to_str(tvbuff_t *tvb, const gint offset);
+extern gchar*  eui64_to_str(const guint64 ad);
+extern gchar*  tvb_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding);
 extern gchar*  time_secs_to_str(const gint32 time_val);
 extern gchar*  time_secs_to_str_unsigned(const guint32);
 extern gchar*  time_msecs_to_str(gint32 time_val);