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