Init some variables to prevent scan-build "Function call argument is an uninitialized...
[metze/wireshark/wip.git] / plugins / profinet / packet-dcom-cba.c
1 /* packet-dcom-cba.c
2  * Routines for DCOM CBA
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/emem.h>
32 #include <epan/expert.h>
33 #include <epan/dissectors/packet-dcerpc.h>
34 #include <epan/dissectors/packet-dcom.h>
35 #include <epan/dissectors/packet-dcom-dispatch.h>
36 #include "packet-dcom-cba-acco.h"
37
38
39 static int hf_cba_opnum = -1;
40
41 static int hf_cba_revision_major = -1;
42 static int hf_cba_revision_minor = -1;
43 static int hf_cba_revision_service_pack = -1;
44 static int hf_cba_revision_build = -1;
45
46 static int hf_cba_time = -1;
47
48 static int hf_cba_name = -1;
49 static int hf_cba_producer = -1;
50 static int hf_cba_product = -1;
51 static int hf_cba_production_date = -1;
52 static int hf_cba_serial_no = -1;
53 static int hf_cba_multi_app = -1;
54 static int hf_cba_profinet_dcom_stack = -1;
55 static int hf_cba_pdev_stamp = -1;
56
57 static int hf_cba_browse_count = -1;
58 static int hf_cba_browse_offset = -1;
59 static int hf_cba_browse_max_return = -1;
60 static int hf_cba_browse_item = -1;
61 static int hf_cba_browse_data_type = -1;
62 static int hf_cba_browse_access_right = -1;
63 static int hf_cba_browse_selector = -1;
64 static int hf_cba_browse_info1 = -1;
65 static int hf_cba_browse_info2 = -1;
66
67 static int hf_cba_cookie = -1;
68 static int hf_cba_state = -1;
69 static int hf_cba_new_state = -1;
70 static int hf_cba_old_state = -1;
71 static int hf_cba_grouperror = -1;
72 static int hf_cba_new_grouperror = -1;
73 static int hf_cba_old_grouperror = -1;
74
75 static int hf_cba_component_id = -1;
76 static int hf_cba_component_version = -1;
77 static int hf_cba_pbaddress = -1;
78 static int hf_cba_pbaddress_system_id = -1;
79 static int hf_cba_pbaddress_address = -1;
80
81 static int hf_cba_save_ldev_name = -1;
82 static int hf_cba_save_result = -1;
83
84 static e_uuid_t uuid_coclass_CBAPhysicalDevice = { 0xcba00000, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
85
86
87 /* CBA interfaces */
88 static int proto_ICBAPhysicalDevice = -1;
89 static gint ett_ICBAPhysicalDevice = -1;
90 static e_uuid_t uuid_ICBAPhysicalDevice = { 0xcba00001, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
91 static guint16  ver_ICBAPhysicalDevice = 0;
92
93 static int proto_ICBAPhysicalDevice2 = -1;
94 static e_uuid_t uuid_ICBAPhysicalDevice2 = { 0xcba00006, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
95 static guint16  ver_ICBAPhysicalDevice2 = 0;
96
97 static int proto_ICBABrowse = -1;
98 static gint ett_ICBABrowse = -1;
99 static e_uuid_t uuid_ICBABrowse = { 0xcba00002, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
100 static guint16  ver_ICBABrowse = 0;
101
102 static int proto_ICBABrowse2 = -1;
103 static e_uuid_t uuid_ICBABrowse2 = { 0xcba00007, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
104 static guint16  ver_ICBABrowse2 = 0;
105
106 static int proto_ICBAPhysicalDevicePC = -1;
107 static gint ett_ICBAPhysicalDevicePC = -1;
108 static e_uuid_t uuid_ICBAPhysicalDevicePC = { 0xcba00003, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
109 static guint16  ver_ICBAPhysicalDevicePC = 0;
110
111 static int proto_ICBAPhysicalDevicePCEvent = -1;
112 static gint ett_ICBAPhysicalDevicePCEvent = -1;
113 static e_uuid_t uuid_ICBAPhysicalDevicePCEvent = { 0xcba00004, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
114 static guint16  ver_ICBAPhysicalDevicePCEvent = 0;
115
116 static int proto_ICBAPersist = -1;
117 static gint ett_ICBAPersist = -1;
118 static e_uuid_t uuid_ICBAPersist = { 0xcba00005, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
119 static guint16  ver_ICBAPersist = 0;
120
121 static int proto_ICBAPersist2 = -1;
122 static e_uuid_t uuid_ICBAPersist2 = { 0xcba00008, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
123 static guint16  ver_ICBAPersist2 = 0;
124
125 static int proto_ICBALogicalDevice = -1;
126 static gint ett_ICBALogicalDevice = -1;
127 static e_uuid_t uuid_ICBALogicalDevice = { 0xcba00011, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
128 static guint16  ver_ICBALogicalDevice = 0;
129
130 static int proto_ICBALogicalDevice2 = -1;
131 static e_uuid_t uuid_ICBALogicalDevice2 = { 0xcba00017, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
132 static guint16  ver_ICBALogicalDevice2 = 0;
133
134 static int proto_ICBAState = -1;
135 static gint ett_ICBAState = -1;
136 static e_uuid_t uuid_ICBAState = { 0xcba00012, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
137 static guint16  ver_ICBAState = 0;
138
139 static int proto_ICBAStateEvent = -1;
140 static gint ett_ICBAStateEvent = -1;
141 static e_uuid_t uuid_ICBAStateEvent = { 0xcba00013, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
142 static guint16  ver_ICBAStateEvent = 0;
143
144 static int proto_ICBATime = -1;
145 static gint ett_ICBATime = -1;
146 static e_uuid_t uuid_ICBATime = { 0xcba00014, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
147 static guint16  ver_ICBATime = 0;
148
149 static int proto_ICBAGroupError = -1;
150 static gint ett_ICBAGroupError = -1;
151 static e_uuid_t uuid_ICBAGroupError = { 0xcba00015, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
152 static guint16  ver_ICBAGroupError = 0;
153
154 static int proto_ICBAGroupErrorEvent = -1;
155 static gint ett_ICBAGroupErrorEvent = -1;
156 static e_uuid_t uuid_ICBAGroupErrorEvent = { 0xcba00016, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
157 static guint16  ver_ICBAGroupErrorEvent = 0;
158
159 static int proto_ICBARTAuto = -1;
160 static gint ett_ICBARTAuto = -1;
161 static e_uuid_t uuid_ICBARTAuto = { 0xcba00051, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
162 static guint16  ver_ICBARTAuto = 0;
163
164 static int proto_ICBARTAuto2 = -1;
165 static e_uuid_t uuid_ICBARTAuto2 = { 0xcba00052, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
166 static guint16  ver_ICBARTAuto2 = 0;
167
168 static int proto_ICBASystemProperties = -1;
169 static gint ett_ICBASystemProperties = -1;
170 static e_uuid_t uuid_ICBASystemProperties = { 0xcba00062, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } };
171 static guint16  ver_ICBASystemProperties = 0;
172
173
174 static gint ett_PBAddress = -1;
175
176
177 static const value_string cba_state_vals[] = {
178         { 0x00, "NonExistent" },
179         { 0x01, "Initializing" },
180         { 0x02, "Ready" },
181         { 0x03, "Operating" },
182         { 0x04, "Defect" },
183     { 0, NULL }
184 };
185
186
187 static const value_string cba_grouperror_vals[] = {
188         { 0x00, "NonAccessible" },
189         { 0x01, "Okay" },
190         { 0x02, "Problem" },
191         { 0x03, "Unknown" },
192         { 0x04, "MaintenanceRequired" },
193         { 0x05, "MaintenanceDemanded" },
194         { 0x06, "MaintenanceRequiredAndDemanded" },
195         { 0x07, "ProblemAndMaintenanceRequired" },
196         { 0x08, "ProblemAndMaintenanceDemanded" },
197         { 0x09, "ProblemAndMaintenanceRequiredAndDemanded" },
198     { 0, NULL }
199 };
200
201 static const value_string dcom_boolean_vals[] = {
202         { 0x00, "FALSE" },
203         { 0x01, "TRUE" },
204         { 0xffff, "TRUE" },
205     { 0, NULL }
206 };
207
208
209
210
211 static int
212 dissect_ICBABrowse_get_Count_resp(tvbuff_t *tvb, int offset,
213         packet_info *pinfo, proto_tree *tree, guint8 *drep)
214 {
215         guint32 u32Count;
216         guint32 u32HResult;
217
218
219     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
220
221         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
222                         hf_cba_browse_count, &u32Count);
223
224         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
225                         &u32HResult);
226
227         if (u32HResult) {       /* !S_OK */
228       col_append_fstr(pinfo->cinfo, COL_INFO, "-> %s", 
229                         val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
230     } else {
231       col_append_fstr(pinfo->cinfo, COL_INFO, " Cnt=%u -> S_OK", u32Count);
232     }
233             
234
235         return offset;
236 }
237
238
239 static int
240 dissect_ICBABrowse_BrowseItems_rqst(tvbuff_t *tvb, int offset,
241         packet_info *pinfo, proto_tree *tree, guint8 *drep)
242 {
243         guint32 u32Offset;
244         guint32 u32MaxReturn;
245
246
247     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
248
249         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
250                         hf_cba_browse_offset, &u32Offset);
251         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
252                         hf_cba_browse_max_return, &u32MaxReturn);
253
254         col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%u MaxReturn=%u", 
255                 u32Offset, u32MaxReturn);
256
257         return offset;
258 }
259
260
261 static int
262 dissect_ICBABrowse_BrowseItems_resp(tvbuff_t *tvb, int offset,
263         packet_info *pinfo, proto_tree *tree, guint8 *drep)
264 {
265         guint32 u32Pointer;
266         guint32 u32HResult;
267
268
269     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
270
271         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
272                                                 &u32Pointer);
273         if (u32Pointer) {
274                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_item);
275         }
276         
277         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
278                                                 &u32Pointer);
279         if (u32Pointer) {
280                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_data_type);
281         }
282
283         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
284                                                 &u32Pointer);
285         if (u32Pointer) {
286                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_access_right);
287         }
288
289         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
290                                 &u32HResult);
291
292         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
293                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
294
295         return offset;
296 }
297
298
299 static int
300 dissect_ICBABrowse2_get_Count2_rqst(tvbuff_t *tvb, int offset,
301         packet_info *pinfo, proto_tree *tree, guint8 *drep)
302 {
303         guint32 u32Selector;
304
305
306     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
307
308         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
309                         hf_cba_browse_selector, &u32Selector);
310
311         col_append_fstr(pinfo->cinfo, COL_INFO, " Selector=%u", 
312                 u32Selector);
313
314         return offset;
315 }
316
317
318
319 static int
320 dissect_ICBABrowse2_BrowseItems2_rqst(tvbuff_t *tvb, int offset,
321         packet_info *pinfo, proto_tree *tree, guint8 *drep)
322 {
323         guint32 u32Selector;
324         guint32 u32Offset;
325         guint32 u32MaxReturn;
326
327
328     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
329
330         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
331                         hf_cba_browse_selector, &u32Selector);
332         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
333                         hf_cba_browse_offset, &u32Offset);
334         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
335                         hf_cba_browse_max_return, &u32MaxReturn);
336
337         col_append_fstr(pinfo->cinfo, COL_INFO, " Sel=%u Offset=%u MaxReturn=%u", 
338                 u32Selector, u32Offset, u32MaxReturn);
339
340         return offset;
341 }
342
343
344 static int
345 dissect_ICBABrowse2_BrowseItems2_resp(tvbuff_t *tvb, int offset,
346         packet_info *pinfo, proto_tree *tree, guint8 *drep)
347 {
348         guint32 u32Pointer;
349         guint32 u32HResult;
350
351
352     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
353
354         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
355                                                 &u32Pointer);
356         if (u32Pointer) {
357                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_item);
358         }
359         
360         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
361                                                 &u32Pointer);
362         if (u32Pointer) {
363                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_info1);
364         }
365
366         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
367                                                 &u32Pointer);
368         if (u32Pointer) {
369                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_browse_info2);
370         }
371
372         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
373                                 &u32HResult);
374
375         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
376                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
377
378         return offset;
379 }
380
381
382 static int
383 dissect_ICBAPersist2_Save2_resp(tvbuff_t *tvb, int offset,
384         packet_info *pinfo, proto_tree *tree, guint8 *drep)
385 {
386         guint32 u32Pointer;
387         guint32 u32HResult;
388
389
390     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
391
392         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
393                                                 &u32Pointer);
394         if (u32Pointer) {
395                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_save_ldev_name);
396         }
397         
398         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
399                                                 &u32Pointer);
400         if (u32Pointer) {
401                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, hf_cba_save_result);
402         }
403
404         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
405                                 &u32HResult);
406
407         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
408                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
409
410         return offset;
411 }
412
413
414
415 static int
416 dissect_get_BSTR_resp(tvbuff_t *tvb, int offset,
417         packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex)
418 {
419         gchar   szStr[1000];
420         guint32 u32MaxStr = sizeof(szStr);
421         guint32 u32Pointer;
422         guint32 u32HResult;
423
424
425     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
426
427         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
428                                                 &u32Pointer);
429         if (u32Pointer) {
430                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
431                         hfindex, szStr, u32MaxStr);
432         }
433         
434         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
435                                 &u32HResult);
436
437         col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\" -> %s", szStr,
438                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
439
440         return offset;
441 }
442
443
444 static int
445 dissect_get_ProductionDate_resp(tvbuff_t *tvb, int offset,
446         packet_info *pinfo, proto_tree *tree, guint8 *drep)
447 {
448         guint32 u32HResult;
449         gdouble r8Date;
450
451
452     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
453
454         offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, drep, 
455                                 hf_cba_production_date, &r8Date);
456         
457         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
458                                 &u32HResult);
459
460         col_append_fstr(pinfo->cinfo, COL_INFO, ": Date: %g -> %s",
461                 r8Date,
462                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
463
464         return offset;
465 }
466
467
468 static int
469 dissect_get_SerialNo_resp(tvbuff_t *tvb, int offset,
470         packet_info *pinfo, proto_tree *tree, guint8 *drep)
471 {
472         guint32 u32HResult;
473         guint32 u32Pointer;
474
475
476     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
477
478         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
479                                                 &u32Pointer);
480         if (u32Pointer) {
481                 offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, drep, 
482                                         hf_cba_serial_no);
483         }
484         
485         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
486                                 &u32HResult);
487
488         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
489                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
490
491         return offset;
492 }
493
494
495 static int
496 dissect_ICBATime_get_Time_resp(tvbuff_t *tvb, int offset,
497         packet_info *pinfo, proto_tree *tree, guint8 *drep)
498 {
499         guint32 u32HResult;
500         gdouble r8Date;
501
502
503     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
504
505         offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, drep, 
506                                 hf_cba_time, &r8Date);
507         
508         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
509                                 &u32HResult);
510
511         col_append_fstr(pinfo->cinfo, COL_INFO, ": Time: %g -> %s", 
512                 r8Date,
513                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
514
515         return offset;
516 }
517
518
519 static int
520 dissect_ICBATime_put_Time_rqst(tvbuff_t *tvb, int offset,
521         packet_info *pinfo, proto_tree *tree, guint8 *drep)
522 {
523         gdouble r8Date;
524
525
526     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
527
528         offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, drep, 
529                                 hf_cba_time, &r8Date);
530         
531         return offset;
532 }
533
534
535 static int
536 dissect_get_Producer_resp(tvbuff_t *tvb, int offset,
537         packet_info *pinfo, proto_tree *tree, guint8 *drep)
538 {
539
540         return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, drep, hf_cba_producer);
541 }
542
543
544 static int
545 dissect_get_Product_resp(tvbuff_t *tvb, int offset,
546         packet_info *pinfo, proto_tree *tree, guint8 *drep)
547 {
548
549         return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, drep, hf_cba_product);
550 }
551
552
553 static int
554 dissect_ICBAPhysicalDevice_get_LogicalDevice_rqst(tvbuff_t *tvb, int offset,
555         packet_info *pinfo, proto_tree *tree, guint8 *drep)
556 {
557         guint32 u32Pointer;
558         gchar   szStr[1000];
559         guint32 u32MaxStr = sizeof(szStr);
560     dcerpc_info *info = (dcerpc_info *) pinfo->private_data;
561     gchar *call;
562
563
564     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
565
566         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
567                                                 &u32Pointer);
568         if (u32Pointer) {
569                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
570                         hf_cba_name, szStr, u32MaxStr);
571         }
572
573     if(strlen(szStr) > 0) {
574         call = se_strdup(szStr);
575         info->call_data->private_data = call;
576     }
577
578     col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", szStr);
579
580         return offset;
581 }
582
583
584 static int
585 dissect_ICBAPhysicalDevice_get_LogicalDevice_resp(tvbuff_t *tvb, int offset,
586         packet_info *pinfo, proto_tree *tree, guint8 *drep)
587 {
588         guint32 u32HResult;
589     dcerpc_info *info = (dcerpc_info *) pinfo->private_data;
590     gchar *ldev_name = info->call_data->private_data;
591     dcom_interface_t *pdev_interf;
592     dcom_interface_t *ldev_interf;
593     cba_pdev_t *pdev;
594     cba_ldev_t *ldev;
595
596
597     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
598
599         offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 0, &ldev_interf);
600
601     /* try to read the ldev name from the request */
602     if(ldev_name != NULL && ldev_interf != NULL) {
603         /* XXX - this is a hack to create a pdev interface */
604         /* as I currently don't understand the objref process for a root interface! */
605         pdev_interf = dcom_interface_new(pinfo, pinfo->net_dst.data, &uuid_ICBAPhysicalDevice, 0, 0, &info->call_data->object_uuid);    
606         if(pdev_interf != NULL) {
607             pdev = cba_pdev_add(pinfo, pinfo->net_dst.data);
608             cba_pdev_link(pinfo, pdev, pdev_interf);
609
610             ldev = cba_ldev_add(pinfo, pdev, ldev_name);
611             cba_ldev_link(pinfo, ldev, ldev_interf);
612         }
613     }
614
615         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
616                                 &u32HResult);
617
618         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
619                   val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
620
621         return offset;
622 }
623
624
625 static int
626 dissect_ICBAPhysicalDevice2_Type_resp(tvbuff_t *tvb, int offset,
627         packet_info *pinfo, proto_tree *tree, guint8 *drep)
628 {
629         guint16 u16MultiApp;
630         guint16 u16PROFInetDCOMStack;
631         guint32 u32HResult;
632
633
634     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
635
636         offset = dissect_dcom_VARIANT_BOOL(tvb, offset, pinfo, tree, drep, 
637                         hf_cba_multi_app, &u16MultiApp);
638
639         offset = dissect_dcom_VARIANT_BOOL(tvb, offset, pinfo, tree, drep, 
640                         hf_cba_profinet_dcom_stack, &u16PROFInetDCOMStack);
641
642         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
643                                 &u32HResult);
644
645           col_append_fstr(pinfo->cinfo, COL_INFO, " App=%s Stack=%s -> %s", 
646                   (u16MultiApp) ? "Multi" : "Single",
647                   (u16PROFInetDCOMStack) ? "PN-DCOM" : "MS-DCOM",
648                   val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
649
650         return offset;
651 }
652
653
654 static int
655 dissect_PROFInetRevision_resp(tvbuff_t *tvb, int offset,
656         packet_info *pinfo, proto_tree *tree, guint8 *drep)
657 {
658         guint16 u16Major;
659         guint16 u16Minor;
660         guint16 u16ServicePack;
661         guint16 u16Build;
662         guint32 u32HResult;
663
664
665     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
666
667         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
668                         hf_cba_revision_major, &u16Major);
669         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
670                         hf_cba_revision_minor, &u16Minor);
671         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
672                         hf_cba_revision_service_pack, &u16ServicePack);
673         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
674                         hf_cba_revision_build, &u16Build);
675
676         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
677                                 &u32HResult);
678
679         col_append_fstr(pinfo->cinfo, COL_INFO, " Revision=%u.%u.%u.%u -> %s", 
680                   u16Major, u16Minor, u16ServicePack, u16Build,
681                   val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
682
683         return offset;
684 }
685
686
687 static int
688 dissect_ICBAPhysicalDevice2_get_PDevStamp_resp(tvbuff_t *tvb, int offset,
689         packet_info *pinfo, proto_tree *tree, guint8 *drep)
690 {
691         guint32 u32PDevStamp;
692         guint32 u32HResult;
693
694
695     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
696
697         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
698                         hf_cba_pdev_stamp, &u32PDevStamp);
699
700         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
701                                 &u32HResult);
702
703         col_append_fstr(pinfo->cinfo, COL_INFO, " PDevStamp=0x%x -> %s", 
704                   u32PDevStamp,
705                   val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
706
707         return offset;
708 }
709
710
711 static int
712 dissect_Revision_resp(tvbuff_t *tvb, int offset,
713         packet_info *pinfo, proto_tree *tree, guint8 *drep)
714 {
715         guint16 u16Major;
716         guint16 u16Minor;
717         guint32 u32HResult;
718
719
720     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
721
722         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
723                         hf_cba_revision_major, &u16Major);
724
725         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
726                         hf_cba_revision_minor, &u16Minor);
727
728         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
729                                 &u32HResult);
730
731         col_append_fstr(pinfo->cinfo, COL_INFO, ": %u.%u -> %s", 
732                 u16Major, u16Minor,
733                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
734
735         return offset;
736 }
737
738
739 static int
740 dissect_ICBALogicalDevice_get_Name_resp(tvbuff_t *tvb, int offset,
741         packet_info *pinfo, proto_tree *tree, guint8 *drep)
742 {
743         gchar   szStr[1000];
744         guint32 u32MaxStr = sizeof(szStr);
745         guint32 u32Pointer;
746         guint32 u32HResult;
747
748
749     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
750
751         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
752                                                 &u32Pointer);
753         if (u32Pointer) {
754                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
755                         hf_cba_name, szStr, u32MaxStr);
756         }
757         
758         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep,
759                                 &u32HResult);
760
761         col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\" -> %s", szStr,
762                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
763
764         return offset;
765 }
766
767
768 static int
769 dissect_RTAuto_get_Name_resp(tvbuff_t *tvb, int offset,
770         packet_info *pinfo, proto_tree *tree, guint8 *drep)
771 {
772
773         return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, drep, hf_cba_name);
774 }
775
776
777 static int
778 dissect_ICBALogicalDevice_get_ACCO_resp(tvbuff_t *tvb, int offset,
779         packet_info *pinfo, proto_tree *tree, guint8 *drep)
780 {
781         guint32 u32HResult;
782     dcom_interface_t *acco_interf;
783     dcerpc_info *info = (dcerpc_info *) pinfo->private_data;
784     cba_ldev_t *ldev;
785
786
787     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
788
789         offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 0, &acco_interf);
790     if(acco_interf == NULL) {
791             expert_add_info_format(pinfo, NULL, PI_UNDECODED, PI_WARN, 
792             "LDev_get_ACCO: can't resolve ACCO interface pointer");
793     }
794
795     ldev = cba_ldev_find(pinfo, pinfo->net_src.data, &info->call_data->object_uuid);
796     
797     /* "crosslink" interface and it's object */
798     if(ldev != NULL && acco_interf != NULL) {
799         cba_ldev_link_acco(pinfo, ldev, acco_interf);
800     }
801
802         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, &u32HResult);
803
804         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
805                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
806
807         return offset;
808 }
809
810
811 static int
812 dissect_ICBALogicalDevice_get_RTAuto_resp(tvbuff_t *tvb, int offset,
813         packet_info *pinfo, proto_tree *tree, guint8 *drep)
814 {
815         guint32 u32HResult;
816
817
818     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
819
820         offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 0, NULL);
821
822         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, &u32HResult);
823
824         col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
825                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
826
827         return offset;
828 }
829
830
831 static int
832 dissect_ICBALogicalDevice_Get_RTAuto_rqst(tvbuff_t *tvb, int offset,
833         packet_info *pinfo, proto_tree *tree, guint8 *drep)
834 {
835         gchar   szStr[1000];
836         guint32 u32MaxStr = sizeof(szStr);
837         guint32 u32Pointer;
838
839
840     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
841
842         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
843                                                 &u32Pointer);
844         if (u32Pointer) {
845                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
846                         hf_cba_name, szStr, u32MaxStr);
847         }
848         
849         col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", szStr);
850
851         return offset;
852 }
853
854
855
856 static int
857 dissect_ComponentInfo_resp(tvbuff_t *tvb, int offset,
858         packet_info *pinfo, proto_tree *tree, guint8 *drep)
859 {
860         gchar   szStr[1000];
861         guint32 u32MaxStr = sizeof(szStr);
862         gchar   szStr2[1000];
863         guint32 u32MaxStr2 = sizeof(szStr2);
864         guint32 u32HResult;
865         guint32 u32Pointer;
866
867
868     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
869
870         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
871                                                 &u32Pointer);
872         if (u32Pointer) {
873                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
874                         hf_cba_component_id, szStr, u32MaxStr);
875         }
876         
877         offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, drep, 
878                                                 &u32Pointer);
879         if (u32Pointer) {
880                 offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, drep, 
881                         hf_cba_component_version, szStr2, u32MaxStr2);
882         }
883         
884         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, &u32HResult);
885
886         col_append_fstr(pinfo->cinfo, COL_INFO, ": ID=\"%s\" Version=\"%s\" -> %s", 
887                         szStr, szStr2,
888                         val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
889
890         return offset;
891 }
892
893
894 static void 
895 dissect_PBAddressInfo(tvbuff_t *tvb, gint offset, packet_info *pinfo,
896                        proto_tree *tree, guint8 *drep,
897                        guint32 u32VarType _U_, guint32 u32ArraySize)
898 {
899     guint8  u8ID;
900     guint8  u8Addr;
901     proto_item *sub_item;
902     proto_tree *sub_tree;
903
904
905     while(u32ArraySize != 0) {
906         sub_item = proto_tree_add_item(tree, hf_cba_pbaddress, tvb, offset, 2, ENC_NA);
907         sub_tree = proto_item_add_subtree(sub_item, ett_PBAddress);
908         
909         offset = dissect_dcom_BYTE(tvb, offset, pinfo, sub_tree, drep, 
910                                                 hf_cba_pbaddress_system_id, &u8ID);
911         offset = dissect_dcom_BYTE(tvb, offset, pinfo, sub_tree, drep, 
912                                                 hf_cba_pbaddress_address, &u8Addr);
913         u32ArraySize-=2;
914
915     proto_item_append_text(sub_item, ": ID=0x%x Addr=%u", u8ID, u8Addr);
916     col_append_fstr(pinfo->cinfo, COL_INFO, ", ID=0x%x Addr=%u", 
917         u8ID, u8Addr);
918     }
919 }
920
921
922 static int
923 dissect_PBAddressInfo_resp(tvbuff_t *tvb, int offset,
924         packet_info *pinfo, proto_tree *tree, guint8 *drep)
925 {
926     guint32 u32HResult;
927
928     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
929
930     offset = dissect_dcom_SAFEARRAY(tvb, offset, pinfo, tree, drep, 0 /*hfindex _U_ */, dissect_PBAddressInfo);
931
932     offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, &u32HResult);
933
934     col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", 
935             val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
936
937     return offset;
938 }
939
940
941 static int
942 dissect_Advise_rqst(tvbuff_t *tvb, int offset,
943         packet_info *pinfo, proto_tree *tree, guint8 *drep)
944 {
945
946
947     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
948
949         offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 0, NULL);
950
951         return offset;
952 }
953
954
955 static int
956 dissect_Advise_resp(tvbuff_t *tvb, int offset,
957         packet_info *pinfo, proto_tree *tree, guint8 *drep)
958 {
959         guint32 u32Cookie;
960         guint32 u32HResult;
961
962
963     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
964
965         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
966                         hf_cba_cookie, &u32Cookie);
967
968         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
969                         &u32HResult);
970
971         col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x -> %s", 
972                 u32Cookie, 
973                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
974
975         return offset;
976 }
977
978
979 static int
980 dissect_Unadvise_rqst(tvbuff_t *tvb, int offset,
981         packet_info *pinfo, proto_tree *tree, guint8 *drep)
982 {
983         guint32 u32Cookie;
984
985
986     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
987
988         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
989                         hf_cba_cookie, &u32Cookie);
990
991         col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x", 
992                 u32Cookie);
993
994         return offset;
995 }
996
997
998 static int
999 dissect_ICBAState_get_State_resp(tvbuff_t *tvb, int offset,
1000         packet_info *pinfo, proto_tree *tree, guint8 *drep)
1001 {
1002         guint16 u16State;
1003         guint32 u32HResult;
1004
1005
1006     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
1007
1008         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1009                         hf_cba_state, &u16State);
1010
1011         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
1012                         &u32HResult);
1013
1014         col_append_fstr(pinfo->cinfo, COL_INFO, ": State=%s -> %s", 
1015                 val_to_str(u16State, cba_state_vals, "Unknown (0x%08x)"),
1016                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
1017
1018         return offset;
1019 }
1020
1021
1022 static int
1023 dissect_ICBAStateEvent_OnStateChanged_rqst(tvbuff_t *tvb, int offset,
1024         packet_info *pinfo, proto_tree *tree, guint8 *drep)
1025 {
1026         guint16 u16NewState;
1027         guint16 u16OldState;
1028
1029
1030     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
1031
1032         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1033                         hf_cba_new_state, &u16NewState);
1034
1035         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1036                         hf_cba_old_state, &u16OldState);
1037
1038         col_append_fstr(pinfo->cinfo, COL_INFO, ": NewState=%s OldState=%s", 
1039                 val_to_str(u16NewState, cba_state_vals, "Unknown (0x%04x)"),
1040                 val_to_str(u16OldState, cba_state_vals, "Unknown (0x%04x)") );
1041
1042         return offset;
1043 }
1044
1045
1046 static int
1047 dissect_ICBAGroupError_OnGroupErrorChanged_rqst(tvbuff_t *tvb, int offset,
1048         packet_info *pinfo, proto_tree *tree, guint8 *drep)
1049 {
1050         guint16 u16NewGroupError;
1051         guint16 u16OldGroupError;
1052
1053
1054     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
1055
1056         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1057                         hf_cba_new_grouperror, &u16NewGroupError);
1058
1059         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1060                         hf_cba_old_grouperror, &u16OldGroupError);
1061
1062         col_append_fstr(pinfo->cinfo, COL_INFO, ": NewGE=%s OldGE=%s", 
1063                 val_to_str(u16NewGroupError, cba_grouperror_vals, "Unknown (0x%04x)"),
1064                 val_to_str(u16OldGroupError, cba_grouperror_vals, "Unknown (0x%04x)") );
1065
1066         return offset;
1067 }
1068
1069
1070 static int
1071 dissect_ICBAPhysicalDevicePCEvent_OnLogicalDeviceAdded_rqst(tvbuff_t *tvb, int offset,
1072         packet_info *pinfo, proto_tree *tree, guint8 *drep)
1073 {
1074         guint32 u32Cookie;
1075         guint32 u32HResult;
1076
1077
1078     offset = dissect_dcom_this(tvb, offset, pinfo, tree, drep);
1079
1080         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
1081                         hf_cba_cookie, &u32Cookie);
1082
1083         offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, drep, 0, NULL);
1084
1085         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
1086                         &u32HResult);
1087
1088         col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x %s", 
1089                 u32Cookie,
1090                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
1091
1092         return offset;
1093 }
1094
1095
1096 static int
1097 dissect_ICBAGroupError_GroupError_resp(tvbuff_t *tvb, int offset,
1098         packet_info *pinfo, proto_tree *tree, guint8 *drep)
1099 {
1100         guint16 u16GroupError;
1101         guint32 u32Cookie;
1102         guint32 u32HResult;
1103
1104
1105     offset = dissect_dcom_that(tvb, offset, pinfo, tree, drep);
1106
1107         offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, drep, 
1108                         hf_cba_grouperror, &u16GroupError);
1109
1110         offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, drep, 
1111                         hf_cba_cookie, &u32Cookie);
1112
1113         offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, drep, 
1114                         &u32HResult);
1115
1116         col_append_fstr(pinfo->cinfo, COL_INFO, ": GroupError=%s Cookie=0x%x -> %s", 
1117                 val_to_str(u16GroupError, cba_grouperror_vals, "Unknown (0x%08x)"),
1118                 u32Cookie,
1119                 val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") );
1120
1121         return offset;
1122 }
1123
1124
1125 /* sub dissector table of ICBAPhysicalDevice / ICBAPhysicalDevice2 interface */
1126 static dcerpc_sub_dissector ICBAPhysicalDevice_dissectors[] = {
1127     { 0, "QueryInterface", NULL, NULL },
1128     { 1, "AddRef", NULL, NULL },
1129     { 2, "Release", NULL, NULL },
1130
1131     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1132     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1133     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1134     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1135
1136     { 7, "get_Producer", dissect_dcom_simple_rqst, dissect_get_Producer_resp },
1137     { 8, "get_Product", dissect_dcom_simple_rqst, dissect_get_Product_resp },
1138     { 9, "get_SerialNo", dissect_dcom_simple_rqst, dissect_get_SerialNo_resp },
1139     {10, "get_ProductionDate", dissect_dcom_simple_rqst, dissect_get_ProductionDate_resp },
1140     {11, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp },
1141     {12, "get_LogicalDevice", dissect_ICBAPhysicalDevice_get_LogicalDevice_rqst, dissect_ICBAPhysicalDevice_get_LogicalDevice_resp },
1142         /* stage 2 */
1143     {13, "Type", dissect_dcom_simple_rqst, dissect_ICBAPhysicalDevice2_Type_resp },
1144     {14, "PROFInetRevision", dissect_dcom_simple_rqst, dissect_PROFInetRevision_resp },
1145     {15, "PDevStamp", dissect_dcom_simple_rqst, dissect_ICBAPhysicalDevice2_get_PDevStamp_resp },
1146         { 0, NULL, NULL, NULL },
1147 };
1148
1149
1150 /* sub dissector table of ICBABrowse / ICBABrowse2 interface */
1151 static dcerpc_sub_dissector ICBABrowse_dissectors[] = {
1152     { 0, "QueryInterface", NULL, NULL },
1153     { 1, "AddRef", NULL, NULL },
1154     { 2, "Release", NULL, NULL },
1155
1156     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1157     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1158     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1159     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1160
1161     { 7, "get_Count", dissect_dcom_simple_rqst, dissect_ICBABrowse_get_Count_resp },
1162     { 8, "BrowseItems", dissect_ICBABrowse_BrowseItems_rqst, dissect_ICBABrowse_BrowseItems_resp },
1163         /* stage 2 */
1164     { 9, "get_Count2", dissect_ICBABrowse2_get_Count2_rqst, dissect_ICBABrowse_get_Count_resp },
1165     {10, "BrowseItems2", dissect_ICBABrowse2_BrowseItems2_rqst, dissect_ICBABrowse2_BrowseItems2_resp },
1166     { 0, NULL, NULL, NULL },
1167 };
1168
1169
1170 /* sub dissector table of ICBAPersist / ICBAPersist2 interface */
1171 static dcerpc_sub_dissector ICBAPersist_dissectors[] = {
1172     { 0, "QueryInterface", NULL, NULL },
1173     { 1, "AddRef", NULL, NULL },
1174     { 2, "Release", NULL, NULL },
1175
1176     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1177     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1178     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1179     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1180
1181     { 7, "Save", dissect_dcom_simple_rqst, dissect_dcom_simple_resp },
1182         /* stage 2 */
1183     { 8, "Save2", dissect_dcom_simple_rqst, dissect_ICBAPersist2_Save2_resp },
1184     { 0, NULL, NULL, NULL },
1185 };
1186
1187
1188 /* sub dissector table of ICBAPhysicalDevicePC interface */
1189 /* (local COM interface, not to be called over network) */
1190 static dcerpc_sub_dissector ICBAPhysicalDevicePC_dissectors[] = {
1191     { 0, "QueryInterface", NULL, NULL },
1192     { 1, "AddRef", NULL, NULL },
1193     { 2, "Release", NULL, NULL },
1194
1195     { 3, "AddLogicalDevice", dissect_Advise_rqst, dissect_Advise_resp },
1196     { 4, "RemoveLogicalDevice", dissect_Unadvise_rqst, dissect_dcom_simple_resp  },
1197     { 5, "AdvisePDevPC", dissect_Advise_rqst, dissect_Advise_resp },
1198     { 6, "UnadvisePDevPC", dissect_Unadvise_rqst, dissect_dcom_simple_resp },
1199         /* stage 2 */
1200     { 7, "RegisterApplication", NULL, NULL },
1201     { 8, "UnRegisterApplication", NULL, NULL },
1202     { 9, "AddLogicalDevice2", NULL, NULL },
1203     { 0, NULL, NULL, NULL },
1204 };
1205
1206
1207 /* sub dissector table of ICBAPhysicalDevicePCEvent interface */
1208 static dcerpc_sub_dissector ICBAPhysicalDevicePCEvent_dissectors[] = {
1209     { 0, "QueryInterface", NULL, NULL },
1210     { 1, "AddRef", NULL, NULL },
1211     { 2, "Release", NULL, NULL },
1212
1213     { 3, "OnLogicalDeviceAdded", dissect_ICBAPhysicalDevicePCEvent_OnLogicalDeviceAdded_rqst, dissect_dcom_simple_resp  },
1214     { 4, "OnLogicalDeviceRemoved", dissect_Unadvise_rqst, dissect_dcom_simple_resp  },
1215     { 0, NULL, NULL, NULL },
1216 };
1217
1218
1219 /* sub dissector table of ICBALogicalDevice / ICBALogicalDevice2 interface */
1220 static dcerpc_sub_dissector ICBALogicalDevice_dissectors[] = {
1221     { 0, "QueryInterface", NULL, NULL },
1222     { 1, "AddRef", NULL, NULL },
1223     { 2, "Release", NULL, NULL },
1224
1225     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1226     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1227     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1228     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1229
1230     { 7, "get_Name", dissect_dcom_simple_rqst, dissect_ICBALogicalDevice_get_Name_resp },
1231     { 8, "get_Producer", dissect_dcom_simple_rqst, dissect_get_Producer_resp },
1232     { 9, "get_Product", dissect_dcom_simple_rqst, dissect_get_Product_resp },
1233     {10, "get_SerialNo", dissect_dcom_simple_rqst, dissect_get_SerialNo_resp },
1234     {11, "get_ProductionDate", dissect_dcom_simple_rqst, dissect_get_ProductionDate_resp },
1235     {12, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp },
1236     {13, "get_ACCO", dissect_dcom_simple_rqst, dissect_ICBALogicalDevice_get_ACCO_resp },
1237     {14, "get_RTAuto", dissect_ICBALogicalDevice_Get_RTAuto_rqst, dissect_ICBALogicalDevice_get_RTAuto_resp },
1238         /* stage 2 */
1239     {15, "PROFInetRevision", dissect_dcom_simple_rqst, dissect_PROFInetRevision_resp },
1240     {16, "ComponentInfo", dissect_dcom_simple_rqst, dissect_ComponentInfo_resp },
1241     {17, "PBAddressInfo", dissect_dcom_simple_rqst, dissect_PBAddressInfo_resp },
1242     { 0, NULL, NULL, NULL },
1243 };
1244
1245
1246 /* sub dissector table of ICBAState interface */
1247 static dcerpc_sub_dissector ICBAState_dissectors[] = {
1248     { 0, "QueryInterface", NULL, NULL },
1249     { 1, "AddRef", NULL, NULL },
1250     { 2, "Release", NULL, NULL },
1251
1252     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1253     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1254     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1255     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1256
1257     { 7, "get_State", dissect_dcom_simple_rqst, dissect_ICBAState_get_State_resp },
1258     { 8, "Activate", dissect_dcom_simple_rqst, dissect_dcom_simple_resp },
1259     { 9, "Deactivate", dissect_dcom_simple_rqst, dissect_dcom_simple_resp },
1260     {10, "Reset", dissect_dcom_simple_rqst, dissect_dcom_simple_resp },
1261     {11, "AdviseState", dissect_Advise_rqst, dissect_Advise_resp },
1262     {12, "UnadviseState", dissect_Unadvise_rqst, dissect_dcom_simple_resp },
1263     { 0, NULL, NULL, NULL },
1264 };
1265
1266
1267 /* sub dissector table of ICBAStateEvent interface */
1268 static dcerpc_sub_dissector ICBAStateEvent_dissectors[] = {
1269     { 0, "QueryInterface", NULL, NULL },
1270     { 1, "AddRef", NULL, NULL },
1271     { 2, "Release", NULL, NULL },
1272
1273     { 3, "OnStateChanged", dissect_ICBAStateEvent_OnStateChanged_rqst, dissect_dcom_simple_resp },
1274     { 0, NULL, NULL, NULL },
1275 };
1276
1277
1278 /* sub dissector table of ICBATime interface */
1279 static dcerpc_sub_dissector ICBATime_dissectors[] = {
1280     { 0, "QueryInterface", NULL, NULL },
1281     { 1, "AddRef", NULL, NULL },
1282     { 2, "Release", NULL, NULL },
1283
1284     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1285     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1286     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1287     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1288
1289     { 7, "get_Time", dissect_dcom_simple_rqst, dissect_ICBATime_get_Time_resp },
1290     { 8, "put_Time", dissect_ICBATime_put_Time_rqst, dissect_dcom_simple_resp },
1291     { 0, NULL, NULL, NULL },
1292 };
1293
1294
1295 /* sub dissector table of ICBAGroupError interface */
1296 static dcerpc_sub_dissector ICBAGroupError_dissectors[] = {
1297     { 0, "QueryInterface", NULL, NULL },
1298     { 1, "AddRef", NULL, NULL },
1299     { 2, "Release", NULL, NULL },
1300
1301     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1302     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1303     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1304     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1305
1306     { 7, "GroupError", dissect_dcom_simple_rqst, dissect_ICBAGroupError_GroupError_resp },
1307     { 8, "AdviseGroupError", dissect_Advise_rqst, dissect_Advise_resp },
1308     { 9, "UnadviseGroupError", dissect_Unadvise_rqst, dissect_dcom_simple_resp },
1309     { 0, NULL, NULL, NULL },
1310 };
1311
1312
1313 /* sub dissector table of ICBAGroupErrorEvent interface */
1314 static dcerpc_sub_dissector ICBAGroupErrorEvent_dissectors[] = {
1315     { 0, "QueryInterface", NULL, NULL },
1316     { 1, "AddRef", NULL, NULL },
1317     { 2, "Release", NULL, NULL },
1318
1319     { 3, "OnGroupErrorChanged", dissect_ICBAGroupError_OnGroupErrorChanged_rqst, dissect_dcom_simple_resp },
1320     { 0, NULL, NULL, NULL },
1321 };
1322
1323
1324 /* sub dissector table of ICBARTAuto interface */
1325 static dcerpc_sub_dissector ICBARTAuto_dissectors[] = {
1326     { 0, "QueryInterface", NULL, NULL },
1327     { 1, "AddRef", NULL, NULL },
1328     { 2, "Release", NULL, NULL },
1329
1330     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1331     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1332     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1333     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1334
1335     { 7, "get_Name", dissect_dcom_simple_rqst, dissect_RTAuto_get_Name_resp },
1336     { 8, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp },
1337
1338         /* stage 2 */
1339     { 9, "ComponentInfo", dissect_dcom_simple_rqst, dissect_ComponentInfo_resp },
1340     { 0, NULL, NULL, NULL },
1341 };
1342
1343
1344 /* the interface ICBASystemProperties will NOT be seen on the ethernet */
1345 /* sub dissector table of ICBASystemProperties interface (stage 2 only) */
1346 /* (usually not called over network, no dissecting needed) */
1347 static dcerpc_sub_dissector ICBASystemProperties_dissectors[] = {
1348     { 0, "QueryInterface", NULL, NULL },
1349     { 1, "AddRef", NULL, NULL },
1350     { 2, "Release", NULL, NULL },
1351
1352     { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp },
1353     { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp },
1354     { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp },
1355     { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp },
1356
1357     { 7, "StateCollection", dissect_dcom_simple_rqst, NULL },
1358     { 8, "StampCollection", dissect_dcom_simple_rqst, NULL },
1359     { 0, NULL, NULL, NULL },
1360 };
1361
1362
1363 static void cba_reinit( void) {
1364     cba_pdevs = NULL;
1365 }
1366
1367
1368 /* register protocol */
1369 void
1370 proto_register_dcom_cba (void)
1371 {
1372         static hf_register_info hf_cba_browse_array[] = {
1373                 { &hf_cba_browse_count,
1374                 { "Count",   "cba.browse.count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1375                 { &hf_cba_browse_offset,
1376                 { "Offset",   "cba.browse.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1377                 { &hf_cba_browse_max_return,
1378                 { "MaxReturn",   "cba.browse.max_return", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1379                 { &hf_cba_browse_item,
1380                 { "ItemNames", "cba.browse.item", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1381                 { &hf_cba_browse_data_type,
1382                 { "DataTypes", "cba.browse.data_type", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1383                 { &hf_cba_browse_access_right,
1384                 { "AccessRights", "cba.browse.access_right", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1385                 { &hf_cba_browse_selector,
1386                 { "Selector",   "cba.browse.selector", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1387                 { &hf_cba_browse_info1,
1388                 { "Info1", "cba.browse.info1", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1389                 { &hf_cba_browse_info2,
1390                 { "Info2", "cba.browse.info2", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1391         };
1392
1393
1394         static hf_register_info hf_cba_pdev_array[] = {
1395                 { &hf_cba_revision_major,
1396                 { "Major", "cba.revision_major", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1397                 { &hf_cba_revision_minor,
1398                 { "Minor", "cba.revision_minor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1399                 { &hf_cba_revision_service_pack,
1400                 { "ServicePack", "cba.revision_service_pack", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1401                 { &hf_cba_revision_build,
1402                 { "Build", "cba_revision_build", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1403                 { &hf_cba_producer,
1404                 { "Producer", "cba.producer", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1405                 { &hf_cba_product,
1406                 { "Product", "cba.product", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1407                 { &hf_cba_multi_app,
1408                 { "MultiApp", "cba.multi_app", FT_UINT16, BASE_HEX, VALS(dcom_boolean_vals), 0x0, NULL, HFILL }},
1409                 { &hf_cba_profinet_dcom_stack,
1410                 { "PROFInetDCOMStack", "cba.profinet_dcom_stack", FT_UINT16, BASE_HEX, VALS(dcom_boolean_vals), 0x0, NULL, HFILL }},
1411                 { &hf_cba_pdev_stamp,
1412                 { "PDevStamp", "cba.pdev_stamp", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1413                 { &hf_cba_save_ldev_name,
1414                 { "LDevName", "cba.save_ldev_name", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1415                 { &hf_cba_save_result,
1416                 { "PartialResult", "cba.save_result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1417         };
1418
1419         static hf_register_info hf_cba_ldev_array[] = {
1420                 { &hf_cba_name,
1421                 { "Name", "cba.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1422                 { &hf_cba_component_id,
1423                 { "ComponentID", "cba.component_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1424                 { &hf_cba_component_version,
1425                 { "Version", "cba.component_version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1426                 { &hf_cba_pbaddress,
1427                 { "PROFIBUS Address", "cba.pbaddress", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1428                 { &hf_cba_pbaddress_system_id,
1429                 { "SystemID", "cba.pbaddress.system_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1430                 { &hf_cba_pbaddress_address,
1431                 { "Address", "cba.pbaddress.address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1432         };
1433
1434         static hf_register_info hf_cba_array[] = {
1435         { &hf_cba_opnum,
1436             { "Operation", "cba.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1437                 { &hf_cba_production_date,
1438                 { "ProductionDate", "cba.production_date", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1439                 { &hf_cba_time,
1440                 { "Time", "cba.time", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1441                 { &hf_cba_serial_no,
1442                 { "SerialNo", "cba.serial_no", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1443                 { &hf_cba_state,
1444                 { "State",  "cba.state", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }},
1445                 { &hf_cba_new_state,
1446                 { "NewState",  "cba.state_new", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }},
1447                 { &hf_cba_old_state,
1448                 { "OldState",  "cba.state_old", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }},
1449                 { &hf_cba_cookie,
1450                 { "Cookie", "cba.cookie", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1451                 { &hf_cba_grouperror,
1452                 { "GroupError", "cba.grouperror", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }},
1453                 { &hf_cba_new_grouperror,
1454                 { "NewGroupError", "cba.grouperror_new", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }},
1455                 { &hf_cba_old_grouperror,
1456                 { "OldGroupError", "cba.grouperror_old", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }},
1457         };
1458
1459         static gint *ett_cba[] = {
1460             &ett_ICBAPhysicalDevice,
1461             &ett_ICBABrowse,
1462             &ett_ICBAPhysicalDevicePC,
1463             &ett_ICBAPhysicalDevicePCEvent,
1464             &ett_ICBAPersist,
1465             &ett_ICBALogicalDevice,
1466             &ett_ICBAState,
1467             &ett_ICBAStateEvent,
1468             &ett_ICBATime,
1469             &ett_ICBAGroupError,
1470             &ett_ICBAGroupErrorEvent,
1471             &ett_ICBARTAuto,
1472             &ett_ICBASystemProperties,
1473             &ett_PBAddress
1474         };
1475
1476         proto_register_subtree_array (ett_cba, array_length (ett_cba));
1477
1478         proto_ICBAPhysicalDevice = proto_register_protocol ("ICBAPhysicalDevice", "ICBAPDev", "cba_pdev");
1479         proto_register_field_array(proto_ICBAPhysicalDevice, hf_cba_pdev_array, array_length(hf_cba_pdev_array));
1480
1481         proto_ICBAPhysicalDevice2 = proto_register_protocol ("ICBAPhysicalDevice2", "ICBAPDev2", "cba_pdev2");
1482
1483         proto_ICBABrowse = proto_register_protocol ("ICBABrowse", "ICBABrowse", "cba_browse");
1484         proto_register_field_array(proto_ICBABrowse, hf_cba_array, array_length(hf_cba_array));
1485         proto_register_field_array(proto_ICBABrowse, hf_cba_browse_array, array_length(hf_cba_browse_array));
1486
1487         proto_ICBABrowse2 = proto_register_protocol ("ICBABrowse2", "ICBABrowse2", "cba_browse2");
1488
1489         proto_ICBAPhysicalDevicePC = proto_register_protocol ("ICBAPhysicalDevicePC", "ICBAPDevPC", "cba_pdev_pc");
1490
1491         proto_ICBAPhysicalDevicePCEvent = proto_register_protocol ("ICBAPhysicalDevicePCEvent", "ICBAPDevPCEvent", "cba_pdev_pc_event");
1492
1493         proto_ICBAPersist = proto_register_protocol ("ICBAPersist", "ICBAPersist", "cba_persist");
1494
1495         proto_ICBAPersist2 = proto_register_protocol ("ICBAPersist2", "ICBAPersist2", "cba_persist2");
1496
1497         proto_ICBALogicalDevice = proto_register_protocol ("ICBALogicalDevice", "ICBALDev", "cba_ldev");
1498         proto_register_field_array(proto_ICBAPhysicalDevice, hf_cba_ldev_array, array_length(hf_cba_ldev_array));
1499
1500         proto_ICBALogicalDevice2 = proto_register_protocol ("ICBALogicalDevice2", "ICBALDev2", "cba_ldev2");
1501
1502         proto_ICBAState = proto_register_protocol ("ICBAState", "ICBAState", "cba_state");
1503
1504         proto_ICBAStateEvent = proto_register_protocol ("ICBAStateEvent", "ICBAStateEvent", "cba_state_event");
1505
1506         proto_ICBATime = proto_register_protocol ("ICBATime", "ICBATime", "cba_time");
1507
1508         proto_ICBAGroupError = proto_register_protocol ("ICBAGroupError", "ICBAGErr", "cba_grouperror");
1509
1510         proto_ICBAGroupErrorEvent = proto_register_protocol ("ICBAGroupErrorEvent", "ICBAGErrEvent", "cba_grouperror_event");
1511
1512         proto_ICBARTAuto = proto_register_protocol ("ICBARTAuto", "ICBARTAuto", "cba_rtauto");
1513
1514         proto_ICBARTAuto2 = proto_register_protocol ("ICBARTAuto2", "ICBARTAuto2", "cba_rtauto2");
1515
1516         proto_ICBASystemProperties = proto_register_protocol ("ICBASystemProperties", "ICBASysProp", "cba_sysprop");
1517
1518         register_init_routine(cba_reinit);
1519 }
1520
1521
1522 /* handoff protocol */
1523 void
1524 proto_reg_handoff_dcom_cba (void)
1525 {
1526     /* Register the CBA class ID */
1527     guids_add_uuid(&uuid_coclass_CBAPhysicalDevice, "CBA");
1528
1529         /* Register the interfaces */
1530         dcerpc_init_uuid(proto_ICBAPhysicalDevice, ett_ICBAPhysicalDevice,
1531                 &uuid_ICBAPhysicalDevice, ver_ICBAPhysicalDevice,
1532                 ICBAPhysicalDevice_dissectors, hf_cba_opnum);
1533
1534         dcerpc_init_uuid(proto_ICBAPhysicalDevice2, ett_ICBAPhysicalDevice,
1535                 &uuid_ICBAPhysicalDevice2, ver_ICBAPhysicalDevice2,
1536                 ICBAPhysicalDevice_dissectors, hf_cba_opnum);
1537
1538         dcerpc_init_uuid(proto_ICBABrowse, ett_ICBABrowse,
1539                 &uuid_ICBABrowse, ver_ICBABrowse,
1540                 ICBABrowse_dissectors, hf_cba_opnum);
1541
1542         dcerpc_init_uuid(proto_ICBABrowse2, ett_ICBABrowse,
1543                 &uuid_ICBABrowse2, ver_ICBABrowse2,
1544                 ICBABrowse_dissectors, hf_cba_opnum);
1545
1546         dcerpc_init_uuid(proto_ICBAPhysicalDevicePC, ett_ICBAPhysicalDevicePC,
1547                 &uuid_ICBAPhysicalDevicePC, ver_ICBAPhysicalDevicePC,
1548                 ICBAPhysicalDevicePC_dissectors, hf_cba_opnum);
1549
1550         dcerpc_init_uuid(proto_ICBAPhysicalDevicePCEvent, ett_ICBAPhysicalDevicePCEvent,
1551                 &uuid_ICBAPhysicalDevicePCEvent, ver_ICBAPhysicalDevicePCEvent,
1552                 ICBAPhysicalDevicePCEvent_dissectors, hf_cba_opnum);
1553
1554         dcerpc_init_uuid(proto_ICBAPersist, ett_ICBAPersist,
1555                 &uuid_ICBAPersist, ver_ICBAPersist,
1556                 ICBAPersist_dissectors, hf_cba_opnum);
1557
1558         dcerpc_init_uuid(proto_ICBAPersist2, ett_ICBAPersist,
1559                 &uuid_ICBAPersist2, ver_ICBAPersist2,
1560                 ICBAPersist_dissectors, hf_cba_opnum);
1561
1562         dcerpc_init_uuid(proto_ICBALogicalDevice, ett_ICBALogicalDevice,
1563                 &uuid_ICBALogicalDevice, ver_ICBALogicalDevice,
1564                 ICBALogicalDevice_dissectors, hf_cba_opnum);
1565
1566         dcerpc_init_uuid(proto_ICBALogicalDevice2, ett_ICBALogicalDevice,
1567                 &uuid_ICBALogicalDevice2, ver_ICBALogicalDevice2,
1568                 ICBALogicalDevice_dissectors, hf_cba_opnum);
1569
1570         dcerpc_init_uuid(proto_ICBAState, ett_ICBAState,
1571                 &uuid_ICBAState, ver_ICBAState,
1572                 ICBAState_dissectors, hf_cba_opnum);
1573
1574         dcerpc_init_uuid(proto_ICBAStateEvent, ett_ICBAStateEvent,
1575                 &uuid_ICBAStateEvent, ver_ICBAStateEvent,
1576                 ICBAStateEvent_dissectors, hf_cba_opnum);
1577
1578         dcerpc_init_uuid(proto_ICBATime, ett_ICBATime,
1579                 &uuid_ICBATime, ver_ICBATime,
1580                 ICBATime_dissectors, hf_cba_opnum);
1581
1582         dcerpc_init_uuid(proto_ICBAGroupError, ett_ICBAGroupError,
1583                 &uuid_ICBAGroupError, ver_ICBAGroupError, 
1584                 ICBAGroupError_dissectors, hf_cba_opnum);
1585
1586         dcerpc_init_uuid(proto_ICBAGroupErrorEvent, ett_ICBAGroupErrorEvent,
1587                 &uuid_ICBAGroupErrorEvent, ver_ICBAGroupErrorEvent,
1588                 ICBAGroupErrorEvent_dissectors, hf_cba_opnum);
1589
1590         dcerpc_init_uuid(proto_ICBARTAuto, ett_ICBARTAuto,
1591                 &uuid_ICBARTAuto, ver_ICBARTAuto, 
1592                 ICBARTAuto_dissectors, hf_cba_opnum);
1593
1594         dcerpc_init_uuid(proto_ICBARTAuto2, ett_ICBARTAuto,
1595                 &uuid_ICBARTAuto2, ver_ICBARTAuto2, 
1596                 ICBARTAuto_dissectors, hf_cba_opnum);
1597
1598         dcerpc_init_uuid(proto_ICBASystemProperties, ett_ICBASystemProperties,
1599                 &uuid_ICBASystemProperties, ver_ICBASystemProperties, 
1600                 ICBASystemProperties_dissectors, hf_cba_opnum);
1601 }