diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index 60a596aa53..45ff749036 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -1194,8 +1194,6 @@ static const int *diameter_flags_fields[] = { NULL }; -static void register_diameter_fields(const char *); - static int dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -1221,7 +1219,7 @@ dissect_diameter_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Load header fields if not already done */ if (hf_diameter_code == -1) - register_diameter_fields(""); + proto_registrar_get_byname("diameter.code"); diam_sub_dis_inf->application_id = tvb_get_ntohl(tvb,8); diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index babba057c5..6202f162e0 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -1357,8 +1357,6 @@ vsa_buffer_table_destroy(void *table) } } -static void register_radius_fields(const char *); - void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint length) { @@ -1373,7 +1371,7 @@ dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv GHashTable *vsa_buffer_table = NULL; if (hf_radius_code == -1) - register_radius_fields(""); + proto_registrar_get_byname("radius.code"); /* * In case we throw an exception, clean up whatever stuff we've @@ -1847,7 +1845,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ /* Load header fields if not already done */ if (hf_radius_code == -1) - register_radius_fields(""); + proto_registrar_get_byname("radius.code"); ti = proto_tree_add_item(tree, proto_radius, tvb, 0, rh.rh_pktlength, ENC_NA); radius_tree = proto_item_add_subtree(ti, ett_radius); @@ -2371,7 +2369,9 @@ radius_init_protocol(void) radius_calls = wmem_map_new(wmem_file_scope(), radius_call_hash, radius_call_equal); } -static void register_radius_fields(const char *unused _U_) { +static void +register_radius_fields(const char *unused _U_) +{ hf_register_info base_hf[] = { { &hf_radius_req, { "Request", "radius.req", FT_BOOLEAN, BASE_NONE, NULL, 0x0, diff --git a/epan/proto.h b/epan/proto.h index ecc534ae7b..56f78350c1 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -2097,7 +2097,8 @@ typedef void (*prefix_initializer_t)(const char* match); /** Register a new prefix for delayed initialization of field arrays Note that the initializer function MAY NOT be called before the dissector is first called. That is, dissectors using this function must be prepared - to call the initializer before beginning dissection. + to call the initializer before beginning dissection; they should do this by + calling proto_registrar_get_byname() on one of the dissector's field names. @param prefix the prefix for the new protocol @param initializer function that will initialize the field array for the given prefix */ WS_DLL_PUBLIC void diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index d1dca91b70..8e3e781d24 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -2081,9 +2081,6 @@ match_ver_value_string( return res? res->vs.strptr : NULL; } -static void register_wimaxasncp_fields(const char*); - - static int dissect_wimaxasncp( tvbuff_t *tvb, @@ -2158,9 +2155,9 @@ dissect_wimaxasncp( offset = 0; /* Register protocol fields, etc if haven't done yet. */ - if (wimaxasncp_dict == NULL) + if (hf_wimaxasncp_version == -1) { - register_wimaxasncp_fields(NULL); + proto_registrar_get_byname("wimaxasncp.version"); } if (tree)