Add an AT_ value for 802.15.4 short addresses.

Note that, if you want EUI-64's to resolve the OUI in the display,
hacking individual dissectors to do it themselves and use AT_STRINGZ is
*not* the right way to do it.

svn path=/trunk/; revision=45743
This commit is contained in:
Guy Harris 2012-10-23 21:19:02 +00:00
parent 31f7fee054
commit 7c76ad78d3
3 changed files with 41 additions and 32 deletions

View File

@ -38,26 +38,27 @@ extern "C" {
/* also be included in address_to_str_buf defined in to_str.c, for presentation purposes */
typedef enum {
AT_NONE, /* no link-layer address */
AT_ETHER, /* MAC (Ethernet, 802.x, FDDI) address */
AT_IPv4, /* IPv4 */
AT_IPv6, /* IPv6 */
AT_IPX, /* IPX */
AT_SNA, /* SNA */
AT_ATALK, /* Appletalk DDP */
AT_VINES, /* Banyan Vines */
AT_OSI, /* OSI NSAP */
AT_ARCNET, /* ARCNET */
AT_FC, /* Fibre Channel */
AT_SS7PC, /* SS7 Point Code */
AT_STRINGZ, /* null-terminated string */
AT_EUI64, /* IEEE EUI-64 */
AT_URI, /* URI/URL/URN */
AT_TIPC, /* TIPC Address Zone,Subnetwork,Processor */
AT_IB, /* Infiniband GID/LID */
AT_USB, /* USB Device address
* (0xffffffff represents the host) */
AT_AX25 /* AX.25 */
AT_NONE, /* no link-layer address */
AT_ETHER, /* MAC (Ethernet, 802.x, FDDI) address */
AT_IPv4, /* IPv4 */
AT_IPv6, /* IPv6 */
AT_IPX, /* IPX */
AT_SNA, /* SNA */
AT_ATALK, /* Appletalk DDP */
AT_VINES, /* Banyan Vines */
AT_OSI, /* OSI NSAP */
AT_ARCNET, /* ARCNET */
AT_FC, /* Fibre Channel */
AT_SS7PC, /* SS7 Point Code */
AT_STRINGZ, /* null-terminated string */
AT_EUI64, /* IEEE EUI-64 */
AT_URI, /* URI/URL/URN */
AT_TIPC, /* TIPC Address Zone,Subnetwork,Processor */
AT_IB, /* Infiniband GID/LID */
AT_USB, /* USB Device address
* (0xffffffff represents the host) */
AT_AX25, /* AX.25 */
AT_IEEE_802_15_4_SHORT /* IEEE 802.15.4 16-bit short address */
} address_type;
typedef enum {

View File

@ -538,6 +538,7 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
{
const guint8 *addrdata;
struct atalk_ddp_addr ddp_addr;
guint16 ieee_802_15_4_short_addr;
char temp[32];
char *tempptr = temp;
@ -615,6 +616,13 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
(addrdata[3] >> 1) & 0x7f, (addrdata[4] >> 1) & 0x7f, (addrdata[5] >> 1) & 0x7f,
(addrdata[6] >> 1) & 0x0f );
break;
case AT_IEEE_802_15_4_SHORT:
ieee_802_15_4_short_addr = pletohs(addr->data);
if (ieee_802_15_4_short_addr == 0xffff)
g_snprintf(buf, buf_len, "Broadcast");
else
g_snprintf(buf, buf_len, "0x%04x", ieee_802_15_4_short_addr);
break;
default:
g_assert_not_reached();
}

View File

@ -697,7 +697,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
/* Get destination address. */
if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_SHORT) {
static char dst_addr[32]; /* has to be static due to SET_ADDRESS */
char dst_addr[32];
/* Get the address. */
packet->dst16 = tvb_get_letohs(tvb, offset);
@ -714,8 +714,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
ieee_hints->dst16 = packet->dst16;
}
SET_ADDRESS(&pinfo->dl_dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr);
SET_ADDRESS(&pinfo->dl_dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
SET_ADDRESS(&pinfo->dst, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
if (tree) {
proto_tree_add_uint(ieee802154_tree, hf_ieee802154_dst16, tvb, offset, 2, packet->dst16);
@ -737,9 +737,9 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
addr = pntoh64(&(packet->dst64));
/* Display the destination address. */
/* NOTE: OUI resolution doesn't happen when displaying EUI64 addresses
* might want to switch to AT_STRINZ type to display the OUI in
* the address columns.
/* XXX - OUI resolution doesn't happen when displaying resolved
* EUI64 addresses; that should probably be fixed in
* epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, &addr);
@ -783,7 +783,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
/* Get short source address if present. */
if (packet->src_addr_mode == IEEE802154_FCF_ADDR_SHORT) {
static char src_addr[32]; /* has to be static due to SET_ADDRESS */
char src_addr[32];
/* Get the address. */
packet->src16 = tvb_get_letohs(tvb, offset);
@ -809,8 +809,8 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
}
}
SET_ADDRESS(&pinfo->dl_src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(src_addr)+1, src_addr);
SET_ADDRESS(&pinfo->dl_src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
SET_ADDRESS(&pinfo->src, AT_IEEE_802_15_4_SHORT, 2, tvb_get_ptr(tvb, offset, 2));
/* Add the addressing info to the tree. */
if (tree) {
@ -849,9 +849,9 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
addr = pntoh64(&(packet->src64));
/* Display the source address. */
/* NOTE: OUI resolution doesn't happen when displaying EUI64 addresses
* might want to switch to AT_STRINZ type to display the OUI in
* the address columns.
/* XXX - OUI resolution doesn't happen when displaying resolved
* EUI64 addresses; that should probably be fixed in
* epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->src, AT_EUI64, 8, &addr);