1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler */
4 /* ../../tools/asn2wrs.py -b -e -p rtse -c rtse.cnf -s packet-rtse-template rtse.asn */
6 /* Input file: packet-rtse-template.c */
8 #line 1 "packet-rtse-template.c"
10 * Routines for RTSE packet dissection
15 * Wireshark - Network traffic analyzer
16 * By Gerald Combs <gerald@wireshark.org>
17 * Copyright 1998 Gerald Combs
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
39 #include <epan/packet.h>
40 #include <epan/conversation.h>
45 #include "packet-ber.h"
46 #include "packet-pres.h"
47 #include "packet-acse.h"
48 #include "packet-ros.h"
49 #include "packet-rtse.h"
51 #define PNAME "X.228 OSI Reliable Transfer Service"
55 /* Initialize the protocol and registered fields */
58 static struct SESSION_DATA_STRUCTURE* session = NULL;
60 static char object_identifier_id[MAX_OID_STR_LEN];
61 static gboolean open_request=FALSE;
62 /* indirect_reference, used to pick up the signalling so we know what
63 kind of data is transferred in SES_DATA_TRANSFER_PDUs */
64 static guint32 indir_ref=0;
65 static guint32 app_proto=0;
67 static proto_tree *top_tree=NULL;
69 static dissector_handle_t rtse_handle = NULL;
70 static dissector_handle_t ros_handle = NULL;
73 /*--- Included file: packet-rtse-hf.c ---*/
74 #line 1 "packet-rtse-hf.c"
75 static int hf_rtse_rtorq_apdu = -1; /* RTORQapdu */
76 static int hf_rtse_rtoac_apdu = -1; /* RTOACapdu */
77 static int hf_rtse_rtorj_apdu = -1; /* RTORJapdu */
78 static int hf_rtse_rttp_apdu = -1; /* RTTPapdu */
79 static int hf_rtse_rttr_apdu = -1; /* RTTRapdu */
80 static int hf_rtse_rtab_apdu = -1; /* RTABapdu */
81 static int hf_rtse_checkpointSize = -1; /* INTEGER */
82 static int hf_rtse_windowSize = -1; /* INTEGER */
83 static int hf_rtse_dialogueMode = -1; /* T_dialogueMode */
84 static int hf_rtse_connectionDataRQ = -1; /* ConnectionData */
85 static int hf_rtse_applicationProtocol = -1; /* T_applicationProtocol */
86 static int hf_rtse_connectionDataAC = -1; /* ConnectionData */
87 static int hf_rtse_refuseReason = -1; /* RefuseReason */
88 static int hf_rtse_userDataRJ = -1; /* T_userDataRJ */
89 static int hf_rtse_abortReason = -1; /* AbortReason */
90 static int hf_rtse_reflectedParameter = -1; /* BIT_STRING */
91 static int hf_rtse_userdataAB = -1; /* T_userdataAB */
92 static int hf_rtse_open = -1; /* T_open */
93 static int hf_rtse_recover = -1; /* SessionConnectionIdentifier */
94 static int hf_rtse_callingSSuserReference = -1; /* CallingSSuserReference */
95 static int hf_rtse_commonReference = -1; /* CommonReference */
96 static int hf_rtse_additionalReferenceInformation = -1; /* AdditionalReferenceInformation */
97 static int hf_rtse_t61String = -1; /* T61String */
98 static int hf_rtse_octetString = -1; /* OCTET_STRING */
99 static int hf_rtse_direct_reference = -1; /* OBJECT_IDENTIFIER */
100 static int hf_rtse_indirect_reference = -1; /* T_indirect_reference */
101 static int hf_rtse_data_value_descriptor = -1; /* ObjectDescriptor */
102 static int hf_rtse_encoding = -1; /* T_encoding */
103 static int hf_rtse_single_ASN1_type = -1; /* T_single_ASN1_type */
104 static int hf_rtse_octet_aligned = -1; /* OCTET_STRING */
105 static int hf_rtse_arbitrary = -1; /* BIT_STRING */
107 /*--- End of included file: packet-rtse-hf.c ---*/
108 #line 65 "packet-rtse-template.c"
110 /* Initialize the subtree pointers */
111 static gint ett_rtse = -1;
113 /*--- Included file: packet-rtse-ett.c ---*/
114 #line 1 "packet-rtse-ett.c"
115 static gint ett_rtse_RTSE_apdus = -1;
116 static gint ett_rtse_RTORQapdu = -1;
117 static gint ett_rtse_RTOACapdu = -1;
118 static gint ett_rtse_RTORJapdu = -1;
119 static gint ett_rtse_RTABapdu = -1;
120 static gint ett_rtse_ConnectionData = -1;
121 static gint ett_rtse_SessionConnectionIdentifier = -1;
122 static gint ett_rtse_CallingSSuserReference = -1;
123 static gint ett_rtse_EXTERNAL = -1;
124 static gint ett_rtse_T_encoding = -1;
126 /*--- End of included file: packet-rtse-ett.c ---*/
127 #line 69 "packet-rtse-template.c"
130 static dissector_table_t rtse_oid_dissector_table=NULL;
131 static GHashTable *oid_table=NULL;
132 static gint ett_rtse_unknown = -1;
135 register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_ros)
138 /* save the name - but not used */
139 g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
141 /* register RTSE with the BER (ACSE) */
142 register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
145 /* make sure we call ROS ... */
146 dissector_add_string("rtse.oid", oid, ros_handle);
148 /* and then tell ROS how to dissect the AS*/
149 register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
152 /* otherwise we just remember how to dissect the AS */
153 dissector_add_string("rtse.oid", oid, dissector);
158 call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
162 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
163 if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree)){
164 proto_item *item=NULL;
165 proto_tree *next_tree=NULL;
167 item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);
169 next_tree=proto_item_add_subtree(item, ett_rtse_unknown);
171 dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
174 /*XXX until we change the #.REGISTER signature for _PDU()s
175 * into new_dissector_t we have to do this kludge with
176 * manually step past the content in the ANY type.
178 offset+=tvb_length_remaining(tvb, offset);
184 /*--- Included file: packet-rtse-fn.c ---*/
185 #line 1 "packet-rtse-fn.c"
186 /*--- Fields for imported types ---*/
192 dissect_rtse_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
193 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
198 static int dissect_checkpointSize_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
199 return dissect_rtse_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_rtse_checkpointSize);
201 static int dissect_windowSize_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
202 return dissect_rtse_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_rtse_windowSize);
206 static const value_string rtse_T_dialogueMode_vals[] = {
214 dissect_rtse_T_dialogueMode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
215 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
220 static int dissect_dialogueMode_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
221 return dissect_rtse_T_dialogueMode(TRUE, tvb, offset, pinfo, tree, hf_rtse_dialogueMode);
227 dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
233 case 1: /* mts-transfer-protocol-1984 */
234 oid = "applicationProtocol.1";
236 case 12: /* mts-transfer-protocol */
237 oid = "applicationProtocol.12";
240 if(session && session->pres_ctx_id)
241 oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
245 if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
246 oid = "applicationProtocol.12";
250 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
253 /* else XXX: need to flag we can't find the presentation context */
259 static int dissect_open(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
260 return dissect_rtse_T_open(FALSE, tvb, offset, pinfo, tree, hf_rtse_open);
266 dissect_rtse_T61String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
268 tvbuff_t *string = NULL;
269 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString,
270 pinfo, tree, tvb, offset, hf_index,
273 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
274 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
280 static int dissect_t61String(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
281 return dissect_rtse_T61String(FALSE, tvb, offset, pinfo, tree, hf_rtse_t61String);
287 dissect_rtse_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
289 tvbuff_t *string = NULL;
290 offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
293 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
294 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
300 static int dissect_octetString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
301 return dissect_rtse_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_rtse_octetString);
303 static int dissect_octet_aligned_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
304 return dissect_rtse_OCTET_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_octet_aligned);
308 static const value_string rtse_CallingSSuserReference_vals[] = {
310 { 1, "octetString" },
314 static const ber_choice_t CallingSSuserReference_choice[] = {
315 { 0, BER_CLASS_UNI, BER_UNI_TAG_TeletexString, BER_FLAGS_NOOWNTAG, dissect_t61String },
316 { 1, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_octetString },
321 dissect_rtse_CallingSSuserReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
322 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
323 CallingSSuserReference_choice, hf_index, ett_rtse_CallingSSuserReference,
328 static int dissect_callingSSuserReference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
329 return dissect_rtse_CallingSSuserReference(FALSE, tvb, offset, pinfo, tree, hf_rtse_callingSSuserReference);
335 dissect_rtse_CommonReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
337 tvbuff_t *string = NULL;
338 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTCTime,
339 pinfo, tree, tvb, offset, hf_index,
342 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
343 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
349 static int dissect_commonReference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
350 return dissect_rtse_CommonReference(FALSE, tvb, offset, pinfo, tree, hf_rtse_commonReference);
356 dissect_rtse_AdditionalReferenceInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
357 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString,
358 pinfo, tree, tvb, offset, hf_index,
363 static int dissect_additionalReferenceInformation_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
364 return dissect_rtse_AdditionalReferenceInformation(TRUE, tvb, offset, pinfo, tree, hf_rtse_additionalReferenceInformation);
368 static const ber_sequence_t SessionConnectionIdentifier_sequence[] = {
369 { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_callingSSuserReference },
370 { BER_CLASS_UNI, BER_UNI_TAG_UTCTime, BER_FLAGS_NOOWNTAG, dissect_commonReference },
371 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_additionalReferenceInformation_impl },
376 dissect_rtse_SessionConnectionIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
378 if(open_request && check_col(pinfo->cinfo, COL_INFO))
379 col_append_fstr(pinfo->cinfo, COL_INFO, "Recover");
380 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
381 SessionConnectionIdentifier_sequence, hf_index, ett_rtse_SessionConnectionIdentifier);
388 static int dissect_recover_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
389 return dissect_rtse_SessionConnectionIdentifier(TRUE, tvb, offset, pinfo, tree, hf_rtse_recover);
393 static const value_string rtse_ConnectionData_vals[] = {
399 static const ber_choice_t ConnectionData_choice[] = {
400 { 0, BER_CLASS_CON, 0, 0, dissect_open },
401 { 1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_recover_impl },
406 dissect_rtse_ConnectionData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
407 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
408 ConnectionData_choice, hf_index, ett_rtse_ConnectionData,
413 static int dissect_connectionDataRQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
414 return dissect_rtse_ConnectionData(FALSE, tvb, offset, pinfo, tree, hf_rtse_connectionDataRQ);
416 static int dissect_connectionDataAC(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
417 return dissect_rtse_ConnectionData(FALSE, tvb, offset, pinfo, tree, hf_rtse_connectionDataAC);
421 static const value_string rtse_T_applicationProtocol_vals[] = {
422 { 12, "mts-transfer-protocol" },
423 { 1, "mts-transfer-protocol-1984" },
429 dissect_rtse_T_applicationProtocol(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
432 offset = dissect_ber_integer(TRUE, pinfo, tree, tvb, offset, hf_index, &app_proto);
438 static int dissect_applicationProtocol_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
439 return dissect_rtse_T_applicationProtocol(TRUE, tvb, offset, pinfo, tree, hf_rtse_applicationProtocol);
443 static const ber_sequence_t RTORQapdu_set[] = {
444 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_checkpointSize_impl },
445 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_windowSize_impl },
446 { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_dialogueMode_impl },
447 { BER_CLASS_CON, 3, BER_FLAGS_NOTCHKTAG, dissect_connectionDataRQ },
448 { BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_applicationProtocol_impl },
453 dissect_rtse_RTORQapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
456 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
457 session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT);
459 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
460 RTORQapdu_set, hf_index, ett_rtse_RTORQapdu);
468 static int dissect_rtorq_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
469 return dissect_rtse_RTORQapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtorq_apdu);
473 static const ber_sequence_t RTOACapdu_set[] = {
474 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_checkpointSize_impl },
475 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_windowSize_impl },
476 { BER_CLASS_CON, 2, BER_FLAGS_NOTCHKTAG, dissect_connectionDataAC },
481 dissect_rtse_RTOACapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
484 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
485 session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT);
487 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
488 RTOACapdu_set, hf_index, ett_rtse_RTOACapdu);
495 static int dissect_rtoac_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
496 return dissect_rtse_RTOACapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtoac_apdu);
500 static const value_string rtse_RefuseReason_vals[] = {
502 { 1, "cannotRecover" },
503 { 2, "validationFailure" },
504 { 3, "unacceptableDialogueMode" },
510 dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
511 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
516 static int dissect_refuseReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
517 return dissect_rtse_RefuseReason(TRUE, tvb, offset, pinfo, tree, hf_rtse_refuseReason);
523 dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
528 case 1: /* mts-transfer-protocol-1984 */
529 oid = "applicationProtocol.1";
531 case 12: /* mts-transfer-protocol */
532 oid = "applicationProtocol.12";
535 if(session && session->pres_ctx_id)
536 oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
540 if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
541 oid = "applicationProtocol.12";
544 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
545 session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR);
547 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
554 static int dissect_userDataRJ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
555 return dissect_rtse_T_userDataRJ(FALSE, tvb, offset, pinfo, tree, hf_rtse_userDataRJ);
559 static const ber_sequence_t RTORJapdu_set[] = {
560 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_refuseReason_impl },
561 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_userDataRJ },
566 dissect_rtse_RTORJapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
567 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
568 RTORJapdu_set, hf_index, ett_rtse_RTORJapdu);
572 static int dissect_rtorj_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
573 return dissect_rtse_RTORJapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtorj_apdu);
579 dissect_rtse_RTTPapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
580 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
585 static int dissect_rttp_apdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
586 return dissect_rtse_RTTPapdu(FALSE, tvb, offset, pinfo, tree, hf_rtse_rttp_apdu);
592 dissect_rtse_RTTRapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
594 tvbuff_t *next_tvb = NULL;
596 offset = dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_index, &next_tvb);
600 /* XXX: we should check is this is an EXTERNAL first */
602 /* ROS won't do this for us */
604 session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
606 offset = dissect_rtse_EXTERNAL(FALSE, next_tvb, 0, pinfo, tree, -1);
614 static int dissect_rttr_apdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
615 return dissect_rtse_RTTRapdu(FALSE, tvb, offset, pinfo, tree, hf_rtse_rttr_apdu);
619 static const value_string rtse_AbortReason_vals[] = {
620 { 0, "localSystemProblem" },
621 { 1, "invalidParameter" },
622 { 2, "unrecognizedActivity" },
623 { 3, "temporaryProblem" },
624 { 4, "protocolError" },
625 { 5, "permanentProblem" },
627 { 7, "transferCompleted" },
633 dissect_rtse_AbortReason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
634 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
639 static int dissect_abortReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
640 return dissect_rtse_AbortReason(TRUE, tvb, offset, pinfo, tree, hf_rtse_abortReason);
646 dissect_rtse_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
647 offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
653 static int dissect_reflectedParameter_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
654 return dissect_rtse_BIT_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_reflectedParameter);
656 static int dissect_arbitrary_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
657 return dissect_rtse_BIT_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_arbitrary);
663 dissect_rtse_T_userdataAB(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
665 /*XXX not implemented yet */
671 static int dissect_userdataAB(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
672 return dissect_rtse_T_userdataAB(FALSE, tvb, offset, pinfo, tree, hf_rtse_userdataAB);
676 static const ber_sequence_t RTABapdu_set[] = {
677 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_abortReason_impl },
678 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_reflectedParameter_impl },
679 { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_userdataAB },
684 dissect_rtse_RTABapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
685 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
686 RTABapdu_set, hf_index, ett_rtse_RTABapdu);
690 static int dissect_rtab_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
691 return dissect_rtse_RTABapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtab_apdu);
695 static const value_string rtse_RTSE_apdus_vals[] = {
705 static const ber_choice_t RTSE_apdus_choice[] = {
706 { 0, BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_rtorq_apdu_impl },
707 { 1, BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_rtoac_apdu_impl },
708 { 2, BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_rtorj_apdu_impl },
709 { 3, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_rttp_apdu },
710 { 4, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_rttr_apdu },
711 { 5, BER_CLASS_CON, 22, BER_FLAGS_IMPLTAG, dissect_rtab_apdu_impl },
716 dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
717 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
718 RTSE_apdus_choice, hf_index, ett_rtse_RTSE_apdus,
727 dissect_rtse_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
728 offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
732 static int dissect_direct_reference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
733 return dissect_rtse_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_rtse_direct_reference);
739 dissect_rtse_T_indirect_reference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
743 offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset,
744 hf_rtse_indirect_reference,
747 /* look up the indirect reference */
748 if((oid = find_oid_by_pres_ctx_id(pinfo, indir_ref)) != NULL) {
749 g_snprintf(object_identifier_id, MAX_OID_STR_LEN, "%s", oid);
757 static int dissect_indirect_reference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
758 return dissect_rtse_T_indirect_reference(FALSE, tvb, offset, pinfo, tree, hf_rtse_indirect_reference);
764 dissect_rtse_ObjectDescriptor(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
765 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_ObjectDescriptor,
766 pinfo, tree, tvb, offset, hf_index,
771 static int dissect_data_value_descriptor(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
772 return dissect_rtse_ObjectDescriptor(FALSE, tvb, offset, pinfo, tree, hf_rtse_data_value_descriptor);
778 dissect_rtse_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
780 offset=call_rtse_oid_callback(object_identifier_id, tvb, offset, pinfo, top_tree);
787 static int dissect_single_ASN1_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
788 return dissect_rtse_T_single_ASN1_type(FALSE, tvb, offset, pinfo, tree, hf_rtse_single_ASN1_type);
792 static const value_string rtse_T_encoding_vals[] = {
793 { 0, "single-ASN1-type" },
794 { 1, "octet-aligned" },
799 static const ber_choice_t T_encoding_choice[] = {
800 { 0, BER_CLASS_CON, 0, 0, dissect_single_ASN1_type },
801 { 1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_octet_aligned_impl },
802 { 2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_arbitrary_impl },
807 dissect_rtse_T_encoding(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
808 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
809 T_encoding_choice, hf_index, ett_rtse_T_encoding,
814 static int dissect_encoding(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
815 return dissect_rtse_T_encoding(FALSE, tvb, offset, pinfo, tree, hf_rtse_encoding);
819 static const ber_sequence_t EXTERNAL_sequence[] = {
820 { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_direct_reference },
821 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_indirect_reference },
822 { BER_CLASS_UNI, BER_UNI_TAG_ObjectDescriptor, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_data_value_descriptor },
823 { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_encoding },
828 dissect_rtse_EXTERNAL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
831 gboolean pc, ind_field;
836 /* XXX asn2wrs can not yet handle tagged assignment so for the
837 * time being just remove this tag manually inside the EXTERNAL
840 offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
841 offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
844 offset = dissect_ber_sequence(TRUE, pinfo, tree, tvb, offset,
845 EXTERNAL_sequence, hf_index, ett_rtse_EXTERNAL);
853 /*--- End of included file: packet-rtse-fn.c ---*/
854 #line 125 "packet-rtse-template.c"
857 * Dissect RTSE PDUs inside a PPDU.
860 dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
864 proto_item *item=NULL;
865 proto_tree *tree=NULL;
867 /* save parent_tree so subdissectors can create new top nodes */
868 top_tree=parent_tree;
870 /* do we have application context from the acse dissector? */
871 if( !pinfo->private_data ){
873 proto_tree_add_text(parent_tree, tvb, offset, -1,
874 "Internal error:can't get application context from ACSE dissector.");
878 session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
883 item = proto_tree_add_item(parent_tree, proto_rtse, tvb, 0, -1, FALSE);
884 tree = proto_item_add_subtree(item, ett_rtse);
886 if (check_col(pinfo->cinfo, COL_PROTOCOL))
887 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE");
888 if (check_col(pinfo->cinfo, COL_INFO))
889 col_clear(pinfo->cinfo, COL_INFO);
891 while (tvb_reported_length_remaining(tvb, offset) > 0){
893 offset=dissect_rtse_RTSE_apdus(FALSE, tvb, offset, pinfo , tree, -1);
894 if(offset == old_offset){
895 proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte RTSE PDU");
896 offset = tvb_length(tvb);
905 /*--- proto_register_rtse -------------------------------------------*/
906 void proto_register_rtse(void) {
909 static hf_register_info hf[] =
912 /*--- Included file: packet-rtse-hfarr.c ---*/
913 #line 1 "packet-rtse-hfarr.c"
914 { &hf_rtse_rtorq_apdu,
915 { "rtorq-apdu", "rtse.rtorq_apdu",
916 FT_NONE, BASE_NONE, NULL, 0,
917 "rtse.RTORQapdu", HFILL }},
918 { &hf_rtse_rtoac_apdu,
919 { "rtoac-apdu", "rtse.rtoac_apdu",
920 FT_NONE, BASE_NONE, NULL, 0,
921 "rtse.RTOACapdu", HFILL }},
922 { &hf_rtse_rtorj_apdu,
923 { "rtorj-apdu", "rtse.rtorj_apdu",
924 FT_NONE, BASE_NONE, NULL, 0,
925 "rtse.RTORJapdu", HFILL }},
926 { &hf_rtse_rttp_apdu,
927 { "rttp-apdu", "rtse.rttp_apdu",
928 FT_INT32, BASE_DEC, NULL, 0,
929 "rtse.RTTPapdu", HFILL }},
930 { &hf_rtse_rttr_apdu,
931 { "rttr-apdu", "rtse.rttr_apdu",
932 FT_BYTES, BASE_HEX, NULL, 0,
933 "rtse.RTTRapdu", HFILL }},
934 { &hf_rtse_rtab_apdu,
935 { "rtab-apdu", "rtse.rtab_apdu",
936 FT_NONE, BASE_NONE, NULL, 0,
937 "rtse.RTABapdu", HFILL }},
938 { &hf_rtse_checkpointSize,
939 { "checkpointSize", "rtse.checkpointSize",
940 FT_INT32, BASE_DEC, NULL, 0,
941 "rtse.INTEGER", HFILL }},
942 { &hf_rtse_windowSize,
943 { "windowSize", "rtse.windowSize",
944 FT_INT32, BASE_DEC, NULL, 0,
945 "rtse.INTEGER", HFILL }},
946 { &hf_rtse_dialogueMode,
947 { "dialogueMode", "rtse.dialogueMode",
948 FT_INT32, BASE_DEC, VALS(rtse_T_dialogueMode_vals), 0,
949 "rtse.T_dialogueMode", HFILL }},
950 { &hf_rtse_connectionDataRQ,
951 { "connectionDataRQ", "rtse.connectionDataRQ",
952 FT_UINT32, BASE_DEC, VALS(rtse_ConnectionData_vals), 0,
953 "rtse.ConnectionData", HFILL }},
954 { &hf_rtse_applicationProtocol,
955 { "applicationProtocol", "rtse.applicationProtocol",
956 FT_INT32, BASE_DEC, VALS(rtse_T_applicationProtocol_vals), 0,
957 "rtse.T_applicationProtocol", HFILL }},
958 { &hf_rtse_connectionDataAC,
959 { "connectionDataAC", "rtse.connectionDataAC",
960 FT_UINT32, BASE_DEC, VALS(rtse_ConnectionData_vals), 0,
961 "rtse.ConnectionData", HFILL }},
962 { &hf_rtse_refuseReason,
963 { "refuseReason", "rtse.refuseReason",
964 FT_INT32, BASE_DEC, VALS(rtse_RefuseReason_vals), 0,
965 "rtse.RefuseReason", HFILL }},
966 { &hf_rtse_userDataRJ,
967 { "userDataRJ", "rtse.userDataRJ",
968 FT_NONE, BASE_NONE, NULL, 0,
969 "rtse.T_userDataRJ", HFILL }},
970 { &hf_rtse_abortReason,
971 { "abortReason", "rtse.abortReason",
972 FT_INT32, BASE_DEC, VALS(rtse_AbortReason_vals), 0,
973 "rtse.AbortReason", HFILL }},
974 { &hf_rtse_reflectedParameter,
975 { "reflectedParameter", "rtse.reflectedParameter",
976 FT_BYTES, BASE_HEX, NULL, 0,
977 "rtse.BIT_STRING", HFILL }},
978 { &hf_rtse_userdataAB,
979 { "userdataAB", "rtse.userdataAB",
980 FT_NONE, BASE_NONE, NULL, 0,
981 "rtse.T_userdataAB", HFILL }},
983 { "open", "rtse.open",
984 FT_NONE, BASE_NONE, NULL, 0,
985 "rtse.T_open", HFILL }},
987 { "recover", "rtse.recover",
988 FT_NONE, BASE_NONE, NULL, 0,
989 "rtse.SessionConnectionIdentifier", HFILL }},
990 { &hf_rtse_callingSSuserReference,
991 { "callingSSuserReference", "rtse.callingSSuserReference",
992 FT_UINT32, BASE_DEC, VALS(rtse_CallingSSuserReference_vals), 0,
993 "rtse.CallingSSuserReference", HFILL }},
994 { &hf_rtse_commonReference,
995 { "commonReference", "rtse.commonReference",
996 FT_STRING, BASE_NONE, NULL, 0,
997 "rtse.CommonReference", HFILL }},
998 { &hf_rtse_additionalReferenceInformation,
999 { "additionalReferenceInformation", "rtse.additionalReferenceInformation",
1000 FT_STRING, BASE_NONE, NULL, 0,
1001 "rtse.AdditionalReferenceInformation", HFILL }},
1002 { &hf_rtse_t61String,
1003 { "t61String", "rtse.t61String",
1004 FT_STRING, BASE_NONE, NULL, 0,
1005 "rtse.T61String", HFILL }},
1006 { &hf_rtse_octetString,
1007 { "octetString", "rtse.octetString",
1008 FT_BYTES, BASE_HEX, NULL, 0,
1009 "rtse.OCTET_STRING", HFILL }},
1010 { &hf_rtse_direct_reference,
1011 { "direct-reference", "rtse.direct_reference",
1012 FT_OID, BASE_NONE, NULL, 0,
1013 "rtse.OBJECT_IDENTIFIER", HFILL }},
1014 { &hf_rtse_indirect_reference,
1015 { "indirect-reference", "rtse.indirect_reference",
1016 FT_INT32, BASE_DEC, NULL, 0,
1017 "rtse.T_indirect_reference", HFILL }},
1018 { &hf_rtse_data_value_descriptor,
1019 { "data-value-descriptor", "rtse.data_value_descriptor",
1020 FT_STRING, BASE_NONE, NULL, 0,
1021 "rtse.ObjectDescriptor", HFILL }},
1022 { &hf_rtse_encoding,
1023 { "encoding", "rtse.encoding",
1024 FT_UINT32, BASE_DEC, VALS(rtse_T_encoding_vals), 0,
1025 "rtse.T_encoding", HFILL }},
1026 { &hf_rtse_single_ASN1_type,
1027 { "single-ASN1-type", "rtse.single_ASN1_type",
1028 FT_NONE, BASE_NONE, NULL, 0,
1029 "rtse.T_single_ASN1_type", HFILL }},
1030 { &hf_rtse_octet_aligned,
1031 { "octet-aligned", "rtse.octet_aligned",
1032 FT_BYTES, BASE_HEX, NULL, 0,
1033 "rtse.OCTET_STRING", HFILL }},
1034 { &hf_rtse_arbitrary,
1035 { "arbitrary", "rtse.arbitrary",
1036 FT_BYTES, BASE_HEX, NULL, 0,
1037 "rtse.BIT_STRING", HFILL }},
1039 /*--- End of included file: packet-rtse-hfarr.c ---*/
1040 #line 182 "packet-rtse-template.c"
1043 /* List of subtrees */
1044 static gint *ett[] = {
1048 /*--- Included file: packet-rtse-ettarr.c ---*/
1049 #line 1 "packet-rtse-ettarr.c"
1050 &ett_rtse_RTSE_apdus,
1051 &ett_rtse_RTORQapdu,
1052 &ett_rtse_RTOACapdu,
1053 &ett_rtse_RTORJapdu,
1055 &ett_rtse_ConnectionData,
1056 &ett_rtse_SessionConnectionIdentifier,
1057 &ett_rtse_CallingSSuserReference,
1059 &ett_rtse_T_encoding,
1061 /*--- End of included file: packet-rtse-ettarr.c ---*/
1062 #line 189 "packet-rtse-template.c"
1065 /* Register protocol */
1066 proto_rtse = proto_register_protocol(PNAME, PSNAME, PFNAME);
1067 register_dissector("rtse", dissect_rtse, proto_rtse);
1068 /* Register fields and subtrees */
1069 proto_register_field_array(proto_rtse, hf, array_length(hf));
1070 proto_register_subtree_array(ett, array_length(ett));
1072 rtse_oid_dissector_table = register_dissector_table("rtse.oid", "RTSE OID Dissectors", FT_STRING, BASE_NONE);
1073 oid_table=g_hash_table_new(g_str_hash, g_str_equal);
1075 rtse_handle = find_dissector("rtse");
1076 ros_handle = find_dissector("ros");
1081 /*--- proto_reg_handoff_rtse --- */
1082 void proto_reg_handoff_rtse(void) {