add_itu_tcap_subdissector@Base 1.9.1
add_new_data_source@Base 1.9.1
add_srt_table_data@Base 1.99.8
+ address_to_bytes@Base 2.1.1
address_to_display@Base 1.99.2
address_to_name@Base 2.1.0
address_to_str@Base 1.12.0~rc1
return hash_val;
}
+WS_DLL_PUBLIC guint address_to_bytes(const address *addr, guint8 *buf, guint buf_len);
+
/* Types of port numbers Wireshark knows about. */
typedef enum {
PT_NONE, /* no port number */
const char *pretty_name;
AddrValueToString addr_to_str;
AddrValueToStringLen addr_str_len;
+ AddrValueToByte addr_to_byte;
AddrColFilterString addr_col_filter;
AddrFixedLen addr_fixed_len;
AddrNameResolutionToString addr_name_res_str;
int address_type_dissector_register(const char* name, const char* pretty_name,
AddrValueToString to_str_func, AddrValueToStringLen str_len_func,
- AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func,
+ AddrValueToByte to_bytes_func, AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func,
AddrNameResolutionToString name_res_str_func, AddrNameResolutionLen name_res_len_func)
{
int addr_type;
dissector_type_addresses[num_dissector_addr_type].pretty_name = pretty_name;
dissector_type_addresses[num_dissector_addr_type].addr_to_str = to_str_func;
dissector_type_addresses[num_dissector_addr_type].addr_str_len = str_len_func;
+ dissector_type_addresses[num_dissector_addr_type].addr_to_byte = to_bytes_func;
dissector_type_addresses[num_dissector_addr_type].addr_col_filter = col_filter_str_func;
dissector_type_addresses[num_dissector_addr_type].addr_fixed_len = fixed_len_func;
dissector_type_addresses[num_dissector_addr_type].addr_name_res_str = name_res_str_func;
return -1;
}
-
/******************************************************************************
* AT_NONE
******************************************************************************/
"No address", /* pretty_name */
none_addr_to_str, /* addr_to_str */
none_addr_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
none_addr_len, /* addr_fixed_len */
none_name_res_str, /* addr_name_res_str */
"Ethernet address", /* pretty_name */
ether_to_str, /* addr_to_str */
ether_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
ether_col_filter_str, /* addr_col_filter */
ether_len, /* addr_fixed_len */
ether_name_resolution_str, /* addr_name_res_str */
"IPv4 address", /* pretty_name */
ipv4_to_str, /* addr_to_str */
ipv4_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
ipv4_col_filter_str, /* addr_col_filter */
ipv4_len, /* addr_fixed_len */
ipv4_name_res_str, /* addr_name_res_str */
"IPv6 address", /* pretty_name */
ipv6_to_str, /* addr_to_str */
ipv6_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
ipv6_col_filter_str, /* addr_col_filter */
ipv6_len, /* addr_fixed_len */
ipv6_name_res_str, /* addr_name_res_str */
"IPX address", /* pretty_name */
ipx_to_str, /* addr_to_str */
ipx_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
ipx_len, /* addr_fixed_len */
NULL, /* addr_name_res_str */
"FC address", /* pretty_name */
fc_to_str, /* addr_to_str */
fc_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
fc_len, /* addr_fixed_len */
NULL, /* addr_name_res_str */
"Fibre Channel WWN", /* pretty_name */
fcwwn_to_str, /* addr_to_str */
fcwwn_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
fcwwn_len, /* addr_fixed_len */
fcwwn_name_res_str, /* addr_name_res_str */
"String address", /* pretty_name */
stringz_addr_to_str, /* addr_to_str */
stringz_addr_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
NULL, /* addr_fixed_len */
NULL, /* addr_name_res_str */
"IEEE EUI-64", /* pretty_name */
eui64_addr_to_str, /* addr_to_str */
eui64_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
eui64_len, /* addr_fixed_len */
NULL, /* addr_name_res_str */
"Infiniband GID/LID", /* pretty_name */
ib_addr_to_str, /* addr_to_str */
ib_str_len, /* addr_str_len */
+ NULL, /* addr_to_byte */
NULL, /* addr_col_filter */
NULL, /* addr_fixed_len */
NULL, /* addr_name_res_str */
"AX.25 Address", /* pretty_name */
ax25_addr_to_str, /* addr_to_str */
ax25_addr_str_len,/* addr_str_len */
+ NULL, /* addr_to_byte */
ax25_col_filter_str, /* addr_col_filter */
ax25_len, /* addr_fixed_len */
NULL, /* addr_name_res_str */
at->addr_to_str(addr, buf, buf_len);
}
+
+guint address_to_bytes(const address *addr, guint8 *buf, guint buf_len)
+{
+ address_type_t *at;
+ guint copy_len = 0;
+
+ if (!buf || !buf_len)
+ return 0;
+
+ ADDR_TYPE_LOOKUP(addr->type, at);
+
+ if (at == NULL)
+ return 0;
+
+ if (at->addr_to_byte == NULL)
+ {
+ /* If a specific function isn't provided, just do a memcpy */
+ copy_len = MIN(((guint)addr->len), buf_len);
+ memcpy(buf, addr->data, copy_len);
+ }
+ else
+ {
+ copy_len = at->addr_to_byte(addr, buf, buf_len);
+ }
+
+ return copy_len;
+}
+
const gchar *
address_to_name(const address *addr)
{
typedef int (*AddrValueToString)(const address* addr, gchar *buf, int buf_len);
typedef int (*AddrValueToStringLen)(const address* addr);
+typedef guint (*AddrValueToByte)(const address* addr, guint8 *buf, guint buf_len);
typedef int (*AddrFixedLen)(void);
typedef const char* (*AddrColFilterString)(const address* addr, gboolean src);
typedef int (*AddrNameResolutionLen)(void);
WS_DLL_PUBLIC int address_type_dissector_register(const char* name, const char* pretty_name,
AddrValueToString to_str_func, AddrValueToStringLen str_len_func,
- AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func,
+ AddrValueToByte to_bytes_func, AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func,
AddrNameResolutionToString name_res_str_func, AddrNameResolutionLen name_res_len_func);
WS_DLL_PUBLIC int address_type_get_by_name(const char* name);
arcnet_dissector_table = register_dissector_table ("arcnet.protocol_id", "ARCNET Protocol ID",
proto_arcnet, FT_UINT8, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
- 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);
+ arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, NULL, arcnet_col_filter_str, arcnet_len, NULL, NULL);
}
ddp_dissector_table = register_dissector_table("ddp.type", "DDP packet type", proto_ddp,
FT_UINT8, BASE_HEX, DISSECTOR_TABLE_ALLOW_DUPLICATE);
- 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);
+ atalk_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, NULL, atalk_col_filter_str, atalk_len, NULL, NULL);
}
void
expert_devicenet = expert_register_protocol(proto_devicenet);
expert_register_field_array(expert_devicenet, ei, array_length(ei));
- 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_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL, NULL, devicenet_addr_len, NULL, NULL);
devicenet_module = prefs_register_protocol(proto_devicenet, NULL);
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_address_type = address_type_dissector_register("AT_ETHER_WLAN", "WLAN Address", ether_to_str, ether_str_len, NULL, 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,
+ wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, NULL, wlan_bssid_col_filter_str,
ether_len, ether_name_resolution_str, ether_name_resolution_len);
set_address(&bssid_broadcast, wlan_bssid_address_type, 6, bssid_broadcast_data);
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, NULL, NULL);
+ ieee802_15_4_short_address_to_str, ieee802_15_4_short_address_str_len, NULL, 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,
subdissector_pgn_table = register_dissector_table("j1939.pgn", "PGN Handle", proto_j1939, FT_UINT32, BASE_DEC, DISSECTOR_TABLE_ALLOW_DUPLICATE);
- 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);
+ j1939_address_type = address_type_dissector_register("AT_J1939", "J1939 Address", J1939_addr_to_str, J1939_addr_str_len, NULL, J1939_col_filter_str, J1939_addr_len, NULL, NULL);
}
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, NULL, NULL);
+ uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, NULL, uri_col_filter_str, NULL, NULL, NULL);
/* Register preferences */
/* register re-init routine */
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, NULL, NULL);
+ mp2t_no_address_type = address_type_dissector_register("AT_MP2T_NONE", "No MP2T Address", none_addr_to_str, none_addr_str_len, NULL, NULL, none_addr_len, NULL, NULL);
heur_subdissector_list = register_heur_dissector_list("mp2t.pid", proto_mp2t);
/* Register init of processing of fragmented DEPI packets */
"MSTP Vendor specific Frametypes", proto_mstp, FT_UINT24, BASE_DEC, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
/* 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, NULL, NULL);
+ mstp_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, NULL, mstp_col_filter_str, mstp_len, NULL, NULL);
}
void
"MTP3 Service indicator",
proto_mtp3, FT_UINT8, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE);
- mtp3_address_type = address_type_dissector_register("AT_SS7PC", "SS7 Point Code", mtp3_addr_to_str, mtp3_str_addr_len, NULL,
+ mtp3_address_type = address_type_dissector_register("AT_SS7PC", "SS7 Point Code", mtp3_addr_to_str, mtp3_str_addr_len, NULL, NULL,
mtp3_addr_len, NULL, NULL);
"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, 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, NULL);
/* Register configuration options */
sna_module = prefs_register_protocol(proto_sna, NULL);
tipc_module = prefs_register_protocol(proto_tipc, proto_reg_handoff_tipc);
tipc_address_type = address_type_dissector_register("AT_TIPC", "TIPC Address Zone,Subnetwork,Processor",
- tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL, NULL, NULL);
+ tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL, NULL, NULL, NULL);
/* Set default ports */
range_convert_str(&global_tipc_udp_port_range, DEFAULT_TIPC_PORT_RANGE, MAX_TCP_PORT);
register_decode_as(&usb_product_da);
register_decode_as(&usb_device_da);
- usb_address_type = address_type_dissector_register("AT_USB", "USB Address", usb_addr_to_str, usb_addr_str_len, NULL, NULL, NULL, NULL);
+ usb_address_type = address_type_dissector_register("AT_USB", "USB Address", usb_addr_to_str, usb_addr_str_len, NULL, NULL, NULL, NULL, NULL);
register_conversation_table(proto_usb, TRUE, usb_conversation_packet, usb_hostlist_packet);
}
vines_ip_handle = create_dissector_handle(dissect_vines_ip,
proto_vines_ip);
- vines_address_type = address_type_dissector_register("AT_VINES", "Banyan Vines address", vines_to_str, vines_str_len, NULL, vines_len, NULL, NULL);
+ vines_address_type = address_type_dissector_register("AT_VINES", "Banyan Vines address", vines_to_str, vines_str_len, NULL, NULL, vines_len, NULL, NULL);
}
void
if (osi_address_type != -1)
return;
- osi_address_type = address_type_dissector_register("AT_OSI", "OSI Address", osi_address_to_str, osi_address_str_len, NULL, NULL, NULL, NULL);
+ osi_address_type = address_type_dissector_register("AT_OSI", "OSI Address", osi_address_to_str, osi_address_str_len, NULL, NULL, NULL, NULL, NULL);
}
}
proto_register_subtree_array(ett_iap_e, MAX_IAP_ENTRIES);
- irda_address_type = address_type_dissector_register("AT_IRDA", "IRDA Address", irda_addr_to_str, irda_addr_str_len, irda_col_filter_str, irda_addr_len, NULL, NULL);
+ irda_address_type = address_type_dissector_register("AT_IRDA", "IRDA Address", irda_addr_to_str, irda_addr_str_len, NULL, irda_col_filter_str, irda_addr_len, NULL, NULL);
}