aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtse.c
diff options
context:
space:
mode:
authorgal <graeme.lunt@smhs.co.uk>2015-02-03 15:55:05 +0000
committerMichael Mann <mmann78@netscape.net>2015-02-04 12:34:15 +0000
commit0a6d1f9821b0d5c0de789f5d70bc58a8ead1cd9a (patch)
tree862b0df7c70c9a376a131ea412434222df7f4e78 /epan/dissectors/packet-rtse.c
parent987518153bfdce82b314c1d931104c5e8a24850c (diff)
Support for P3 over RTSE.
Resolve mixed space/tab issue in the RTSE and BER dissectors and included modelines in both templates. Change-Id: I4b75bad94ed111d0faee205e026b2322b7dafbd1 Reviewed-on: https://code.wireshark.org/review/6932 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-rtse.c')
-rw-r--r--epan/dissectors/packet-rtse.c360
1 files changed, 189 insertions, 171 deletions
diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c
index 9bf69266cc..b28b3977b1 100644
--- a/epan/dissectors/packet-rtse.c
+++ b/epan/dissectors/packet-rtse.c
@@ -135,26 +135,26 @@ static gint ett_rtse_fragment = -1;
static gint ett_rtse_fragments = -1;
static const fragment_items rtse_frag_items = {
- /* Fragment subtrees */
- &ett_rtse_fragment,
- &ett_rtse_fragments,
- /* Fragment fields */
- &hf_rtse_fragments,
- &hf_rtse_fragment,
- &hf_rtse_fragment_overlap,
- &hf_rtse_fragment_overlap_conflicts,
- &hf_rtse_fragment_multiple_tails,
- &hf_rtse_fragment_too_long_fragment,
- &hf_rtse_fragment_error,
- &hf_rtse_fragment_count,
- /* Reassembled in field */
- &hf_rtse_reassembled_in,
- /* Reassembled length field */
- &hf_rtse_reassembled_length,
- /* Reassembled data field */
- NULL,
- /* Tag */
- "RTSE fragments"
+ /* Fragment subtrees */
+ &ett_rtse_fragment,
+ &ett_rtse_fragments,
+ /* Fragment fields */
+ &hf_rtse_fragments,
+ &hf_rtse_fragment,
+ &hf_rtse_fragment_overlap,
+ &hf_rtse_fragment_overlap_conflicts,
+ &hf_rtse_fragment_multiple_tails,
+ &hf_rtse_fragment_too_long_fragment,
+ &hf_rtse_fragment_error,
+ &hf_rtse_fragment_count,
+ /* Reassembled in field */
+ &hf_rtse_reassembled_in,
+ /* Reassembled length field */
+ &hf_rtse_reassembled_length,
+ /* Reassembled data field */
+ NULL,
+ /* Tag */
+ "RTSE fragments"
};
void
@@ -181,7 +181,8 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
dissector_add_string("rtse.oid", oid, ros_handle);
/* and then tell ROS how to dissect the AS*/
- register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
+ if(dissector != NULL)
+ register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
} else {
/* otherwise we just remember how to dissect the AS */
@@ -192,43 +193,47 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector
static int
call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data)
{
- tvbuff_t *next_tvb;
- int len;
+ tvbuff_t *next_tvb;
+ int len;
- next_tvb = tvb_new_subset_remaining(tvb, offset);
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
- if((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
- proto_item *item;
- proto_tree *next_tree;
+ if((len = dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)) == 0) {
+ proto_item *item;
+ proto_tree *next_tree;
- next_tree = proto_tree_add_subtree_format(tree, next_tvb, 0, -1, ett_rtse_unknown, &item,
- "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);
+ next_tree = proto_tree_add_subtree_format(tree, next_tvb, 0, -1, ett_rtse_unknown, &item,
+ "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);
- expert_add_info_format(pinfo, item, &ei_rtse_dissector_oid_not_implemented,
+ expert_add_info_format(pinfo, item, &ei_rtse_dissector_oid_not_implemented,
"RTSE: Dissector for OID %s not implemented", oid);
- len = dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
- }
+ len = dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
+ }
- offset += len;
+ offset += len;
- return offset;
+ return offset;
}
static int
call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_)
{
- const char *oid = NULL;
+ const char *oid = NULL;
if (actx->external.indirect_ref_present) {
- oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference);
- } else if (actx->external.direct_ref_present) {
- oid = actx->external.direct_reference;
- }
- if (oid)
+ oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference);
+
+ if(!oid)
+ proto_tree_add_text(tree, tvb, offset, tvb_captured_length_remaining(tvb, offset), "Unable to determine abstract syntax for indirect reference: %d.", actx->external.indirect_reference);
+ } else if (actx->external.direct_ref_present) {
+ oid = actx->external.direct_reference;
+ }
+
+ if (oid)
offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data);
- return offset;
+ return offset;
}
@@ -728,7 +733,7 @@ dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
/*--- End of included file: packet-rtse-fn.c ---*/
-#line 185 "../../asn1/rtse/packet-rtse-template.c"
+#line 190 "../../asn1/rtse/packet-rtse-template.c"
/*
* Dissect RTSE PDUs inside a PPDU.
@@ -736,119 +741,119 @@ dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data)
{
- int offset = 0;
- int old_offset;
- proto_item *item;
- proto_tree *tree;
- proto_tree *next_tree=NULL;
- tvbuff_t *next_tvb = NULL;
- tvbuff_t *data_tvb = NULL;
- fragment_head *frag_msg = NULL;
- guint32 fragment_length;
- guint32 rtse_id = 0;
- gboolean data_handled = FALSE;
- struct SESSION_DATA_STRUCTURE* session;
- conversation_t *conversation = NULL;
- asn1_ctx_t asn1_ctx;
- asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
-
- /* do we have application context from the acse dissector? */
- if (data == NULL)
- return 0;
- session = (struct SESSION_DATA_STRUCTURE*)data;
-
- /* save parent_tree so subdissectors can create new top nodes */
- top_tree=parent_tree;
-
- asn1_ctx.private_data = session;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE");
- col_clear(pinfo->cinfo, COL_INFO);
-
- if (rtse_reassemble &&
- ((session->spdu_type == SES_DATA_TRANSFER) ||
- (session->spdu_type == SES_MAJOR_SYNC_POINT))) {
- /* Use conversation index as fragment id */
- conversation = find_conversation (pinfo->fd->num,
- &pinfo->src, &pinfo->dst, pinfo->ptype,
- pinfo->srcport, pinfo->destport, 0);
- if (conversation != NULL) {
- rtse_id = conversation->index;
- }
- session->rtse_reassemble = TRUE;
- }
- if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
- frag_msg = fragment_end_seq_next (&rtse_reassembly_table,
- pinfo, rtse_id, NULL);
- next_tvb = process_reassembled_data (tvb, offset, pinfo, "Reassembled RTSE",
- frag_msg, &rtse_frag_items, NULL, parent_tree);
- }
-
- item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA);
- tree = proto_item_add_subtree(item, ett_rtse);
-
- if (rtse_reassemble && session->spdu_type == SES_DATA_TRANSFER) {
- /* strip off the OCTET STRING encoding - including any CONSTRUCTED OCTET STRING */
- dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, offset, hf_rtse_segment_data, &data_tvb);
-
- if (data_tvb) {
- fragment_length = tvb_captured_length_remaining (data_tvb, 0);
- proto_item_append_text(asn1_ctx.created_item, " (%u byte%s)", fragment_length,
- plurality(fragment_length, "", "s"));
- frag_msg = fragment_add_seq_next (&rtse_reassembly_table,
- data_tvb, 0, pinfo,
- rtse_id, NULL,
- fragment_length, TRUE);
- if (frag_msg && pinfo->fd->num != frag_msg->reassembled_in) {
- /* Add a "Reassembled in" link if not reassembled in this frame */
- proto_tree_add_uint (tree, *(rtse_frag_items.hf_reassembled_in),
- data_tvb, 0, 0, frag_msg->reassembled_in);
- }
- pinfo->fragmented = TRUE;
- data_handled = TRUE;
- } else {
- fragment_length = tvb_captured_length_remaining (tvb, offset);
- }
-
- col_append_fstr(pinfo->cinfo, COL_INFO, "[RTSE fragment, %u byte%s]",
- fragment_length, plurality(fragment_length, "", "s"));
- } else if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
- if (next_tvb) {
- /* ROS won't do this for us */
- session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
- /*offset=*/dissect_ber_external_type(FALSE, tree, next_tvb, 0, &asn1_ctx, -1, call_rtse_external_type_callback);
- top_tree = NULL;
- /* Return other than 0 to indicate that we handled this packet */
- return 1;
- } else {
- offset = tvb_captured_length (tvb);
- }
- pinfo->fragmented = FALSE;
- data_handled = TRUE;
- }
-
- if (!data_handled) {
- while (tvb_reported_length_remaining(tvb, offset) > 0){
- old_offset=offset;
- offset=dissect_rtse_RTSE_apdus(TRUE, tvb, offset, &asn1_ctx, tree, -1);
- if(offset == old_offset){
- next_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
- ett_rtse_unknown, &item, "Unknown RTSE PDU");
- expert_add_info (pinfo, item, &ei_rtse_unknown_rtse_pdu);
- dissect_unknown_ber(pinfo, tvb, offset, next_tree);
- break;
- }
- }
- }
-
- top_tree = NULL;
- return tvb_captured_length(tvb);
+ int offset = 0;
+ int old_offset;
+ proto_item *item;
+ proto_tree *tree;
+ proto_tree *next_tree=NULL;
+ tvbuff_t *next_tvb = NULL;
+ tvbuff_t *data_tvb = NULL;
+ fragment_head *frag_msg = NULL;
+ guint32 fragment_length;
+ guint32 rtse_id = 0;
+ gboolean data_handled = FALSE;
+ struct SESSION_DATA_STRUCTURE* session;
+ conversation_t *conversation = NULL;
+ asn1_ctx_t asn1_ctx;
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
+
+ /* do we have application context from the acse dissector? */
+ if (data == NULL)
+ return 0;
+ session = (struct SESSION_DATA_STRUCTURE*)data;
+
+ /* save parent_tree so subdissectors can create new top nodes */
+ top_tree=parent_tree;
+
+ asn1_ctx.private_data = session;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ if (rtse_reassemble &&
+ ((session->spdu_type == SES_DATA_TRANSFER) ||
+ (session->spdu_type == SES_MAJOR_SYNC_POINT))) {
+ /* Use conversation index as fragment id */
+ conversation = find_conversation (pinfo->fd->num,
+ &pinfo->src, &pinfo->dst, pinfo->ptype,
+ pinfo->srcport, pinfo->destport, 0);
+ if (conversation != NULL) {
+ rtse_id = conversation->index;
+ }
+ session->rtse_reassemble = TRUE;
+ }
+ if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
+ frag_msg = fragment_end_seq_next (&rtse_reassembly_table,
+ pinfo, rtse_id, NULL);
+ next_tvb = process_reassembled_data (tvb, offset, pinfo, "Reassembled RTSE",
+ frag_msg, &rtse_frag_items, NULL, parent_tree);
+ }
+
+ item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA);
+ tree = proto_item_add_subtree(item, ett_rtse);
+
+ if (rtse_reassemble && session->spdu_type == SES_DATA_TRANSFER) {
+ /* strip off the OCTET STRING encoding - including any CONSTRUCTED OCTET STRING */
+ dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, offset, hf_rtse_segment_data, &data_tvb);
+
+ if (data_tvb) {
+ fragment_length = tvb_captured_length_remaining (data_tvb, 0);
+ proto_item_append_text(asn1_ctx.created_item, " (%u byte%s)", fragment_length,
+ plurality(fragment_length, "", "s"));
+ frag_msg = fragment_add_seq_next (&rtse_reassembly_table,
+ data_tvb, 0, pinfo,
+ rtse_id, NULL,
+ fragment_length, TRUE);
+ if (frag_msg && pinfo->fd->num != frag_msg->reassembled_in) {
+ /* Add a "Reassembled in" link if not reassembled in this frame */
+ proto_tree_add_uint (tree, *(rtse_frag_items.hf_reassembled_in),
+ data_tvb, 0, 0, frag_msg->reassembled_in);
+ }
+ pinfo->fragmented = TRUE;
+ data_handled = TRUE;
+ } else {
+ fragment_length = tvb_captured_length_remaining (tvb, offset);
+ }
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "[RTSE fragment, %u byte%s]",
+ fragment_length, plurality(fragment_length, "", "s"));
+ } else if (rtse_reassemble && session->spdu_type == SES_MAJOR_SYNC_POINT) {
+ if (next_tvb) {
+ /* ROS won't do this for us */
+ session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
+ /*offset=*/dissect_ber_external_type(FALSE, tree, next_tvb, 0, &asn1_ctx, -1, call_rtse_external_type_callback);
+ top_tree = NULL;
+ /* Return other than 0 to indicate that we handled this packet */
+ return 1;
+ } else {
+ offset = tvb_captured_length (tvb);
+ }
+ pinfo->fragmented = FALSE;
+ data_handled = TRUE;
+ }
+
+ if (!data_handled) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0){
+ old_offset=offset;
+ offset=dissect_rtse_RTSE_apdus(TRUE, tvb, offset, &asn1_ctx, tree, -1);
+ if(offset == old_offset){
+ next_tree = proto_tree_add_subtree(tree, tvb, offset, -1,
+ ett_rtse_unknown, &item, "Unknown RTSE PDU");
+ expert_add_info (pinfo, item, &ei_rtse_unknown_rtse_pdu);
+ dissect_unknown_ber(pinfo, tvb, offset, next_tree);
+ break;
+ }
+ }
+ }
+
+ top_tree = NULL;
+ return tvb_captured_length(tvb);
}
static void rtse_reassemble_init (void)
{
- reassembly_table_init (&rtse_reassembly_table,
- &addresses_reassembly_table_functions);
+ reassembly_table_init (&rtse_reassembly_table,
+ &addresses_reassembly_table_functions);
}
/*--- proto_register_rtse -------------------------------------------*/
@@ -860,39 +865,39 @@ void proto_register_rtse(void) {
/* Fragment entries */
{ &hf_rtse_segment_data,
{ "RTSE segment data", "rtse.segment", FT_NONE, BASE_NONE,
- NULL, 0x00, NULL, HFILL } },
+ NULL, 0x00, NULL, HFILL } },
{ &hf_rtse_fragments,
{ "RTSE fragments", "rtse.fragments", FT_NONE, BASE_NONE,
- NULL, 0x00, NULL, HFILL } },
+ NULL, 0x00, NULL, HFILL } },
{ &hf_rtse_fragment,
{ "RTSE fragment", "rtse.fragment", FT_FRAMENUM, BASE_NONE,
- NULL, 0x00, NULL, HFILL } },
+ NULL, 0x00, NULL, HFILL } },
{ &hf_rtse_fragment_overlap,
{ "RTSE fragment overlap", "rtse.fragment.overlap", FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, NULL, HFILL } },
+ BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_rtse_fragment_overlap_conflicts,
{ "RTSE fragment overlapping with conflicting data",
- "rtse.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
- NULL, 0x0, NULL, HFILL } },
+ "rtse.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
+ NULL, 0x0, NULL, HFILL } },
{ &hf_rtse_fragment_multiple_tails,
{ "RTSE has multiple tail fragments",
- "rtse.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
- NULL, 0x0, NULL, HFILL } },
+ "rtse.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
+ NULL, 0x0, NULL, HFILL } },
{ &hf_rtse_fragment_too_long_fragment,
{ "RTSE fragment too long", "rtse.fragment.too_long_fragment",
- FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_rtse_fragment_error,
{ "RTSE defragmentation error", "rtse.fragment.error", FT_FRAMENUM,
- BASE_NONE, NULL, 0x00, NULL, HFILL } },
+ BASE_NONE, NULL, 0x00, NULL, HFILL } },
{ &hf_rtse_fragment_count,
{ "RTSE fragment count", "rtse.fragment.count", FT_UINT32, BASE_DEC,
- NULL, 0x00, NULL, HFILL } },
+ NULL, 0x00, NULL, HFILL } },
{ &hf_rtse_reassembled_in,
{ "Reassembled RTSE in frame", "rtse.reassembled.in", FT_FRAMENUM, BASE_NONE,
- NULL, 0x00, "This RTSE packet is reassembled in this frame", HFILL } },
+ NULL, 0x00, "This RTSE packet is reassembled in this frame", HFILL } },
{ &hf_rtse_reassembled_length,
{ "Reassembled RTSE length", "rtse.reassembled.length", FT_UINT32, BASE_DEC,
- NULL, 0x00, "The total length of the reassembled payload", HFILL } },
+ NULL, 0x00, "The total length of the reassembled payload", HFILL } },
/*--- Included file: packet-rtse-hfarr.c ---*/
@@ -995,7 +1000,7 @@ void proto_register_rtse(void) {
NULL, HFILL }},
/*--- End of included file: packet-rtse-hfarr.c ---*/
-#line 351 "../../asn1/rtse/packet-rtse-template.c"
+#line 356 "../../asn1/rtse/packet-rtse-template.c"
};
/* List of subtrees */
@@ -1017,7 +1022,7 @@ void proto_register_rtse(void) {
&ett_rtse_CallingSSuserReference,
/*--- End of included file: packet-rtse-ettarr.c ---*/
-#line 360 "../../asn1/rtse/packet-rtse-template.c"
+#line 365 "../../asn1/rtse/packet-rtse-template.c"
};
static ei_register_info ei[] = {
@@ -1040,11 +1045,11 @@ void proto_register_rtse(void) {
rtse_module = prefs_register_protocol_subtree("OSI", proto_rtse, NULL);
prefs_register_bool_preference(rtse_module, "reassemble",
- "Reassemble segmented RTSE datagrams",
- "Whether segmented RTSE datagrams should be reassembled."
- " To use this option, you must also enable"
- " \"Allow subdissectors to reassemble TCP streams\""
- " in the TCP protocol settings.", &rtse_reassemble);
+ "Reassemble segmented RTSE datagrams",
+ "Whether segmented RTSE datagrams should be reassembled."
+ " To use this option, you must also enable"
+ " \"Allow subdissectors to reassemble TCP streams\""
+ " in the TCP protocol settings.", &rtse_reassemble);
rtse_oid_dissector_table = register_dissector_table("rtse.oid", "RTSE OID Dissectors", FT_STRING, BASE_NONE);
oid_table=g_hash_table_new(g_str_hash, g_str_equal);
@@ -1058,3 +1063,16 @@ void proto_reg_handoff_rtse(void) {
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */