1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler */
4 /* ../../tools/asn2eth.py -X -b -e -p rtse -c rtse.cnf -s packet-rtse-template rtse.asn */
6 /* Input file: packet-rtse-template.c */
9 * Routines for RTSE packet dissection
14 * Ethereal - Network traffic analyzer
15 * By Gerald Combs <gerald@ethereal.com>
16 * Copyright 1998 Gerald Combs
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 #include <epan/packet.h>
39 #include <epan/conversation.h>
44 #include "packet-ber.h"
45 #include "packet-pres.h"
46 #include "packet-acse.h"
47 #include "packet-ros.h"
48 #include "packet-rtse.h"
50 #define PNAME "X.228 OSI Reliable Transfer Service"
54 /* Initialize the protocol and registered fields */
57 static struct SESSION_DATA_STRUCTURE* session = NULL;
59 static char object_identifier_id[MAX_OID_STR_LEN];
60 static gboolean open_request=FALSE;
61 /* indirect_reference, used to pick up the signalling so we know what
62 kind of data is transferred in SES_DATA_TRANSFER_PDUs */
63 static guint32 indir_ref=0;
64 static guint32 app_proto=0;
66 static proto_tree *top_tree=NULL;
68 static dissector_handle_t rtse_handle = NULL;
69 static dissector_handle_t ros_handle = NULL;
72 /*--- Included file: packet-rtse-hf.c ---*/
74 static int hf_rtse_rtorq_apdu = -1; /* RTORQapdu */
75 static int hf_rtse_rtoac_apdu = -1; /* RTOACapdu */
76 static int hf_rtse_rtorj_apdu = -1; /* RTORJapdu */
77 static int hf_rtse_rttp_apdu = -1; /* RTTPapdu */
78 static int hf_rtse_rttr_apdu = -1; /* RTTRapdu */
79 static int hf_rtse_rtab_apdu = -1; /* RTABapdu */
80 static int hf_rtse_checkpointSize = -1; /* INTEGER */
81 static int hf_rtse_windowSize = -1; /* INTEGER */
82 static int hf_rtse_dialogueMode = -1; /* T_dialogueMode */
83 static int hf_rtse_connectionDataRQ = -1; /* ConnectionData */
84 static int hf_rtse_applicationProtocol = -1; /* T_applicationProtocol */
85 static int hf_rtse_connectionDataAC = -1; /* ConnectionData */
86 static int hf_rtse_refuseReason = -1; /* RefuseReason */
87 static int hf_rtse_userDataRJ = -1; /* T_userDataRJ */
88 static int hf_rtse_abortReason = -1; /* AbortReason */
89 static int hf_rtse_reflectedParameter = -1; /* BIT_STRING */
90 static int hf_rtse_userdataAB = -1; /* T_userdataAB */
91 static int hf_rtse_open = -1; /* T_open */
92 static int hf_rtse_recover = -1; /* SessionConnectionIdentifier */
93 static int hf_rtse_callingSSuserReference = -1; /* CallingSSuserReference */
94 static int hf_rtse_commonReference = -1; /* CommonReference */
95 static int hf_rtse_additionalReferenceInformation = -1; /* AdditionalReferenceInformation */
96 static int hf_rtse_t61String = -1; /* T61String */
97 static int hf_rtse_octetString = -1; /* OCTET_STRING */
98 static int hf_rtse_direct_reference = -1; /* OBJECT_IDENTIFIER */
99 static int hf_rtse_indirect_reference = -1; /* T_indirect_reference */
100 static int hf_rtse_data_value_descriptor = -1; /* ObjectDescriptor */
101 static int hf_rtse_encoding = -1; /* T_encoding */
102 static int hf_rtse_single_ASN1_type = -1; /* T_single_ASN1_type */
103 static int hf_rtse_octet_aligned = -1; /* OCTET_STRING */
104 static int hf_rtse_arbitrary = -1; /* BIT_STRING */
106 /*--- End of included file: packet-rtse-hf.c ---*/
109 /* Initialize the subtree pointers */
110 static gint ett_rtse = -1;
112 /*--- Included file: packet-rtse-ett.c ---*/
114 static gint ett_rtse_RTSE_apdus = -1;
115 static gint ett_rtse_RTORQapdu = -1;
116 static gint ett_rtse_RTOACapdu = -1;
117 static gint ett_rtse_RTORJapdu = -1;
118 static gint ett_rtse_RTABapdu = -1;
119 static gint ett_rtse_ConnectionData = -1;
120 static gint ett_rtse_SessionConnectionIdentifier = -1;
121 static gint ett_rtse_CallingSSuserReference = -1;
122 static gint ett_rtse_EXTERNAL = -1;
123 static gint ett_rtse_T_encoding = -1;
125 /*--- End of included file: packet-rtse-ett.c ---*/
129 static dissector_table_t rtse_oid_dissector_table=NULL;
130 static GHashTable *oid_table=NULL;
131 static gint ett_rtse_unknown = -1;
134 register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_ros)
137 /* save the name - but not used */
138 g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
140 /* register RTSE with the BER (ACSE) */
141 register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
144 /* make sure we call ROS ... */
145 dissector_add_string("rtse.oid", oid, ros_handle);
147 /* and then tell ROS how to dissect the AS*/
148 register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
151 /* otherwise we just remember how to dissect the AS */
152 dissector_add_string("rtse.oid", oid, dissector);
157 call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
161 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
162 if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree)){
163 proto_item *item=NULL;
164 proto_tree *next_tree=NULL;
166 item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "RTSE: Dissector for OID:%s not implemented. Contact Ethereal developers if you want this supported", oid);
168 next_tree=proto_item_add_subtree(item, ett_rtse_unknown);
170 dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
173 /*XXX until we change the #.REGISTER signature for _PDU()s
174 * into new_dissector_t we have to do this kludge with
175 * manually step past the content in the ANY type.
177 offset+=tvb_length_remaining(tvb, offset);
183 /*--- Included file: packet-rtse-fn.c ---*/
185 /*--- Fields for imported types ---*/
191 dissect_rtse_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
192 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
197 static int dissect_checkpointSize_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
198 return dissect_rtse_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_rtse_checkpointSize);
200 static int dissect_windowSize_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
201 return dissect_rtse_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_rtse_windowSize);
205 static const value_string rtse_T_dialogueMode_vals[] = {
213 dissect_rtse_T_dialogueMode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
214 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
219 static int dissect_dialogueMode_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
220 return dissect_rtse_T_dialogueMode(TRUE, tvb, offset, pinfo, tree, hf_rtse_dialogueMode);
226 dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
231 case 1: /* mts-transfer-protocol-1984 */
232 oid = "applicationProtocol.1";
234 case 12: /* mts-transfer-protocol */
235 oid = "applicationProtocol.12";
238 if(session && session->pres_ctx_id)
239 oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
243 if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
244 oid = "applicationProtocol.12";
248 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
251 /* else XXX: need to flag we can't find the presentation context */
256 static int dissect_open(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
257 return dissect_rtse_T_open(FALSE, tvb, offset, pinfo, tree, hf_rtse_open);
263 dissect_rtse_T61String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
264 tvbuff_t *string = NULL;
265 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString,
266 pinfo, tree, tvb, offset, hf_index,
269 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
270 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
275 static int dissect_t61String(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
276 return dissect_rtse_T61String(FALSE, tvb, offset, pinfo, tree, hf_rtse_t61String);
282 dissect_rtse_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
283 tvbuff_t *string = NULL;
284 offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
287 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
288 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
293 static int dissect_octetString(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
294 return dissect_rtse_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_rtse_octetString);
296 static int dissect_octet_aligned_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
297 return dissect_rtse_OCTET_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_octet_aligned);
301 static const value_string rtse_CallingSSuserReference_vals[] = {
303 { 1, "octetString" },
307 static const ber_choice_t CallingSSuserReference_choice[] = {
308 { 0, BER_CLASS_UNI, BER_UNI_TAG_TeletexString, BER_FLAGS_NOOWNTAG, dissect_t61String },
309 { 1, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_octetString },
314 dissect_rtse_CallingSSuserReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
315 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
316 CallingSSuserReference_choice, hf_index, ett_rtse_CallingSSuserReference,
321 static int dissect_callingSSuserReference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
322 return dissect_rtse_CallingSSuserReference(FALSE, tvb, offset, pinfo, tree, hf_rtse_callingSSuserReference);
328 dissect_rtse_CommonReference(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
329 tvbuff_t *string = NULL;
330 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTCTime,
331 pinfo, tree, tvb, offset, hf_index,
334 if(open_request && string && check_col(pinfo->cinfo, COL_INFO))
335 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_length(string)));
340 static int dissect_commonReference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
341 return dissect_rtse_CommonReference(FALSE, tvb, offset, pinfo, tree, hf_rtse_commonReference);
347 dissect_rtse_AdditionalReferenceInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
348 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString,
349 pinfo, tree, tvb, offset, hf_index,
354 static int dissect_additionalReferenceInformation_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
355 return dissect_rtse_AdditionalReferenceInformation(TRUE, tvb, offset, pinfo, tree, hf_rtse_additionalReferenceInformation);
359 static const ber_sequence_t SessionConnectionIdentifier_sequence[] = {
360 { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_callingSSuserReference },
361 { BER_CLASS_UNI, BER_UNI_TAG_UTCTime, BER_FLAGS_NOOWNTAG, dissect_commonReference },
362 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_additionalReferenceInformation_impl },
367 dissect_rtse_SessionConnectionIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
368 if(open_request && check_col(pinfo->cinfo, COL_INFO))
369 col_append_fstr(pinfo->cinfo, COL_INFO, "Recover");
370 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
371 SessionConnectionIdentifier_sequence, hf_index, ett_rtse_SessionConnectionIdentifier);
377 static int dissect_recover_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
378 return dissect_rtse_SessionConnectionIdentifier(TRUE, tvb, offset, pinfo, tree, hf_rtse_recover);
382 static const value_string rtse_ConnectionData_vals[] = {
388 static const ber_choice_t ConnectionData_choice[] = {
389 { 0, BER_CLASS_CON, 0, 0, dissect_open },
390 { 1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_recover_impl },
395 dissect_rtse_ConnectionData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
396 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
397 ConnectionData_choice, hf_index, ett_rtse_ConnectionData,
402 static int dissect_connectionDataRQ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
403 return dissect_rtse_ConnectionData(FALSE, tvb, offset, pinfo, tree, hf_rtse_connectionDataRQ);
405 static int dissect_connectionDataAC(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
406 return dissect_rtse_ConnectionData(FALSE, tvb, offset, pinfo, tree, hf_rtse_connectionDataAC);
410 static const value_string rtse_T_applicationProtocol_vals[] = {
411 { 12, "mts-transfer-protocol" },
412 { 1, "mts-transfer-protocol-1984" },
418 dissect_rtse_T_applicationProtocol(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
420 offset = dissect_ber_integer(TRUE, pinfo, tree, tvb, offset, hf_index, &app_proto);
425 static int dissect_applicationProtocol_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
426 return dissect_rtse_T_applicationProtocol(TRUE, tvb, offset, pinfo, tree, hf_rtse_applicationProtocol);
430 static const ber_sequence_t RTORQapdu_set[] = {
431 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_checkpointSize_impl },
432 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_windowSize_impl },
433 { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_dialogueMode_impl },
434 { BER_CLASS_CON, 3, BER_FLAGS_NOTCHKTAG, dissect_connectionDataRQ },
435 { BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_applicationProtocol_impl },
440 dissect_rtse_RTORQapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
442 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
443 session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT);
445 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
446 RTORQapdu_set, hf_index, ett_rtse_RTORQapdu);
453 static int dissect_rtorq_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
454 return dissect_rtse_RTORQapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtorq_apdu);
458 static const ber_sequence_t RTOACapdu_set[] = {
459 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_checkpointSize_impl },
460 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_windowSize_impl },
461 { BER_CLASS_CON, 2, BER_FLAGS_NOTCHKTAG, dissect_connectionDataAC },
466 dissect_rtse_RTOACapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
468 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
469 session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT);
471 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
472 RTOACapdu_set, hf_index, ett_rtse_RTOACapdu);
478 static int dissect_rtoac_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
479 return dissect_rtse_RTOACapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtoac_apdu);
483 static const value_string rtse_RefuseReason_vals[] = {
485 { 1, "cannotRecover" },
486 { 2, "validationFailure" },
487 { 3, "unacceptableDialogueMode" },
493 dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
494 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
499 static int dissect_refuseReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
500 return dissect_rtse_RefuseReason(TRUE, tvb, offset, pinfo, tree, hf_rtse_refuseReason);
506 dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
510 case 1: /* mts-transfer-protocol-1984 */
511 oid = "applicationProtocol.1";
513 case 12: /* mts-transfer-protocol */
514 oid = "applicationProtocol.12";
517 if(session && session->pres_ctx_id)
518 oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
522 if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
523 oid = "applicationProtocol.12";
526 if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
527 session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR);
529 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
535 static int dissect_userDataRJ(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
536 return dissect_rtse_T_userDataRJ(FALSE, tvb, offset, pinfo, tree, hf_rtse_userDataRJ);
540 static const ber_sequence_t RTORJapdu_set[] = {
541 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_refuseReason_impl },
542 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_userDataRJ },
547 dissect_rtse_RTORJapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
548 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
549 RTORJapdu_set, hf_index, ett_rtse_RTORJapdu);
553 static int dissect_rtorj_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
554 return dissect_rtse_RTORJapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtorj_apdu);
560 dissect_rtse_RTTPapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
561 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
566 static int dissect_rttp_apdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
567 return dissect_rtse_RTTPapdu(FALSE, tvb, offset, pinfo, tree, hf_rtse_rttp_apdu);
573 dissect_rtse_RTTRapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
574 tvbuff_t *next_tvb = NULL;
576 offset = dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_index, &next_tvb);
580 /* XXX: we should check is this is an EXTERNAL first */
582 /* ROS won't do this for us */
584 session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
586 offset = dissect_rtse_EXTERNAL(FALSE, next_tvb, 0, pinfo, tree, -1);
593 static int dissect_rttr_apdu(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
594 return dissect_rtse_RTTRapdu(FALSE, tvb, offset, pinfo, tree, hf_rtse_rttr_apdu);
598 static const value_string rtse_AbortReason_vals[] = {
599 { 0, "localSystemProblem" },
600 { 1, "invalidParameter" },
601 { 2, "unrecognizedActivity" },
602 { 3, "temporaryProblem" },
603 { 4, "protocolError" },
604 { 5, "permanentProblem" },
606 { 7, "transferCompleted" },
612 dissect_rtse_AbortReason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
613 offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
618 static int dissect_abortReason_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
619 return dissect_rtse_AbortReason(TRUE, tvb, offset, pinfo, tree, hf_rtse_abortReason);
625 dissect_rtse_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
626 offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
632 static int dissect_reflectedParameter_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
633 return dissect_rtse_BIT_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_reflectedParameter);
635 static int dissect_arbitrary_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
636 return dissect_rtse_BIT_STRING(TRUE, tvb, offset, pinfo, tree, hf_rtse_arbitrary);
642 dissect_rtse_T_userdataAB(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
643 /*XXX not implemented yet */
648 static int dissect_userdataAB(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
649 return dissect_rtse_T_userdataAB(FALSE, tvb, offset, pinfo, tree, hf_rtse_userdataAB);
653 static const ber_sequence_t RTABapdu_set[] = {
654 { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_abortReason_impl },
655 { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_reflectedParameter_impl },
656 { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL, dissect_userdataAB },
661 dissect_rtse_RTABapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
662 offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
663 RTABapdu_set, hf_index, ett_rtse_RTABapdu);
667 static int dissect_rtab_apdu_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
668 return dissect_rtse_RTABapdu(TRUE, tvb, offset, pinfo, tree, hf_rtse_rtab_apdu);
672 static const value_string rtse_RTSE_apdus_vals[] = {
682 static const ber_choice_t RTSE_apdus_choice[] = {
683 { 0, BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_rtorq_apdu_impl },
684 { 1, BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_rtoac_apdu_impl },
685 { 2, BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_rtorj_apdu_impl },
686 { 3, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_rttp_apdu },
687 { 4, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_rttr_apdu },
688 { 5, BER_CLASS_CON, 22, BER_FLAGS_IMPLTAG, dissect_rtab_apdu_impl },
693 dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
694 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
695 RTSE_apdus_choice, hf_index, ett_rtse_RTSE_apdus,
704 dissect_rtse_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
705 offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
709 static int dissect_direct_reference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
710 return dissect_rtse_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_rtse_direct_reference);
716 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_) {
719 offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset,
720 hf_rtse_indirect_reference,
723 /* look up the indirect reference */
724 if((oid = find_oid_by_pres_ctx_id(pinfo, indir_ref)) != NULL) {
725 g_snprintf(object_identifier_id, MAX_OID_STR_LEN, "%s", oid);
732 static int dissect_indirect_reference(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
733 return dissect_rtse_T_indirect_reference(FALSE, tvb, offset, pinfo, tree, hf_rtse_indirect_reference);
739 dissect_rtse_ObjectDescriptor(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
740 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_ObjectDescriptor,
741 pinfo, tree, tvb, offset, hf_index,
746 static int dissect_data_value_descriptor(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
747 return dissect_rtse_ObjectDescriptor(FALSE, tvb, offset, pinfo, tree, hf_rtse_data_value_descriptor);
753 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_) {
754 offset=call_rtse_oid_callback(object_identifier_id, tvb, offset, pinfo, top_tree);
760 static int dissect_single_ASN1_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
761 return dissect_rtse_T_single_ASN1_type(FALSE, tvb, offset, pinfo, tree, hf_rtse_single_ASN1_type);
765 static const value_string rtse_T_encoding_vals[] = {
766 { 0, "single-ASN1-type" },
767 { 1, "octet-aligned" },
772 static const ber_choice_t T_encoding_choice[] = {
773 { 0, BER_CLASS_CON, 0, 0, dissect_single_ASN1_type },
774 { 1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_octet_aligned_impl },
775 { 2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_arbitrary_impl },
780 dissect_rtse_T_encoding(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
781 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
782 T_encoding_choice, hf_index, ett_rtse_T_encoding,
787 static int dissect_encoding(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
788 return dissect_rtse_T_encoding(FALSE, tvb, offset, pinfo, tree, hf_rtse_encoding);
792 static const ber_sequence_t EXTERNAL_sequence[] = {
793 { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_direct_reference },
794 { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_indirect_reference },
795 { BER_CLASS_UNI, BER_UNI_TAG_ObjectDescriptor, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_data_value_descriptor },
796 { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_encoding },
801 dissect_rtse_EXTERNAL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
803 gboolean pc, ind_field;
808 /* XXX asn2eth can not yet handle tagged assignment so for the
809 * time being just remove this tag manually inside the EXTERNAL
812 offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
813 offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
816 offset = dissect_ber_sequence(TRUE, pinfo, tree, tvb, offset,
817 EXTERNAL_sequence, hf_index, ett_rtse_EXTERNAL);
824 /*--- End of included file: packet-rtse-fn.c ---*/
828 * Dissect RTSE PDUs inside a PPDU.
831 dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
835 proto_item *item=NULL;
836 proto_tree *tree=NULL;
838 /* save parent_tree so subdissectors can create new top nodes */
839 top_tree=parent_tree;
841 /* do we have application context from the acse dissector? */
842 if( !pinfo->private_data ){
844 proto_tree_add_text(parent_tree, tvb, offset, -1,
845 "Internal error:can't get application context from ACSE dissector.");
849 session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
854 item = proto_tree_add_item(parent_tree, proto_rtse, tvb, 0, -1, FALSE);
855 tree = proto_item_add_subtree(item, ett_rtse);
857 if (check_col(pinfo->cinfo, COL_PROTOCOL))
858 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE");
859 if (check_col(pinfo->cinfo, COL_INFO))
860 col_clear(pinfo->cinfo, COL_INFO);
862 while (tvb_reported_length_remaining(tvb, offset) > 0){
864 offset=dissect_rtse_RTSE_apdus(FALSE, tvb, offset, pinfo , tree, -1);
865 if(offset == old_offset){
866 proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte RTSE PDU");
867 offset = tvb_length(tvb);
876 /*--- proto_register_rtse -------------------------------------------*/
877 void proto_register_rtse(void) {
880 static hf_register_info hf[] =
883 /*--- Included file: packet-rtse-hfarr.c ---*/
885 { &hf_rtse_rtorq_apdu,
886 { "rtorq-apdu", "rtse.rtorq_apdu",
887 FT_NONE, BASE_NONE, NULL, 0,
888 "RTSE-apdus/rtorq-apdu", HFILL }},
889 { &hf_rtse_rtoac_apdu,
890 { "rtoac-apdu", "rtse.rtoac_apdu",
891 FT_NONE, BASE_NONE, NULL, 0,
892 "RTSE-apdus/rtoac-apdu", HFILL }},
893 { &hf_rtse_rtorj_apdu,
894 { "rtorj-apdu", "rtse.rtorj_apdu",
895 FT_NONE, BASE_NONE, NULL, 0,
896 "RTSE-apdus/rtorj-apdu", HFILL }},
897 { &hf_rtse_rttp_apdu,
898 { "rttp-apdu", "rtse.rttp_apdu",
899 FT_INT32, BASE_DEC, NULL, 0,
900 "RTSE-apdus/rttp-apdu", HFILL }},
901 { &hf_rtse_rttr_apdu,
902 { "rttr-apdu", "rtse.rttr_apdu",
903 FT_BYTES, BASE_HEX, NULL, 0,
904 "RTSE-apdus/rttr-apdu", HFILL }},
905 { &hf_rtse_rtab_apdu,
906 { "rtab-apdu", "rtse.rtab_apdu",
907 FT_NONE, BASE_NONE, NULL, 0,
908 "RTSE-apdus/rtab-apdu", HFILL }},
909 { &hf_rtse_checkpointSize,
910 { "checkpointSize", "rtse.checkpointSize",
911 FT_INT32, BASE_DEC, NULL, 0,
913 { &hf_rtse_windowSize,
914 { "windowSize", "rtse.windowSize",
915 FT_INT32, BASE_DEC, NULL, 0,
917 { &hf_rtse_dialogueMode,
918 { "dialogueMode", "rtse.dialogueMode",
919 FT_INT32, BASE_DEC, VALS(rtse_T_dialogueMode_vals), 0,
920 "RTORQapdu/dialogueMode", HFILL }},
921 { &hf_rtse_connectionDataRQ,
922 { "connectionDataRQ", "rtse.connectionDataRQ",
923 FT_UINT32, BASE_DEC, VALS(rtse_ConnectionData_vals), 0,
924 "RTORQapdu/connectionDataRQ", HFILL }},
925 { &hf_rtse_applicationProtocol,
926 { "applicationProtocol", "rtse.applicationProtocol",
927 FT_INT32, BASE_DEC, VALS(rtse_T_applicationProtocol_vals), 0,
928 "RTORQapdu/applicationProtocol", HFILL }},
929 { &hf_rtse_connectionDataAC,
930 { "connectionDataAC", "rtse.connectionDataAC",
931 FT_UINT32, BASE_DEC, VALS(rtse_ConnectionData_vals), 0,
932 "RTOACapdu/connectionDataAC", HFILL }},
933 { &hf_rtse_refuseReason,
934 { "refuseReason", "rtse.refuseReason",
935 FT_INT32, BASE_DEC, VALS(rtse_RefuseReason_vals), 0,
936 "RTORJapdu/refuseReason", HFILL }},
937 { &hf_rtse_userDataRJ,
938 { "userDataRJ", "rtse.userDataRJ",
939 FT_NONE, BASE_NONE, NULL, 0,
940 "RTORJapdu/userDataRJ", HFILL }},
941 { &hf_rtse_abortReason,
942 { "abortReason", "rtse.abortReason",
943 FT_INT32, BASE_DEC, VALS(rtse_AbortReason_vals), 0,
944 "RTABapdu/abortReason", HFILL }},
945 { &hf_rtse_reflectedParameter,
946 { "reflectedParameter", "rtse.reflectedParameter",
947 FT_BYTES, BASE_HEX, NULL, 0,
948 "RTABapdu/reflectedParameter", HFILL }},
949 { &hf_rtse_userdataAB,
950 { "userdataAB", "rtse.userdataAB",
951 FT_NONE, BASE_NONE, NULL, 0,
952 "RTABapdu/userdataAB", HFILL }},
954 { "open", "rtse.open",
955 FT_NONE, BASE_NONE, NULL, 0,
956 "ConnectionData/open", HFILL }},
958 { "recover", "rtse.recover",
959 FT_NONE, BASE_NONE, NULL, 0,
960 "ConnectionData/recover", HFILL }},
961 { &hf_rtse_callingSSuserReference,
962 { "callingSSuserReference", "rtse.callingSSuserReference",
963 FT_UINT32, BASE_DEC, VALS(rtse_CallingSSuserReference_vals), 0,
964 "SessionConnectionIdentifier/callingSSuserReference", HFILL }},
965 { &hf_rtse_commonReference,
966 { "commonReference", "rtse.commonReference",
967 FT_STRING, BASE_NONE, NULL, 0,
968 "SessionConnectionIdentifier/commonReference", HFILL }},
969 { &hf_rtse_additionalReferenceInformation,
970 { "additionalReferenceInformation", "rtse.additionalReferenceInformation",
971 FT_STRING, BASE_NONE, NULL, 0,
972 "SessionConnectionIdentifier/additionalReferenceInformation", HFILL }},
973 { &hf_rtse_t61String,
974 { "t61String", "rtse.t61String",
975 FT_STRING, BASE_NONE, NULL, 0,
976 "CallingSSuserReference/t61String", HFILL }},
977 { &hf_rtse_octetString,
978 { "octetString", "rtse.octetString",
979 FT_BYTES, BASE_HEX, NULL, 0,
980 "CallingSSuserReference/octetString", HFILL }},
981 { &hf_rtse_direct_reference,
982 { "direct-reference", "rtse.direct_reference",
983 FT_STRING, BASE_NONE, NULL, 0,
984 "EXTERNAL/direct-reference", HFILL }},
985 { &hf_rtse_indirect_reference,
986 { "indirect-reference", "rtse.indirect_reference",
987 FT_INT32, BASE_DEC, NULL, 0,
988 "EXTERNAL/indirect-reference", HFILL }},
989 { &hf_rtse_data_value_descriptor,
990 { "data-value-descriptor", "rtse.data_value_descriptor",
991 FT_STRING, BASE_NONE, NULL, 0,
992 "EXTERNAL/data-value-descriptor", HFILL }},
994 { "encoding", "rtse.encoding",
995 FT_UINT32, BASE_DEC, VALS(rtse_T_encoding_vals), 0,
996 "EXTERNAL/encoding", HFILL }},
997 { &hf_rtse_single_ASN1_type,
998 { "single-ASN1-type", "rtse.single_ASN1_type",
999 FT_NONE, BASE_NONE, NULL, 0,
1000 "EXTERNAL/encoding/single-ASN1-type", HFILL }},
1001 { &hf_rtse_octet_aligned,
1002 { "octet-aligned", "rtse.octet_aligned",
1003 FT_BYTES, BASE_HEX, NULL, 0,
1004 "EXTERNAL/encoding/octet-aligned", HFILL }},
1005 { &hf_rtse_arbitrary,
1006 { "arbitrary", "rtse.arbitrary",
1007 FT_BYTES, BASE_HEX, NULL, 0,
1008 "EXTERNAL/encoding/arbitrary", HFILL }},
1010 /*--- End of included file: packet-rtse-hfarr.c ---*/
1014 /* List of subtrees */
1015 static gint *ett[] = {
1019 /*--- Included file: packet-rtse-ettarr.c ---*/
1021 &ett_rtse_RTSE_apdus,
1022 &ett_rtse_RTORQapdu,
1023 &ett_rtse_RTOACapdu,
1024 &ett_rtse_RTORJapdu,
1026 &ett_rtse_ConnectionData,
1027 &ett_rtse_SessionConnectionIdentifier,
1028 &ett_rtse_CallingSSuserReference,
1030 &ett_rtse_T_encoding,
1032 /*--- End of included file: packet-rtse-ettarr.c ---*/
1036 /* Register protocol */
1037 proto_rtse = proto_register_protocol(PNAME, PSNAME, PFNAME);
1038 register_dissector("rtse", dissect_rtse, proto_rtse);
1039 /* Register fields and subtrees */
1040 proto_register_field_array(proto_rtse, hf, array_length(hf));
1041 proto_register_subtree_array(ett, array_length(ett));
1043 rtse_oid_dissector_table = register_dissector_table("rtse.oid", "RTSE OID Dissectors", FT_STRING, BASE_NONE);
1044 oid_table=g_hash_table_new(g_str_hash, g_str_equal);
1049 /*--- proto_reg_handoff_rtse --- */
1050 void proto_reg_handoff_rtse(void) {
1052 rtse_handle = find_dissector("rtse");
1053 ros_handle = find_dissector("ros");