2 * Dissector for Open Control Protocol OCP.1/AES70
4 * Copyright (c) 2021-2024 by Martin Mayer <martin.mayer@m2-it-solutions.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <epan/expert.h>
16 #include <epan/conversation.h>
17 #include <epan/unit_strings.h>
18 #include "packet-tcp.h"
20 #define OCP1_SYNC_VAL 0x3B
21 #define OCP1_PROTO_VER 0x0001
22 #define OCP1_FRAME_HEADER_LEN 10
23 #define OCP1_MESSAGE_SIZE_LEN 4
26 #define OCP1_PDU_TYPE_OCA_CMD 0x00
27 #define OCP1_PDU_TYPE_OCA_CMD_RRQ 0x01
28 #define OCP1_PDU_TYPE_OCA_NTF 0x02
29 #define OCP1_PDU_TYPE_OCA_RSP 0x03
30 #define OCP1_PDU_TYPE_OCA_KEEPALIVE 0x04
32 /* DeviceState flags */
33 #define OCP1_DEVICESTATE_OPER 0x0001
34 #define OCP1_DEVICESTATE_DISABLED 0x0002
35 #define OCP1_DEVICESTATE_ERROR 0x0004
36 #define OCP1_DEVICESTATE_INIT 0x0008
37 #define OCP1_DEVICESTATE_UPDATING 0x0010
39 /* no valid PDU type, only used as array index for type errors
40 * must be highest PDU type + 1 */
41 #define OCP1_PDU_TYPE_ERROR_INDEX 0x05
43 /* Handle Hashmap Key */
44 struct oca_request_hash_key
{
48 /* Handle Hashmap Val */
49 struct oca_request_hash_val
{
54 uint16_t method_index
;
56 static wmem_map_t
*oca_request_hash_map
;
58 void proto_register_ocp1(void);
59 void proto_reg_handoff_ocp1(void);
61 static dissector_handle_t ocp1_tcp_handle
;
62 static dissector_handle_t ocp1_udp_handle
;
64 static int proto_ocp1
;
67 static int hf_ocp1_sync_value
;
68 static int hf_ocp1_protocol_version
;
69 static int hf_ocp1_pdu_size
;
70 static int hf_ocp1_pdu_type
;
71 static int hf_ocp1_message_count
;
73 /* Keep-Alive Fields */
74 static int hf_ocp1_heartbeat_time_s
;
75 static int hf_ocp1_heartbeat_time_ms
;
78 static int hf_ocp1_message_size
;
79 static int hf_ocp1_message_handle
;
80 static int hf_ocp1_message_target_ono
;
81 static int hf_ocp1_message_emitter_ono
;
82 static int hf_ocp1_message_occ
;
83 static int hf_ocp1_message_method_id
;
84 static int hf_ocp1_message_method_tree_level
;
85 static int hf_ocp1_message_method_index
;
86 static int hf_ocp1_message_event_id
;
87 static int hf_ocp1_message_event_tree_level
;
88 static int hf_ocp1_message_event_index
;
89 static int hf_ocp1_message_parameter_count
;
90 static int hf_ocp1_message_status_code
;
91 static int hf_ocp1_response_in
;
92 static int hf_ocp1_response_to
;
94 /* Notification Fields */
95 static int hf_ocp1_notification_parameter_context
;
98 static int hf_ocp1_params
;
99 static int hf_ocp1_params_bool
;
100 static int hf_ocp1_params_ono
;
101 static int hf_ocp1_params_event_id
;
102 static int hf_ocp1_params_event_tree_level
;
103 static int hf_ocp1_params_event_index
;
104 static int hf_ocp1_params_method_id
;
105 static int hf_ocp1_params_method_tree_level
;
106 static int hf_ocp1_params_method_index
;
107 static int hf_ocp1_params_property_id
;
108 static int hf_ocp1_params_property_tree_level
;
109 static int hf_ocp1_params_property_index
;
110 static int hf_ocp1_params_blob
;
111 static int hf_ocp1_params_blob_datasize
;
112 static int hf_ocp1_params_blob_data
;
113 static int hf_ocp1_params_string
;
114 static int hf_ocp1_params_string_length
;
115 static int hf_ocp1_params_string_value
;
116 static int hf_ocp1_params_ntf_delivery_mode
;
117 static int hf_ocp1_params_list_count
;
118 static int hf_ocp1_params_map_count
;
119 static int hf_ocp1_params_imageid
;
120 static int hf_ocp1_params_classid
;
121 static int hf_ocp1_params_classid_fields
;
122 static int hf_ocp1_params_class_version
;
123 static int hf_ocp1_params_oca_version
;
124 static int hf_ocp1_params_reset_cause
;
125 static int hf_ocp1_params_power_state
;
126 static int hf_ocp1_params_media_clock_type
;
127 static int hf_ocp1_params_component
;
128 static int hf_ocp1_params_devicestate
;
129 static int hf_ocp1_params_devicestate_oper
;
130 static int hf_ocp1_params_devicestate_disabled
;
131 static int hf_ocp1_params_devicestate_error
;
132 static int hf_ocp1_params_devicestate_init
;
133 static int hf_ocp1_params_devicestate_updating
;
134 static int hf_ocp1_params_ocaver_major
;
135 static int hf_ocp1_params_ocaver_minor
;
136 static int hf_ocp1_params_ocaver_build
;
137 static int hf_ocp1_params_ocaver_comp
;
138 static int hf_ocp1_params_subscriber_ctx_len
;
139 static int hf_ocp1_params_libvol_id
;
140 static int hf_ocp1_params_libvoltype_id
;
141 static int hf_ocp1_params_library_count
;
142 static int hf_ocp1_params_time_ntp
;
143 static int hf_ocp1_params_time_ptp
;
144 static int hf_ocp1_params_time_ptp_negative
;
145 static int hf_ocp1_params_time_ptp_seconds
;
146 static int hf_ocp1_params_time_ptp_nanoseconds
;
147 static int hf_ocp1_params_time_mode
;
148 static int hf_ocp1_params_time_units
;
149 static int hf_ocp1_params_task_id
;
150 static int hf_ocp1_params_task_group_id
;
151 static int hf_ocp1_params_time_interval
;
152 static int hf_ocp1_params_start_time
;
153 static int hf_ocp1_params_task_command
;
154 static int hf_ocp1_params_task_manager_state
;
155 static int hf_ocp1_params_task_state
;
156 static int hf_ocp1_params_task_status_error_code
;
157 static int hf_ocp1_params_media_coding_scheme_id
;
160 static expert_field ei_ocp1_handle_fail
;
161 static expert_field ei_ocp1_bad_status_code
;
162 static expert_field ei_ocp1_invalid_length
;
166 static int ett_ocp1_pdu
;
167 static int ett_ocp1_keepalive
;
168 static int ett_ocp1_message_method
;
169 static int ett_ocp1_context
;
170 static int ett_ocp1_event_data
;
171 static int ett_ocp1_event_method
;
172 static int ett_ocp1_params
;
173 static int ett_ocp1_params_event
;
174 static int ett_ocp1_params_method
;
175 static int ett_ocp1_params_property
;
176 static int ett_ocp1_params_blob
;
177 static int ett_ocp1_params_string
;
178 static int ett_ocp1_params_manager_desc
;
179 static int ett_ocp1_params_devicestate
;
180 static int ett_ocp1_params_compversion
;
181 static int ett_ocp1_params_ocaver
;
182 static int ett_ocp1_params_ptp
;
185 static const value_string pdu_type_vals
[] = {
186 { OCP1_PDU_TYPE_OCA_CMD
, "Command, no response required" },
187 { OCP1_PDU_TYPE_OCA_CMD_RRQ
, "Command, response required" },
188 { OCP1_PDU_TYPE_OCA_NTF
, "Notification" },
189 { OCP1_PDU_TYPE_OCA_RSP
, "Response" },
190 { OCP1_PDU_TYPE_OCA_KEEPALIVE
, "Keep-Alive" },
195 static const value_string OcaStatus
[] = {
197 { 0x01, "Protocol Version Error" },
198 { 0x02, "Device Error" },
200 { 0x04, "Bad Format" },
201 { 0x05, "Bad Object Number" },
202 { 0x06, "Parameter Error" },
203 { 0x07, "Parameter Out Of Range" },
204 { 0x08, "Not Implemented" },
205 { 0x09, "Invalid Request" },
206 { 0x0A, "Processing Failed" },
207 { 0x0B, "Bad Method" },
208 { 0x0C, "Partially Succeeded" },
210 { 0x0E, "Buffer Overflow" },
214 static const value_string OcaNotificationDeliveryMode
[] = {
215 { 0x01, "Reliable" },
219 static const value_string OcaPowerState
[] = {
226 static const value_string OcaMediaClockType
[] = {
228 { 0x01, "Internal" },
230 { 0x03, "External" },
234 static const value_string OcaResetCause
[] = {
236 { 0x01, "InternalError" },
238 { 0x03, "ExternalRequest" },
242 static const value_string OcaComponent
[] = {
243 { 0x0000, "BootLoader" },
247 static const value_string OcaTaskCommand
[] = {
259 static const value_string OcaTaskManagerState
[] = {
262 { 0x02, "Disabled" },
266 static const value_string OcaTaskState
[] = {
268 { 0x01, "NotPrepared" },
269 { 0x02, "Disabled" },
272 { 0x05, "Completed" },
279 static const value_string OcaFixedONo
[] = {
280 { 0x01, "OcaDeviceManager" },
281 { 0x02, "OcaSecurityManager" },
282 { 0x03, "OcaFirmwareManager" },
283 { 0x04, "OcaSubscriptionManager" },
284 { 0x05, "OcaPowerManager" },
285 { 0x06, "OcaNetworkManager" },
286 { 0x07, "OcaMediaClockManager" },
287 { 0x08, "OcaLibraryManager" },
288 { 0x09, "OcaAudioProcessingManager" },
289 { 0x0A, "OcaDeviceTimeManager" },
290 { 0x0B, "OcaTaskManager" },
291 { 0x0C, "OcaCodingManager" },
292 { 0x0D, "OcaDiagnosticManager" },
296 static const value_string OcaRootMethods
[] = {
297 { 0x01, "GetClassIdentification" },
298 { 0x02, "GetLockable" },
299 { 0x03, "LockTotal" },
302 { 0x06, "LockReadonly" },
306 static const value_string OcaDeviceManagerMethods
[] = {
307 { 0x01, "GetOcaVersion" },
308 { 0x02, "GetModelGUID" },
309 { 0x03, "GetSerialNumber" },
310 { 0x04, "GetDeviceName" },
311 { 0x05, "SetDeviceName" },
312 { 0x06, "GetModelDescription" },
315 { 0x09, "GetUserInventoryCode" },
316 { 0x0A, "SetUserInventoryCode" },
317 { 0x0B, "GetEnabled" },
318 { 0x0C, "SetEnabled" },
319 { 0x0D, "GetState" },
320 { 0x0E, "SetResetKey" },
321 { 0x0F, "GetResetCause" },
322 { 0x10, "ClearResetCause" },
323 { 0x11, "GetMessage" },
324 { 0x12, "SetMessage" },
325 { 0x13, "GetManagers" },
326 { 0x14, "GetDeviceRevisionID" },
330 static const value_string OcaSecurityManagerMethods
[] = {
331 { 0x01, "EnableControlSecurity" },
332 { 0x02, "DisableControlSecurity" },
333 { 0x03, "ChangePreSharedKey" },
334 { 0x04, "AddPreSharedKey" },
335 { 0x05, "DeletePreSharedKey" },
339 static const value_string OcaFirmwareManagerMethods
[] = {
340 { 0x01, "GetComponentVersions" },
341 { 0x02, "StartUpdateProcess" },
342 { 0x03, "BeginActiveImageUpdate" },
343 { 0x04, "AddImageData" },
344 { 0x05, "VerifyImage" },
345 { 0x06, "EndActiveImageUpdate" },
346 { 0x07, "BeginPassiveComponentUpdate" },
347 { 0x08, "EndUpdateProcess" },
351 static const value_string OcaSubscriptionManagerMethods
[] = {
352 { 0x01, "AddSubscription" },
353 { 0x02, "RemoveSubscription" },
354 { 0x03, "DisableNotifications" },
355 { 0x04, "ReEnableNotifications" },
356 { 0x05, "AddPropertyChangeSubscription" },
357 { 0x06, "RemovePropertyChangeSubscription" },
358 { 0x07, "GetMaximumSubscriberContextLength" },
362 static const value_string OcaPowerManagerMethods
[] = {
363 { 0x01, "GetState" },
364 { 0x02, "SetState" },
365 { 0x03, "GetPowerSupplies" },
366 { 0x04, "GetActivePowerSupplies" },
367 { 0x05, "ExchangePowerSupply" },
368 { 0x06, "GetAutoState" },
372 static const value_string OcaNetworkManagerMethods
[] = {
373 { 0x01, "GetNetworks" },
374 { 0x02, "GetStreamNetworks" },
375 { 0x03, "GetControlNetworks" },
376 { 0x04, "GetMediaTransportNetworks" },
380 static const value_string OcaMediaClockManagerMethods
[] = {
381 { 0x01, "GetClocks" },
382 { 0x02, "GetMediaClockTypesSupported" },
383 { 0x03, "GetClock3s" },
387 static const value_string OcaLibraryManagerMethods
[] = {
388 { 0x01, "AddLibrary" },
389 { 0x02, "DeleteLibrary" },
390 { 0x03, "GetLibraryCount" },
391 { 0x04, "GetLibraryList" },
392 { 0x05, "GetCurrentPatch" },
393 { 0x06, "ApplyPatch" },
397 static const value_string OcaTimeMode
[] = {
398 { 0x01, "Absolute" },
399 { 0x02, "Relative" },
403 static const value_string OcaTimeUnits
[] = {
409 static const value_string OcaAudioProcessingManagerMethods
[] = {
413 static const value_string OcaDeviceTimeManagerMethods
[] = {
414 { 0x01, "GetDeviceTimeNTP" },
415 { 0x02, "SetDeviceTimeNTP" },
416 { 0x03, "GetTimeSources" },
417 { 0x04, "GetCurrentDeviceTimeSource" },
418 { 0x05, "SetCurrentDeviceTimeSource" },
419 { 0x06, "GetDeviceTimePTP" },
420 { 0x07, "SetDeviceTimePTP" },
424 static const value_string OcaTaskManagerMethods
[] = {
426 { 0x02, "ControlAllTasks" },
427 { 0x03, "ControlTaskGroup" },
428 { 0x04, "ControlTask" },
429 { 0x05, "GetState" },
430 { 0x06, "GetTaskStatuses" },
431 { 0x07, "GetTaskStatus" },
433 { 0x09, "GetTasks" },
436 { 0x0C, "DeleteTask"},
440 static const value_string OcaCodingManagerMethods
[] = {
441 { 0x01, "GetAvailableEncodingSchemes" },
442 { 0x02, "GetAvailableDecodingSchemes" },
446 static const value_string OcaDiagnosticManagerMethods
[] = {
447 { 0x01, "GetLockStatus" },
452 /* wmem hash/equal funcs */
454 oca_handle_hash (const void *v
)
456 const struct oca_request_hash_key
*key
= (const struct oca_request_hash_key
*)v
;
459 val
= key
->conv_index
+ key
->handle
;
465 oca_handle_equal(const void *v
, const void *w
)
467 const struct oca_request_hash_key
*v1
= (const struct oca_request_hash_key
*)v
;
468 const struct oca_request_hash_key
*v2
= (const struct oca_request_hash_key
*)w
;
471 v1
->conv_index
== v2
->conv_index
&&
472 v1
->handle
== v2
->handle
483 format_occ(char *s
, uint64_t value
) {
486 uint32_t ono
= value
>> 32;
487 uint16_t tree_level
= (uint32_t)value
>> 16;
488 uint16_t idx
= (uint16_t)value
;
490 /* Currently, we can only solve fixed object numbers */
491 if(ono
< 0x01 || ono
> 0x0D) {
492 snprintf(s
, ITEM_LABEL_LENGTH
, "Unknown Object Class");
496 const char *unknown_method
= "UnknownMethod";
497 const char *unknown_class
= "UnknownClass";
501 switch (tree_level
) {
505 method
= val_to_str_const(idx
, OcaRootMethods
, unknown_method
);
508 /* OcaManager Classes */
512 method
= val_to_str_const(idx
, OcaDeviceManagerMethods
, unknown_method
);
515 method
= val_to_str_const(idx
, OcaSecurityManagerMethods
, unknown_method
);
518 method
= val_to_str_const(idx
, OcaFirmwareManagerMethods
, unknown_method
);
521 method
= val_to_str_const(idx
, OcaSubscriptionManagerMethods
, unknown_method
);
524 method
= val_to_str_const(idx
, OcaPowerManagerMethods
, unknown_method
);
527 method
= val_to_str_const(idx
, OcaNetworkManagerMethods
, unknown_method
);
530 method
= val_to_str_const(idx
, OcaMediaClockManagerMethods
, unknown_method
);
533 method
= val_to_str_const(idx
, OcaLibraryManagerMethods
, unknown_method
);
536 method
= val_to_str_const(idx
, OcaAudioProcessingManagerMethods
, unknown_method
);
539 method
= val_to_str_const(idx
, OcaDeviceTimeManagerMethods
, unknown_method
);
542 method
= val_to_str_const(idx
, OcaTaskManagerMethods
, unknown_method
);
545 method
= val_to_str_const(idx
, OcaCodingManagerMethods
, unknown_method
);
548 method
= val_to_str_const(idx
, OcaDiagnosticManagerMethods
, unknown_method
);
551 snprintf(s
, ITEM_LABEL_LENGTH
, "%s.%s", val_to_str_const(ono
, OcaFixedONo
, unknown_class
), unknown_method
);
557 /* Only level 1 (OcaRoot) and 3 (Managers) are valid */
558 snprintf(s
, ITEM_LABEL_LENGTH
, "%s.%s", val_to_str_const(ono
, OcaFixedONo
, unknown_class
), unknown_method
);
563 snprintf(s
, ITEM_LABEL_LENGTH
, "%s.%s", val_to_str_const(ono
, OcaFixedONo
, unknown_class
), method
);
567 /* Parameter Decoder Datatypes */
569 decode_params_OcaONo(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
571 proto_tree_add_item(tree
, hf_ocp1_params_ono
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
576 decode_params_OcaResetCause(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
578 proto_tree_add_item(tree
, hf_ocp1_params_reset_cause
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
583 decode_params_OcaPowerState(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
585 proto_tree_add_item(tree
, hf_ocp1_params_power_state
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
590 decode_params_OcaMediaClockType(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
592 proto_tree_add_item(tree
, hf_ocp1_params_media_clock_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
597 decode_params_OcaComponent(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
599 proto_tree_add_item(tree
, hf_ocp1_params_component
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
604 decode_params_OcaBlob(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
, char *fname
)
609 unsigned offset_m
= offset
;
610 uint16_t datasize
= tvb_get_uint16(tvb
, offset
, ENC_BIG_ENDIAN
);
612 ti
= proto_tree_add_item(tree
, hf_ocp1_params_blob
, tvb
, offset_m
, 2 + datasize
, ENC_NA
);
613 proto_item_prepend_text(ti
, "%s: ", fname
);
614 l_tree
= proto_item_add_subtree(ti
, ett_ocp1_params_blob
);
616 proto_tree_add_item(l_tree
, hf_ocp1_params_blob_datasize
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
619 proto_tree_add_item(l_tree
, hf_ocp1_params_blob_data
, tvb
, offset_m
, datasize
, ENC_NA
);
620 offset_m
+= datasize
;
622 return offset_m
- offset
;
626 decode_params_OcaBlobFixedLen(tvbuff_t
*tvb
, unsigned offset
, unsigned length
, proto_tree
*tree
, char *fname
)
630 ti
= proto_tree_add_item(tree
, hf_ocp1_params_blob_data
, tvb
, offset
, length
, ENC_NA
);
631 proto_item_prepend_text(ti
, "%s: ", fname
);
637 decode_params_OcaString(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
, char *fname
)
642 unsigned offset_m
= offset
;
643 uint16_t length
= tvb_get_uint16(tvb
, offset
, ENC_BIG_ENDIAN
);
645 ti
= proto_tree_add_item(tree
, hf_ocp1_params_string
, tvb
, offset_m
, 2 + length
, ENC_NA
);
646 l_tree
= proto_item_add_subtree(ti
, ett_ocp1_params_string
);
648 proto_tree_add_item(l_tree
, hf_ocp1_params_string_length
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
651 proto_tree_add_item(l_tree
, hf_ocp1_params_string_value
, tvb
, offset_m
, length
, ENC_UTF_8
);
652 proto_item_set_text(ti
,"%s: %s", fname
, tvb_get_string_enc(wmem_packet_scope(), tvb
, offset_m
, length
, ENC_UTF_8
));
655 return offset_m
- offset
;
659 decode_params_OcaBoolean(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
661 proto_tree_add_item(tree
, hf_ocp1_params_bool
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
666 decode_params_OcaEventID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
671 ti
= proto_tree_add_item(tree
, hf_ocp1_params_event_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
672 l_tree
= proto_item_add_subtree(ti
, ett_ocp1_params_event
);
674 proto_tree_add_item(l_tree
, hf_ocp1_params_event_tree_level
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
677 proto_tree_add_item(l_tree
, hf_ocp1_params_event_index
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
683 decode_params_OcaEvent(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
685 unsigned offset_m
= offset
;
686 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
687 offset_m
+= decode_params_OcaEventID(tvb
, offset_m
, tree
);
689 return offset_m
- offset
;
693 decode_params_OcaMethodID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
698 ti
= proto_tree_add_item(tree
, hf_ocp1_params_method_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
699 l_tree
= proto_item_add_subtree(ti
, ett_ocp1_params_method
);
701 proto_tree_add_item(l_tree
, hf_ocp1_params_method_tree_level
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
704 proto_tree_add_item(l_tree
, hf_ocp1_params_method_index
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
710 decode_params_OcaPropertyID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
715 ti
= proto_tree_add_item(tree
, hf_ocp1_params_property_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
716 l_tree
= proto_item_add_subtree(ti
, ett_ocp1_params_property
);
718 proto_tree_add_item(l_tree
, hf_ocp1_params_property_tree_level
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
721 proto_tree_add_item(l_tree
, hf_ocp1_params_property_index
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
727 decode_params_OcaClassID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
730 unsigned offset_m
= offset
;
732 proto_tree_add_item(tree
, hf_ocp1_params_classid_fields
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
733 uint16_t fields
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
736 ti
= proto_tree_add_item(tree
, hf_ocp1_params_classid
, tvb
, offset_m
, fields
*2, ENC_ASCII
);
739 for(int i
=0; i
<fields
; i
++) {
741 proto_item_append_text(ti
, "%d", tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
));
743 proto_item_append_text(ti
, "%d.", tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
));
748 return offset_m
- offset
;
753 decode_params_OcaClassVersion(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
755 proto_tree_add_item(tree
, hf_ocp1_params_class_version
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
760 decode_params_OcaClassIdentification(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
762 unsigned offset_m
= offset
;
764 offset_m
+= decode_params_OcaClassID(tvb
, offset_m
, tree
);
765 offset_m
+= decode_params_OcaClassVersion(tvb
, offset_m
, tree
);
767 return offset_m
- offset
;
771 decode_params_OcaManagerDescriptor(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
773 unsigned offset_m
= offset
;
775 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
776 offset_m
+= decode_params_OcaString(tvb
, offset_m
, tree
, "Name");
777 offset_m
+= decode_params_OcaClassID(tvb
, offset_m
, tree
);
778 offset_m
+= decode_params_OcaClassVersion(tvb
, offset_m
, tree
);
780 return offset_m
- offset
;
784 decode_params_OcaNotificationDeliveryMode(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
786 proto_tree_add_item(tree
, hf_ocp1_params_ntf_delivery_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
792 decode_params_OcaModelDescription(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
794 unsigned offset_m
= offset
;
795 offset_m
+= decode_params_OcaString(tvb
, offset_m
, tree
, "Manufacturer");
796 offset_m
+= decode_params_OcaString(tvb
, offset_m
, tree
, "Name");
797 offset_m
+= decode_params_OcaString(tvb
, offset_m
, tree
, "Version");
799 return offset_m
- offset
;
803 decode_params_OcaModelGUID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
805 unsigned offset_m
= offset
;
806 offset_m
+= decode_params_OcaBlobFixedLen(tvb
, offset_m
, 1, tree
, "Reserved");
807 offset_m
+= decode_params_OcaBlobFixedLen(tvb
, offset_m
, 3, tree
, "Manufacturer Code");
808 offset_m
+= decode_params_OcaBlobFixedLen(tvb
, offset_m
, 4, tree
, "Model Code");
810 return offset_m
- offset
;
814 decode_params_OcaMethod(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
816 unsigned offset_m
= offset
;
817 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
818 offset_m
+= decode_params_OcaMethodID(tvb
, offset_m
, tree
);
820 return offset_m
- offset
;
824 decode_params_OcaLibVolType(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
826 unsigned offset_m
= offset
;
827 offset_m
+= decode_params_OcaBlobFixedLen(tvb
, offset_m
, 3, tree
, "Authority");
828 proto_tree_add_item(tree
, hf_ocp1_params_libvoltype_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
831 return offset_m
- offset
;
835 decode_params_OcaLibVolID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
837 proto_tree_add_item(tree
, hf_ocp1_params_libvol_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
842 decode_params_OcaLibVolIdentifier(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
844 unsigned offset_m
= offset
;
845 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
846 offset_m
+= decode_params_OcaLibVolID(tvb
, offset_m
, tree
);
848 return offset_m
- offset
;
852 decode_params_OcaLibraryIdentifier(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
854 unsigned offset_m
= offset
;
855 offset_m
+= decode_params_OcaLibVolType(tvb
, offset_m
, tree
);
856 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
858 return offset_m
- offset
;
862 decode_params_OcaVersion(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
864 unsigned offset_m
= offset
;
868 v_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset_m
, 14, ett_ocp1_params_ocaver
, &ti
,
869 "Version %d.%d.%d.%d",
870 tvb_get_uint32(tvb
, offset
, ENC_BIG_ENDIAN
),
871 tvb_get_uint32(tvb
, offset
+ 4, ENC_BIG_ENDIAN
),
872 tvb_get_uint32(tvb
, offset
+ 8, ENC_BIG_ENDIAN
),
873 tvb_get_uint16(tvb
, offset
+ 12, ENC_BIG_ENDIAN
));
875 proto_tree_add_item(v_tree
, hf_ocp1_params_ocaver_major
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
877 proto_tree_add_item(v_tree
, hf_ocp1_params_ocaver_minor
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
879 proto_tree_add_item(v_tree
, hf_ocp1_params_ocaver_build
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
881 proto_tree_add_item(v_tree
, hf_ocp1_params_ocaver_comp
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
884 return offset_m
- offset
;
888 decode_params_OcaTimeNTP(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
890 proto_tree_add_item(tree
, hf_ocp1_params_time_ntp
, tvb
, offset
, 8, ENC_TIME_NTP
);
895 decode_params_OcaTimePTP(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
897 unsigned offset_m
= offset
;
901 proto_tree_add_item(tree
, hf_ocp1_params_time_ptp_negative
, tvb
, offset_m
, 1, ENC_BIG_ENDIAN
);
904 ti
= proto_tree_add_item(tree
, hf_ocp1_params_time_ptp
, tvb
, offset_m
, 12, ENC_TIME_SECS_NSECS
);
906 pt
= proto_item_add_subtree(ti
, ett_ocp1_params_ptp
);
907 proto_tree_add_item(pt
, hf_ocp1_params_time_ptp_seconds
, tvb
, offset_m
, 8, ENC_BIG_ENDIAN
);
910 proto_tree_add_item(pt
, hf_ocp1_params_time_ptp_nanoseconds
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
914 return offset_m
- offset
;
918 decode_params_OcaTimeMode(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
920 proto_tree_add_item(tree
, hf_ocp1_params_time_mode
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
925 decode_params_OcaTimeInterval(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
927 proto_tree_add_item(tree
, hf_ocp1_params_time_interval
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
932 decode_params_OcaTimeUnits(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
934 proto_tree_add_item(tree
, hf_ocp1_params_time_units
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
939 decode_params_OcaTaskID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
941 proto_tree_add_item(tree
, hf_ocp1_params_task_id
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
946 decode_params_OcaTaskGroupID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
948 proto_tree_add_item(tree
, hf_ocp1_params_task_group_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
953 decode_params_OcaTaskCommand(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
955 proto_tree_add_item(tree
, hf_ocp1_params_task_command
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
960 decode_params_OcaTaskManagerState(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
962 proto_tree_add_item(tree
, hf_ocp1_params_task_manager_state
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
967 decode_params_OcaTaskState(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
969 proto_tree_add_item(tree
, hf_ocp1_params_task_state
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
974 decode_params_OcaTaskStatus(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
976 unsigned offset_m
= offset
;
978 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, tree
);
979 offset_m
+= decode_params_OcaTaskState(tvb
, offset_m
, tree
);
980 proto_tree_add_item(tree
, hf_ocp1_params_task_status_error_code
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
983 return offset_m
- offset
;
987 decode_params_OcaTask(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
990 unsigned offset_m
= offset
;
992 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, tree
);
993 offset_m
+= decode_params_OcaString(tvb
, offset_m
, tree
, "Label");
994 offset_m
+= decode_params_OcaLibVolIdentifier(tvb
, offset_m
, tree
);
995 offset_m
+= decode_params_OcaTaskGroupID(tvb
, offset_m
, tree
);
997 uint8_t mode
= tvb_get_uint8(tvb
, offset_m
);
998 offset_m
+= decode_params_OcaTimeMode(tvb
, offset_m
, tree
);
999 offset_m
+= decode_params_OcaTimeUnits(tvb
, offset_m
, tree
);
1000 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, tree
);
1002 if(mode
==1) {/* seconds, PTP */
1003 offset_m
+= decode_params_OcaTimePTP(tvb
, offset_m
, tree
);
1004 } else if (mode
==2) { /* samples, uint64_t */
1005 proto_tree_add_item(tree
, hf_ocp1_params_start_time
, tvb
, offset_m
, 8, ENC_BIG_ENDIAN
);
1007 } else { /* fail, malformed */
1008 return offset_m
- offset
;
1011 offset_m
+= decode_params_OcaTimeInterval(tvb
, offset_m
, tree
);
1012 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, tree
, "ApplicationSpecificParameters");
1014 return offset_m
- offset
;
1018 decode_params_OcaMediaCodingSchemeID(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
1020 proto_tree_add_item(tree
, hf_ocp1_params_media_coding_scheme_id
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
1025 decode_params_OcaDeviceState(tvbuff_t
*tvb
, unsigned offset
, proto_tree
*tree
)
1027 static int* const state_bits
[] = {
1028 &hf_ocp1_params_devicestate_oper
,
1029 &hf_ocp1_params_devicestate_disabled
,
1030 &hf_ocp1_params_devicestate_error
,
1031 &hf_ocp1_params_devicestate_init
,
1032 &hf_ocp1_params_devicestate_updating
,
1035 proto_tree_add_bitmask(tree
, tvb
, offset
, hf_ocp1_params_devicestate
, ett_ocp1_params_devicestate
, state_bits
, ENC_BIG_ENDIAN
);
1040 /* Parameter Decoder (Class Methods) */
1042 decode_params_OcaRoot(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1044 unsigned offset_m
= offset
;
1046 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1047 /* GetClassIdentification ([out] OcaClassIdentification) */
1048 proto_tree
*p1_tree
;
1051 unsigned len
= 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
)*2 + 2;
1053 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, len
, ett_ocp1_params
, &t1
, "Parameter 1 (Class Identification)");
1054 offset_m
+= decode_params_OcaClassIdentification(tvb
, offset_m
, p1_tree
);
1056 else if(m_idx
== 0x02 && !request
&& pcount
== 1) {
1057 /* GetLockable ([out] lockable: OcaBoolean) */
1058 proto_tree
*p1_tree
;
1061 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (Lockable)");
1062 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p1_tree
);
1064 else if(m_idx
== 0x05 && !request
&& pcount
== 1) {
1065 /* GetRole ([out] role: OcaString) */
1066 proto_tree
*p1_tree
;
1069 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Role)");
1070 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Role");
1073 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1077 return offset_m
- offset
;
1081 decode_params_OcaDeviceManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1083 unsigned offset_m
= offset
;
1085 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1086 /* GetOcaVersion ([out] OcaVersion: OcaUint16) */
1087 proto_tree
*p1_tree
;
1090 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (OCA Version)");
1091 proto_tree_add_item(p1_tree
, hf_ocp1_params_oca_version
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1094 else if(m_idx
== 0x02 && !request
&& pcount
== 1) {
1095 /* GetModelGUID ([out] GUID: OcaModelGUID) */
1096 proto_tree
*p1_tree
;
1099 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (GUID)");
1100 offset_m
+= decode_params_OcaModelGUID(tvb
, offset_m
, p1_tree
);
1102 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1103 /* GetSerialNumber ([out] serialNumber: OcaString) */
1104 proto_tree
*p1_tree
;
1107 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Serial Number)");
1108 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Serial Number");
1110 else if(m_idx
== 0x04 && !request
&& pcount
== 1) {
1111 /* GetDeviceName ([out] Name: OcaString) */
1112 proto_tree
*p1_tree
;
1115 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Name)");
1116 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Name");
1118 else if(m_idx
== 0x05 && request
&& pcount
== 1) {
1119 /* SetDeviceName (Name: OcaString) */
1120 proto_tree
*p1_tree
;
1123 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Name)");
1124 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Name");
1126 else if(m_idx
== 0x06 && !request
&& pcount
== 1) {
1127 /* GetModelDescription ([out] Description: OcaModelDescription) */
1128 proto_tree
*p1_tree
;
1131 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Description)");
1132 offset_m
+= decode_params_OcaModelDescription(tvb
, offset_m
, p1_tree
);
1134 else if(m_idx
== 0x07 && !request
&& pcount
== 1) {
1135 /* GetRole ([out] role: OcaString) */
1136 proto_tree
*p1_tree
;
1139 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Role)");
1140 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Role");
1142 else if(m_idx
== 0x08 && request
&& pcount
== 1) {
1143 /* SetRole (role: OcaString) */
1144 proto_tree
*p1_tree
;
1147 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Role)");
1148 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Role");
1150 else if(m_idx
== 0x09 && !request
&& pcount
== 1) {
1151 /* GetUserInventoryCode ([out] Code: OcaString) */
1152 proto_tree
*p1_tree
;
1155 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Code)");
1156 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Code");
1158 else if(m_idx
== 0x0A && request
&& pcount
== 1) {
1159 /* SetUserInventoryCode (Code: OcaString) */
1160 proto_tree
*p1_tree
;
1163 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Code)");
1164 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Code");
1166 else if(m_idx
== 0x0B && !request
&& pcount
== 1) {
1167 /* GetEnabled ([out] enabled: OcaBoolean) */
1168 proto_tree
*p1_tree
;
1171 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (enabled)");
1172 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p1_tree
);
1174 else if(m_idx
== 0x0C && request
&& pcount
== 1) {
1175 /* SetEnabled (enabled: OcaBoolean) */
1176 proto_tree
*p1_tree
;
1179 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (enabled)");
1180 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p1_tree
);
1182 else if(m_idx
== 0x0D && !request
&& pcount
== 1) {
1183 /* GetState ([out] state: OcaDeviceState) */
1184 proto_tree
*p1_tree
;
1187 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (State)");
1188 offset_m
+= decode_params_OcaDeviceState(tvb
, offset_m
, p1_tree
);
1191 else if(m_idx
== 0x0E && request
&& pcount
== 2) {
1192 /* SetResetKey (Key: OcaBlobFixedLen<16>, Address: OcaNetworkAddress) */
1193 proto_tree
*p1_tree
, *p2_tree
;
1194 proto_item
*t1
, *t2
;
1196 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 16, ett_ocp1_params
, &t1
, "Parameter 1 (Key)");
1197 offset_m
+= decode_params_OcaBlobFixedLen(tvb
, offset_m
, 16, p1_tree
, "Key");
1198 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (Address)");
1199 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Address");
1202 else if(m_idx
== 0x0F && !request
&& pcount
== 1) {
1203 /* GetResetCause ([out] resetCause: OcaResetCause) */
1204 proto_tree
*p1_tree
;
1207 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (Reset Cause)");
1208 offset_m
+= decode_params_OcaResetCause(tvb
, offset_m
, p1_tree
);
1210 else if(m_idx
== 0x11 && !request
&& pcount
== 1) {
1211 /* GetMessage ([out] Message: OcaString) */
1212 proto_tree
*p1_tree
;
1215 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Message)");
1216 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Message");
1218 else if(m_idx
== 0x12 && request
&& pcount
== 1) {
1219 /* SetMessage (Message: OcaString) */
1220 proto_tree
*p1_tree
;
1223 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Message)");
1224 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Message");
1226 else if(m_idx
== 0x13 && !request
&& pcount
== 1) {
1227 /* GetManagers ([out] Managers: OcaList<OcaManagerDescriptor>) */
1228 proto_tree
*p1_tree
;
1231 /* Determine the full length */
1232 int plen_total
= 2; /* start with len=2, this is the list count field */
1233 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1234 for(int i
= 0; i
< item_count
; i
++) { /* Loop list items */
1235 plen_total
+= 4; /* ono */
1236 plen_total
+= tvb_get_uint16(tvb
, offset_m
+ plen_total
, ENC_BIG_ENDIAN
) + 2; /* string length + length field (uint16) */
1237 plen_total
+= tvb_get_uint16(tvb
, offset_m
+ plen_total
, ENC_BIG_ENDIAN
)*2 + 2; /* ClassID field count (uint16) + count x ID (uint16) */
1238 plen_total
+= 2; /* OcaClassVersionNumber */
1241 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Managers)");
1243 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1245 for(int i
= 0; i
< item_count
; i
++) {
1247 proto_tree
*list_tree
;
1248 plen
+= 4; /* ono */
1249 plen
+= tvb_get_uint16(tvb
, offset_m
+ plen
, ENC_BIG_ENDIAN
) + 2; /* string length + length field (uint16) */
1250 plen
+= tvb_get_uint16(tvb
, offset_m
+ plen
, ENC_BIG_ENDIAN
)*2 + 2; /* ClassID field count (uint16) + count x ID (uint16) */
1251 plen
+= 2; /* OcaClassVersioNumber */
1252 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, plen
, ett_ocp1_params_manager_desc
, NULL
, "Manager Descriptor Item %d", i
+1 );
1253 offset_m
+= decode_params_OcaManagerDescriptor(tvb
, offset_m
, list_tree
);
1257 else if(m_idx
== 0x14 && !request
&& pcount
== 1) {
1258 /* GetDeviceRevisionID ([out] ID: OcaString) */
1259 proto_tree
*p1_tree
;
1262 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
1263 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Revision");
1266 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1270 return offset_m
- offset
;
1274 decode_params_OcaSecurityManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1276 unsigned offset_m
= offset
;
1278 if(m_idx
== 0x03 && request
&& pcount
== 2) {
1279 /* ChangePreSharedKey (identity: OcaString, newKey: OcaBlob) */
1280 proto_tree
*p1_tree
, *p2_tree
;
1281 proto_item
*t1
, *t2
;
1283 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Identity)");
1284 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Identity");
1285 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (New Key)");
1286 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Key");
1288 else if(m_idx
== 0x04 && request
&& pcount
== 2) {
1289 /* AddPreSharedKey (identity: OcaString, newKey: OcaBlob) */
1290 proto_tree
*p1_tree
, *p2_tree
;
1291 proto_item
*t1
, *t2
;
1293 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Identity)");
1294 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Identity");
1295 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (Key)");
1296 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Key");
1298 else if(m_idx
== 0x05 && request
&& pcount
== 1) {
1299 /* DeletePreSharedKey (identity: OcaString) */
1300 proto_tree
*p1_tree
;
1303 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Identity)");
1304 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Identity");
1307 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1311 return offset_m
- offset
;
1315 decode_params_OcaFirmwareManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1317 unsigned offset_m
= offset
;
1319 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1320 /* GetComponentVersions ([out] componentVersions: OcaList<OcaVersion>) */
1321 proto_tree
*p1_tree
;
1324 /* Determine the full length */
1325 /* Each OcaVersion item length = major uint32 + minor uint32 + build uint32 + component uint16 = 14 bytes */
1326 int plen_total
= 2; /* start with len=2, this is the list count field */
1327 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1328 plen_total
+= item_count
* 14;
1330 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Component Versions)");
1332 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1334 for(int i
= 0; i
< item_count
; i
++) {
1335 proto_tree
*list_tree
;
1336 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 14, ett_ocp1_params_compversion
, NULL
, "Component Version Item %d", i
+1 );
1337 offset_m
+= decode_params_OcaVersion(tvb
, offset_m
, list_tree
);
1341 else if(m_idx
== 0x03 && request
&& pcount
== 1) {
1342 /* BeginActiveImageUpdate (component: OcaComponent) */
1343 proto_tree
*p1_tree
;
1346 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (Component)");
1347 offset_m
+= decode_params_OcaComponent(tvb
, offset_m
, p1_tree
);
1350 else if(m_idx
== 0x04 && request
&& pcount
== 2) {
1351 /* AddImageData (id: OcaUint32, imageData: OcaBlob) */
1352 proto_tree
*p1_tree
, *p2_tree
;
1353 proto_item
*t1
, *t2
;
1355 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
1356 proto_tree_add_item(p1_tree
, hf_ocp1_params_imageid
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
1358 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (Image Data)");
1359 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Image Data");
1361 else if(m_idx
== 0x05 && request
&& pcount
== 1) {
1362 /* VerifyImage (verifyData: OcaBlob) */
1363 proto_tree
*p1_tree
;
1366 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Verify Data)");
1367 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p1_tree
, "Data");
1369 else if(m_idx
== 0x07 && request
&& pcount
== 3) {
1370 /* BeginPassiveComponentUpdate (component: OcaComponent, serverAddress: OcaNetworkAddress, updateFileName: OcaString) */
1371 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
;
1372 proto_item
*t1
, *t2
, *t3
;
1374 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (Component)");
1375 offset_m
+= decode_params_OcaComponent(tvb
, offset_m
, p1_tree
);
1376 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (Server Address)");
1377 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Server Address");
1378 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t3
, "Parameter 3 (Update File Name)");
1379 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p3_tree
, "File Name");
1382 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1386 return offset_m
- offset
;
1390 decode_params_OcaSubscriptionManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1392 unsigned offset_m
= offset
;
1394 if(m_idx
== 0x01 && request
&& pcount
== 5) {
1395 /* AddSubscription (Event: OcaEvent, Subscriber: OcaMethod, SubscriberContext: OcaBlob, NotificationDeliveryMode: OcaNotificationDeliveryMode, DestinationInformation: OcaNetworkAddress) */
1396 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
, *p4_tree
, *p5_tree
;
1397 proto_item
*t1
, *t2
, *t3
, *t4
, *t5
;
1399 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (Event)");
1400 offset_m
+= decode_params_OcaEvent(tvb
, offset_m
, p1_tree
);
1401 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t2
, "Parameter 2 (Subscriber)");
1402 offset_m
+= decode_params_OcaMethod(tvb
, offset_m
, p2_tree
);
1403 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t3
, "Parameter 3 (Subscriber Context)");
1404 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p3_tree
, "Subscriber Context");
1405 p4_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t4
, "Parameter 4 (Notification Delivery Mode)");
1406 offset_m
+= decode_params_OcaNotificationDeliveryMode(tvb
, offset_m
, p4_tree
);
1407 p5_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t5
, "Parameter 5 (Destination Information)");
1408 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p5_tree
, "Destination Information");
1411 else if(m_idx
== 0x02 && request
&& pcount
== 2) {
1412 /* RemoveSubscription (Event: OcaEvent, Subscriber: OcaMethod) */
1413 proto_tree
*p1_tree
, *p2_tree
;
1414 proto_item
*t1
, *t2
;
1416 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (Event)");
1417 offset_m
+= decode_params_OcaEvent(tvb
, offset_m
, p1_tree
);
1418 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t2
, "Parameter 2 (Subscriber)");
1419 offset_m
+= decode_params_OcaMethod(tvb
, offset_m
, p2_tree
);
1422 else if(m_idx
== 0x05 && request
&& pcount
== 6) {
1423 /* AddPropertyChangeSubscription (Emitter: OcaONo, Property: OcaPropertyID, Subscriber: OcaMethod, SubscriberContext: OcaBlob, NotificationDeliveryMode: OcaNotificationDeliveryMode, DestinationInformation: OcaNetworkAddress) */
1424 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
, *p4_tree
, *p5_tree
, *p6_tree
;
1425 proto_item
*t1
, *t2
, *t3
, *t4
, *t5
, *t6
;
1427 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Emitter)");
1428 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1429 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t2
, "Parameter 2 (Property)");
1430 offset_m
+= decode_params_OcaPropertyID(tvb
, offset_m
, p2_tree
);
1431 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t3
, "Parameter 3 (Subscriber)");
1432 offset_m
+= decode_params_OcaMethod(tvb
, offset_m
, p3_tree
);
1433 p4_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t4
, "Parameter 4 (SubscriberContext)");
1434 offset
+= decode_params_OcaBlob(tvb
, offset_m
, p4_tree
, "Context");
1435 p5_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t5
, "Parameter 5 (Notification Delivery Mode)");
1436 offset_m
+= decode_params_OcaNotificationDeliveryMode(tvb
, offset_m
, p5_tree
);
1437 p6_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t6
, "Parameter 6 (Destination Information)");
1438 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p6_tree
, "Address");
1440 else if(m_idx
== 0x06 && request
&& pcount
== 3) {
1441 /* RemovePropertyChangeSubscription (Emitter: OcaONo, Property: OcaPropertyID, Subscriber: OcaMethod) */
1442 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
;
1443 proto_item
*t1
, *t2
, *t3
;
1445 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Emitter)");
1446 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1447 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t2
, "Parameter 2 (Property)");
1448 offset_m
+= decode_params_OcaPropertyID(tvb
, offset_m
, p2_tree
);
1449 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t3
, "Parameter 3 (Subscriber)");
1450 offset_m
+= decode_params_OcaMethod(tvb
, offset_m
, p3_tree
);
1452 else if(m_idx
== 0x07 && !request
&& pcount
== 1) {
1453 /* GetMaximumSubscriberContextLength ([out] Max: OcaUint16) */
1454 proto_tree
*p1_tree
;
1457 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (Max)");
1458 proto_tree_add_item(p1_tree
, hf_ocp1_params_subscriber_ctx_len
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1463 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1467 return offset_m
- offset
;
1471 decode_params_OcaPowerManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1473 unsigned offset_m
= offset
;
1475 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1476 /* GetState ([out] State: OcaPowerState) */
1477 proto_tree
*p1_tree
;
1480 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (State)");
1481 offset_m
+= decode_params_OcaPowerState(tvb
, offset_m
, p1_tree
);
1483 else if(m_idx
== 0x02 && request
&& pcount
== 1) {
1484 /* SetState (State: OcaPowerState) */
1485 proto_tree
*p1_tree
;
1488 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (State)");
1489 offset_m
+= decode_params_OcaPowerState(tvb
, offset_m
, p1_tree
);
1491 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1492 /* GetPowerSupplies ([out] psuList: OcaList<OcaONo>) */
1493 proto_tree
*p1_tree
;
1496 /* Determine the full length */
1497 /* Each ONo item has length 4 bytes */
1498 int plen_total
= 2; /* start with len=2, this is the list count field */
1499 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1500 plen_total
+= item_count
* 4;
1502 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (PSU List)");
1504 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1506 for(int i
= 0; i
< item_count
; i
++) {
1507 proto_tree
*list_tree
;
1508 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "PSU Item %d", i
+1 );
1509 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1512 else if(m_idx
== 0x04 && !request
&& pcount
== 1) {
1513 /* GetActivePowerSupplies ([out] psuList: OcaList<OcaONo>) */
1514 proto_tree
*p1_tree
;
1517 /* Determine the full length */
1518 /* Each ONo item has length 4 bytes */
1519 int plen_total
= 2; /* start with len=2, this is the list count field */
1520 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1521 plen_total
+= item_count
* 4;
1523 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (PSU List)");
1525 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1527 for(int i
= 0; i
< item_count
; i
++) {
1528 proto_tree
*list_tree
;
1529 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "PSU Item %d", i
+1 );
1530 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1533 else if(m_idx
== 0x05 && request
&& pcount
== 3) {
1534 /* ExchangePowerSupply (oldPsu: OcaONo, newPsu: OcaONo, powerOffOld: OcaBoolean) */
1535 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
;
1536 proto_item
*t1
, *t2
, *t3
;
1538 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Old PSU)");
1539 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1540 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t2
, "Parameter 2 (New PSU)");
1541 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p2_tree
);
1542 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t3
, "Parameter 3 (Power off old)");
1543 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p3_tree
);
1545 else if(m_idx
== 0x06 && !request
&& pcount
== 1) {
1546 /* GetAutoState ([out] state: OcaBoolean) */
1547 proto_tree
*p1_tree
;
1550 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (State)");
1551 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p1_tree
);
1554 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1558 return offset_m
- offset
;
1562 decode_params_OcaNetworkManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1564 unsigned offset_m
= offset
;
1566 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1567 /* GetNetworks ([out] Networks: OcaList<OcaONo>) */
1568 proto_tree
*p1_tree
;
1571 /* Determine the full length */
1572 /* Each ONo item has length 4 bytes */
1573 int plen_total
= 2; /* start with len=2, this is the list count field */
1574 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1575 plen_total
+= item_count
* 4;
1577 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Networks)");
1579 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1581 for(int i
= 0; i
< item_count
; i
++) {
1582 proto_tree
*list_tree
;
1583 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Network Item %d", i
+1 );
1584 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1587 else if(m_idx
== 0x02 && !request
&& pcount
== 1) {
1588 /* GetStreamNetworks ([out] StreamNetworks: OcaList<OcaONo>) */
1589 proto_tree
*p1_tree
;
1592 /* Determine the full length */
1593 /* Each ONo item has length 4 bytes */
1594 int plen_total
= 2; /* start with len=2, this is the list count field */
1595 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1596 plen_total
+= item_count
* 4;
1598 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Stream Networks)");
1600 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1602 for(int i
= 0; i
< item_count
; i
++) {
1603 proto_tree
*list_tree
;
1604 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Network Item %d", i
+1 );
1605 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1608 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1609 /* GetControlNetworks ([out] ControlNetworks: OcaList<OcaONo>) */
1610 proto_tree
*p1_tree
;
1613 /* Determine the full length */
1614 /* Each ONo item has length 4 bytes */
1615 int plen_total
= 2; /* start with len=2, this is the list count field */
1616 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1617 plen_total
+= item_count
* 4;
1619 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Control Networks)");
1621 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1623 for(int i
= 0; i
< item_count
; i
++) {
1624 proto_tree
*list_tree
;
1625 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Network Item %d", i
+1 );
1626 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1629 else if(m_idx
== 0x04 && !request
&& pcount
== 1) {
1630 /* GetMediaTransportNetworks ([out] MediaTransportNetworks: OcaList<OcaONo>) */
1631 proto_tree
*p1_tree
;
1634 /* Determine the full length */
1635 /* Each ONo item has length 4 bytes */
1636 int plen_total
= 2; /* start with len=2, this is the list count field */
1637 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1638 plen_total
+= item_count
* 4;
1640 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Media Transport Networks)");
1642 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1644 for(int i
= 0; i
< item_count
; i
++) {
1645 proto_tree
*list_tree
;
1646 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Network Item %d", i
+1 );
1647 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1651 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1655 return offset_m
- offset
;
1659 decode_params_OcaMediaClockManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1661 unsigned offset_m
= offset
;
1663 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1664 /* GetClocks ([out] Clocks: OcaList<OcaONo>) */
1665 proto_tree
*p1_tree
;
1668 /* Determine the full length */
1669 /* Each ONo item has length 4 bytes */
1670 int plen_total
= 2; /* start with len=2, this is the list count field */
1671 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1672 plen_total
+= item_count
* 4;
1674 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Clocks)");
1676 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1678 for(int i
= 0; i
< item_count
; i
++) {
1679 proto_tree
*list_tree
;
1680 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Clock Item %d", i
+1 );
1681 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1684 else if(m_idx
== 0x02 && !request
&& pcount
== 1) {
1685 /* GetMediaClockTypesSupported ([out] MediaClockTypes: OcaList<OcaMediaClockType>) */
1686 proto_tree
*p1_tree
;
1689 /* Determine the full length */
1690 /* Each OcaMediaClockType item has length 1 byte */
1691 int plen_total
= 2; /* start with len=2, this is the list count field */
1692 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1693 plen_total
+= item_count
;
1695 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Media Clock Types)");
1697 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1699 for(int i
= 0; i
< item_count
; i
++) {
1700 proto_tree
*list_tree
;
1701 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 1, ett_ocp1_params_compversion
, NULL
, "Type Item %d", i
+1 );
1702 offset_m
+= decode_params_OcaMediaClockType(tvb
, offset_m
, list_tree
);
1705 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1706 /* GetClock3s ([out] Clocks: OcaList<OcaONo>) */
1707 proto_tree
*p1_tree
;
1710 /* Determine the full length */
1711 /* Each ONo item has length 4 bytes */
1712 int plen_total
= 2; /* start with len=2, this is the list count field */
1713 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1714 plen_total
+= item_count
* 4;
1716 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Clocks)");
1718 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1720 for(int i
= 0; i
< item_count
; i
++) {
1721 proto_tree
*list_tree
;
1722 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Clock Item %d", i
+1 );
1723 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1727 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1731 return offset_m
- offset
;
1735 decode_params_OcaLibraryManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1737 unsigned offset_m
= offset
;
1739 if(m_idx
== 0x01 && request
&& pcount
== 1) {
1740 /* AddLibrary (Type: OcaLibVolType) */
1741 proto_tree
*p1_tree
;
1744 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Type)");
1745 offset_m
+= decode_params_OcaLibVolType(tvb
, offset_m
, p1_tree
);
1747 else if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1748 /* AddLibrary ([out] Identifier: OcaLibraryIdentifier) */
1749 proto_tree
*p1_tree
;
1752 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Identifier)");
1753 offset_m
+= decode_params_OcaLibraryIdentifier(tvb
, offset_m
, p1_tree
);
1755 else if(m_idx
== 0x02 && request
&& pcount
== 1) {
1756 /* DeleteLibrary (ID: OcaONo) */
1757 proto_tree
*p1_tree
;
1760 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
1761 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1763 else if(m_idx
== 0x03 && request
&& pcount
== 1) {
1764 /* GetLibraryCount (Type: OcaLibVolType) */
1765 proto_tree
*p1_tree
;
1768 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (OcaLibVolType)");
1769 offset_m
+= decode_params_OcaLibVolType(tvb
, offset_m
, p1_tree
);
1771 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1772 /* GetLibraryCount ([out] Count: OcaUint16) */
1773 proto_tree
*p1_tree
;
1776 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Count)");
1777 proto_tree_add_item(p1_tree
, hf_ocp1_params_library_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1780 else if(m_idx
== 0x04 && request
&& pcount
== 1) {
1781 /* GetLibraryList (Type: OcaLibVolType) */
1782 proto_tree
*p1_tree
;
1785 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Type)");
1786 offset_m
+= decode_params_OcaLibVolType(tvb
, offset_m
, p1_tree
);
1788 else if(m_idx
== 0x04 && !request
&& pcount
== 1) {
1789 /* GetLibraryList ([out] OcaList<OcaLibraryIdentifier) */
1790 proto_tree
*p1_tree
;
1793 /* Determine the full length
1794 * Each Item consists out of
1795 * - OcaLibraryIdentifier --> 11 bytes
1796 * - Type (authority = fixed len blob 3, id = 4 bytes)
1797 * - ONo = 4 bytes */
1798 int plen_total
= 2; /* start with len=2, this is the list count field */
1799 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1800 plen_total
+= item_count
* 11;
1802 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Library Identifier)");
1804 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1806 for(int i
= 0; i
< item_count
; i
++) {
1807 proto_tree
*list_tree
;
1808 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 11, ett_ocp1_params_compversion
, NULL
, "Library Item %d", i
+1 );
1809 offset_m
+= decode_params_OcaLibraryIdentifier(tvb
, offset_m
, list_tree
);
1812 else if(m_idx
== 0x05 && !request
&& pcount
== 1) {
1813 /* GetCurrentPatch ([out] ID: OcaLibVolIdentifier) */
1814 proto_tree
*p1_tree
;
1817 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
1818 offset_m
+= decode_params_OcaLibVolIdentifier(tvb
, offset_m
, p1_tree
);
1820 else if(m_idx
== 0x06 && request
&& pcount
== 1) {
1821 /* ApplyPatch (ID: OcaLibVolIdentifier) */
1822 proto_tree
*p1_tree
;
1825 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
1826 offset_m
+= decode_params_OcaLibVolIdentifier(tvb
, offset_m
, p1_tree
);
1829 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1833 return offset_m
- offset
;
1837 decode_params_OcaAudioProcessing(tvbuff_t
*tvb
, int offset
, int length
, proto_tree
*tree
)
1839 unsigned offset_m
= offset
;
1841 /* No registered methods */
1842 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1845 return offset_m
- offset
;
1849 decode_params_OcaDeviceTimeManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1851 unsigned offset_m
= offset
;
1853 if(m_idx
== 0x01 && !request
&& pcount
== 1) {
1854 /* GetDeviceTimeNTP ([out] DeviceTime: OcaTimeNTP) */
1855 proto_tree
*p1_tree
;
1858 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (Time)");
1859 offset_m
+= decode_params_OcaTimeNTP(tvb
, offset_m
, p1_tree
);
1861 else if(m_idx
== 0x02 && request
&& pcount
== 1) {
1862 /* SetDeviceTimeNTP (DeviceTime: OcaTimeNTP) */
1863 proto_tree
*p1_tree
;
1866 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (Time)");
1867 offset_m
+= decode_params_OcaTimeNTP(tvb
, offset_m
, p1_tree
);
1869 else if(m_idx
== 0x03 && !request
&& pcount
== 1) {
1870 /* GetTimeSources ([out] TimeSourceONos: OcaList<OcaONo>) */
1871 proto_tree
*p1_tree
;
1874 /* Determine the full length */
1875 /* Each Item is an ONo = 4 bytes */
1876 int plen_total
= 2; /* start with len=2, this is the list count field */
1877 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
1878 plen_total
+= item_count
* 4;
1880 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Time Sources)");
1882 proto_tree_add_item(p1_tree
, hf_ocp1_params_list_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
1884 for(int i
= 0; i
< item_count
; i
++) {
1885 proto_tree
*list_tree
;
1886 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 4, ett_ocp1_params_compversion
, NULL
, "Time Source Item %d", i
+1 );
1887 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, list_tree
);
1890 else if(m_idx
== 0x04 && !request
&& pcount
== 1) {
1891 /* GetCurrentDeviceTimeSource ([out] TimeSourceONo: OcaONo) */
1892 proto_tree
*p1_tree
;
1895 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Time Source)");
1896 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1898 else if(m_idx
== 0x05 && request
&& pcount
== 1) {
1899 /* SetCurrentDeviceTimeSource (TimeSourceONo: OcaONo) */
1900 proto_tree
*p1_tree
;
1903 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 8, ett_ocp1_params
, &t1
, "Parameter 1 (Time Source)");
1904 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
1906 else if(m_idx
== 0x06 && !request
&& pcount
== 1) {
1907 /* GetDeviceTimePTP ([out] DeviceTime: OcaTimePTP) */
1908 proto_tree
*p1_tree
;
1911 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 13, ett_ocp1_params
, &t1
, "Parameter 1 (Time)");
1912 offset_m
+= decode_params_OcaTimePTP(tvb
, offset_m
, p1_tree
);
1914 else if(m_idx
== 0x07 && request
&& pcount
== 1) {
1915 /* SetDeviceTimePTP (DeviceTime: OcaTimePTP) */
1916 proto_tree
*p1_tree
;
1919 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 13, ett_ocp1_params
, &t1
, "Parameter 1 (Time)");
1920 offset_m
+= decode_params_OcaTimePTP(tvb
, offset_m
, p1_tree
);
1923 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
1927 return offset_m
- offset
;
1931 decode_params_OcaTaskManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
1933 unsigned offset_m
= offset
;
1935 if(m_idx
== 0x01 && request
&& pcount
== 1) {
1936 /* Enable (Enable: OcaBoolean) */
1937 proto_tree
*p1_tree
;
1940 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (Enable)");
1941 offset_m
+= decode_params_OcaBoolean(tvb
, offset_m
, p1_tree
);
1943 else if(m_idx
== 0x02 && request
&& pcount
== 2) {
1944 /* ControlAllTasks (Command: OcaTaskCommand, ApplicationTaskParameter: OcaBlob) */
1945 proto_tree
*p1_tree
, *p2_tree
;
1946 proto_item
*t1
, *t2
;
1948 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (Command)");
1949 offset_m
+= decode_params_OcaTaskCommand(tvb
, offset_m
, p1_tree
);
1950 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t2
, "Parameter 2 (Application Task Parameter)");
1951 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p2_tree
, "Task Parameter");
1953 else if(m_idx
== 0x03 && request
&& pcount
== 3) {
1954 /* ControlTaskGroup (GroupID: OcaTaskGroupID, Command: OcaTaskCommand, ApplicationTaskParameter: OcaBlob) */
1955 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
;
1956 proto_item
*t1
, *t2
, *t3
;
1958 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2, ett_ocp1_params
, &t1
, "Parameter 1 (Group ID)");
1959 offset_m
+= decode_params_OcaTaskGroupID(tvb
, offset_m
, p1_tree
);
1960 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t2
, "Parameter 2 (Command)");
1961 offset_m
+= decode_params_OcaTaskCommand(tvb
, offset_m
, p2_tree
);
1962 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t3
, "Parameter 3 (Application Task Parameter)");
1963 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p3_tree
, "Task Parameter");
1965 else if(m_idx
== 0x04 && request
&& pcount
== 3) {
1966 /* ControlTask (TaskID: OcaTaskID, Command: OcaTaskCommand, ApplicationTaskParameter: OcaBlob) */
1967 proto_tree
*p1_tree
, *p2_tree
, *p3_tree
;
1968 proto_item
*t1
, *t2
, *t3
;
1970 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Task ID)");
1971 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, p1_tree
);
1972 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t2
, "Parameter 2 (Task Command)");
1973 offset_m
+= decode_params_OcaTaskCommand(tvb
, offset_m
, p2_tree
);
1974 p3_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t3
, "Parameter 3 (Application Task Parameter)");
1975 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, p3_tree
, "Task Parameter");
1977 else if(m_idx
== 0x05 && !request
&& pcount
== 1) {
1978 /* GetState ([out] State: OcaTaskManagerState) */
1979 proto_tree
*p1_tree
;
1982 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 1, ett_ocp1_params
, &t1
, "Parameter 1 (State)");
1983 offset_m
+= decode_params_OcaTaskManagerState(tvb
, offset_m
, p1_tree
);
1985 else if(m_idx
== 0x06 && request
&& pcount
== 1) {
1986 /* GetTaskStatuses ([out] Statuses: OcaTaskStatus) */
1987 proto_tree
*p1_tree
;
1990 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 7, ett_ocp1_params
, &t1
, "Parameter 1 (Statuses)");
1991 offset_m
+= decode_params_OcaTaskStatus(tvb
, offset_m
, p1_tree
);
1993 else if(m_idx
== 0x07 && request
&& pcount
== 1) {
1994 /* GetTaskStatus (TaskID: OcaTaskID) */
1995 proto_tree
*p1_tree
;
1998 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Task ID)");
1999 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, p1_tree
);
2001 else if(m_idx
== 0x07 && !request
&& pcount
== 1) {
2002 /* GetTaskStatus ([out] Status: OcaTaskStatus) */
2003 proto_tree
*p1_tree
;
2006 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 7, ett_ocp1_params
, &t1
, "Parameter 1 (Status)");
2007 offset_m
+= decode_params_OcaTaskStatus(tvb
, offset_m
, p1_tree
);
2009 else if(m_idx
== 0x08 /*&& request*/ && pcount
== 1) {
2010 /* AddTask ([inout] Task: OcaTask) */
2011 proto_tree
*p1_tree
;
2014 /* Determine length */
2015 /* ID (4) + Label (OcaString) + ProgramID (8) + GroupID (2) + TimeMode (1) + */
2016 unsigned len
= 4 + 2 + tvb_get_uint16(tvb
, offset_m
+ 4, ENC_BIG_ENDIAN
) + 8 + 2 + 1;
2017 /* TimeUnits (1) + ClockONo (4) + StartTime (13 if TimeUnits=1 (seconds, PTP Time), 8 if TimeUnits=2 (samples)) + Duration (4) + */
2018 if(tvb_get_uint8(tvb
, offset_m
+ len
)==1) { /* 1 = PTP Time, 13 byte */
2019 len
+= 1 + 4 + 13 + 4;
2020 } if(tvb_get_uint8(tvb
, offset_m
+ len
)==2) { /* 2 = samples, 8 byte */
2021 len
+= 1 + 4 + 8 + 4;
2022 } else { /* invalid, malformed */
2023 return offset_m
- offset
;
2025 /* ApplicationSpecificParameters (blob) */
2026 len
+= 2 + tvb_get_uint16(tvb
, offset_m
+ len
, ENC_BIG_ENDIAN
);
2029 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, len
, ett_ocp1_params
, &t1
, "Parameter 1 (Task)");
2030 offset_m
+= decode_params_OcaTask(tvb
, offset_m
, p1_tree
);
2032 else if(m_idx
== 0x09 && !request
&& pcount
== 1) {
2033 /* GetTasks ([out] Tasks: OcaMap<OcaTaskID,OcaTask>) */
2034 proto_tree
*p1_tree
;
2037 /* Determine the full length */
2038 int plen_total
= 2; /* start with len=2, this is the map item count field */
2039 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
2040 for(int i
= 0; i
< item_count
; i
++) { /* Loop map items */
2041 plen_total
+= 4; /* Map Key -> OcaTaskID, Uint32 */
2043 plen_total
+= 4; /* ID */
2044 plen_total
+= 2 + tvb_get_uint16(tvb
, offset_m
+ plen_total
, ENC_BIG_ENDIAN
); /* Label OCA String */
2045 plen_total
+= 11; /* ProgramID, GroupId, TimeMode */
2046 /* TimeUnits (1) + ClockONo (4) + StartTime (13 if TimeUnits=1 (seconds, PTP Time), 8 if TimeUnits=2 (samples)) + Duration (4) + */
2047 if(tvb_get_uint8(tvb
, offset_m
+ plen_total
)==1) { /* 1 = PTP Time, 13 byte */
2048 plen_total
+= 1 + 4 + 13 + 4;
2049 } if(tvb_get_uint8(tvb
, offset_m
+ plen_total
)==2) { /* 2 = samples, 8 byte */
2050 plen_total
+= 1 + 4 + 8 + 4;
2051 } else { /* invalid, malformed */
2052 return offset_m
- offset
;
2054 /* ApplicationSpecificParameters (blob) */
2055 plen_total
+= 2 + tvb_get_uint16(tvb
, offset_m
+ plen_total
, ENC_BIG_ENDIAN
);
2058 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Task Map)");
2060 proto_tree_add_item(p1_tree
, hf_ocp1_params_map_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2062 for(int i
= 0; i
< item_count
; i
++) {
2063 proto_tree
*list_tree
;
2065 /* Determine length */
2066 /* Task ID (4) (Key) + ID (4) + Label (OcaString) + ProgramID (8) + GroupID (2) + TimeMode (1) + */
2067 unsigned len
= 4 + 4 + 2 + tvb_get_uint16(tvb
, offset_m
+ 4, ENC_BIG_ENDIAN
) + 8 + 2 + 1;
2068 /* TimeUnits (1) + ClockONo (4) + StartTime (13 if TimeUnits=1 (seconds, PTP Time), 8 if TimeUnits=2 (samples)) + Duration (4) + */
2069 if(tvb_get_uint8(tvb
, offset_m
+ len
)==1) { /* 1 = PTP Time, 13 byte */
2070 len
+= 1 + 4 + 13 + 4;
2071 } if(tvb_get_uint8(tvb
, offset_m
+ len
)==2) { /* 2 = samples, 8 byte */
2072 len
+= 1 + 4 + 8 + 4;
2073 } else { /* invalid, malformed */
2074 return offset_m
- offset
;
2076 /* ApplicationSpecificParameters (blob) */
2077 len
+= 2 + tvb_get_uint16(tvb
, offset_m
+ len
, ENC_BIG_ENDIAN
);
2079 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, len
, ett_ocp1_params_compversion
, NULL
, "Task Item %d", i
+1 );
2080 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, list_tree
);
2081 offset_m
+= decode_params_OcaTask(tvb
, offset_m
, list_tree
);
2084 else if(m_idx
== 0x0A && request
&& pcount
== 1) {
2085 /* GetTask (ID: OcaTaskID) */
2086 proto_tree
*p1_tree
;
2089 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (ID)");
2090 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, p1_tree
);
2092 else if(m_idx
== 0x0A && !request
&& pcount
== 1) {
2093 /* GetTask ([out] Task: OcaTask) */
2094 proto_tree
*p1_tree
;
2097 /* Determine length */
2098 /* ID (4) + Label (OcaString) + ProgramID (8) + GroupID (2) + TimeMode (1) + */
2099 unsigned len
= 4 + 2 + tvb_get_uint16(tvb
, offset_m
+ 4, ENC_BIG_ENDIAN
) + 8 + 2 + 1;
2100 /* TimeUnits (1) + ClockONo (4) + StartTime (13 if TimeUnits=1 (seconds, PTP Time), 8 if TimeUnits=2 (samples)) + Duration (4) + */
2101 if(tvb_get_uint8(tvb
, offset_m
+ len
)==1) { /* 1 = PTP Time, 13 byte */
2102 len
+= 1 + 4 + 13 + 4;
2103 } if(tvb_get_uint8(tvb
, offset_m
+ len
)==2) { /* 2 = samples, 8 byte */
2104 len
+= 1 + 4 + 8 + 4;
2105 } else { /* invalid, malformed */
2106 return offset_m
- offset
;
2108 /* ApplicationSpecificParameters (blob) */
2109 len
+= 2 + tvb_get_uint16(tvb
, offset_m
+ len
, ENC_BIG_ENDIAN
);
2111 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, len
, ett_ocp1_params
, &t1
, "Parameter 1 (Task)");
2112 offset_m
+= decode_params_OcaTask(tvb
, offset_m
, p1_tree
);
2114 else if(m_idx
== 0x0B && request
&& pcount
== 2) {
2115 /* SetTask (ID: OcaTaskID, Task: OcaTask) */
2116 proto_tree
*p1_tree
, *p2_tree
;
2117 proto_item
*t1
, *t2
;
2119 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Task ID)");
2120 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, p1_tree
);
2122 /* Determine length */
2123 /* ID (4) + Label (OcaString) + ProgramID (8) + GroupID (2) + TimeMode (1) + */
2124 unsigned len
= 4 + 2 + tvb_get_uint16(tvb
, offset_m
+ 4, ENC_BIG_ENDIAN
) + 8 + 2 + 1;
2125 /* TimeUnits (1) + ClockONo (4) + StartTime (13 if TimeUnits=1 (seconds, PTP Time), 8 if TimeUnits=2 (samples)) + Duration (4) + */
2126 if(tvb_get_uint8(tvb
, offset_m
+ len
)==1) { /* 1 = PTP Time, 13 byte */
2127 len
+= 1 + 4 + 13 + 4;
2128 } if(tvb_get_uint8(tvb
, offset_m
+ len
)==2) { /* 2 = samples, 8 byte */
2129 len
+= 1 + 4 + 8 + 4;
2130 } else { /* invalid, malformed */
2131 return offset_m
- offset
;
2133 /* ApplicationSpecificParameters (blob) */
2134 len
+= 2 + tvb_get_uint16(tvb
, offset_m
+ len
, ENC_BIG_ENDIAN
);
2136 p2_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, len
, ett_ocp1_params
, &t2
, "Parameter 2 (Task)");
2137 offset_m
+= decode_params_OcaTask(tvb
, offset_m
, p2_tree
);
2139 else if(m_idx
== 0x0C && request
&& pcount
== 1) {
2140 /* DeleteTask (ID: OcaTaskID) */
2141 proto_tree
*p1_tree
;
2144 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Task ID)");
2145 offset_m
+= decode_params_OcaTaskID(tvb
, offset_m
, p1_tree
);
2148 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
2152 return offset_m
- offset
;
2156 decode_params_OcaCodingManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
2158 unsigned offset_m
= offset
;
2160 if((m_idx
== 0x01 || m_idx
== 0x02) && !request
&& pcount
== 1) {
2161 /* GetAvailableEncodingSchemes ([out] Schemes: OcaMap<OcaMediaCodingSchemeID,OcaString>) */
2162 /* GetAvailableDecodingSchemes ([out] Schemes: OcaMap<OcaMediaCodingSchemeID,OcaString>) */
2163 proto_tree
*p1_tree
;
2166 /* Determine the full length */
2167 int plen_total
= 2; /* start with len=2, this is the map item count field */
2168 uint16_t item_count
= tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
);
2169 for(int i
= 0; i
< item_count
; i
++) { /* Loop map items */
2170 plen_total
+= 4; /* Map Key -> OcaMediaCodingSchemeID, Uint16 */
2172 plen_total
+= 2 + tvb_get_uint16(tvb
, offset_m
+ plen_total
, ENC_BIG_ENDIAN
); /* Value, String */
2175 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, plen_total
, ett_ocp1_params
, &t1
, "Parameter 1 (Schemes)");
2177 proto_tree_add_item(p1_tree
, hf_ocp1_params_map_count
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2179 for(int i
= 0; i
< item_count
; i
++) {
2180 proto_tree
*list_tree
;
2181 list_tree
= proto_tree_add_subtree_format(p1_tree
, tvb
, offset_m
, 11, ett_ocp1_params_compversion
, NULL
, "Scheme Item %d", i
+1 );
2182 offset_m
+= decode_params_OcaMediaCodingSchemeID(tvb
, offset_m
, list_tree
);
2183 offset_m
+= decode_params_OcaString(tvb
, offset_m
, list_tree
, "Scheme");
2187 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
2191 return offset_m
- offset
;
2195 decode_params_OcaDiagnosticManager(tvbuff_t
*tvb
, int offset
, int length
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
2197 unsigned offset_m
= offset
;
2199 if(m_idx
== 0x01 && request
&& pcount
== 1) {
2200 /* GetLockStatus (ONo: OcaONo) */
2201 proto_tree
*p1_tree
;
2204 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 4, ett_ocp1_params
, &t1
, "Parameter 1 (Object No.)");
2205 offset_m
+= decode_params_OcaONo(tvb
, offset_m
, p1_tree
);
2207 else if(m_idx
== 0x01 && !request
&& pcount
== 1) {
2208 /* GetLockStatus ([out] StatusDescription: OcaString) */
2209 proto_tree
*p1_tree
;
2212 p1_tree
= proto_tree_add_subtree(tree
, tvb
, offset_m
, 2 + tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
), ett_ocp1_params
, &t1
, "Parameter 1 (Status Description)");
2213 offset_m
+= decode_params_OcaString(tvb
, offset_m
, p1_tree
, "Description");
2216 proto_tree_add_item(tree
, hf_ocp1_params
, tvb
, offset_m
, length
, ENC_NA
);
2220 return offset_m
- offset
;
2224 decode_params(tvbuff_t
*tvb
, int offset
, int length
, uint32_t ono
, uint16_t tree_level
, uint16_t m_idx
, uint8_t pcount
, bool request
, proto_tree
*tree
)
2227 proto_tree
*params_tree
;
2230 params_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
, ett_ocp1_params
, &ti
, "Parameters");
2232 if(tree_level
== 0x01)
2233 decode_params_OcaRoot(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2235 else if(tree_level
== 0x03)
2238 decode_params_OcaDeviceManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2241 decode_params_OcaSecurityManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2244 decode_params_OcaFirmwareManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2247 decode_params_OcaSubscriptionManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2250 decode_params_OcaPowerManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2253 decode_params_OcaNetworkManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2256 decode_params_OcaMediaClockManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2259 decode_params_OcaLibraryManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2262 decode_params_OcaAudioProcessing(tvb
, offset
, length
, params_tree
);
2265 decode_params_OcaDeviceTimeManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2268 decode_params_OcaTaskManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2271 decode_params_OcaCodingManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2274 decode_params_OcaDiagnosticManager(tvb
, offset
, length
, m_idx
, pcount
, request
, params_tree
);
2277 proto_tree_add_item(params_tree
, hf_ocp1_params
, tvb
, offset
, length
, ENC_NA
);
2282 proto_tree_add_item(params_tree
, hf_ocp1_params
, tvb
, offset
, length
, ENC_NA
);
2288 dissect_ocp1_msg_keepalive(tvbuff_t
*tvb
, int offset
, int length
, proto_tree
*tree
)
2290 proto_tree
*message_tree
;
2293 message_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, length
, ett_ocp1_keepalive
, &ti
, "Keep-Alive Message");
2296 proto_tree_add_item(message_tree
, hf_ocp1_heartbeat_time_s
, tvb
, offset
, length
, ENC_BIG_ENDIAN
);
2297 } else if (length
== 4) {
2298 proto_tree_add_item(message_tree
, hf_ocp1_heartbeat_time_ms
, tvb
, offset
, length
, ENC_BIG_ENDIAN
);
2303 return offset
+ length
;
2307 dissect_ocp1_msg_command(tvbuff_t
*tvb
, int offset
, int length
, packet_info
*pinfo
, proto_tree
*tree
, unsigned msg_counter
)
2309 proto_tree
*message_tree
, *method_tree
;
2310 proto_item
*ti
, *tf
, *t_occ
, *r_pkt
;
2311 conversation_t
*conversation
;
2313 struct oca_request_hash_key request_key
, *new_request_key
;
2314 struct oca_request_hash_val
*request_val
=NULL
;
2317 message_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, length
, ett_ocp1_keepalive
, &ti
, "Command Message %d", msg_counter
);
2319 int offset_m
= offset
;
2321 proto_tree_add_item(message_tree
, hf_ocp1_message_size
, tvb
, offset_m
, OCP1_MESSAGE_SIZE_LEN
, ENC_BIG_ENDIAN
);
2322 offset_m
+= OCP1_MESSAGE_SIZE_LEN
;
2324 proto_tree_add_item(message_tree
, hf_ocp1_message_handle
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2327 t_occ
= proto_tree_add_item(message_tree
, hf_ocp1_message_occ
, tvb
, offset_m
, 8, ENC_BIG_ENDIAN
);
2328 proto_item_set_generated(t_occ
);
2329 proto_tree_add_item(message_tree
, hf_ocp1_message_target_ono
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2332 tf
= proto_tree_add_item(message_tree
, hf_ocp1_message_method_id
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2333 method_tree
= proto_item_add_subtree(tf
, ett_ocp1_message_method
);
2335 proto_tree_add_item(method_tree
, hf_ocp1_message_method_tree_level
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2338 proto_tree_add_item(method_tree
, hf_ocp1_message_method_index
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2341 proto_tree_add_item(message_tree
, hf_ocp1_message_parameter_count
, tvb
, offset_m
, 1, ENC_BIG_ENDIAN
);
2344 if (length
-(offset_m
- offset
) > 0) {
2345 decode_params(tvb
, offset_m
, length
-(offset_m
- offset
),
2346 tvb_get_uint32(tvb
, offset
+ 8, ENC_BIG_ENDIAN
),
2347 tvb_get_uint16(tvb
, offset
+ 12, ENC_BIG_ENDIAN
),
2348 tvb_get_uint16(tvb
, offset
+ 14, ENC_BIG_ENDIAN
),
2349 tvb_get_uint8(tvb
, offset
+ 16),
2350 true, message_tree
);
2353 /* Handle wmem for lookup */
2354 conversation
= find_or_create_conversation(pinfo
);
2355 request_key
.conv_index
= conversation
->conv_index
;
2356 request_key
.handle
= tvb_get_uint32(tvb
, offset
+ 4, ENC_BIG_ENDIAN
);
2358 request_val
= (struct oca_request_hash_val
*) wmem_map_lookup(oca_request_hash_map
, &request_key
);
2362 new_request_key
= wmem_new(wmem_file_scope(), struct oca_request_hash_key
);
2363 *new_request_key
= request_key
;
2365 request_val
= wmem_new(wmem_file_scope(), struct oca_request_hash_val
);
2366 request_val
->pnum
= pinfo
->num
;
2367 request_val
->pnum_resp
= 0;
2368 request_val
->ono
= tvb_get_uint32(tvb
, offset
+ 8, ENC_BIG_ENDIAN
);
2369 request_val
->tree_level
= tvb_get_uint16(tvb
, offset
+ 12, ENC_BIG_ENDIAN
);
2370 request_val
->method_index
= tvb_get_uint16(tvb
, offset
+ 14, ENC_BIG_ENDIAN
);
2372 wmem_map_insert(oca_request_hash_map
, new_request_key
, request_val
);
2375 /* If response has populated response packet num */
2376 if(request_val
->pnum_resp
> 0) {
2377 r_pkt
= proto_tree_add_uint(message_tree
, hf_ocp1_response_in
, tvb
, 0, 0, request_val
->pnum_resp
);
2378 proto_item_set_generated(r_pkt
);
2386 dissect_ocp1_msg_notification(tvbuff_t
*tvb
, int offset
, int length
, proto_tree
*tree
, unsigned msg_counter
)
2388 proto_tree
*message_tree
, *context_tree
, *method_tree
, *eventdata_tree
, *eventid_tree
;
2389 proto_item
*ti
, *tf
, *te
, *teid
, *t_occ
, *ti_context
;
2391 message_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, length
, ett_ocp1_keepalive
, &ti
, "Notification Message %d", msg_counter
);
2393 int offset_m
= offset
;
2395 proto_tree_add_item(message_tree
, hf_ocp1_message_size
, tvb
, offset_m
, OCP1_MESSAGE_SIZE_LEN
, ENC_BIG_ENDIAN
);
2396 offset_m
+= OCP1_MESSAGE_SIZE_LEN
;
2398 t_occ
= proto_tree_add_item(message_tree
, hf_ocp1_message_occ
, tvb
, offset_m
, 8, ENC_BIG_ENDIAN
);
2399 proto_item_set_generated(t_occ
);
2400 proto_tree_add_item(message_tree
, hf_ocp1_message_target_ono
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2403 tf
= proto_tree_add_item(message_tree
, hf_ocp1_message_method_id
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2404 method_tree
= proto_item_add_subtree(tf
, ett_ocp1_message_method
);
2406 proto_tree_add_item(method_tree
, hf_ocp1_message_method_tree_level
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2409 proto_tree_add_item(method_tree
, hf_ocp1_message_method_index
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2412 proto_tree_add_item(message_tree
, hf_ocp1_message_parameter_count
, tvb
, offset_m
, 1, ENC_BIG_ENDIAN
);
2415 ti_context
= proto_tree_add_item(message_tree
, hf_ocp1_notification_parameter_context
, tvb
, offset_m
, tvb_get_uint16(tvb
, offset_m
, ENC_BIG_ENDIAN
) + 2, ENC_NA
);
2416 context_tree
= proto_item_add_subtree(ti_context
, ett_ocp1_context
);
2417 offset_m
+= decode_params_OcaBlob(tvb
, offset_m
, context_tree
, "Context");
2419 eventdata_tree
= proto_tree_add_subtree(message_tree
, tvb
, offset_m
, length
-(offset_m
- offset
), ett_ocp1_event_data
, &te
, "Event Data");
2420 proto_tree_add_item(eventdata_tree
, hf_ocp1_message_emitter_ono
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2423 teid
= proto_tree_add_item(eventdata_tree
, hf_ocp1_message_event_id
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2424 eventid_tree
= proto_item_add_subtree(teid
, ett_ocp1_event_method
);
2426 proto_tree_add_item(eventid_tree
, hf_ocp1_message_event_tree_level
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2429 proto_tree_add_item(eventid_tree
, hf_ocp1_message_event_index
, tvb
, offset_m
, 2, ENC_BIG_ENDIAN
);
2432 if (length
-(offset_m
- offset
) > 0) {
2433 decode_params(tvb
, offset_m
, length
-(offset_m
- offset
),
2434 tvb_get_uint32(tvb
, offset
+ 4, ENC_BIG_ENDIAN
),
2435 tvb_get_uint16(tvb
, offset
+ 8, ENC_BIG_ENDIAN
),
2436 tvb_get_uint16(tvb
, offset
+ 10, ENC_BIG_ENDIAN
),
2437 tvb_get_uint8(tvb
, offset
+ 12),
2438 false, eventdata_tree
);
2445 dissect_ocp1_msg_response(tvbuff_t
*tvb
, int offset
, int length
, packet_info
*pinfo
, proto_tree
*tree
, unsigned msg_counter
)
2447 proto_tree
*message_tree
;
2448 proto_item
*ti
, *r_pkt
;
2449 conversation_t
*conversation
;
2450 struct oca_request_hash_key request_key
;
2451 struct oca_request_hash_val
*request_val
=NULL
, request_val_empty
;
2453 message_tree
= proto_tree_add_subtree_format(tree
, tvb
, offset
, length
, ett_ocp1_keepalive
, &ti
, "Response Message %d", msg_counter
);
2455 int offset_m
= offset
;
2457 proto_tree_add_item(message_tree
, hf_ocp1_message_size
, tvb
, offset_m
, OCP1_MESSAGE_SIZE_LEN
, ENC_BIG_ENDIAN
);
2458 offset_m
+= OCP1_MESSAGE_SIZE_LEN
;
2460 proto_tree_add_item(message_tree
, hf_ocp1_message_handle
, tvb
, offset_m
, 4, ENC_BIG_ENDIAN
);
2463 proto_tree_add_item(message_tree
, hf_ocp1_message_status_code
, tvb
, offset_m
, 1, ENC_BIG_ENDIAN
);
2464 if(tvb_get_uint8(tvb
, offset_m
) != 0x00) {
2465 expert_add_info(pinfo
, ti
, &ei_ocp1_bad_status_code
);
2469 proto_tree_add_item(message_tree
, hf_ocp1_message_parameter_count
, tvb
, offset_m
, 1, ENC_BIG_ENDIAN
);
2472 /* Find request info */
2473 conversation
= find_or_create_conversation(pinfo
);
2474 request_key
.conv_index
= conversation
->conv_index
;
2475 request_key
.handle
= tvb_get_uint32(tvb
, offset
+ 4, ENC_BIG_ENDIAN
);
2477 /* build an empty oca_request_val
2478 * if wmem lookup fails, reference this one to force the parameter dissectors to fail */
2479 request_val_empty
= (struct oca_request_hash_val
) {0};
2481 request_val
= (struct oca_request_hash_val
*) wmem_map_lookup(oca_request_hash_map
, &request_key
);
2483 request_val
= &request_val_empty
;
2486 if (length
-(offset_m
- offset
) > 0) {
2487 decode_params(tvb
, offset_m
, length
-(offset_m
- offset
),
2489 request_val
->tree_level
,
2490 request_val
->method_index
,
2491 tvb_get_uint8(tvb
, offset
+ 9),
2492 false, message_tree
);
2495 /* Add generated/expert info for packet lookup (request_val is available either way) */
2496 if(request_val
->pnum
> 0) {
2497 r_pkt
= proto_tree_add_uint(message_tree
, hf_ocp1_response_to
, tvb
, 0, 0, request_val
->pnum
);
2498 request_val
->pnum_resp
= pinfo
->num
;
2499 proto_item_set_generated(r_pkt
);
2501 expert_add_info(pinfo
, ti
, &ei_ocp1_handle_fail
);
2509 dissect_ocp1_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, int offset
, proto_tree
*tree
, unsigned *pdu_counter
)
2512 if (tvb_get_uint8(tvb
, offset
) != OCP1_SYNC_VAL
)
2515 unsigned offset_d
= offset
; /* Increment counter for dissection */
2516 unsigned offset_m
= offset
+ OCP1_FRAME_HEADER_LEN
; /* Set offset to start of first message, will increment to next message later */
2517 unsigned message_size
; /* Message size (per iteration) */
2519 if (tvb_captured_length_remaining(tvb
, offset
) < OCP1_FRAME_HEADER_LEN
)
2522 uint32_t header_pdu_size
= tvb_get_uint32(tvb
, offset
+ 3, ENC_BIG_ENDIAN
);
2523 uint8_t pdu_type
= tvb_get_uint8(tvb
, offset
+ 7);
2525 proto_tree
*pdu_tree
;
2531 case (OCP1_PDU_TYPE_OCA_CMD
):
2532 pdu_counter
[OCP1_PDU_TYPE_OCA_CMD
]++;
2533 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "Command PDU");
2535 case (OCP1_PDU_TYPE_OCA_CMD_RRQ
):
2536 pdu_counter
[OCP1_PDU_TYPE_OCA_CMD_RRQ
]++;
2537 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "CommandRrq PDU");
2539 case OCP1_PDU_TYPE_OCA_NTF
:
2540 pdu_counter
[OCP1_PDU_TYPE_OCA_NTF
]++;
2541 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "Notification PDU");
2543 case OCP1_PDU_TYPE_OCA_RSP
:
2544 pdu_counter
[OCP1_PDU_TYPE_OCA_RSP
]++;
2545 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "Response PDU");
2547 case OCP1_PDU_TYPE_OCA_KEEPALIVE
:
2548 pdu_counter
[OCP1_PDU_TYPE_OCA_KEEPALIVE
]++;
2549 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "Keep-Alive PDU");
2552 pdu_counter
[OCP1_PDU_TYPE_ERROR_INDEX
]++;
2553 pdu_tree
= proto_tree_add_subtree(tree
, tvb
, offset
, header_pdu_size
+ 1, ett_ocp1_pdu
, &ti
, "Invalid Type PDU");
2558 proto_tree_add_item(pdu_tree
, hf_ocp1_sync_value
, tvb
, offset_d
, 1, ENC_BIG_ENDIAN
);
2561 proto_tree_add_item(pdu_tree
, hf_ocp1_protocol_version
, tvb
, offset_d
, 2, ENC_BIG_ENDIAN
);
2564 proto_tree_add_item(pdu_tree
, hf_ocp1_pdu_size
, tvb
, offset_d
, 4, ENC_BIG_ENDIAN
);
2567 proto_tree_add_item(pdu_tree
, hf_ocp1_pdu_type
, tvb
, offset_d
, 1, ENC_BIG_ENDIAN
);
2570 proto_tree_add_item(pdu_tree
, hf_ocp1_message_count
, tvb
, offset_d
, 2, ENC_BIG_ENDIAN
);
2572 unsigned msg_counter
= 1;
2577 /* dissect PDU messages */
2580 case (OCP1_PDU_TYPE_OCA_CMD
|| OCP1_PDU_TYPE_OCA_CMD_RRQ
):
2582 while (offset_m
< (offset
+ header_pdu_size
+ 1)) {
2583 /* first 4 byte of message is command size (incl. these 4 bytes) */
2584 message_size
= tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
);
2585 if(message_size
< OCP1_MESSAGE_SIZE_LEN
) {
2586 expert_add_info(pinfo
, pdu_tree
, &ei_ocp1_invalid_length
);
2590 dissect_ocp1_msg_command(tvb
, offset_m
, tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
), pinfo
, pdu_tree
, msg_counter
);
2591 offset_m
+= message_size
;
2596 case OCP1_PDU_TYPE_OCA_NTF
:
2598 while (offset_m
< (offset
+ header_pdu_size
+ 1)) {
2599 /* first 4 byte of message is command size (incl. these 4 bytes) */
2600 message_size
= tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
);
2601 if(message_size
< OCP1_MESSAGE_SIZE_LEN
) {
2602 expert_add_info(pinfo
, pdu_tree
, &ei_ocp1_invalid_length
);
2606 dissect_ocp1_msg_notification(tvb
, offset_m
, tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
), pdu_tree
, msg_counter
);
2607 offset_m
+= message_size
;
2612 case OCP1_PDU_TYPE_OCA_RSP
:
2614 while (offset_m
< (offset
+ header_pdu_size
+ 1)) {
2615 /* first 4 byte of message is response size (incl. these 4 bytes) */
2616 message_size
= tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
);
2617 if(message_size
< OCP1_MESSAGE_SIZE_LEN
) {
2618 expert_add_info(pinfo
, pdu_tree
, &ei_ocp1_invalid_length
);
2621 dissect_ocp1_msg_response(tvb
, offset_m
, tvb_get_uint32(tvb
, offset_m
, ENC_BIG_ENDIAN
), pinfo
, pdu_tree
, msg_counter
);
2622 offset_m
+= message_size
;
2627 case OCP1_PDU_TYPE_OCA_KEEPALIVE
:
2629 /* Keep-Alive shall only contain one message */
2630 if (tvb_get_uint16(tvb
, offset
+ 8, ENC_BIG_ENDIAN
) != 0x01)
2633 /* Message length possible are 2 bytes (sec) or 4 bytes (msec) */
2634 if (header_pdu_size
!= 11 && header_pdu_size
!= 13)
2637 dissect_ocp1_msg_keepalive(tvb
, offset_m
, header_pdu_size
- 9, pdu_tree
);
2641 call_data_dissector(tvb_new_subset_length(tvb
, offset
+ OCP1_FRAME_HEADER_LEN
, header_pdu_size
+ 1 - OCP1_FRAME_HEADER_LEN
), pinfo
, pdu_tree
);
2645 return header_pdu_size
+ 1;
2649 dissect_ocp1(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
2651 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "OCP.1");
2652 col_clear(pinfo
->cinfo
, COL_INFO
);
2654 proto_item
*ti
= proto_tree_add_item(tree
, proto_ocp1
, tvb
, 0, -1, ENC_NA
);
2655 proto_tree
*ocp1_tree
= proto_item_add_subtree(ti
, ett_ocp1
);
2657 unsigned pdu_counter
[OCP1_PDU_TYPE_ERROR_INDEX
+1] = {0};
2659 /* iterate through PDUs */
2660 unsigned offset
= 0;
2661 while (offset
< tvb_captured_length(tvb
)) {
2663 int len
= dissect_ocp1_pdu(tvb
, pinfo
, offset
, ocp1_tree
, pdu_counter
);
2664 if(len
== 0) return 0;
2668 /* Add column info */
2669 if(pdu_counter
[OCP1_PDU_TYPE_OCA_CMD
] > 0)
2670 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "Command (%d)", pdu_counter
[OCP1_PDU_TYPE_OCA_CMD
]);
2671 if(pdu_counter
[OCP1_PDU_TYPE_OCA_CMD_RRQ
] > 0)
2672 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "CommandRrq (%d)", pdu_counter
[OCP1_PDU_TYPE_OCA_CMD_RRQ
]);
2673 if(pdu_counter
[OCP1_PDU_TYPE_OCA_NTF
] > 0)
2674 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "Notification (%d)", pdu_counter
[OCP1_PDU_TYPE_OCA_NTF
]);
2675 if(pdu_counter
[OCP1_PDU_TYPE_OCA_RSP
] > 0)
2676 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "Response (%d)", pdu_counter
[OCP1_PDU_TYPE_OCA_RSP
]);
2677 if(pdu_counter
[OCP1_PDU_TYPE_OCA_KEEPALIVE
] > 0)
2678 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "Keep-Alive (%d)", pdu_counter
[OCP1_PDU_TYPE_OCA_KEEPALIVE
]);
2679 if(pdu_counter
[OCP1_PDU_TYPE_ERROR_INDEX
] > 0)
2680 col_append_sep_fstr(pinfo
->cinfo
, COL_INFO
, ", ", "Invalid PDU type (%d)", pdu_counter
[OCP1_PDU_TYPE_ERROR_INDEX
]);
2682 return tvb_captured_length(tvb
);
2686 get_ocp1_message_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
2689 bool another_pdu
= true;
2692 /* concat multiple PDUs into one protocol tree */
2693 while(another_pdu
) {
2695 unsigned pdu_size
= tvb_get_uint32(tvb
, offset
+ 3, ENC_BIG_ENDIAN
) + 1;
2698 if (!(tvb_captured_length_remaining(tvb
, offset
+ pdu_size
) >= OCP1_FRAME_HEADER_LEN
+ 1) || pdu_size
< OCP1_FRAME_HEADER_LEN
- 1)
2699 another_pdu
= false;
2709 dissect_ocp1_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
2711 if (!tvb_bytes_exist(tvb
, 0, OCP1_FRAME_HEADER_LEN
))
2714 tcp_dissect_pdus(tvb
, pinfo
, tree
, true, OCP1_FRAME_HEADER_LEN
, get_ocp1_message_len
, dissect_ocp1
, data
);
2715 return tvb_reported_length(tvb
);
2719 test_ocp1(tvbuff_t
*tvb
)
2722 /* Heuristics assume PDU start at offset=0
2723 * Testing for SyncVal + Version at arbitrary position is not enough
2726 /* Size must be larger than SyncVal + Header = 10 bytes */
2727 if (tvb_captured_length(tvb
) < OCP1_FRAME_HEADER_LEN
)
2730 /* PDU size must be larger than header size (without SyncVal) */
2731 if (tvb_get_uint32(tvb
, 3, ENC_BIG_ENDIAN
) < OCP1_FRAME_HEADER_LEN
- 1)
2734 /* SyncVal must be the first byte */
2735 if (tvb_get_uint8(tvb
, 0) != OCP1_SYNC_VAL
)
2738 /* Protocol version must be 0x0001 */
2739 if (tvb_get_uint16(tvb
, 1, ENC_BIG_ENDIAN
) != OCP1_PROTO_VER
)
2742 /* PDU type can be 0x00-0x04 */
2743 if (tvb_get_uint8(tvb
, 7) > 0x04)
2746 /* Check packet length
2747 * - PDU's header size can be larger than packet (fragmentation)
2748 * - packet could be larger then header's PDU size (multiple PDUs)
2749 * If the byte after message one is SyncVal again and there are enough remaining bytes
2750 * for at least a header, then it smells like OCP.1, really...but don't iterate through every possible PDU
2751 * (Header's PDU size field includes header and message length but excludes SyncVal (1 byte))
2753 unsigned header_pdu_size
= tvb_get_uint32(tvb
, 3, ENC_BIG_ENDIAN
);
2754 if (tvb_captured_length(tvb
) > header_pdu_size
+ 1) {
2756 tvb_get_uint8(tvb
, header_pdu_size
+ 1) != OCP1_SYNC_VAL
&&
2757 tvb_captured_length(tvb
) <= header_pdu_size
+ 11 /* PDU one (PDU size + SyncVal) + SyncVal-/Header length PDU two = 11 bytes */
2766 dissect_ocp1_heur_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
2768 if (!test_ocp1(tvb
))
2771 dissect_ocp1_tcp(tvb
, pinfo
, tree
, data
);
2777 dissect_ocp1_heur_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
2779 if (!test_ocp1(tvb
))
2782 dissect_ocp1(tvb
, pinfo
, tree
, data
);
2788 proto_register_ocp1(void)
2790 static hf_register_info hf
[] = {
2793 { &hf_ocp1_sync_value
,
2794 { "Sync Value", "ocp1.syncval",
2799 { &hf_ocp1_protocol_version
,
2800 { "Protocol Version", "ocp1.version",
2801 FT_UINT16
, BASE_DEC
,
2805 { &hf_ocp1_pdu_size
,
2806 { "Size", "ocp1.size",
2807 FT_UINT32
, BASE_DEC
,
2811 { &hf_ocp1_pdu_type
,
2812 { "Type", "ocp1.type",
2814 VALS(pdu_type_vals
), 0x0,
2817 { &hf_ocp1_message_count
,
2818 { "Message Count", "ocp1.msgcount",
2819 FT_UINT16
, BASE_DEC
,
2825 { &hf_ocp1_response_in
,
2826 { "Response in", "ocp1.response_in",
2827 FT_FRAMENUM
, BASE_NONE
,
2828 FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE
), 0x0,
2831 { &hf_ocp1_response_to
,
2832 { "Request in", "ocp1.response_to",
2833 FT_FRAMENUM
, BASE_NONE
,
2834 FRAMENUM_TYPE(FT_FRAMENUM_REQUEST
), 0x0,
2839 { &hf_ocp1_heartbeat_time_s
,
2840 { "Heartbeat Time", "ocp1.heartbeat.time",
2841 FT_UINT16
, BASE_DEC
| BASE_UNIT_STRING
,
2842 UNS(&units_seconds
), 0x0,
2845 { &hf_ocp1_heartbeat_time_ms
,
2846 { "Heartbeat Time", "ocp1.heartbeat.time",
2847 FT_UINT32
, BASE_DEC
| BASE_UNIT_STRING
,
2848 UNS(&units_milliseconds
), 0x0,
2853 { &hf_ocp1_message_occ
,
2854 { "OCC", "ocp1.occ",
2855 FT_UINT64
, BASE_CUSTOM
,
2856 CF_FUNC(format_occ
), 0x0,
2859 { &hf_ocp1_message_target_ono
,
2860 { "Target Object No.", "ocp1.tono",
2861 FT_UINT32
, BASE_DEC_HEX
,
2865 { &hf_ocp1_message_emitter_ono
,
2866 { "Emitter Object No.", "ocp1.eono",
2867 FT_UINT32
, BASE_DEC_HEX
,
2871 { &hf_ocp1_message_parameter_count
,
2872 { "Parameter Count", "ocp1.pcount",
2877 { &hf_ocp1_message_method_id
,
2878 { "Method ID", "ocp1.mid",
2879 FT_UINT32
, BASE_DEC_HEX
,
2883 { &hf_ocp1_message_method_tree_level
,
2884 { "Tree Level", "ocp1.mlevel",
2885 FT_UINT16
, BASE_DEC
,
2889 { &hf_ocp1_message_method_index
,
2890 { "Method Index", "ocp1.midx",
2891 FT_UINT16
, BASE_DEC
,
2895 { &hf_ocp1_message_event_id
,
2896 { "Event ID", "ocp1.eid",
2897 FT_UINT32
, BASE_DEC_HEX
,
2901 { &hf_ocp1_message_event_tree_level
,
2902 { "Tree Level", "ocp1.elevel",
2903 FT_UINT16
, BASE_DEC
,
2907 { &hf_ocp1_message_event_index
,
2908 { "Event Index", "ocp1.eidx",
2909 FT_UINT16
, BASE_DEC
,
2913 { &hf_ocp1_message_size
,
2914 { "Size", "ocp1.msgsize",
2915 FT_UINT32
, BASE_DEC
,
2919 { &hf_ocp1_message_handle
,
2920 { "Handle", "ocp1.handle",
2921 FT_UINT32
, BASE_DEC_HEX
,
2925 { &hf_ocp1_message_status_code
,
2926 { "Status Code", "ocp1.status",
2928 VALS(OcaStatus
), 0x0,
2933 { &hf_ocp1_notification_parameter_context
,
2934 { "Context", "ocp1.context",
2935 FT_BYTES
, BASE_NONE
,
2942 { "Parameter Data", "ocp1.params",
2943 FT_BYTES
, BASE_NONE
,
2947 { &hf_ocp1_params_bool
,
2948 { "Boolean", "ocp1.params.bool",
2949 FT_BOOLEAN
, BASE_NONE
,
2953 { &hf_ocp1_params_ono
,
2954 { "Object No.", "ocp1.params.ono",
2955 FT_UINT32
, BASE_DEC_HEX
,
2959 { &hf_ocp1_params_event_id
,
2960 { "Event ID", "ocp1.params.eid",
2961 FT_UINT32
, BASE_DEC_HEX
,
2965 { &hf_ocp1_params_event_tree_level
,
2966 { "Tree Level", "ocp1.params.elevel",
2967 FT_UINT16
, BASE_DEC
,
2971 { &hf_ocp1_params_event_index
,
2972 { "Event Index", "ocp1.params.eidx",
2973 FT_UINT16
, BASE_DEC
,
2977 { &hf_ocp1_params_method_id
,
2978 { "Method ID", "ocp1.params.mid",
2979 FT_UINT32
, BASE_DEC_HEX
,
2983 { &hf_ocp1_params_method_tree_level
,
2984 { "Tree Level", "ocp1.params.mlevel",
2985 FT_UINT16
, BASE_DEC
,
2989 { &hf_ocp1_params_method_index
,
2990 { "Method Index", "ocp1.params.midx",
2991 FT_UINT16
, BASE_DEC
,
2995 { &hf_ocp1_params_property_id
,
2996 { "Method ID", "ocp1.params.pid",
2997 FT_UINT32
, BASE_DEC_HEX
,
3001 { &hf_ocp1_params_property_tree_level
,
3002 { "Tree Level", "ocp1.params.plevel",
3003 FT_UINT16
, BASE_DEC
,
3007 { &hf_ocp1_params_property_index
,
3008 { "Property Index", "ocp1.params.pidx",
3009 FT_UINT16
, BASE_DEC
,
3013 { &hf_ocp1_params_blob
,
3014 { "Blob", "ocp1.params.blob",
3019 { &hf_ocp1_params_blob_datasize
,
3020 { "Size", "ocp1.params.blob.size",
3021 FT_UINT16
, BASE_DEC
,
3025 { &hf_ocp1_params_blob_data
,
3026 { "Data", "ocp1.params.blob.data",
3027 FT_BYTES
, BASE_NONE
,
3031 { &hf_ocp1_params_string
,
3032 { "String", "ocp1.params.string",
3037 { &hf_ocp1_params_string_length
,
3038 { "Length", "ocp1.params.string.length",
3039 FT_UINT16
, BASE_DEC
,
3043 { &hf_ocp1_params_string_value
,
3044 { "Value", "ocp1.params.string.value",
3045 FT_STRING
, BASE_NONE
,
3049 { &hf_ocp1_params_ntf_delivery_mode
,
3050 { "Notification Delivery Mode", "ocp1.params.dmode",
3052 VALS(OcaNotificationDeliveryMode
), 0x0,
3055 { &hf_ocp1_params_list_count
,
3056 { "List Count", "ocp1.params.lcount",
3057 FT_UINT16
, BASE_DEC
,
3061 { &hf_ocp1_params_map_count
,
3062 { "List Count", "ocp1.params.mcount",
3063 FT_UINT16
, BASE_DEC
,
3067 { &hf_ocp1_params_classid_fields
,
3068 { "Class ID Fields", "ocp1.params.classid.fields",
3069 FT_UINT16
, BASE_DEC
,
3073 { &hf_ocp1_params_classid
,
3074 { "Class ID", "ocp1.params.classid",
3075 FT_STRINGZ
, BASE_NONE
,
3079 { &hf_ocp1_params_class_version
,
3080 { "Class Version", "ocp1.params.classver",
3081 FT_UINT16
, BASE_DEC
,
3085 { &hf_ocp1_params_imageid
,
3086 { "ID", "ocp1.params.imageid",
3087 FT_UINT32
, BASE_DEC_HEX
,
3091 { &hf_ocp1_params_oca_version
,
3092 { "OCA Version", "ocp1.params.ocaver",
3093 FT_UINT16
, BASE_DEC
,
3097 { &hf_ocp1_params_reset_cause
,
3098 { "Reset Cause", "ocp1.params.resetcause",
3100 VALS(OcaResetCause
), 0x0,
3103 { &hf_ocp1_params_power_state
,
3104 { "Power State", "ocp1.params.powerstate",
3106 VALS(OcaPowerState
), 0x0,
3109 { &hf_ocp1_params_media_clock_type
,
3110 { "Media Clock Type", "ocp1.params.mediaclocktype",
3112 VALS(OcaMediaClockType
), 0x0,
3115 { &hf_ocp1_params_component
,
3116 { "Component", "ocp1.params.component",
3117 FT_UINT16
, BASE_DEC
,
3118 VALS(OcaComponent
), 0x0,
3121 { &hf_ocp1_params_devicestate
,
3122 { "Device State", "ocp1.params.devicestate",
3123 FT_UINT16
, BASE_HEX
,
3127 { &hf_ocp1_params_devicestate_oper
,
3128 { "Operational", "ocp1.params.devicestate.oper",
3130 NULL
, OCP1_DEVICESTATE_OPER
,
3133 { &hf_ocp1_params_devicestate_disabled
,
3134 { "Disabled", "ocp1.params.devicestate.disabled",
3136 NULL
, OCP1_DEVICESTATE_DISABLED
,
3139 { &hf_ocp1_params_devicestate_error
,
3140 { "Error", "ocp1.params.devicestate.error",
3142 NULL
, OCP1_DEVICESTATE_ERROR
,
3145 { &hf_ocp1_params_devicestate_init
,
3146 { "Initializing", "ocp1.params.devicestate.init",
3148 NULL
, OCP1_DEVICESTATE_INIT
,
3151 { &hf_ocp1_params_devicestate_updating
,
3152 { "Updating", "ocp1.params.devicestate.updating",
3154 NULL
, OCP1_DEVICESTATE_UPDATING
,
3157 { &hf_ocp1_params_ocaver_major
,
3158 { "Major", "ocp1.params.ocaver.major",
3159 FT_UINT32
, BASE_DEC_HEX
,
3163 { &hf_ocp1_params_ocaver_minor
,
3164 { "Minor", "ocp1.params.ocaver.minor",
3165 FT_UINT32
, BASE_DEC_HEX
,
3169 { &hf_ocp1_params_ocaver_build
,
3170 { "Build", "ocp1.params.ocaver.build",
3171 FT_UINT32
, BASE_DEC_HEX
,
3175 { &hf_ocp1_params_ocaver_comp
,
3176 { "Component", "ocp1.params.ocaver.component",
3177 FT_UINT16
, BASE_DEC
,
3178 VALS(OcaComponent
), 0x0,
3181 { &hf_ocp1_params_subscriber_ctx_len
,
3182 { "Max. Subscriber Context Length", "ocp1.params.subscr_ctx_len",
3183 FT_UINT16
, BASE_DEC
,
3187 { &hf_ocp1_params_libvol_id
,
3188 { "Library Volume ID", "ocp1.params.libvolid",
3189 FT_UINT32
, BASE_DEC
,
3193 { &hf_ocp1_params_libvoltype_id
,
3194 { "Library Volume Type ID", "ocp1.params.libvoltype",
3195 FT_UINT32
, BASE_DEC
,
3199 { &hf_ocp1_params_library_count
,
3200 { "Library Count", "ocp1.params.libcount",
3201 FT_UINT16
, BASE_DEC
,
3205 { &hf_ocp1_params_time_ntp
,
3206 { "NTP Time", "ocp1.params.time_ntp",
3207 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_NTP_UTC
,
3211 { &hf_ocp1_params_time_ptp_negative
,
3212 { "Negative", "ocp1.params.time_ptp_negative",
3213 FT_BOOLEAN
, BASE_NONE
,
3217 { &hf_ocp1_params_time_ptp
,
3218 { "PTP Time", "ocp1.params.time_ptp",
3219 FT_RELATIVE_TIME
, BASE_NONE
,
3223 { &hf_ocp1_params_time_ptp_seconds
,
3224 { "Seconds", "ocp1.params.time_ptp_seconds",
3225 FT_UINT64
, BASE_DEC
,
3229 { &hf_ocp1_params_time_ptp_nanoseconds
,
3230 { "Nanoseconds", "ocp1.params.time_ptp_nanoseconds",
3231 FT_UINT32
, BASE_DEC
,
3235 { &hf_ocp1_params_time_mode
,
3236 { "Time Mode", "ocp1.params.time_mode",
3238 VALS(OcaTimeMode
), 0x0,
3241 { &hf_ocp1_params_time_units
,
3242 { "Time Units", "ocp1.params.time_units",
3244 VALS(OcaTimeUnits
), 0x0,
3247 { &hf_ocp1_params_task_id
,
3248 { "Task ID", "ocp1.params.task_id",
3249 FT_UINT32
, BASE_DEC_HEX
,
3253 { &hf_ocp1_params_task_group_id
,
3254 { "Task Group ID", "ocp1.params.task_group_id",
3255 FT_UINT16
, BASE_DEC_HEX
,
3259 { &hf_ocp1_params_time_interval
,
3260 { "Time Interval", "ocp1.params.time_interval",
3261 FT_FLOAT
, BASE_NONE
,
3265 { &hf_ocp1_params_start_time
,
3266 { "Start Time", "ocp1.params.start_time",
3267 FT_UINT64
, BASE_DEC_HEX
,
3271 { &hf_ocp1_params_task_command
,
3272 { "Task Command", "ocp1.params.task_command",
3274 VALS(OcaTaskCommand
), 0x0,
3277 { &hf_ocp1_params_task_manager_state
,
3278 { "Task Manager State", "ocp1.params.task_mgr_state",
3280 VALS(OcaTaskManagerState
), 0x0,
3283 { &hf_ocp1_params_task_state
,
3284 { "Task Manager State", "ocp1.params.task_state",
3286 VALS(OcaTaskState
), 0x0,
3289 { &hf_ocp1_params_task_status_error_code
,
3290 { "Task Manager State", "ocp1.params.task_status_error_code",
3291 FT_UINT16
, BASE_DEC_HEX
,
3295 { &hf_ocp1_params_media_coding_scheme_id
,
3296 { "Media Coding Scheme ID", "ocp1.params.media_coding_scheme_id",
3297 FT_UINT16
, BASE_DEC_HEX
,
3303 static ei_register_info ei
[] = {
3304 { &ei_ocp1_handle_fail
,
3305 { "ocp1.handle_fail", PI_RESPONSE_CODE
, PI_WARN
,
3306 "Request to handle not captured", EXPFILL
}
3308 { &ei_ocp1_bad_status_code
,
3309 { "ocp1.bad_status_code", PI_RESPONSE_CODE
, PI_ERROR
,
3310 "Status code indicates failed command", EXPFILL
}
3312 { &ei_ocp1_invalid_length
,
3313 { "ocp1.invalid_length", PI_MALFORMED
, PI_ERROR
,
3314 "Size or length field has invalid value", EXPFILL
}
3318 static int *ett
[] = {
3321 &ett_ocp1_keepalive
,
3322 &ett_ocp1_message_method
,
3324 &ett_ocp1_event_data
,
3325 &ett_ocp1_event_method
,
3327 &ett_ocp1_params_event
,
3328 &ett_ocp1_params_method
,
3329 &ett_ocp1_params_property
,
3330 &ett_ocp1_params_blob
,
3331 &ett_ocp1_params_string
,
3332 &ett_ocp1_params_manager_desc
,
3333 &ett_ocp1_params_devicestate
,
3334 &ett_ocp1_params_compversion
,
3335 &ett_ocp1_params_ocaver
,
3336 &ett_ocp1_params_ptp
3339 expert_module_t
* expert_ocp1
;
3341 oca_request_hash_map
= wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), oca_handle_hash
, oca_handle_equal
);
3343 proto_ocp1
= proto_register_protocol("Open Control Protocol (OCP.1/AES70)", "OCP.1", "ocp1");
3345 proto_register_field_array(proto_ocp1
, hf
, array_length(hf
));
3346 proto_register_subtree_array(ett
, array_length(ett
));
3348 expert_ocp1
= expert_register_protocol(proto_ocp1
);
3349 expert_register_field_array(expert_ocp1
, ei
, array_length(ei
));
3351 ocp1_tcp_handle
= register_dissector("ocp1.tcp", dissect_ocp1_tcp
, proto_ocp1
);
3352 ocp1_udp_handle
= register_dissector("ocp1.udp", dissect_ocp1
, proto_ocp1
);
3356 proto_reg_handoff_ocp1(void)
3358 heur_dissector_add("tcp", dissect_ocp1_heur_tcp
, "OCP.1 over TCP", "ocp1_tcp", proto_ocp1
, HEURISTIC_ENABLE
);
3359 heur_dissector_add("udp", dissect_ocp1_heur_udp
, "OCP.1 over UDP", "ocp1_udp", proto_ocp1
, HEURISTIC_ENABLE
);
3363 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3368 * indent-tabs-mode: nil
3371 * vi: set shiftwidth=4 tabstop=8 expandtab:
3372 * :indentSize=4:tabSize=8:noTabs=true: