From Graeme Lunt:
[obnox/wireshark/wip.git] / epan / dissectors / packet-rtse.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
3 /* .\packet-rtse.c                                                            */
4 /* ../../tools/asn2eth.py -X -b -e -p rtse -c rtse.cnf -s packet-rtse-template rtse.asn */
5
6 /* Input file: packet-rtse-template.c */
7
8 /* packet-rtse_asn1.c
9  * Routines for RTSE packet dissection
10  * Graeme Lunt 2005
11  *
12  * $Id$
13  *
14  * Ethereal - Network traffic analyzer
15  * By Gerald Combs <gerald@ethereal.com>
16  * Copyright 1998 Gerald Combs
17  *
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.
22  *
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.
27  *
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.
31  */
32
33 #ifdef HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #include <glib.h>
38 #include <epan/packet.h>
39 #include <epan/conversation.h>
40
41 #include <stdio.h>
42 #include <string.h>
43
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"
49
50 #define PNAME  "X.228 OSI Reliable Transfer Service"
51 #define PSNAME "RTSE"
52 #define PFNAME "rtse"
53
54 /* Initialize the protocol and registered fields */
55 int proto_rtse = -1;
56
57 static struct SESSION_DATA_STRUCTURE* session = NULL;
58
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;
65
66 static proto_tree *top_tree=NULL;
67
68 static  dissector_handle_t rtse_handle = NULL;
69 static  dissector_handle_t ros_handle = NULL;
70
71
72 /*--- Included file: packet-rtse-hf.c ---*/
73
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 */
105
106 /*--- End of included file: packet-rtse-hf.c ---*/
107
108
109 /* Initialize the subtree pointers */
110 static gint ett_rtse = -1;
111
112 /*--- Included file: packet-rtse-ett.c ---*/
113
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;
124
125 /*--- End of included file: packet-rtse-ett.c ---*/
126
127
128
129 static dissector_table_t rtse_oid_dissector_table=NULL;
130 static GHashTable *oid_table=NULL;
131 static gint ett_rtse_unknown = -1;
132
133 void
134 register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_ros)
135 {
136
137   /* save the name - but not used */
138   g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
139
140   /* register RTSE with the BER (ACSE) */
141   register_ber_oid_dissector_handle(oid, rtse_handle, proto, name);
142
143   if(uses_ros) {
144     /* make sure we call ROS ... */
145     dissector_add_string("rtse.oid", oid, ros_handle);
146
147     /* and then tell ROS how to dissect the AS*/
148     register_ros_oid_dissector_handle(oid, dissector, proto, name, TRUE);
149
150   } else {
151     /* otherwise we just remember how to dissect the AS */
152     dissector_add_string("rtse.oid", oid, dissector);
153   }
154 }
155
156 static int
157 call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
158 {
159         tvbuff_t *next_tvb;
160
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;
165
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);
167                 if(item){
168                         next_tree=proto_item_add_subtree(item, ett_rtse_unknown);
169                 }
170                 dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
171         }
172
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.
176          */
177         offset+=tvb_length_remaining(tvb, offset);
178
179         return offset;
180 }
181
182
183 /*--- Included file: packet-rtse-fn.c ---*/
184
185 /*--- Fields for imported types ---*/
186
187
188
189
190 static int
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,
193                                   NULL);
194
195   return offset;
196 }
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);
199 }
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);
202 }
203
204
205 static const value_string rtse_T_dialogueMode_vals[] = {
206   {   0, "monologue" },
207   {   1, "twa" },
208   { 0, NULL }
209 };
210
211
212 static int
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,
215                                   NULL);
216
217   return offset;
218 }
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);
221 }
222
223
224
225 static int
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_) {
227
228         char *oid = NULL;
229
230         switch(app_proto)  {
231         case 1:         /* mts-transfer-protocol-1984 */
232                 oid = "applicationProtocol.1";
233                 break;
234         case 12:        /* mts-transfer-protocol */
235                 oid = "applicationProtocol.12";
236                 break;
237         default:
238                 if(session && session->pres_ctx_id)
239                         oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
240                 break;
241         }
242         
243         if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
244                 oid = "applicationProtocol.12";
245
246         if(oid) {
247
248                 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
249         }
250
251         /* else XXX: need to flag we can't find the presentation context */
252
253
254   return offset;
255 }
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);
258 }
259
260
261
262 static int
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,
267                                             &string);
268
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)));
271
272
273   return offset;
274 }
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);
277 }
278
279
280
281 static int
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,
285                                        &string);
286
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)));
289
290
291   return offset;
292 }
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);
295 }
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);
298 }
299
300
301 static const value_string rtse_CallingSSuserReference_vals[] = {
302   {   0, "t61String" },
303   {   1, "octetString" },
304   { 0, NULL }
305 };
306
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 },
310   { 0, 0, 0, 0, NULL }
311 };
312
313 static int
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,
317                                  NULL);
318
319   return offset;
320 }
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);
323 }
324
325
326
327 static int
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,
332                                             &string);
333
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)));
336
337
338   return offset;
339 }
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);
342 }
343
344
345
346 static int
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,
350                                             NULL);
351
352   return offset;
353 }
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);
356 }
357
358
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 },
363   { 0, 0, 0, NULL }
364 };
365
366 static int
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);
372
373
374
375   return offset;
376 }
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);
379 }
380
381
382 static const value_string rtse_ConnectionData_vals[] = {
383   {   0, "open" },
384   {   1, "recover" },
385   { 0, NULL }
386 };
387
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 },
391   { 0, 0, 0, 0, NULL }
392 };
393
394 static int
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,
398                                  NULL);
399
400   return offset;
401 }
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);
404 }
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);
407 }
408
409
410 static const value_string rtse_T_applicationProtocol_vals[] = {
411   {  12, "mts-transfer-protocol" },
412   {   1, "mts-transfer-protocol-1984" },
413   { 0, NULL }
414 };
415
416
417 static int
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_) {
419
420   offset = dissect_ber_integer(TRUE, pinfo, tree, tvb, offset, hf_index, &app_proto);
421
422
423   return offset;
424 }
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);
427 }
428
429
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 },
436   { 0, 0, 0, NULL }
437 };
438
439 int
440 dissect_rtse_RTORQapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
441
442   if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
443         session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT);
444   open_request=TRUE;
445     offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
446                               RTORQapdu_set, hf_index, ett_rtse_RTORQapdu);
447
448   open_request=FALSE;
449
450
451   return offset;
452 }
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);
455 }
456
457
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 },
462   { 0, 0, 0, NULL }
463 };
464
465 int
466 dissect_rtse_RTOACapdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
467
468   if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
469         session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT);
470
471     offset = dissect_ber_set(implicit_tag, pinfo, tree, tvb, offset,
472                               RTOACapdu_set, hf_index, ett_rtse_RTOACapdu);
473
474
475
476   return offset;
477 }
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);
480 }
481
482
483 static const value_string rtse_RefuseReason_vals[] = {
484   {   0, "rtsBusy" },
485   {   1, "cannotRecover" },
486   {   2, "validationFailure" },
487   {   3, "unacceptableDialogueMode" },
488   { 0, NULL }
489 };
490
491
492 static int
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,
495                                   NULL);
496
497   return offset;
498 }
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);
501 }
502
503
504
505 static int
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_) {
507         char *oid = NULL;
508
509         switch(app_proto)  {
510         case 1:         /* mts-transfer-protocol-1984 */
511                 oid = "applicationProtocol.1";
512                 break;
513         case 12:        /* mts-transfer-protocol */
514                 oid = "applicationProtocol.12";
515                 break;
516         default:
517                 if(session && session->pres_ctx_id)
518                         oid = find_oid_by_pres_ctx_id(pinfo, session->pres_ctx_id);
519                 break;
520         }
521         
522         if(!oid) /* XXX: problem here is we haven't decoded the applicationProtocol yet - so we make assumptions! */
523                 oid = "applicationProtocol.12";
524
525         if(oid) {
526           if((session = (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)) != NULL)
527                 session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR);
528
529                 offset = call_rtse_oid_callback(oid, tvb, offset, pinfo, top_tree ? top_tree : tree);
530         }
531
532
533   return offset;
534 }
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);
537 }
538
539
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 },
543   { 0, 0, 0, NULL }
544 };
545
546 int
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);
550
551   return offset;
552 }
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);
555 }
556
557
558
559 static int
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,
562                                   NULL);
563
564   return offset;
565 }
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);
568 }
569
570
571
572 static int
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;
575
576         offset = dissect_ber_octet_string(FALSE, pinfo, tree, tvb, offset, hf_index, &next_tvb);
577
578         if(next_tvb) {
579
580                 /* XXX: we should check is this is an EXTERNAL first */
581
582                 /* ROS won't do this for us */
583                 if(session)
584                         session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
585
586                 offset = dissect_rtse_EXTERNAL(FALSE, next_tvb, 0, pinfo, tree, -1);
587
588         }
589
590
591   return offset;
592 }
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);
595 }
596
597
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" },
605   {   6, "userError" },
606   {   7, "transferCompleted" },
607   { 0, NULL }
608 };
609
610
611 static int
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,
614                                   NULL);
615
616   return offset;
617 }
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);
620 }
621
622
623
624 static int
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,
627                                     NULL, hf_index, -1,
628                                     NULL);
629
630   return offset;
631 }
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);
634 }
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);
637 }
638
639
640
641 static int
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 */
644
645
646   return offset;
647 }
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);
650 }
651
652
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 },
657   { 0, 0, 0, NULL }
658 };
659
660 int
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);
664
665   return offset;
666 }
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);
669 }
670
671
672 static const value_string rtse_RTSE_apdus_vals[] = {
673   {   0, "rtorq-apdu" },
674   {   1, "rtoac-apdu" },
675   {   2, "rtorj-apdu" },
676   {   3, "rttp-apdu" },
677   {   4, "rttr-apdu" },
678   {   5, "rtab-apdu" },
679   { 0, NULL }
680 };
681
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 },
689   { 0, 0, 0, 0, NULL }
690 };
691
692 static int
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,
696                                  NULL);
697
698   return offset;
699 }
700
701
702
703 static int
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);
706
707   return offset;
708 }
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);
711 }
712
713
714
715 static int
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_) {
717   char *oid;
718
719   offset = dissect_ber_integer(FALSE, pinfo, tree, tvb, offset,
720                 hf_rtse_indirect_reference,
721                 &indir_ref);
722
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);
726   }
727         
728
729
730   return offset;
731 }
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);
734 }
735
736
737
738 static int
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,
742                                             NULL);
743
744   return offset;
745 }
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);
748 }
749
750
751
752 static int
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);
755
756
757
758   return offset;
759 }
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);
762 }
763
764
765 static const value_string rtse_T_encoding_vals[] = {
766   {   0, "single-ASN1-type" },
767   {   1, "octet-aligned" },
768   {   2, "arbitrary" },
769   { 0, NULL }
770 };
771
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 },
776   { 0, 0, 0, 0, NULL }
777 };
778
779 static int
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,
783                                  NULL);
784
785   return offset;
786 }
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);
789 }
790
791
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 },
797   { 0, 0, 0, NULL }
798 };
799
800 int
801 dissect_rtse_EXTERNAL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
802   gint8 class;
803   gboolean pc, ind_field;
804   gint32 tag;
805   guint32 len1;
806
807   if(!implicit_tag) {
808     /* XXX  asn2eth can not yet handle tagged assignment so for the
809      * time being  just remove this tag manually inside the EXTERNAL
810      * dissector.
811      */
812      offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
813      offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
814    }
815
816    offset = dissect_ber_sequence(TRUE, pinfo, tree, tvb, offset,
817                                 EXTERNAL_sequence, hf_index, ett_rtse_EXTERNAL);
818
819
820   return offset;
821 }
822
823
824 /*--- End of included file: packet-rtse-fn.c ---*/
825
826
827 /*
828 * Dissect RTSE PDUs inside a PPDU.
829 */
830 static void
831 dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
832 {
833         int offset = 0;
834         int old_offset;
835         proto_item *item=NULL;
836         proto_tree *tree=NULL;
837
838         /* save parent_tree so subdissectors can create new top nodes */
839         top_tree=parent_tree;
840
841         /* do we have application context from the acse dissector?  */
842         if( !pinfo->private_data ){
843                 if(parent_tree){
844                         proto_tree_add_text(parent_tree, tvb, offset, -1,
845                                 "Internal error:can't get application context from ACSE dissector.");
846                 } 
847                 return  ;
848         } else {
849                 session  = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
850
851         }
852
853         if(parent_tree){
854                 item = proto_tree_add_item(parent_tree, proto_rtse, tvb, 0, -1, FALSE);
855                 tree = proto_item_add_subtree(item, ett_rtse);
856         }
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);
861
862         while (tvb_reported_length_remaining(tvb, offset) > 0){
863                 old_offset=offset;
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);
868                         break;
869                 }
870         }
871
872         top_tree = NULL;
873 }
874
875
876 /*--- proto_register_rtse -------------------------------------------*/
877 void proto_register_rtse(void) {
878
879   /* List of fields */
880   static hf_register_info hf[] =
881   {
882
883 /*--- Included file: packet-rtse-hfarr.c ---*/
884
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,
912         "", HFILL }},
913     { &hf_rtse_windowSize,
914       { "windowSize", "rtse.windowSize",
915         FT_INT32, BASE_DEC, NULL, 0,
916         "", HFILL }},
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 }},
953     { &hf_rtse_open,
954       { "open", "rtse.open",
955         FT_NONE, BASE_NONE, NULL, 0,
956         "ConnectionData/open", HFILL }},
957     { &hf_rtse_recover,
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 }},
993     { &hf_rtse_encoding,
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 }},
1009
1010 /*--- End of included file: packet-rtse-hfarr.c ---*/
1011
1012   };
1013
1014   /* List of subtrees */
1015   static gint *ett[] = {
1016     &ett_rtse,
1017     &ett_rtse_unknown,
1018
1019 /*--- Included file: packet-rtse-ettarr.c ---*/
1020
1021     &ett_rtse_RTSE_apdus,
1022     &ett_rtse_RTORQapdu,
1023     &ett_rtse_RTOACapdu,
1024     &ett_rtse_RTORJapdu,
1025     &ett_rtse_RTABapdu,
1026     &ett_rtse_ConnectionData,
1027     &ett_rtse_SessionConnectionIdentifier,
1028     &ett_rtse_CallingSSuserReference,
1029     &ett_rtse_EXTERNAL,
1030     &ett_rtse_T_encoding,
1031
1032 /*--- End of included file: packet-rtse-ettarr.c ---*/
1033
1034   };
1035
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));
1042
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);
1045
1046 }
1047
1048
1049 /*--- proto_reg_handoff_rtse --- */
1050 void proto_reg_handoff_rtse(void) {
1051
1052   rtse_handle = find_dissector("rtse");
1053   ros_handle = find_dissector("ros");
1054 }