Get rid of dissect_ber_boolean_value() and change the signature of
[obnox/wireshark/wip.git] / epan / dissectors / packet-ros.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* packet-ros.c                                                               */
4 /* ../../tools/asn2wrs.py -b -e -p ros -c ros.cnf -s packet-ros-template ros.asn Remote-Operations-Information-Objects.asn */
5
6 /* Input file: packet-ros-template.c */
7
8 #line 1 "packet-ros-template.c"
9 /* packet-ros_asn1.c
10  * Routines for ROS packet dissection
11  * Graeme Lunt 2005
12  *
13  * $Id$
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
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.
23  *
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.
28  *
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.
32  */
33
34 #ifdef HAVE_CONFIG_H
35 # include "config.h"
36 #endif
37
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include <epan/conversation.h>
41 #include <epan/emem.h>
42 #include <epan/asn1.h>
43
44 #include <stdio.h>
45 #include <string.h>
46
47 #include "packet-ber.h"
48 #include "packet-pres.h"
49 #include "packet-ros.h"
50
51 #define PNAME  "X.880 OSI Remote Operations Service"
52 #define PSNAME "ROS"
53 #define PFNAME "ros"
54
55 /* Initialize the protocol and registered fields */
56 int proto_ros = -1;
57
58 static struct SESSION_DATA_STRUCTURE* session = NULL;
59
60 static proto_tree *top_tree=NULL;
61 static guint32 opcode;
62 static guint32 invokeid;
63
64 static  dissector_handle_t ros_handle = NULL;
65
66 typedef struct ros_conv_info_t {
67   struct ros_conv_info_t *next;
68   GHashTable *unmatched; /* unmatched operations */
69   GHashTable *matched;   /* matched operations */
70 } ros_conv_info_t;
71
72 static ros_conv_info_t *ros_info_items = NULL;
73
74 typedef struct ros_call_response {
75   gboolean is_request;
76   guint32 req_frame;
77   nstime_t req_time;
78   guint32 rep_frame;
79   guint invokeId;
80 } ros_call_response_t;
81
82 static int hf_ros_response_in = -1;
83 static int hf_ros_response_to = -1;
84 static int hf_ros_time = -1;
85
86
87
88 /*--- Included file: packet-ros-hf.c ---*/
89 #line 1 "packet-ros-hf.c"
90 static int hf_ros_invoke = -1;                    /* Invoke */
91 static int hf_ros_returnResult = -1;              /* ReturnResult */
92 static int hf_ros_returnError = -1;               /* ReturnError */
93 static int hf_ros_reject = -1;                    /* Reject */
94 static int hf_ros_bind_invoke = -1;               /* T_bind_invoke */
95 static int hf_ros_bind_result = -1;               /* T_bind_result */
96 static int hf_ros_bind_error = -1;                /* T_bind_error */
97 static int hf_ros_unbind_invoke = -1;             /* T_unbind_invoke */
98 static int hf_ros_unbind_result = -1;             /* T_unbind_result */
99 static int hf_ros_unbind_error = -1;              /* T_unbind_error */
100 static int hf_ros_invokeId = -1;                  /* InvokeId */
101 static int hf_ros_linkedId = -1;                  /* INTEGER */
102 static int hf_ros_opcode = -1;                    /* OperationCode */
103 static int hf_ros_argument = -1;                  /* T_argument */
104 static int hf_ros_result = -1;                    /* T_result */
105 static int hf_ros_operationResult = -1;           /* OperationResult */
106 static int hf_ros_errcode = -1;                   /* ErrorCode */
107 static int hf_ros_parameter = -1;                 /* T_parameter */
108 static int hf_ros_problem = -1;                   /* T_problem */
109 static int hf_ros_general = -1;                   /* GeneralProblem */
110 static int hf_ros_invokeProblem = -1;             /* InvokeProblem */
111 static int hf_ros_rejectResult = -1;              /* ReturnResultProblem */
112 static int hf_ros_rejectError = -1;               /* ReturnErrorProblem */
113 static int hf_ros_present = -1;                   /* T_present */
114 static int hf_ros_absent = -1;                    /* NULL */
115 static int hf_ros_local = -1;                     /* INTEGER */
116 static int hf_ros_global = -1;                    /* OBJECT_IDENTIFIER */
117
118 /*--- End of included file: packet-ros-hf.c ---*/
119 #line 80 "packet-ros-template.c"
120
121 /* Initialize the subtree pointers */
122 static gint ett_ros = -1;
123
124 /*--- Included file: packet-ros-ett.c ---*/
125 #line 1 "packet-ros-ett.c"
126 static gint ett_ros_ROS = -1;
127 static gint ett_ros_Invoke = -1;
128 static gint ett_ros_ReturnResult = -1;
129 static gint ett_ros_T_result = -1;
130 static gint ett_ros_ReturnError = -1;
131 static gint ett_ros_Reject = -1;
132 static gint ett_ros_T_problem = -1;
133 static gint ett_ros_InvokeId = -1;
134 static gint ett_ros_Code = -1;
135
136 /*--- End of included file: packet-ros-ett.c ---*/
137 #line 84 "packet-ros-template.c"
138
139 static dissector_table_t ros_oid_dissector_table=NULL;
140
141 static GHashTable *oid_table=NULL;
142 static GHashTable *protocol_table=NULL;
143 static gint ett_ros_unknown = -1;
144
145 void
146 register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_rtse)
147 {
148         dissector_add_string("ros.oid", oid, dissector);
149         g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
150
151         if(!uses_rtse)
152           /* if we are not using RTSE, then we must register ROS with BER (ACSE) */
153           register_ber_oid_dissector_handle(oid, ros_handle, proto, name);
154 }
155
156 void
157 register_ros_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name, gboolean uses_rtse)
158 {
159         g_hash_table_insert(protocol_table, (gpointer)oid, (gpointer)rinfo);    
160         g_hash_table_insert(oid_table, (gpointer)oid, (gpointer)name);
161
162         if(!uses_rtse)
163           /* if we are not using RTSE, then we must register ROS with BER (ACSE) */
164           register_ber_oid_dissector_handle(oid, ros_handle, proto, name);
165 }
166
167 static new_dissector_t ros_lookup_opr_dissector(gint32 opcode, const ros_opr_t *operations, gboolean argument)
168 {
169         /* we don't know what order asn2wrs/module definition is, so ... */
170         if(operations) {
171                 for(;operations->arg_pdu != (new_dissector_t)(-1); operations++) 
172                         if(operations->opcode == opcode) 
173                                 return argument ? operations->arg_pdu : operations->res_pdu;
174                 
175         }
176         return NULL;
177 }
178
179 static new_dissector_t ros_lookup_err_dissector(gint32 errcode, const ros_err_t *errors)
180 {
181         /* we don't know what order asn2wrs/module definition is, so ... */
182         if(errors) {
183                 for(;errors->err_pdu != (new_dissector_t) (-1); errors++) {
184                         if(errors->errcode == errcode) 
185                                 return errors->err_pdu;
186                 }
187         }
188         return NULL;
189 }
190
191
192 static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
193 {
194         ros_info_t *rinfo;
195         gint32     opcode = 0;
196         const gchar *opname = NULL;
197         const gchar *suffix = NULL;
198         int offset = 0;
199         new_dissector_t opdissector = NULL;
200         const value_string *lookup;
201         proto_item *item=NULL;
202         proto_tree *ros_tree=NULL;
203
204         if((rinfo = (ros_info_t*)g_hash_table_lookup(protocol_table, oid)) != NULL) {
205
206                 if(tree){
207                         item = proto_tree_add_item(tree, *(rinfo->proto), tvb, 0, -1, FALSE);
208                         ros_tree = proto_item_add_subtree(item, *(rinfo->ett_proto));
209                 }
210
211                 if (check_col(pinfo->cinfo, COL_PROTOCOL))
212                         col_set_str(pinfo->cinfo, COL_PROTOCOL, rinfo->name);
213
214                 /* if this is a bind operation */
215                 if((session->ros_op & ROS_OP_TYPE_MASK) == ROS_OP_BIND) {
216                         /* use the in-built operation codes */
217                         if((session->ros_op & ROS_OP_PDU_MASK) ==  ROS_OP_ERROR)
218                                 opcode = err_ros_bind;
219                         else
220                                 opcode = op_ros_bind;                           
221                 } else 
222                         /* otherwise just take the opcode */
223                         opcode = session->ros_op & ROS_OP_OPCODE_MASK;
224
225                 /* default lookup in the operations */
226                 lookup = rinfo->opr_code_strings;
227
228                 switch(session->ros_op & ROS_OP_PDU_MASK) {
229                 case ROS_OP_ARGUMENT:   
230                         opdissector = ros_lookup_opr_dissector(opcode, rinfo->opr_code_dissectors, TRUE);
231                         suffix = "_argument";
232                         break;
233                 case ROS_OP_RESULT:     
234                         opdissector = ros_lookup_opr_dissector(opcode, rinfo->opr_code_dissectors, FALSE);
235                         suffix = "_result";
236                         break;
237                 case ROS_OP_ERROR:      
238                         opdissector = ros_lookup_err_dissector(opcode, rinfo->err_code_dissectors);
239                         lookup = rinfo->err_code_strings;
240                         break;
241                 default:
242                         break;
243                 }
244
245                 if(opdissector) {
246
247                         opname = val_to_str(opcode, lookup, "Unknown opcode (%d)");
248
249                         if (check_col(pinfo->cinfo, COL_INFO)) {
250                                 col_set_str(pinfo->cinfo, COL_INFO, opname);
251                                 if(suffix)
252                                         col_append_fstr(pinfo->cinfo, COL_INFO, suffix);
253                         }
254                         
255                         offset = (*opdissector)(tvb, pinfo, ros_tree);
256
257                         return TRUE;
258                 }
259         }
260
261         return FALSE;
262 }
263
264 static int
265 call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
266 {
267         tvbuff_t *next_tvb;
268
269         next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_reported_length_remaining(tvb, offset));
270
271         if(!ros_try_string(oid, next_tvb, pinfo, tree) &&
272            !dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree)){
273                 proto_item *item=NULL;
274                 proto_tree *next_tree=NULL;
275
276                 item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "ROS: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid);
277                 if(item){
278                         next_tree=proto_item_add_subtree(item, ett_ros_unknown);
279                 }
280                 dissect_unknown_ber(pinfo, next_tvb, offset, next_tree);
281         }
282
283         /*XXX until we change the #.REGISTER signature for _PDU()s 
284          * into new_dissector_t   we have to do this kludge with
285          * manually step past the content in the ANY type.
286          */
287         offset+=tvb_length_remaining(tvb, offset);
288
289         return offset;
290 }
291
292
293 static guint
294 ros_info_hash_matched(gconstpointer k)
295 {
296   const ros_call_response_t *key = k;
297
298   return key->invokeId;
299 }
300
301 static gint
302 ros_info_equal_matched(gconstpointer k1, gconstpointer k2)
303 {
304   const ros_call_response_t *key1 = k1;
305   const ros_call_response_t *key2 = k2;
306
307   if( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ){
308     return 0;
309   }
310   /* a response may span multiple frames
311   if( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ){
312     return 0;
313   }
314   */
315
316   return key1->invokeId==key2->invokeId;
317 }
318
319 static guint
320 ros_info_hash_unmatched(gconstpointer k)
321 {
322   const ros_call_response_t *key = k;
323
324   return key->invokeId;
325 }
326
327 static gint
328 ros_info_equal_unmatched(gconstpointer k1, gconstpointer k2)
329 {
330   const ros_call_response_t *key1 = k1;
331   const ros_call_response_t *key2 = k2;
332
333   return key1->invokeId==key2->invokeId;
334 }
335
336 static ros_call_response_t *
337 ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint invokeId, gboolean isInvoke)
338 {
339   ros_call_response_t rcr, *rcrp=NULL;
340   ros_conv_info_t *ros_info = ros_info_items;
341
342   /* first see if we have already matched this */
343
344   rcr.invokeId=invokeId;
345   rcr.is_request = isInvoke;
346
347   if(isInvoke) {
348     rcr.req_frame=pinfo->fd->num;
349     rcr.rep_frame=0;
350   } else {
351     rcr.req_frame=0;
352     rcr.rep_frame=pinfo->fd->num;
353   }
354   
355   rcrp=g_hash_table_lookup(ros_info->matched, &rcr);
356
357   if(rcrp) {
358     /* we have found a match */
359     rcrp->is_request=rcr.is_request;
360
361   } else {
362     
363     /* we haven't found a match - try and match it up */
364
365     if(isInvoke) {
366       /* this a a request - add it to the unmatched list */
367
368       /* check that we dont already have one of those in the
369          unmatched list and if so remove it */
370
371       rcr.invokeId=invokeId;
372
373       rcrp=g_hash_table_lookup(ros_info->unmatched, &rcr);
374
375       if(rcrp){
376         g_hash_table_remove(ros_info->unmatched, rcrp);
377       }
378       
379       /* if we cant reuse the old one, grab a new chunk */
380       if(!rcrp){
381         rcrp=se_alloc(sizeof(ros_call_response_t));
382       }
383       rcrp->invokeId=invokeId;
384       rcrp->req_frame=pinfo->fd->num;
385       rcrp->req_time=pinfo->fd->abs_ts;
386       rcrp->rep_frame=0;
387       rcrp->is_request=TRUE;
388       g_hash_table_insert(ros_info->unmatched, rcrp, rcrp);
389       return NULL;
390
391     } else {
392
393       /* this is a result - it should be in our unmatched list */
394
395       rcr.invokeId=invokeId;
396       rcrp=g_hash_table_lookup(ros_info->unmatched, &rcr);
397
398       if(rcrp){
399
400         if(!rcrp->rep_frame){
401           g_hash_table_remove(ros_info->unmatched, rcrp);
402           rcrp->rep_frame=pinfo->fd->num;
403           rcrp->is_request=FALSE;
404           g_hash_table_insert(ros_info->matched, rcrp, rcrp);
405         }
406       }
407     }
408   }
409
410   if(rcrp){ /* we have found a match */
411     proto_item *item = NULL;
412
413     if(rcrp->is_request){
414       item=proto_tree_add_uint(tree, hf_ros_response_in, tvb, 0, 0, rcrp->rep_frame);
415       PROTO_ITEM_SET_GENERATED (item);
416     } else {
417       nstime_t ns;
418       item=proto_tree_add_uint(tree, hf_ros_response_to, tvb, 0, 0, rcrp->req_frame);
419       PROTO_ITEM_SET_GENERATED (item);
420       nstime_delta(&ns, &pinfo->fd->abs_ts, &rcrp->req_time);
421       item=proto_tree_add_time(tree, hf_ros_time, tvb, 0, 0, &ns);
422       PROTO_ITEM_SET_GENERATED (item);
423     }
424   }
425   
426   return rcrp;
427 }
428
429
430 /*--- Included file: packet-ros-fn.c ---*/
431 #line 1 "packet-ros-fn.c"
432
433
434 static int
435 dissect_ros_T_present(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
436   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
437                                   &invokeid);
438
439   return offset;
440 }
441
442
443
444 static int
445 dissect_ros_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
446   offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
447
448   return offset;
449 }
450
451
452 const value_string ros_InvokeId_vals[] = {
453   {   0, "present" },
454   {   1, "absent" },
455   { 0, NULL }
456 };
457
458 static const ber_choice_t InvokeId_choice[] = {
459   {   0, &hf_ros_present         , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ros_T_present },
460   {   1, &hf_ros_absent          , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_ros_NULL },
461   { 0, NULL, 0, 0, 0, NULL }
462 };
463
464 int
465 dissect_ros_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
466   offset = dissect_ber_choice(actx, tree, tvb, offset,
467                                  InvokeId_choice, hf_index, ett_ros_InvokeId,
468                                  NULL);
469
470   return offset;
471 }
472
473
474
475 static int
476 dissect_ros_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
477   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
478                                   NULL);
479
480   return offset;
481 }
482
483
484
485 static int
486 dissect_ros_OperationCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
487   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
488                                   &opcode);
489
490   return offset;
491 }
492
493
494
495 static int
496 dissect_ros_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
497 #line 25 "ros.cnf"
498   char *oid;
499   /* not sure what the length should be - -1 for now */
500   proto_tree_add_text(tree, tvb, offset,-1, "invoke argument");
501
502   ros_match_call_response(tvb, actx->pinfo, tree, invokeid, TRUE);
503         
504   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
505         /* this should be ROS! */
506         session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT);
507         /* now add the opcode */
508         session->ros_op |= opcode;
509         offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
510   }
511
512
513
514   return offset;
515 }
516
517
518 static const ber_sequence_t Invoke_sequence[] = {
519   { &hf_ros_invokeId        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ros_InvokeId },
520   { &hf_ros_linkedId        , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ros_INTEGER },
521   { &hf_ros_opcode          , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ros_OperationCode },
522   { &hf_ros_argument        , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ros_T_argument },
523   { NULL, 0, 0, 0, NULL }
524 };
525
526 static int
527 dissect_ros_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
528   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
529                                    Invoke_sequence, hf_index, ett_ros_Invoke);
530
531   return offset;
532 }
533
534
535
536 static int
537 dissect_ros_OperationResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
538 #line 40 "ros.cnf"
539   char *oid;
540   /* not sure what the length should be - -1 for now */
541   proto_tree_add_text(tree, tvb, offset,-1, "return result");
542
543   ros_match_call_response(tvb, actx->pinfo, tree, invokeid, FALSE);
544         
545   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
546         /* this should be ROS! */
547         session->ros_op = (ROS_OP_INVOKE | ROS_OP_RESULT);
548         /* now add the opcode */
549         session->ros_op |= opcode;
550         offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
551   }
552
553
554
555   return offset;
556 }
557
558
559 static const ber_sequence_t T_result_sequence[] = {
560   { &hf_ros_opcode          , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ros_OperationCode },
561   { &hf_ros_operationResult , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_ros_OperationResult },
562   { NULL, 0, 0, 0, NULL }
563 };
564
565 static int
566 dissect_ros_T_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
567   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
568                                    T_result_sequence, hf_index, ett_ros_T_result);
569
570   return offset;
571 }
572
573
574 static const ber_sequence_t ReturnResult_sequence[] = {
575   { &hf_ros_invokeId        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ros_InvokeId },
576   { &hf_ros_result          , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ros_T_result },
577   { NULL, 0, 0, 0, NULL }
578 };
579
580 static int
581 dissect_ros_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
582   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
583                                    ReturnResult_sequence, hf_index, ett_ros_ReturnResult);
584
585   return offset;
586 }
587
588
589
590 static int
591 dissect_ros_ErrorCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
592   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
593                                   &opcode);
594
595   return offset;
596 }
597
598
599
600 static int
601 dissect_ros_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
602 #line 55 "ros.cnf"
603   char *oid;
604   /* not sure what the length should be - -1 for now */
605   proto_tree_add_text(tree, tvb, offset,-1, "return result");
606
607   ros_match_call_response(tvb, actx->pinfo, tree, invokeid, FALSE);
608         
609   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
610         /* this should be ROS! */
611         session->ros_op = (ROS_OP_INVOKE | ROS_OP_ERROR);
612         /* now add the opcode  (really the error code) */
613         session->ros_op |= opcode;
614         offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
615   }
616
617
618
619
620   return offset;
621 }
622
623
624 static const ber_sequence_t ReturnError_sequence[] = {
625   { &hf_ros_invokeId        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ros_InvokeId },
626   { &hf_ros_errcode         , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ros_ErrorCode },
627   { &hf_ros_parameter       , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ros_T_parameter },
628   { NULL, 0, 0, 0, NULL }
629 };
630
631 static int
632 dissect_ros_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
633   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
634                                    ReturnError_sequence, hf_index, ett_ros_ReturnError);
635
636   return offset;
637 }
638
639
640 static const value_string ros_GeneralProblem_vals[] = {
641   {   0, "unrecognizedPDU" },
642   {   1, "mistypedPDU" },
643   {   2, "badlyStructuredPDU" },
644   { 0, NULL }
645 };
646
647
648 static int
649 dissect_ros_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
650   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
651                                   NULL);
652
653   return offset;
654 }
655
656
657 static const value_string ros_InvokeProblem_vals[] = {
658   {   0, "duplicateInvocation" },
659   {   1, "unrecognizedOperation" },
660   {   2, "mistypedArgument" },
661   {   3, "resourceLimitation" },
662   {   4, "releaseInProgress" },
663   {   5, "unrecognizedLinkedId" },
664   {   6, "linkedResponseUnexpected" },
665   {   7, "unexpectedLinkedOperation" },
666   { 0, NULL }
667 };
668
669
670 static int
671 dissect_ros_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
672   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
673                                   NULL);
674
675   return offset;
676 }
677
678
679 static const value_string ros_ReturnResultProblem_vals[] = {
680   {   0, "unrecognizedInvocation" },
681   {   1, "resultResponseUnexpected" },
682   {   2, "mistypedResult" },
683   { 0, NULL }
684 };
685
686
687 static int
688 dissect_ros_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
689   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
690                                   NULL);
691
692   return offset;
693 }
694
695
696 static const value_string ros_ReturnErrorProblem_vals[] = {
697   {   0, "unrecognizedInvocation" },
698   {   1, "errorResponseUnexpected" },
699   {   2, "unrecognizedError" },
700   {   3, "unexpectedError" },
701   {   4, "mistypedParameter" },
702   { 0, NULL }
703 };
704
705
706 static int
707 dissect_ros_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
708   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
709                                   NULL);
710
711   return offset;
712 }
713
714
715 static const value_string ros_T_problem_vals[] = {
716   {   0, "general" },
717   {   1, "invoke" },
718   {   2, "returnResult" },
719   {   3, "returnError" },
720   { 0, NULL }
721 };
722
723 static const ber_choice_t T_problem_choice[] = {
724   {   0, &hf_ros_general         , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ros_GeneralProblem },
725   {   1, &hf_ros_invokeProblem   , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ros_InvokeProblem },
726   {   2, &hf_ros_rejectResult    , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ros_ReturnResultProblem },
727   {   3, &hf_ros_rejectError     , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ros_ReturnErrorProblem },
728   { 0, NULL, 0, 0, 0, NULL }
729 };
730
731 static int
732 dissect_ros_T_problem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
733   offset = dissect_ber_choice(actx, tree, tvb, offset,
734                                  T_problem_choice, hf_index, ett_ros_T_problem,
735                                  NULL);
736
737   return offset;
738 }
739
740
741 static const ber_sequence_t Reject_sequence[] = {
742   { &hf_ros_invokeId        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ros_InvokeId },
743   { &hf_ros_problem         , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ros_T_problem },
744   { NULL, 0, 0, 0, NULL }
745 };
746
747 static int
748 dissect_ros_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
749   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
750                                    Reject_sequence, hf_index, ett_ros_Reject);
751
752   return offset;
753 }
754
755
756
757 static int
758 dissect_ros_T_bind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
759 #line 71 "ros.cnf"
760   char *oid;
761   /* not sure what the length should be - -1 for now */
762   proto_tree_add_text(tree, tvb, offset,-1, "bind-invoke");
763
764   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
765     /* this should be ROS! */
766     session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT);
767     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
768   }
769
770
771
772   return offset;
773 }
774
775
776
777 static int
778 dissect_ros_T_bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
779 #line 82 "ros.cnf"
780   char *oid;
781   /* not sure what the length should be - -1 for now */
782   proto_tree_add_text(tree, tvb, offset,-1, "bind-result");
783
784   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
785     /* this should be ROS! */
786     session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT);
787     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
788   }
789
790
791
792   return offset;
793 }
794
795
796
797 static int
798 dissect_ros_T_bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
799 #line 93 "ros.cnf"
800   char *oid;
801   /* not sure what the length should be - -1 for now */
802   proto_tree_add_text(tree, tvb, offset,-1, "bind-error");
803
804   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
805     /* this should be ROS! */
806     session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR);
807     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
808   }
809
810
811
812
813   return offset;
814 }
815
816
817
818 static int
819 dissect_ros_T_unbind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
820 #line 105 "ros.cnf"
821   char *oid;
822   /* not sure what the length should be - -1 for now */
823   proto_tree_add_text(tree, tvb, offset,-1, "unbind-invoke");
824
825   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
826     /* this should be ROS! */
827     session->ros_op = (ROS_OP_UNBIND | ROS_OP_ARGUMENT);
828     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
829   }
830
831
832
833
834   return offset;
835 }
836
837
838
839 static int
840 dissect_ros_T_unbind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
841 #line 117 "ros.cnf"
842   char *oid;
843   /* not sure what the length should be - -1 for now */
844   proto_tree_add_text(tree, tvb, offset,-1, "unbind-result");
845
846   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
847     /* this should be ROS! */
848     session->ros_op = (ROS_OP_UNBIND | ROS_OP_RESULT);
849     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
850   }
851
852
853
854   return offset;
855 }
856
857
858
859 static int
860 dissect_ros_T_unbind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
861 #line 128 "ros.cnf"
862   char *oid;
863   /* not sure what the length should be - -1 for now */
864   proto_tree_add_text(tree, tvb, offset,-1, "unbind-error");
865
866   if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) {
867     /* this should be ROS! */
868     session->ros_op = (ROS_OP_UNBIND | ROS_OP_ERROR);
869     offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree);
870   }
871
872
873   return offset;
874 }
875
876
877 static const value_string ros_ROS_vals[] = {
878   {   1, "invoke" },
879   {   2, "returnResult" },
880   {   3, "returnError" },
881   {   4, "reject" },
882   {  16, "bind-invoke" },
883   {  17, "bind-result" },
884   {  18, "bind-error" },
885   {  19, "unbind-invoke" },
886   {  20, "unbind-result" },
887   {  21, "unbind-error" },
888   { 0, NULL }
889 };
890
891 static const ber_choice_t ROS_choice[] = {
892   {   1, &hf_ros_invoke          , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ros_Invoke },
893   {   2, &hf_ros_returnResult    , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ros_ReturnResult },
894   {   3, &hf_ros_returnError     , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ros_ReturnError },
895   {   4, &hf_ros_reject          , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_ros_Reject },
896   {  16, &hf_ros_bind_invoke     , BER_CLASS_CON, 16, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_invoke },
897   {  17, &hf_ros_bind_result     , BER_CLASS_CON, 17, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_result },
898   {  18, &hf_ros_bind_error      , BER_CLASS_CON, 18, BER_FLAGS_IMPLTAG, dissect_ros_T_bind_error },
899   {  19, &hf_ros_unbind_invoke   , BER_CLASS_CON, 19, BER_FLAGS_IMPLTAG, dissect_ros_T_unbind_invoke },
900   {  20, &hf_ros_unbind_result   , BER_CLASS_CON, 20, BER_FLAGS_IMPLTAG, dissect_ros_T_unbind_result },
901   {  21, &hf_ros_unbind_error    , BER_CLASS_CON, 21, BER_FLAGS_IMPLTAG, dissect_ros_T_unbind_error },
902   { 0, NULL, 0, 0, 0, NULL }
903 };
904
905 static int
906 dissect_ros_ROS(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
907   offset = dissect_ber_choice(actx, tree, tvb, offset,
908                                  ROS_choice, hf_index, ett_ros_ROS,
909                                  NULL);
910
911   return offset;
912 }
913
914
915
916 static int
917 dissect_ros_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
918   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
919
920   return offset;
921 }
922
923
924 const value_string ros_Code_vals[] = {
925   {   0, "local" },
926   {   1, "global" },
927   { 0, NULL }
928 };
929
930 static const ber_choice_t Code_choice[] = {
931   {   0, &hf_ros_local           , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ros_INTEGER },
932   {   1, &hf_ros_global          , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_ros_OBJECT_IDENTIFIER },
933   { 0, NULL, 0, 0, 0, NULL }
934 };
935
936 int
937 dissect_ros_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
938   offset = dissect_ber_choice(actx, tree, tvb, offset,
939                                  Code_choice, hf_index, ett_ros_Code,
940                                  NULL);
941
942   return offset;
943 }
944
945
946
947 static int
948 dissect_ros_Priority(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
949   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
950                                   NULL);
951
952   return offset;
953 }
954
955
956 /*--- End of included file: packet-ros-fn.c ---*/
957 #line 376 "packet-ros-template.c"
958
959 /*
960 * Dissect ROS PDUs inside a PPDU.
961 */
962 static void
963 dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
964 {
965         int offset = 0;
966         int old_offset;
967         proto_item *item=NULL;
968         proto_tree *tree=NULL;
969         conversation_t *conversation;
970         ros_conv_info_t *ros_info = NULL;
971         asn1_ctx_t asn1_ctx;
972         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
973
974         /* save parent_tree so subdissectors can create new top nodes */
975         top_tree=parent_tree;
976
977         /* do we have application context from the acse dissector?  */
978         if( !pinfo->private_data ){
979                 if(parent_tree){
980                         proto_tree_add_text(parent_tree, tvb, offset, -1,
981                                 "Internal error:can't get application context from ACSE dissector.");
982                 } 
983                 return  ;
984         } else {
985                 session  = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
986
987         }
988
989         /*
990          * Do we have a conversation for this connection?
991          */
992         conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
993                                          pinfo->ptype, pinfo->srcport,
994                                          pinfo->destport, 0);
995         if (conversation == NULL) {
996           /* We don't yet have a conversation, so create one. */
997           conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
998                                           pinfo->ptype, pinfo->srcport,
999                                           pinfo->destport, 0);
1000
1001         }
1002
1003         /*
1004          * Do we already have our info
1005          */
1006         ros_info = conversation_get_proto_data(conversation, proto_ros);
1007         if (ros_info == NULL) {
1008
1009           /* No.  Attach that information to the conversation. */
1010
1011           ros_info = se_alloc(sizeof(ros_conv_info_t));
1012           ros_info->matched=g_hash_table_new(ros_info_hash_matched, ros_info_equal_matched);
1013           ros_info->unmatched=g_hash_table_new(ros_info_hash_unmatched, ros_info_equal_unmatched);
1014           
1015           conversation_add_proto_data(conversation, proto_ros, ros_info);
1016           
1017           ros_info->next = ros_info_items;
1018           ros_info_items = ros_info;
1019           }
1020
1021         /* pinfo->private_data = ros_info; */
1022
1023         if(parent_tree){
1024                 item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, FALSE);
1025                 tree = proto_item_add_subtree(item, ett_ros);
1026         }
1027         if (check_col(pinfo->cinfo, COL_PROTOCOL))
1028                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ROS");
1029         if (check_col(pinfo->cinfo, COL_INFO))
1030                 col_clear(pinfo->cinfo, COL_INFO);
1031
1032         while (tvb_reported_length_remaining(tvb, offset) > 0){
1033                 old_offset=offset;
1034                 offset=dissect_ros_ROS(FALSE, tvb, offset, &asn1_ctx , tree, -1);
1035                 if(offset == old_offset){
1036                         proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte ROS PDU");
1037                         offset = tvb_length(tvb);
1038                         break;
1039                 }
1040         }
1041 }
1042
1043 static void
1044 ros_reinit(void)
1045 {
1046   ros_conv_info_t *ros_info;
1047
1048   /* Free up state attached to the ros_info structures */
1049   for (ros_info = ros_info_items; ros_info != NULL; ros_info = ros_info->next) {
1050     g_hash_table_destroy(ros_info->matched);
1051     ros_info->matched=NULL;
1052     g_hash_table_destroy(ros_info->unmatched);
1053     ros_info->unmatched=NULL;
1054   }
1055
1056   ros_info_items = NULL;
1057
1058 }
1059
1060 /*--- proto_register_ros -------------------------------------------*/
1061 void proto_register_ros(void) {
1062
1063   /* List of fields */
1064   static hf_register_info hf[] =
1065   {
1066     { &hf_ros_response_in,
1067       { "Response In", "ros.response_in",
1068         FT_FRAMENUM, BASE_DEC, NULL, 0x0,
1069         "The response to this remote operation invocation is in this frame", HFILL }},
1070     { &hf_ros_response_to,
1071       { "Response To", "ros.response_to",
1072         FT_FRAMENUM, BASE_DEC, NULL, 0x0,
1073         "This is a response to the remote operation invocation in this frame", HFILL }},
1074     { &hf_ros_time,
1075       { "Time", "ros.time",
1076         FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
1077         "The time between the Invoke and the Response", HFILL }},
1078
1079
1080 /*--- Included file: packet-ros-hfarr.c ---*/
1081 #line 1 "packet-ros-hfarr.c"
1082     { &hf_ros_invoke,
1083       { "invoke", "ros.invoke",
1084         FT_NONE, BASE_NONE, NULL, 0,
1085         "ros.Invoke", HFILL }},
1086     { &hf_ros_returnResult,
1087       { "returnResult", "ros.returnResult",
1088         FT_NONE, BASE_NONE, NULL, 0,
1089         "ros.ReturnResult", HFILL }},
1090     { &hf_ros_returnError,
1091       { "returnError", "ros.returnError",
1092         FT_NONE, BASE_NONE, NULL, 0,
1093         "ros.ReturnError", HFILL }},
1094     { &hf_ros_reject,
1095       { "reject", "ros.reject",
1096         FT_NONE, BASE_NONE, NULL, 0,
1097         "ros.Reject", HFILL }},
1098     { &hf_ros_bind_invoke,
1099       { "bind-invoke", "ros.bind_invoke",
1100         FT_NONE, BASE_NONE, NULL, 0,
1101         "ros.T_bind_invoke", HFILL }},
1102     { &hf_ros_bind_result,
1103       { "bind-result", "ros.bind_result",
1104         FT_NONE, BASE_NONE, NULL, 0,
1105         "ros.T_bind_result", HFILL }},
1106     { &hf_ros_bind_error,
1107       { "bind-error", "ros.bind_error",
1108         FT_NONE, BASE_NONE, NULL, 0,
1109         "ros.T_bind_error", HFILL }},
1110     { &hf_ros_unbind_invoke,
1111       { "unbind-invoke", "ros.unbind_invoke",
1112         FT_NONE, BASE_NONE, NULL, 0,
1113         "ros.T_unbind_invoke", HFILL }},
1114     { &hf_ros_unbind_result,
1115       { "unbind-result", "ros.unbind_result",
1116         FT_NONE, BASE_NONE, NULL, 0,
1117         "ros.T_unbind_result", HFILL }},
1118     { &hf_ros_unbind_error,
1119       { "unbind-error", "ros.unbind_error",
1120         FT_NONE, BASE_NONE, NULL, 0,
1121         "ros.T_unbind_error", HFILL }},
1122     { &hf_ros_invokeId,
1123       { "invokeId", "ros.invokeId",
1124         FT_UINT32, BASE_DEC, VALS(ros_InvokeId_vals), 0,
1125         "ros.InvokeId", HFILL }},
1126     { &hf_ros_linkedId,
1127       { "linkedId", "ros.linkedId",
1128         FT_INT32, BASE_DEC, NULL, 0,
1129         "ros.INTEGER", HFILL }},
1130     { &hf_ros_opcode,
1131       { "opcode", "ros.opcode",
1132         FT_INT32, BASE_DEC, NULL, 0,
1133         "ros.OperationCode", HFILL }},
1134     { &hf_ros_argument,
1135       { "argument", "ros.argument",
1136         FT_NONE, BASE_NONE, NULL, 0,
1137         "ros.T_argument", HFILL }},
1138     { &hf_ros_result,
1139       { "result", "ros.result",
1140         FT_NONE, BASE_NONE, NULL, 0,
1141         "ros.T_result", HFILL }},
1142     { &hf_ros_operationResult,
1143       { "result", "ros.result",
1144         FT_NONE, BASE_NONE, NULL, 0,
1145         "ros.OperationResult", HFILL }},
1146     { &hf_ros_errcode,
1147       { "errcode", "ros.errcode",
1148         FT_INT32, BASE_DEC, NULL, 0,
1149         "ros.ErrorCode", HFILL }},
1150     { &hf_ros_parameter,
1151       { "parameter", "ros.parameter",
1152         FT_NONE, BASE_NONE, NULL, 0,
1153         "ros.T_parameter", HFILL }},
1154     { &hf_ros_problem,
1155       { "problem", "ros.problem",
1156         FT_UINT32, BASE_DEC, VALS(ros_T_problem_vals), 0,
1157         "ros.T_problem", HFILL }},
1158     { &hf_ros_general,
1159       { "general", "ros.general",
1160         FT_INT32, BASE_DEC, VALS(ros_GeneralProblem_vals), 0,
1161         "ros.GeneralProblem", HFILL }},
1162     { &hf_ros_invokeProblem,
1163       { "invoke", "ros.invoke",
1164         FT_INT32, BASE_DEC, VALS(ros_InvokeProblem_vals), 0,
1165         "ros.InvokeProblem", HFILL }},
1166     { &hf_ros_rejectResult,
1167       { "returnResult", "ros.returnResult",
1168         FT_INT32, BASE_DEC, VALS(ros_ReturnResultProblem_vals), 0,
1169         "ros.ReturnResultProblem", HFILL }},
1170     { &hf_ros_rejectError,
1171       { "returnError", "ros.returnError",
1172         FT_INT32, BASE_DEC, VALS(ros_ReturnErrorProblem_vals), 0,
1173         "ros.ReturnErrorProblem", HFILL }},
1174     { &hf_ros_present,
1175       { "present", "ros.present",
1176         FT_INT32, BASE_DEC, NULL, 0,
1177         "ros.T_present", HFILL }},
1178     { &hf_ros_absent,
1179       { "absent", "ros.absent",
1180         FT_NONE, BASE_NONE, NULL, 0,
1181         "ros.NULL", HFILL }},
1182     { &hf_ros_local,
1183       { "local", "ros.local",
1184         FT_INT32, BASE_DEC, NULL, 0,
1185         "ros.INTEGER", HFILL }},
1186     { &hf_ros_global,
1187       { "global", "ros.global",
1188         FT_OID, BASE_NONE, NULL, 0,
1189         "ros.OBJECT_IDENTIFIER", HFILL }},
1190
1191 /*--- End of included file: packet-ros-hfarr.c ---*/
1192 #line 498 "packet-ros-template.c"
1193   };
1194
1195   /* List of subtrees */
1196   static gint *ett[] = {
1197     &ett_ros,
1198     &ett_ros_unknown,
1199
1200 /*--- Included file: packet-ros-ettarr.c ---*/
1201 #line 1 "packet-ros-ettarr.c"
1202     &ett_ros_ROS,
1203     &ett_ros_Invoke,
1204     &ett_ros_ReturnResult,
1205     &ett_ros_T_result,
1206     &ett_ros_ReturnError,
1207     &ett_ros_Reject,
1208     &ett_ros_T_problem,
1209     &ett_ros_InvokeId,
1210     &ett_ros_Code,
1211
1212 /*--- End of included file: packet-ros-ettarr.c ---*/
1213 #line 505 "packet-ros-template.c"
1214   };
1215
1216   /* Register protocol */
1217   proto_ros = proto_register_protocol(PNAME, PSNAME, PFNAME);
1218   register_dissector("ros", dissect_ros, proto_ros);
1219   /* Register fields and subtrees */
1220   proto_register_field_array(proto_ros, hf, array_length(hf));
1221   proto_register_subtree_array(ett, array_length(ett));
1222
1223   ros_oid_dissector_table = register_dissector_table("ros.oid", "ROS OID Dissectors", FT_STRING, BASE_NONE);
1224   oid_table=g_hash_table_new(g_str_hash, g_str_equal);
1225   protocol_table=g_hash_table_new(g_str_hash, g_str_equal);
1226
1227   ros_handle = find_dissector("ros");
1228
1229   register_init_routine(ros_reinit);
1230 }
1231
1232
1233 /*--- proto_reg_handoff_ros --- */
1234 void proto_reg_handoff_ros(void) {
1235
1236
1237 }