aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-12 12:03:49 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-19 13:09:41 +0000
commit8d16ac46d50445f4e0ce567acb8e265db08a7576 (patch)
tree54d7b9813f8b83cca7d9592b2f5ae313f720a940 /epan/dissectors
parent7208355fb99f18b5b82d028f6af170f3dbafc8c9 (diff)
Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string. Convert AT_FCWWN to using proper name resolution format First use of address_with_resolution_to_str with field types in proto.c Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2 Reviewed-on: https://code.wireshark.org/review/7196 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-arcnet.c16
-rw-r--r--epan/dissectors/packet-atalk.c17
-rw-r--r--epan/dissectors/packet-devicenet.c7
-rw-r--r--epan/dissectors/packet-ieee80211.c6
-rw-r--r--epan/dissectors/packet-ieee802154.c8
-rw-r--r--epan/dissectors/packet-j1939.c7
-rw-r--r--epan/dissectors/packet-jxta.c6
-rw-r--r--epan/dissectors/packet-mp2t.c2
-rw-r--r--epan/dissectors/packet-mstp.c16
-rw-r--r--epan/dissectors/packet-sna.c8
-rw-r--r--epan/dissectors/packet-tipc.c6
11 files changed, 52 insertions, 47 deletions
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c
index a09cc59469..251a0d3e5c 100644
--- a/epan/dissectors/packet-arcnet.c
+++ b/epan/dissectors/packet-arcnet.c
@@ -53,19 +53,19 @@ static int arcnet_address_type = -1;
static dissector_table_t arcnet_dissector_table;
static dissector_handle_t data_handle;
-static gboolean arcnet_to_str(const address* addr, gchar *buf, int buf_len _U_)
+static int arcnet_str_len(const address* addr _U_)
+{
+ return 5;
+}
+
+static int arcnet_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
*buf++ = '0';
*buf++ = 'x';
buf = bytes_to_hexstr(buf, (const guint8 *)addr->data, 1);
*buf = '\0'; /* NULL terminate */
- return TRUE;
-}
-
-static int arcnet_str_len(const address* addr _U_)
-{
- return 5;
+ return arcnet_str_len(addr);
}
static const char* arcnet_col_filter_str(const address* addr _U_, gboolean is_src)
@@ -385,7 +385,7 @@ proto_register_arcnet (void)
proto_register_field_array (proto_arcnet, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
- arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str, arcnet_len);
+ arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str, arcnet_len, NULL, NULL);
}
diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c
index 0b97a667e6..972c54b09c 100644
--- a/epan/dissectors/packet-atalk.c
+++ b/epan/dissectors/packet-atalk.c
@@ -1177,7 +1177,13 @@ struct atalk_ddp_addr {
guint8 node;
};
-static gboolean atalk_to_str(const address* addr, gchar *buf, int buf_len _U_)
+
+static int atalk_str_len(const address* addr _U_)
+{
+ return 8;
+}
+
+static int atalk_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
struct atalk_ddp_addr atalk;
memcpy(&atalk, addr->data, sizeof atalk);
@@ -1187,12 +1193,7 @@ static gboolean atalk_to_str(const address* addr, gchar *buf, int buf_len _U_)
buf = bytes_to_hexstr(buf, &atalk.node, 1);
*buf++ = '\0'; /* NULL terminate */
- return TRUE;
-}
-
-static int atalk_str_len(const address* addr _U_)
-{
- return 14;
+ return atalk_str_len(addr);
}
static const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src)
@@ -2067,7 +2068,7 @@ proto_register_atalk(void)
ddp_dissector_table = register_dissector_table("ddp.type", "DDP packet type",
FT_UINT8, BASE_HEX);
- atalk_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, atalk_col_filter_str, atalk_len);
+ atalk_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, atalk_col_filter_str, atalk_len, NULL, NULL);
}
void
diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c
index 29a1e08b0b..2e283e0383 100644
--- a/epan/dissectors/packet-devicenet.c
+++ b/epan/dissectors/packet-devicenet.c
@@ -781,13 +781,14 @@ static int dissect_devicenet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
return tvb_captured_length(tvb);
}
-static gboolean devicenet_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
+static int devicenet_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
guint8 addrdata = *((guint8*)addr->data) & 0x3F;
+ gchar *start_buf = buf;
buf = uint_to_str_back(buf, addrdata);
*buf = '\0';
- return TRUE;
+ return buf-start_buf+1;
}
static int devicenet_addr_str_len(const address* addr _U_)
@@ -1030,7 +1031,7 @@ void proto_register_devicenet(void)
new_register_dissector("devicenet", dissect_devicenet, proto_devicenet);
- devicenet_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL, devicenet_addr_len);
+ devicenet_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL, devicenet_addr_len, NULL, NULL);
devicenet_module = prefs_register_protocol(proto_devicenet, NULL);
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index e1ad7dade4..46e46d01cd 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -26806,8 +26806,10 @@ proto_register_ieee80211 (void)
wlan_tap = register_tap("wlan");
register_conversation_table(proto_wlan, TRUE, wlan_conversation_packet, wlan_hostlist_packet);
- wlan_address_type = address_type_dissector_register("AT_ETHER_WLAN", "WLAN Address", ether_to_str, ether_str_len, wlan_col_filter_str, ether_len);
- wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, wlan_bssid_col_filter_str, ether_len);
+ wlan_address_type = address_type_dissector_register("AT_ETHER_WLAN", "WLAN Address", ether_to_str, ether_str_len, wlan_col_filter_str,
+ ether_len, ether_name_resolution_str, ether_name_resolution_len);
+ wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, wlan_bssid_col_filter_str,
+ ether_len, ether_name_resolution_str, ether_name_resolution_len);
/* Register configuration options */
wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c
index 2467bc1651..4488634945 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -392,14 +392,14 @@ static gboolean ieee802154_extend_auth = TRUE;
#define ieee802154_crc_tvb(tvb, offset) (crc16_ccitt_tvb_seed(tvb, offset, IEEE802154_CRC_SEED) ^ IEEE802154_CRC_XOROUT)
-static gboolean ieee802_15_4_short_address_to_str(const address* addr, gchar *buf, int buf_len)
+static int ieee802_15_4_short_address_to_str(const address* addr, gchar *buf, int buf_len)
{
guint16 ieee_802_15_4_short_addr = pletoh16(addr->data);
if (ieee_802_15_4_short_addr == 0xffff)
{
g_strlcpy(buf, "Broadcast", buf_len);
- return TRUE;
+ return 10;
}
*buf++ = '0';
@@ -407,7 +407,7 @@ static gboolean ieee802_15_4_short_address_to_str(const address* addr, gchar *bu
buf = word_to_hex(buf, ieee_802_15_4_short_addr);
*buf = '\0'; /* NULL terminate */
- return TRUE;
+ return 7;
}
static int ieee802_15_4_short_address_str_len(const address* addr _U_)
@@ -2790,7 +2790,7 @@ void proto_register_ieee802154(void)
expert_register_field_array(expert_ieee802154, ei, array_length(ei));
ieee802_15_4_short_address_type = address_type_dissector_register("AT_IEEE_802_15_4_SHORT", "IEEE 802.15.4 16-bit short address",
- ieee802_15_4_short_address_to_str, ieee802_15_4_short_address_str_len, NULL, ieee802_15_4_short_address_len);
+ ieee802_15_4_short_address_to_str, ieee802_15_4_short_address_str_len, NULL, ieee802_15_4_short_address_len, NULL, NULL);
/* add a user preference to set the 802.15.4 ethertype */
ieee802154_module = prefs_register_protocol(proto_ieee802154,
diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c
index 10c8a7860c..66d4493c20 100644
--- a/epan/dissectors/packet-j1939.c
+++ b/epan/dissectors/packet-j1939.c
@@ -259,13 +259,14 @@ static int dissect_j1939(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
return tvb_captured_length(tvb);
}
-static gboolean J1939_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
+static int J1939_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
const guint8 *addrdata = (const guint8 *)addr->data;
+ gchar *start_buf = buf;
buf = uint_to_str_back(buf, *addrdata);
*buf = '\0';
- return TRUE;
+ return buf-start_buf+1;
}
static int J1939_addr_str_len(const address* addr _U_)
@@ -350,7 +351,7 @@ void proto_register_j1939(void)
subdissector_pgn_table = register_dissector_table("j1939.pgn", "PGN Handle", FT_UINT32, BASE_DEC);
- j1939_address_type = address_type_dissector_register("AT_J1939", "J1939 Address", J1939_addr_to_str, J1939_addr_str_len, J1939_col_filter_str, J1939_addr_len);
+ j1939_address_type = address_type_dissector_register("AT_J1939", "J1939 Address", J1939_addr_to_str, J1939_addr_str_len, J1939_col_filter_str, J1939_addr_len, NULL, NULL);
}
/*
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 6a8d8ab59f..af0b9c1831 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -244,12 +244,12 @@ jxta_hostlist_packet(void *pit, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
return 1;
}
-static gboolean uri_to_str(const address* addr, gchar *buf, int buf_len)
+static int uri_to_str(const address* addr, gchar *buf, int buf_len)
{
int copy_len = addr->len < (buf_len - 1) ? addr->len : (buf_len - 1);
memcpy(buf, addr->data, copy_len );
buf[copy_len] = '\0';
- return TRUE;
+ return copy_len+1;
}
static int uri_str_len(const address* addr)
@@ -2368,7 +2368,7 @@ void proto_register_jxta(void)
/* Register JXTA Sub-tree */
proto_register_subtree_array(ett, array_length(ett));
- uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, uri_col_filter_str, NULL);
+ uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, uri_col_filter_str, NULL, NULL, NULL);
/* Register preferences */
/* register re-init routine */
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index 6d3426b112..82e65cbe66 100644
--- a/epan/dissectors/packet-mp2t.c
+++ b/epan/dissectors/packet-mp2t.c
@@ -1513,7 +1513,7 @@ proto_register_mp2t(void)
expert_mp2t = expert_register_protocol(proto_mp2t);
expert_register_field_array(expert_mp2t, ei, array_length(ei));
- mp2t_no_address_type = address_type_dissector_register("AT_MP2T_NONE", "No MP2T Address", none_addr_to_str, none_addr_str_len, NULL, none_addr_len);
+ mp2t_no_address_type = address_type_dissector_register("AT_MP2T_NONE", "No MP2T Address", none_addr_to_str, none_addr_str_len, NULL, none_addr_len, NULL, NULL);
heur_subdissector_list = register_heur_dissector_list("mp2t.pid");
/* Register init of processing of fragmented DEPI packets */
diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c
index c8159c99aa..f0c2b9f4dd 100644
--- a/epan/dissectors/packet-mstp.c
+++ b/epan/dissectors/packet-mstp.c
@@ -149,19 +149,19 @@ mstp_frame_type_text(guint32 val)
"Unknown Frame Type (%u)");
}
-static gboolean mstp_to_str(const address* addr, gchar *buf, int buf_len _U_)
+static int mstp_str_len(const address* addr _U_)
+{
+ return 5;
+}
+
+static int mstp_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
*buf++ = '0';
*buf++ = 'x';
buf = bytes_to_hexstr(buf, (const guint8 *)addr->data, 1);
*buf = '\0'; /* NULL terminate */
- return TRUE;
-}
-
-static int mstp_str_len(const address* addr _U_)
-{
- return 5;
+ return mstp_str_len(addr);
}
static const char* mstp_col_filter_str(const address* addr _U_, gboolean is_src)
@@ -465,7 +465,7 @@ proto_register_mstp(void)
"MSTP Vendor specific Frametypes", FT_UINT24, BASE_DEC);
/* Table_type: (Vendor ID << 16) + Frametype */
- mstp_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, mstp_col_filter_str, mstp_len);
+ mstp_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, mstp_col_filter_str, mstp_len, NULL, NULL);
}
void
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index 1f50007ac9..cfa5bd2e09 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -829,7 +829,7 @@ static void dissect_gds (tvbuff_t*, packet_info*, proto_tree*, proto_tree*);
static void dissect_rh (tvbuff_t*, int, proto_tree*);
static void dissect_control(tvbuff_t*, int, int, proto_tree*, int, enum parse);
-static gboolean sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len _U_)
+static int sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len _U_)
{
const guint8 *addrdata;
struct sna_fid_type_4_addr sna_fid_type_4_addr;
@@ -859,10 +859,10 @@ static gboolean sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len
break;
default:
buf[0] = '\0';
- return FALSE;
+ return 1;
}
- return TRUE;
+ return strlen(buf)+1;
}
@@ -3481,7 +3481,7 @@ proto_register_sna(void)
"Systems Network Architecture XID", "SNA XID", "sna_xid");
register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid);
- sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL);
+ sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL, NULL, NULL);
/* Register configuration options */
sna_module = prefs_register_protocol(proto_sna, NULL);
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index a9dc4cb05c..68baf63281 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -605,7 +605,7 @@ tipc_addr_to_str(guint tipc_address)
return tipc_addr_value_to_buf(tipc_address, buf, MAX_TIPC_ADDRESS_STR_LEN);
}
-static gboolean
+static int
tipc_addr_to_str_buf(const address* addr, gchar *buf, int buf_len)
{
const guint8 *data = (const guint8 *)addr->data;
@@ -617,7 +617,7 @@ tipc_addr_to_str_buf(const address* addr, gchar *buf, int buf_len)
tipc_address = (tipc_address << 8) ^ data[3];
tipc_addr_value_to_buf(tipc_address, buf, buf_len);
- return TRUE;
+ return strlen(buf)+1;
}
static int tipc_addr_str_len(const address* addr _U_)
@@ -2962,7 +2962,7 @@ proto_register_tipc(void)
tipc_module = prefs_register_protocol(proto_tipc, proto_reg_handoff_tipc);
tipc_address_type = address_type_dissector_register("tipc_address_type", "TIPC Address Zone,Subnetwork,Processor",
- tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL);
+ tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL, NULL, NULL);
/* Set default ports */
range_convert_str(&global_tipc_udp_port_range, DEFAULT_TIPC_PORT_RANGE, MAX_TCP_PORT);