aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-06-12 11:12:15 -0400
committerMichael Mann <mmann78@netscape.net>2016-06-13 05:16:51 +0000
commit87b5597ee0170d4fcf05f7eae364fb79e70f8ca3 (patch)
treeb4e9550da9af89ca015fe73ec7fd55247f8158d0 /epan
parent0baf13f8e979b8755a7fa314c3fa65e5bf37d21a (diff)
Add address_type_get_by_name
This allows the decoupling of a dissector registering an address type so it doesn't need to export the returned registered type. Change-Id: I49c913d042e70bd4b7ea1e964ba9511bb27304f5 Reviewed-on: https://code.wireshark.org/review/15855 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')
-rw-r--r--epan/address_types.c16
-rw-r--r--epan/address_types.h2
-rw-r--r--epan/dissectors/packet-tipc.c2
3 files changed, 19 insertions, 1 deletions
diff --git a/epan/address_types.c b/epan/address_types.c
index 52d2639430..445083ec47 100644
--- a/epan/address_types.c
+++ b/epan/address_types.c
@@ -121,6 +121,22 @@ int address_type_dissector_register(const char* name, const char* pretty_name,
return addr_type;
}
+int address_type_get_by_name(const char* name)
+{
+ address_type_t** addr;
+
+ for (addr = type_list; addr != NULL; addr++)
+ {
+ if (!strcmp((*addr)->name, name))
+ {
+ return (*addr)->addr_type;
+ }
+ }
+
+ return -1;
+}
+
+
/******************************************************************************
* AT_NONE
******************************************************************************/
diff --git a/epan/address_types.h b/epan/address_types.h
index 79265e6167..2fdb7f8f53 100644
--- a/epan/address_types.h
+++ b/epan/address_types.h
@@ -44,6 +44,8 @@ WS_DLL_PUBLIC int address_type_dissector_register(const char* name, const char*
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);
+
void address_types_initialize(void);
/* Address type functions used by multiple (dissector) address types */
diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c
index 16076f53da..915d2f958c 100644
--- a/epan/dissectors/packet-tipc.c
+++ b/epan/dissectors/packet-tipc.c
@@ -3045,7 +3045,7 @@ proto_register_tipc(void)
/* Register configuration options */
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_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);
/* Set default ports */