aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gfp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-gfp.c')
-rw-r--r--epan/dissectors/packet-gfp.c85
1 files changed, 38 insertions, 47 deletions
diff --git a/epan/dissectors/packet-gfp.c b/epan/dissectors/packet-gfp.c
index 84af2f48bf..78eb3c4166 100644
--- a/epan/dissectors/packet-gfp.c
+++ b/epan/dissectors/packet-gfp.c
@@ -37,36 +37,39 @@
void proto_reg_handoff_gfp(void);
void proto_register_gfp(void);
+/* Dissector handle */
+static dissector_handle_t gfp_handle;
+
/* Initialize the protocol and registered fields */
-static int proto_gfp = -1;
-static int hf_gfp_pli = -1;
-static int hf_gfp_chec = -1;
-static int hf_gfp_chec_status = -1;
-static int hf_gfp_type = -1;
-static int hf_gfp_pti = -1;
-static int hf_gfp_pfi = -1;
-static int hf_gfp_exi = -1;
-static int hf_gfp_upi_data = -1;
-static int hf_gfp_upi_management = -1;
-static int hf_gfp_thec = -1;
-static int hf_gfp_thec_status = -1;
-static int hf_gfp_cid = -1;
-static int hf_gfp_ehec = -1;
-static int hf_gfp_ehec_status = -1;
-static int hf_gfp_fcs = -1;
-static int hf_gfp_fcs_good = -1;
-static int hf_gfp_fcs_bad = -1;
-
-static expert_field ei_gfp_pli_idle_nonempty = EI_INIT;
-static expert_field ei_gfp_pli_unknown = EI_INIT;
-static expert_field ei_gfp_pli_invalid = EI_INIT;
-static expert_field ei_gfp_chec_bad = EI_INIT;
-static expert_field ei_gfp_thec_bad = EI_INIT;
-static expert_field ei_gfp_ehec_bad = EI_INIT;
-static expert_field ei_gfp_exi_short = EI_INIT;
-static expert_field ei_gfp_pfi_short = EI_INIT;
-static expert_field ei_gfp_payload_undecoded = EI_INIT;
-static expert_field ei_gfp_fcs_bad = EI_INIT;
+static int proto_gfp;
+static int hf_gfp_pli;
+static int hf_gfp_chec;
+static int hf_gfp_chec_status;
+static int hf_gfp_type;
+static int hf_gfp_pti;
+static int hf_gfp_pfi;
+static int hf_gfp_exi;
+static int hf_gfp_upi_data;
+static int hf_gfp_upi_management;
+static int hf_gfp_thec;
+static int hf_gfp_thec_status;
+static int hf_gfp_cid;
+static int hf_gfp_ehec;
+static int hf_gfp_ehec_status;
+static int hf_gfp_fcs;
+static int hf_gfp_fcs_good;
+static int hf_gfp_fcs_bad;
+
+static expert_field ei_gfp_pli_idle_nonempty;
+static expert_field ei_gfp_pli_unknown;
+static expert_field ei_gfp_pli_invalid;
+static expert_field ei_gfp_chec_bad;
+static expert_field ei_gfp_thec_bad;
+static expert_field ei_gfp_ehec_bad;
+static expert_field ei_gfp_exi_short;
+static expert_field ei_gfp_pfi_short;
+static expert_field ei_gfp_payload_undecoded;
+static expert_field ei_gfp_fcs_bad;
#define GFP_USER_DATA 0
#define GFP_CLIENT_MANAGEMENT 4
@@ -77,9 +80,9 @@ static expert_field ei_gfp_fcs_bad = EI_INIT;
#define GFP_EXT_RING 2
/* Initialize the subtree pointers */
-static gint ett_gfp = -1;
-static gint ett_gfp_type = -1;
-static gint ett_gfp_fcs = -1;
+static gint ett_gfp;
+static gint ett_gfp_type;
+static gint ett_gfp_fcs;
static dissector_table_t gfp_dissector_table;
@@ -175,7 +178,7 @@ static const range_string gfp_upi_management_rvals[] = {
static void gfp_prompt(packet_info *pinfo, gchar* result)
{
- g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "UPI %u as",
+ snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "UPI %u as",
GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_gfp, 0)));
}
@@ -555,6 +558,8 @@ proto_register_gfp(void)
/* Register the protocol name and description */
proto_gfp = proto_register_protocol("Generic Framing Procedure",
"GFP", "gfp");
+ gfp_handle = register_dissector("gfp", dissect_gfp,
+ proto_gfp);
/* Required function calls to register the header fields and subtrees */
proto_register_field_array(proto_gfp, hf, array_length(hf));
@@ -576,23 +581,9 @@ proto_register_gfp(void)
register_decode_as(&gfp_da);
}
-/* If this function is registered as a prefs callback (see
- * prefs_register_protocol above) this function is also called by Wireshark's
- * preferences manager whenever "Apply" or "OK" are pressed. In that case, it
- * should accommodate being called more than once by use of the static
- * 'initialized' variable included below.
- *
- * This form of the reg_handoff function is used if if you perform registration
- * functions which are dependent upon prefs.
- */
void
proto_reg_handoff_gfp(void)
{
- static dissector_handle_t gfp_handle;
-
- gfp_handle = create_dissector_handle(dissect_gfp,
- proto_gfp);
-
dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_T, gfp_handle);
dissector_add_uint("wtap_encap", WTAP_ENCAP_GFP_F, gfp_handle);