aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-08 20:36:03 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-09 03:49:13 +0000
commit8ff944d4ab892521c6a32fe40f6a410640a34d34 (patch)
treecb9bb5956a1073babc778b2f75fd2d83a52608e3 /epan/dissectors
parent2875cd382fdc0efd5d949f674a0328ecf918b7e9 (diff)
Add fixed length function for address types.
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c. Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file. Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4 Reviewed-on: https://code.wireshark.org/review/7038 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.c7
-rw-r--r--epan/dissectors/packet-atalk.c8
-rw-r--r--epan/dissectors/packet-devicenet.c7
-rw-r--r--epan/dissectors/packet-ieee80211.c4
-rw-r--r--epan/dissectors/packet-ieee802154.c7
-rw-r--r--epan/dissectors/packet-ismp.c19
-rw-r--r--epan/dissectors/packet-j1939.c15
-rw-r--r--epan/dissectors/packet-jxta.c2
-rw-r--r--epan/dissectors/packet-mp2t.c2
-rw-r--r--epan/dissectors/packet-mstp.c7
-rw-r--r--epan/dissectors/packet-sna.c2
-rw-r--r--epan/dissectors/packet-tipc.c2
12 files changed, 69 insertions, 13 deletions
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c
index a7a1b4e457..a09cc59469 100644
--- a/epan/dissectors/packet-arcnet.c
+++ b/epan/dissectors/packet-arcnet.c
@@ -76,6 +76,11 @@ static const char* arcnet_col_filter_str(const address* addr _U_, gboolean is_sr
return "arcnet.dst";
}
+static int arcnet_len(void)
+{
+ return 1;
+}
+
void
capture_arcnet (const guchar *pd, int len, packet_counts *ld,
gboolean has_offset, gboolean has_exception)
@@ -380,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_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str, arcnet_len);
}
diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c
index 9e1ca4cf70..0b97a667e6 100644
--- a/epan/dissectors/packet-atalk.c
+++ b/epan/dissectors/packet-atalk.c
@@ -1195,7 +1195,7 @@ static int atalk_str_len(const address* addr _U_)
return 14;
}
-const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src)
+static const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src)
{
if (is_src)
return "ddp.src";
@@ -1203,6 +1203,10 @@ const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src)
return "ddp.dst";
}
+static int atalk_len(void)
+{
+ return 3;
+}
static int
dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
@@ -2063,7 +2067,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_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, atalk_col_filter_str, atalk_len);
}
void
diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c
index 58e7229565..5e7974c0d7 100644
--- a/epan/dissectors/packet-devicenet.c
+++ b/epan/dissectors/packet-devicenet.c
@@ -792,6 +792,11 @@ static int devicenet_addr_str_len(const address* addr _U_)
return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */
}
+static int devicenet_addr_len(void)
+{
+ return 1;
+}
+
void proto_register_devicenet(void)
{
module_t *devicenet_module;
@@ -1022,7 +1027,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_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL, devicenet_addr_len);
devicenet_module = prefs_register_protocol(proto_devicenet, NULL);
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index a66e03ec5c..c90856c5a0 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -26553,8 +26553,8 @@ 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);
- 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);
+ 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);
/* 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 ff37f1aa36..58a458fb57 100644
--- a/epan/dissectors/packet-ieee802154.c
+++ b/epan/dissectors/packet-ieee802154.c
@@ -414,6 +414,11 @@ static int ieee802_15_4_short_address_str_len(const address* addr _U_)
return 11;
}
+static int ieee802_15_4_short_address_len(void)
+{
+ return 2;
+}
+
/*FUNCTION:------------------------------------------------------
* NAME
@@ -2784,7 +2789,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_to_str, ieee802_15_4_short_address_str_len, NULL, ieee802_15_4_short_address_len);
/* add a user preference to set the 802.15.4 ethertype */
ieee802154_module = prefs_register_protocol(proto_ieee802154,
diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c
index debb8d869f..69b5f66caf 100644
--- a/epan/dissectors/packet-ismp.c
+++ b/epan/dissectors/packet-ismp.c
@@ -28,6 +28,7 @@
#include <epan/expert.h>
#include <epan/to_str.h>
#include <epan/etypes.h>
+#include <epan/addr_resolv.h>
void proto_register_ismp(void);
void proto_reg_handoff_ismp(void);
@@ -215,6 +216,24 @@ static const value_string edp_tuple_types[] =
{ 0,NULL }
};
+static gchar*
+ipx_addr_to_str(const guint32 net, const guint8 *ad)
+{
+ gchar *buf;
+ char *name;
+
+ name = get_ether_name_if_known(ad);
+
+ if (name) {
+ buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net), name);
+ }
+ else {
+ buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net),
+ bytestring_to_str(wmem_packet_scope(), ad, 6, '\0'));
+ }
+ return buf;
+}
+
/* Function to dissect EDP portion of ISMP message */
static void
dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp_tree)
diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c
index 94f9b3d981..4fbe1017ae 100644
--- a/epan/dissectors/packet-j1939.c
+++ b/epan/dissectors/packet-j1939.c
@@ -273,6 +273,19 @@ static int J1939_addr_str_len(const address* addr _U_)
return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */
}
+static const char* J1939_col_filter_str(const address* addr _U_, gboolean is_src)
+{
+ if (is_src)
+ return "j1939.src_addr";
+
+ return "j1939.dst_addr";
+}
+
+static int J1939_addr_len(void)
+{
+ return 1;
+}
+
void proto_register_j1939(void)
{
static hf_register_info hf[] = {
@@ -337,7 +350,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, NULL);
+ 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);
}
/*
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 13c4cc442d..6a8d8ab59f 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -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);
+ uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, uri_col_filter_str, NULL);
/* Register preferences */
/* register re-init routine */
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c
index 677a839bc1..6d3426b112 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);
+ 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);
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 a4d6d43b7a..c8159c99aa 100644
--- a/epan/dissectors/packet-mstp.c
+++ b/epan/dissectors/packet-mstp.c
@@ -172,6 +172,11 @@ static const char* mstp_col_filter_str(const address* addr _U_, gboolean is_src)
return "mstp.dst";
}
+static int mstp_len(void)
+{
+ return 1;
+}
+
/* dissects a BACnet MS/TP frame */
/* preamble 0x55 0xFF is not included in Cimetrics U+4 output */
void
@@ -460,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_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, mstp_col_filter_str, mstp_len);
}
void
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index be78e0e404..1f50007ac9 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -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);
+ sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, 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 5086e82c48..a9dc4cb05c 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -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);
+ tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL);
/* Set default ports */
range_convert_str(&global_tipc_udp_port_range, DEFAULT_TIPC_PORT_RANGE, MAX_TCP_PORT);