diff options
Diffstat (limited to 'epan/dissectors/packet-vrt.c')
-rw-r--r-- | epan/dissectors/packet-vrt.c | 48 |
1 files changed, 12 insertions, 36 deletions
diff --git a/epan/dissectors/packet-vrt.c b/epan/dissectors/packet-vrt.c index 129136bd23..5db62628d8 100644 --- a/epan/dissectors/packet-vrt.c +++ b/epan/dissectors/packet-vrt.c @@ -28,11 +28,11 @@ #include "config.h" #include <epan/packet.h> -#include <epan/prefs.h> void proto_register_vrt(void); +void proto_reg_handoff_vrt(void); -static gint dissector_port_pref = 4991; +#define VITA_49_PORT 4991 static int proto_vrt = -1; @@ -155,10 +155,9 @@ static const int *ind_hfs[] = { &hf_vrt_trailer_ind_caltime }; -void dissect_header(tvbuff_t *tvb, proto_tree *tree, int type, int offset); -void dissect_trailer(tvbuff_t *tvb, proto_tree *tree, int offset); -void dissect_cid(tvbuff_t *tvb, proto_tree *tree, int offset); -void proto_reg_handoff_vrt(void); +static void dissect_header(tvbuff_t *tvb, proto_tree *tree, int type, int offset); +static void dissect_trailer(tvbuff_t *tvb, proto_tree *tree, int offset); +static void dissect_cid(tvbuff_t *tvb, proto_tree *tree, int offset); static int dissect_vrt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -261,7 +260,7 @@ static int dissect_vrt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void return tvb_captured_length(tvb); } -void dissect_header(tvbuff_t *tvb, proto_tree *tree, int type, int offset) +static void dissect_header(tvbuff_t *tvb, proto_tree *tree, int type, int offset) { proto_item *hdr_item; proto_tree *hdr_tree; @@ -284,7 +283,7 @@ void dissect_header(tvbuff_t *tvb, proto_tree *tree, int type, int offset) proto_tree_add_item(hdr_tree, hf_vrt_len, tvb, offset, 2, ENC_BIG_ENDIAN); } -void dissect_trailer(tvbuff_t *tvb, proto_tree *tree, int offset) +static void dissect_trailer(tvbuff_t *tvb, proto_tree *tree, int offset) { proto_item *enable_item, *ind_item, *trailer_item; proto_tree *enable_tree; @@ -321,7 +320,7 @@ void dissect_trailer(tvbuff_t *tvb, proto_tree *tree, int offset) proto_tree_add_item(trailer_tree, hf_vrt_trailer_acpc, tvb, offset, 1, ENC_BIG_ENDIAN); } -void dissect_cid(tvbuff_t *tvb, proto_tree *tree, int offset) +static void dissect_cid(tvbuff_t *tvb, proto_tree *tree, int offset) { proto_item *cid_item; proto_tree *cid_tree; @@ -634,42 +633,19 @@ proto_register_vrt(void) &ett_cid }; - module_t *vrt_module; - - proto_vrt = proto_register_protocol ( - "VITA 49 radio transport protocol", /* name */ - "VITA 49", /* short name */ - "vrt" /* abbrev */ - ); + proto_vrt = proto_register_protocol ("VITA 49 radio transport protocol", "VITA 49", "vrt"); proto_register_field_array(proto_vrt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - - vrt_module = prefs_register_protocol(proto_vrt, proto_reg_handoff_vrt); - prefs_register_uint_preference(vrt_module, - "dissector_port", - "Dissector UDP port", - "The UDP port used by this dissector", - 10, &dissector_port_pref); } void proto_reg_handoff_vrt(void) { - static gboolean vrt_prefs_initialized = FALSE; - static dissector_handle_t vrt_handle; - static gint dissector_port; - - if (!vrt_prefs_initialized) { - vrt_handle = create_dissector_handle(dissect_vrt, proto_vrt); - vrt_prefs_initialized = TRUE; - } else { - dissector_delete_uint("udp.port", dissector_port, vrt_handle); - } - - dissector_port = dissector_port_pref; + dissector_handle_t vrt_handle; - dissector_add_uint("udp.port", dissector_port, vrt_handle); + vrt_handle = create_dissector_handle(dissect_vrt, proto_vrt); + dissector_add_uint_with_preference("udp.port", VITA_49_PORT, vrt_handle); } /* |