aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtcdc.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-rtcdc.c')
-rw-r--r--epan/dissectors/packet-rtcdc.c78
1 files changed, 33 insertions, 45 deletions
diff --git a/epan/dissectors/packet-rtcdc.c b/epan/dissectors/packet-rtcdc.c
index b2d290b478..2a1e47a586 100644
--- a/epan/dissectors/packet-rtcdc.c
+++ b/epan/dissectors/packet-rtcdc.c
@@ -27,38 +27,37 @@
void proto_register_rtcdc(void);
void proto_reg_handoff_rtcdc(void);
-/* PPID used for this protocol */
-static guint32 rtcdc_ppid = WEBRTC_DCEP_PROTOCOL_ID;
+static dissector_handle_t rtcdc_handle;
/* Initialize the protocol and registered fields */
-static int proto_rtcdc = -1;
-static int hf_message_type = -1;
-static int hf_channel_type = -1;
-static int hf_flags = -1;
-static int hf_flags_reserved = -1;
-static int hf_unordered_allowed = -1;
-static int hf_reliability = -1;
-static int hf_priority = -1;
-static int hf_label = -1;
-static int hf_error = -1;
-static int hf_sid = -1;
-static int hf_new_channel_type = -1;
-static int hf_new_reliability = -1;
-static int hf_new_priority = -1;
-static int hf_new_label_length = -1;
-static int hf_new_protocol_length = -1;
-static int hf_new_label = -1;
-static int hf_new_protocol = -1;
+static int proto_rtcdc;
+static int hf_message_type;
+static int hf_channel_type;
+static int hf_flags;
+static int hf_flags_reserved;
+static int hf_unordered_allowed;
+static int hf_reliability;
+static int hf_priority;
+static int hf_label;
+static int hf_error;
+static int hf_sid;
+static int hf_new_channel_type;
+static int hf_new_reliability;
+static int hf_new_priority;
+static int hf_new_label_length;
+static int hf_new_protocol_length;
+static int hf_new_label;
+static int hf_new_protocol;
/* Initialize the subtree pointers */
-static gint ett_rtcdc = -1;
-static gint ett_flags = -1;
+static gint ett_rtcdc;
+static gint ett_flags;
-static expert_field ei_rtcdc_new_reliability_non_zero = EI_INIT;
-static expert_field ei_rtcdc_message_type_unknown = EI_INIT;
-static expert_field ei_rtcdc_inconsistent_label_and_parameter_length = EI_INIT;
-static expert_field ei_rtcdc_message_too_long = EI_INIT;
-static expert_field ei_rtcdc_new_channel_type = EI_INIT;
+static expert_field ei_rtcdc_new_reliability_non_zero;
+static expert_field ei_rtcdc_message_type_unknown;
+static expert_field ei_rtcdc_inconsistent_label_and_parameter_length;
+static expert_field ei_rtcdc_message_too_long;
+static expert_field ei_rtcdc_new_channel_type;
#define DATA_CHANNEL_OPEN_REQUEST 0x00
#define DATA_CHANNEL_OPEN_RESPONSE 0x01
@@ -114,7 +113,7 @@ dissect_open_request_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
proto_tree_add_item(flags_tree, hf_unordered_allowed, tvb, FLAGS_OFFSET, FLAGS_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_reliability, tvb, RELIABILITY_OFFSET, RELIABILITY_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_priority, tvb, PRIORITY_OFFSET, PRIORITY_LENGTH, ENC_BIG_ENDIAN);
- proto_tree_add_item(rtcdc_tree, hf_label, tvb, LABEL_OFFSET, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rtcdc_tree, hf_label, tvb, LABEL_OFFSET, -1, ENC_ASCII);
}
return;
}
@@ -216,8 +215,8 @@ dissect_new_open_request_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_tree_add_item(rtcdc_tree, hf_new_reliability, tvb, NEW_RELIABILITY_OFFSET, NEW_RELIABILITY_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_new_label_length, tvb, NEW_LABEL_LENGTH_OFFSET, NEW_LABEL_LENGTH_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(rtcdc_tree, hf_new_protocol_length, tvb, NEW_PROTOCOL_LENGTH_OFFSET, NEW_PROTOCOL_LENGTH_LENGTH, ENC_BIG_ENDIAN);
- proto_tree_add_item(rtcdc_tree, hf_new_label, tvb, NEW_LABEL_OFFSET, label_length, ENC_ASCII|ENC_NA);
- proto_tree_add_item(rtcdc_tree, hf_new_protocol, tvb, NEW_LABEL_OFFSET + label_length, protocol_length, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(rtcdc_tree, hf_new_label, tvb, NEW_LABEL_OFFSET, label_length, ENC_ASCII);
+ proto_tree_add_item(rtcdc_tree, hf_new_protocol, tvb, NEW_LABEL_OFFSET + label_length, protocol_length, ENC_ASCII);
}
return;
}
@@ -260,7 +259,6 @@ dissect_rtcdc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
void
proto_register_rtcdc(void)
{
- module_t *rtcdc_module;
expert_module_t *expert_rtcdc;
static hf_register_info hf[] = {
@@ -368,25 +366,15 @@ proto_register_rtcdc(void)
proto_register_subtree_array(ett, array_length(ett));
expert_rtcdc = expert_register_protocol(proto_rtcdc);
expert_register_field_array(expert_rtcdc, ei, array_length(ei));
- rtcdc_module = prefs_register_protocol(proto_rtcdc, proto_reg_handoff_rtcdc);
- prefs_register_uint_preference(rtcdc_module, "sctp.ppi", "RTCDC SCTP PPID", "RTCDC SCTP PPID if other than the default", 10, &rtcdc_ppid);
+ /* rtcdc_module = prefs_register_protocol(proto_rtcdc, NULL); */
+
+ rtcdc_handle = register_dissector("rtcdc", dissect_rtcdc, proto_rtcdc);
}
void
proto_reg_handoff_rtcdc(void)
{
- static gboolean initialized = FALSE;
- static dissector_handle_t rtcdc_handle;
- static guint32 current_ppid;
-
- if (!initialized) {
- rtcdc_handle = create_dissector_handle(dissect_rtcdc, proto_rtcdc);
- initialized = TRUE;
- } else {
- dissector_delete_uint("sctp.ppi", current_ppid, rtcdc_handle);
- }
- current_ppid = rtcdc_ppid;
- dissector_add_uint("sctp.ppi", current_ppid, rtcdc_handle);
+ dissector_add_uint_with_preference("sctp.ppi", WEBRTC_DCEP_PROTOCOL_ID, rtcdc_handle);
}
/*