language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
C
wireshark/plugins/epan/ethercat/packet-nv.c
/* packet-nv.c * Routines for ethercat packet disassembly * * Copyright (c) 2007 by Beckhoff Automation GmbH * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* Include files */ #include "config.h" #include <epan/packet.h> #include "packet-nv.h" void proto_register_nv(void); void proto_reg_handoff_nv(void); /* Define the nv proto */ int proto_nv = -1; static dissector_handle_t nv_handle; static int ett_nv = -1; static int ett_nv_header = -1; static int ett_nv_var = -1; static int ett_nv_varheader = -1; /* static int hf_nv_summary = -1; */ static int hf_nv_header = -1; static int hf_nv_publisher = -1; static int hf_nv_count = -1; static int hf_nv_cycleindex = -1; static int hf_nv_variable = -1; static int hf_nv_varheader = -1; static int hf_nv_id = -1; static int hf_nv_hash = -1; static int hf_nv_length = -1; static int hf_nv_quality = -1; static int hf_nv_data = -1; /*nv*/ static void NvSummaryFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax) { guint32 nvOffset = offset; snprintf ( szText, nMax, "Network Vars from %d.%d.%d.%d.%d.%d - %d Var(s)", tvb_get_guint8(tvb, nvOffset), tvb_get_guint8(tvb, nvOffset+1), tvb_get_guint8(tvb, nvOffset+2), tvb_get_guint8(tvb, nvOffset+3), tvb_get_guint8(tvb, nvOffset+4), tvb_get_guint8(tvb, nvOffset+5), tvb_get_letohs(tvb, nvOffset+6)); } static void NvPublisherFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax) { guint32 nvOffset = offset; snprintf ( szText, nMax, "Publisher %d.%d.%d.%d.%d.%d", tvb_get_guint8(tvb, nvOffset), tvb_get_guint8(tvb, nvOffset+1), tvb_get_guint8(tvb, nvOffset+2), tvb_get_guint8(tvb, nvOffset+3), tvb_get_guint8(tvb, nvOffset+4), tvb_get_guint8(tvb, nvOffset+5)); } static void NvVarHeaderFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax) { snprintf ( szText, nMax, "Variable - Id = %d, Length = %d", tvb_get_letohs(tvb, offset), tvb_get_letohs(tvb, offset+4)); } static int dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti; proto_tree *nv_tree, *nv_header_tree, *nv_var_tree,*nv_varheader_tree; gint offset = 0; char szText[200]; int nMax = (int)sizeof(szText)-1; gint i; col_set_str(pinfo->cinfo, COL_PROTOCOL, "TC-NV"); col_clear(pinfo->cinfo, COL_INFO); NvSummaryFormater(tvb, offset, szText, nMax); col_append_str(pinfo->cinfo, COL_INFO, szText); if (tree) { guint16 nv_count; ti = proto_tree_add_item(tree, proto_nv, tvb, 0, -1, ENC_NA); nv_tree = proto_item_add_subtree(ti, ett_nv); proto_item_append_text(ti,": %s",szText); ti = proto_tree_add_item(nv_tree, hf_nv_header, tvb, offset, NvParserHDR_Len, ENC_NA); nv_header_tree = proto_item_add_subtree(ti, ett_nv_header); ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, (int)sizeof(guint8)*6, ENC_NA); NvPublisherFormater(tvb, offset, szText, nMax); proto_item_set_text(ti, "%s", szText); offset+=((int)sizeof(guint8)*6); proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); nv_count = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset = NvParserHDR_Len; for ( i=0; i < nv_count; i++ ) { guint16 var_length = tvb_get_letohs(tvb, offset+4); ti = proto_tree_add_item(nv_tree, hf_nv_variable, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len+var_length, ENC_NA); NvVarHeaderFormater(tvb, offset, szText, nMax); proto_item_set_text(ti, "%s", szText); nv_var_tree = proto_item_add_subtree(ti, ett_nv_var); ti = proto_tree_add_item(nv_var_tree, hf_nv_varheader, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len, ENC_NA); nv_varheader_tree = proto_item_add_subtree(ti, ett_nv_varheader); proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset+=(int)sizeof(guint16); proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset+=(int)sizeof(guint16); proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset+=(int)sizeof(guint16); proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset+=(int)sizeof(guint16); proto_tree_add_item(nv_var_tree, hf_nv_data, tvb, offset, var_length, ENC_NA); offset+=var_length; } } return tvb_captured_length(tvb); } void proto_register_nv(void) { static hf_register_info hf[] = { #if 0 { &hf_nv_summary, { "Summary of the Nv Packet", "tc_nv.summary", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, #endif { &hf_nv_header, { "Header", "tc_nv.header", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_nv_publisher, { "Publisher", "tc_nv.publisher", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_nv_count, { "Count", "tc_nv.count", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_cycleindex, { "CycleIndex", "tc_nv.cycleindex", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_variable, { "Variable", "tc_nv.variable", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_nv_varheader, { "VarHeader", "tc_nv.varheader", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_nv_id, { "Id", "tc_nv.id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_hash, { "Hash", "tc_nv.hash", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_length, { "Length", "tc_nv.length", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_quality, { "Quality", "tc_nv.quality", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_nv_data, { "Data", "tc_nv.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { &ett_nv, &ett_nv_header, &ett_nv_var, &ett_nv_varheader }; proto_nv = proto_register_protocol("TwinCAT NV", "TC-NV","tc_nv"); proto_register_field_array(proto_nv,hf,array_length(hf)); proto_register_subtree_array(ett,array_length(ett)); nv_handle = register_dissector("tc_nv", dissect_nv, proto_nv); } void proto_reg_handoff_nv(void) { dissector_add_uint("ecatf.type", 4, nv_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local Variables: * c-basic-offset: 3 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=3 tabstop=8 expandtab: * :indentSize=3:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/ethercat/packet-nv.h
/* packet-nv.h * * Copyright (c) 2007 by Beckhoff Automation GmbH * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef _PACKET_NV_H_ #define _PACKET_NV_H_ /* Ensure the same data layout for all platforms*/ typedef struct _ETYPE_88A4_NV_DATA_HEADER { guint16 Id; guint16 Hash; guint16 Length; guint16 Quality; } ETYPE_88A4_NV_DATA_HEADER; #define ETYPE_88A4_NV_DATA_HEADER_Len (int)sizeof(ETYPE_88A4_NV_DATA_HEADER) typedef struct _NvParserHDR { guint8 Publisher[6]; guint16 CountNV; guint16 CycleIndex; guint16 Reserved; } NvParserHDR; #define NvParserHDR_Len (int)sizeof(NvParserHDR) #endif /* _PACKET_NV_H_*/
Text
wireshark/plugins/epan/falco_bridge/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(falco-bridge 0 0 4 0) set(DISSECTOR_SRC packet-falco-bridge.c sinsp-span.cpp ) set(DISSECTOR_HEADERS conversation-macros.h sinsp-span.h ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ) add_logray_plugin_library(falco-bridge epan) # XXX Hacks; need to fix in falcosecurity-libs. target_compile_definitions(falco-bridge PRIVATE HAVE_STRLCPY=1 ) # target_compile_options(falco-bridge PRIVATE -Wno-address-of-packed-member) target_include_directories(falco-bridge SYSTEM PRIVATE ${SINSP_INCLUDE_DIRS} ) target_link_libraries(falco-bridge epan ${SINSP_LINK_LIBRARIES} ) install_plugin(falco-bridge epan) CHECKAPI( NAME falco-bridge SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C
wireshark/plugins/epan/falco_bridge/packet-falco-bridge.c
/* packet-falco-bridge.c * * By Loris Degioanni * Copyright (C) 2021 Sysdig, Inc. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ // To do: // - Convert this to C++? It would let us get rid of the glue that is // sinsp-span and make string handling a lot easier. However, // epan/address.h and driver/ppm_events_public.h both define PT_NONE. // - Add a configuration preference for configure_plugin? // - Add a configuration preference for individual conversation filters vs ANDing them? // We would need to add deregister_(|log_)conversation_filter before we implement this. #include "config.h" #include <stddef.h> #include <stdint.h> #include <stdio.h> #ifndef _WIN32 #include <unistd.h> #include <dlfcn.h> #endif #include <epan/exceptions.h> #include <epan/packet.h> #include <epan/proto.h> #include <epan/proto_data.h> #include <epan/conversation.h> #include <epan/conversation_filter.h> #include <epan/tap.h> #include <epan/stat_tap_ui.h> #include <wsutil/file_util.h> #include <wsutil/filesystem.h> #include <wsutil/inet_addr.h> #include <wsutil/report_message.h> #include "sinsp-span.h" typedef enum bridge_field_flags_e { BFF_NONE = 0, BFF_HIDDEN = 1 << 1, // Unused BFF_INFO = 1 << 2, BFF_CONVERSATION = 1 << 3 } bridge_field_flags_e; typedef struct conv_filter_info { hf_register_info *field_info; bool is_present; wmem_strbuf_t *strbuf; } conv_filter_info; typedef struct bridge_info { sinsp_source_info_t *ssi; uint32_t source_id; int proto; hf_register_info* hf; int* hf_ids; hf_register_info* hf_v4; int *hf_v4_ids; hf_register_info* hf_v6; int *hf_v6_ids; int* hf_id_to_addr_id; // Maps an hf offset to an hf_v[46] offset uint32_t visible_fields; uint32_t* field_flags; int* field_ids; uint32_t num_conversation_filters; conv_filter_info *conversation_filters; } bridge_info; static int proto_falco_bridge = -1; static gint ett_falco_bridge = -1; static gint ett_sinsp_span = -1; static gint ett_address = -1; static dissector_table_t ptype_dissector_table; static int dissect_falco_bridge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data); static int dissect_sinsp_span(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_); /* * Array of plugin bridges */ bridge_info* bridges = NULL; guint nbridges = 0; guint n_conv_fields = 0; /* * sinsp extractor span */ sinsp_span_t *sinsp_span = NULL; /* * Fields */ static int hf_sdp_source_id_size = -1; static int hf_sdp_lengths = -1; static int hf_sdp_source_id = -1; static hf_register_info hf[] = { { &hf_sdp_source_id_size, { "Plugin ID size", "falcobridge.id.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_sdp_lengths, { "Field Lengths", "falcobridge.lens", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_sdp_source_id, { "Plugin ID", "falcobridge.id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, }; // Returns true if the field might contain an IPv4 or IPv6 address. // XXX This should probably be a preference. static bool is_addr_field(const char *abbrev) { if (strstr(abbrev, ".srcip")) { // ct.srcip return true; } else if (strstr(abbrev, ".client.ip")) { // okta.client.ip return true; } return false; } static gboolean is_filter_valid(packet_info *pinfo, void *cfi_ptr) { conv_filter_info *cfi = (conv_filter_info *)cfi_ptr; if (!cfi->is_present) { return FALSE; } int proto_id = proto_registrar_get_parent(cfi->field_info->hfinfo.id); if (proto_id < 0) { return false; } return proto_is_frame_protocol(pinfo->layers, proto_registrar_get_nth(proto_id)->abbrev); } static gchar* build_filter(packet_info *pinfo _U_, void *cfi_ptr) { conv_filter_info *cfi = (conv_filter_info *)cfi_ptr; if (!cfi->is_present) { return FALSE; } return ws_strdup_printf("%s eq %s", cfi->field_info->hfinfo.abbrev, cfi->strbuf->str); } void configure_plugin(bridge_info* bi, char* config _U_) { /* * Initialize the plugin */ bi->source_id = get_sinsp_source_id(bi->ssi); size_t tot_fields = get_sinsp_source_nfields(bi->ssi); bi->visible_fields = 0; uint32_t addr_fields = 0; sinsp_field_info_t sfi; bi->num_conversation_filters = 0; for (size_t j = 0; j < tot_fields; j++) { get_sinsp_source_field_info(bi->ssi, j, &sfi); if (sfi.is_hidden) { /* * Skip the fields that are marked as hidden. * XXX Should we keep them and call proto_item_set_hidden? */ continue; } if (sfi.type == SFT_STRINGZ && is_addr_field(sfi.abbrev)) { addr_fields++; } bi->visible_fields++; if (sfi.is_conversation) { bi->num_conversation_filters++; } } if (bi->visible_fields) { bi->hf = (hf_register_info*)wmem_alloc(wmem_epan_scope(), bi->visible_fields * sizeof(hf_register_info)); bi->hf_ids = (int*)wmem_alloc(wmem_epan_scope(), bi->visible_fields * sizeof(int)); bi->field_ids = (int*)wmem_alloc(wmem_epan_scope(), bi->visible_fields * sizeof(int)); bi->field_flags = (guint32*)wmem_alloc(wmem_epan_scope(), bi->visible_fields * sizeof(guint32)); if (addr_fields) { bi->hf_id_to_addr_id = (int *)wmem_alloc(wmem_epan_scope(), bi->visible_fields * sizeof(int)); bi->hf_v4 = (hf_register_info*)wmem_alloc(wmem_epan_scope(), addr_fields * sizeof(hf_register_info)); bi->hf_v4_ids = (int*)wmem_alloc(wmem_epan_scope(), addr_fields * sizeof(int)); bi->hf_v6 = (hf_register_info*)wmem_alloc(wmem_epan_scope(), addr_fields * sizeof(hf_register_info)); bi->hf_v6_ids = (int*)wmem_alloc(wmem_epan_scope(), addr_fields * sizeof(int)); } if (bi->num_conversation_filters) { bi->conversation_filters = (conv_filter_info *)wmem_alloc(wmem_epan_scope(), bi->num_conversation_filters * sizeof (conv_filter_info)); } uint32_t fld_cnt = 0; size_t conv_fld_cnt = 0; uint32_t addr_fld_cnt = 0; for (size_t j = 0; j < tot_fields; j++) { bi->hf_ids[fld_cnt] = -1; bi->field_ids[fld_cnt] = (int) j; bi->field_flags[fld_cnt] = BFF_NONE; hf_register_info* ri = bi->hf + fld_cnt; get_sinsp_source_field_info(bi->ssi, j, &sfi); if (sfi.is_hidden) { /* * Skip the fields that are marked as hidden */ continue; } enum ftenum ftype; int fdisplay = BASE_NONE; switch (sfi.type) { case SFT_STRINGZ: ftype = FT_STRINGZ; break; case SFT_UINT64: ftype = FT_UINT64; switch (sfi.display_format) { case SFDF_DECIMAL: fdisplay = BASE_DEC; break; case SFDF_HEXADECIMAL: fdisplay = BASE_HEX; break; case SFDF_OCTAL: fdisplay = BASE_OCT; break; default: THROW_FORMATTED(DissectorError, "error in plugin %s: display format %s is not supported", get_sinsp_source_name(bi->ssi), sfi.abbrev); } break; default: THROW_FORMATTED(DissectorError, "error in plugin %s: type of field %s is not supported", get_sinsp_source_name(bi->ssi), sfi.abbrev); } hf_register_info finfo = { bi->hf_ids + fld_cnt, { wmem_strdup(wmem_epan_scope(), sfi.display), wmem_strdup(wmem_epan_scope(), sfi.abbrev), ftype, fdisplay, NULL, 0x0, wmem_strdup(wmem_epan_scope(), sfi.description), HFILL } }; *ri = finfo; if (sfi.is_conversation) { bi->field_flags[fld_cnt] |= BFF_CONVERSATION; bi->conversation_filters[conv_fld_cnt].field_info = ri; bi->conversation_filters[conv_fld_cnt].strbuf = wmem_strbuf_new(wmem_epan_scope(), ""); const char *source_name = get_sinsp_source_name(bi->ssi); const char *conv_filter_name = wmem_strdup_printf(wmem_epan_scope(), "%s %s", source_name, ri->hfinfo.name); register_log_conversation_filter(source_name, conv_filter_name, is_filter_valid, build_filter, &bi->conversation_filters[conv_fld_cnt]); if (conv_fld_cnt == 0) { add_conversation_filter_protocol(source_name); } conv_fld_cnt++; } if (sfi.is_info) { bi->field_flags[fld_cnt] |= BFF_INFO; } if (sfi.type == SFT_STRINGZ && is_addr_field(sfi.abbrev)) { bi->hf_id_to_addr_id[fld_cnt] = addr_fld_cnt; bi->hf_v4_ids[addr_fld_cnt] = -1; hf_register_info* ri_v4 = bi->hf_v4 + addr_fld_cnt; hf_register_info finfo_v4 = { bi->hf_v4_ids + addr_fld_cnt, { wmem_strdup_printf(wmem_epan_scope(), "%s (IPv4)", sfi.display), wmem_strdup_printf(wmem_epan_scope(), "%s.v4", sfi.abbrev), FT_IPv4, BASE_NONE, NULL, 0x0, wmem_strdup_printf(wmem_epan_scope(), "%s (IPv4)", sfi.description), HFILL } }; *ri_v4 = finfo_v4; bi->hf_v6_ids[addr_fld_cnt] = -1; hf_register_info* ri_v6 = bi->hf_v6 + addr_fld_cnt; hf_register_info finfo_v6 = { bi->hf_v6_ids + addr_fld_cnt, { wmem_strdup_printf(wmem_epan_scope(), "%s (IPv6)", sfi.display), wmem_strdup_printf(wmem_epan_scope(), "%s.v6", sfi.abbrev), FT_IPv4, BASE_NONE, NULL, 0x0, wmem_strdup_printf(wmem_epan_scope(), "%s (IPv6)", sfi.description), HFILL } }; *ri_v6 = finfo_v6; addr_fld_cnt++; } else if (bi->hf_id_to_addr_id) { bi->hf_id_to_addr_id[fld_cnt] = -1; } fld_cnt++; } proto_register_field_array(proto_falco_bridge, bi->hf, fld_cnt); if (addr_fld_cnt) { proto_register_field_array(proto_falco_bridge, bi->hf_v4, addr_fld_cnt); proto_register_field_array(proto_falco_bridge, bi->hf_v6, addr_fld_cnt); } } } void import_plugin(char* fname) { nbridges++; bridge_info* bi = &bridges[nbridges - 1]; char *err_str = create_sinsp_source(sinsp_span, fname, &(bi->ssi)); if (err_str) { nbridges--; report_failure("Unable to load sinsp plugin %s: %s.", fname, err_str); g_free(err_str); return; } configure_plugin(bi, ""); const char *source_name = get_sinsp_source_name(bi->ssi); const char *plugin_name = g_strdup_printf("%s Plugin", source_name); bi->proto = proto_register_protocol ( plugin_name, /* full name */ source_name, /* short name */ source_name /* filter_name */ ); static dissector_handle_t ct_handle; ct_handle = create_dissector_handle(dissect_sinsp_span, bi->proto); dissector_add_uint("falcobridge.id", bi->source_id, ct_handle); } static void on_wireshark_exit(void) { // XXX This currently crashes in a sinsp thread. // destroy_sinsp_span(sinsp_span); sinsp_span = NULL; } void proto_register_falcoplugin(void) { proto_falco_bridge = proto_register_protocol ( "Falco Bridge", /* name */ "Falco Bridge", /* short name */ "falcobridge" /* abbrev */ ); register_dissector("falcobridge", dissect_falco_bridge, proto_falco_bridge); /* * Create the dissector table that we will use to route the dissection to * the appropriate Falco plugin. */ ptype_dissector_table = register_dissector_table("falcobridge.id", "Falco Bridge Plugin ID", proto_falco_bridge, FT_UINT32, BASE_DEC); /* * Load the plugins */ WS_DIR *dir; WS_DIRENT *file; char *filename; char *spdname = g_build_filename(get_plugins_dir_with_version(), "falco", NULL); char *ppdname = g_build_filename(get_plugins_pers_dir_with_version(), "falco", NULL); /* * We scan the plugins directory twice. The first time we count how many * plugins we have, which we need to know in order to allocate the right * amount of memory. The second time we actually load and configure * each plugin. */ if ((dir = ws_dir_open(spdname, 0, NULL)) != NULL) { while ((ws_dir_read_name(dir)) != NULL) { nbridges++; } ws_dir_close(dir); } if ((dir = ws_dir_open(ppdname, 0, NULL)) != NULL) { while ((ws_dir_read_name(dir)) != NULL) { nbridges++; } ws_dir_close(dir); } sinsp_span = create_sinsp_span(); bridges = g_new0(bridge_info, nbridges); nbridges = 0; if ((dir = ws_dir_open(spdname, 0, NULL)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) { filename = g_build_filename(spdname, ws_dir_get_name(file), NULL); import_plugin(filename); g_free(filename); } ws_dir_close(dir); } if ((dir = ws_dir_open(ppdname, 0, NULL)) != NULL) { while ((file = ws_dir_read_name(dir)) != NULL) { filename = g_build_filename(ppdname, ws_dir_get_name(file), NULL); import_plugin(filename); g_free(filename); } ws_dir_close(dir); } g_free(spdname); g_free(ppdname); /* * Setup protocol subtree array */ static gint *ett[] = { &ett_falco_bridge, &ett_sinsp_span, &ett_address, }; proto_register_field_array(proto_falco_bridge, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); register_shutdown_routine(on_wireshark_exit); } static bridge_info* get_bridge_info(guint32 source_id) { for(guint j = 0; j < nbridges; j++) { if(bridges[j].source_id == source_id) { return &bridges[j]; } } return NULL; } static int dissect_falco_bridge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "Falco Bridge"); /* Clear out stuff in the info column */ col_clear(pinfo->cinfo,COL_INFO); // https://github.com/falcosecurity/libs/blob/9c942f27/userspace/libscap/scap.c#L1900 proto_item *ti = proto_tree_add_item(tree, proto_falco_bridge, tvb, 0, 12, ENC_NA); proto_tree *fb_tree = proto_item_add_subtree(ti, ett_falco_bridge); proto_tree_add_item(fb_tree, hf_sdp_source_id_size, tvb, 0, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(fb_tree, hf_sdp_lengths, tvb, 4, 4, ENC_LITTLE_ENDIAN); proto_item *idti = proto_tree_add_item(fb_tree, hf_sdp_source_id, tvb, 8, 4, ENC_LITTLE_ENDIAN); guint32 source_id = tvb_get_guint32(tvb, 8, ENC_LITTLE_ENDIAN); bridge_info* bi = get_bridge_info(source_id); col_add_fstr(pinfo->cinfo, COL_INFO, "Plugin ID: %u", source_id); if (bi == NULL) { proto_item_append_text(idti, " (NOT SUPPORTED)"); col_append_str(pinfo->cinfo, COL_INFO, " (NOT SUPPORTED)"); return tvb_captured_length(tvb); } const char *source_name = get_sinsp_source_name(bi->ssi); proto_item_append_text(idti, " (%s)", source_name); col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", source_name); dissector_handle_t dissector = dissector_get_uint_handle(ptype_dissector_table, source_id); if (dissector) { tvbuff_t* next_tvb = tvb_new_subset_length(tvb, 12, tvb_captured_length(tvb) - 12); call_dissector_with_data(dissector, next_tvb, pinfo, tree, bi); } return tvb_captured_length(tvb); } static int dissect_sinsp_span(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* bi_ptr) { bridge_info* bi = (bridge_info *) bi_ptr; guint plen = tvb_captured_length(tvb); const char *source_name = get_sinsp_source_name(bi->ssi); col_set_str(pinfo->cinfo, COL_PROTOCOL, source_name); /* Clear out stuff in the info column */ col_clear(pinfo->cinfo, COL_INFO); proto_item* ti = proto_tree_add_item(tree, bi->proto, tvb, 0, plen, ENC_NA); proto_tree* fb_tree = proto_item_add_subtree(ti, ett_sinsp_span); guint8* payload = (guint8*)tvb_get_ptr(tvb, 0, plen); sinsp_field_extract_t *sinsp_fields = (sinsp_field_extract_t*) wmem_alloc(pinfo->pool, sizeof(sinsp_field_extract_t) * bi->visible_fields); for (uint32_t fld_idx = 0; fld_idx < bi->visible_fields; fld_idx++) { header_field_info* hfinfo = &(bi->hf[fld_idx].hfinfo); sinsp_field_extract_t *sfe = &sinsp_fields[fld_idx]; sfe->field_id = bi->field_ids[fld_idx]; sfe->field_name = hfinfo->abbrev; sfe->type = hfinfo->type == FT_STRINGZ ? SFT_STRINGZ : SFT_UINT64; } // If we have a failure, try to dissect what we can first, then bail out with an error. bool rc = extract_sisnp_source_fields(bi->ssi, payload, plen, pinfo->pool, sinsp_fields, bi->visible_fields); if (!rc) { REPORT_DISSECTOR_BUG("Falco plugin %s extract error: %s", get_sinsp_source_name(bi->ssi), get_sinsp_source_last_error(bi->ssi)); } for (uint32_t idx = 0; idx < bi->num_conversation_filters; idx++) { bi->conversation_filters[idx].is_present = false; wmem_strbuf_truncate(bi->conversation_filters[idx].strbuf, 0); } conversation_element_t *first_conv_els = NULL; // hfid + field val + CONVERSATION_LOG for (uint32_t fld_idx = 0; fld_idx < bi->visible_fields; fld_idx++) { sinsp_field_extract_t *sfe = &sinsp_fields[fld_idx]; header_field_info* hfinfo = &(bi->hf[fld_idx].hfinfo); if (!sfe->is_present) { continue; } conv_filter_info *cur_conv_filter = NULL; conversation_element_t *cur_conv_els = NULL; if ((bi->field_flags[fld_idx] & BFF_CONVERSATION) != 0) { for (uint32_t cf_idx = 0; cf_idx < bi->num_conversation_filters; cf_idx++) { if (&(bi->conversation_filters[cf_idx].field_info)->hfinfo == hfinfo) { cur_conv_filter = &bi->conversation_filters[cf_idx]; if (!first_conv_els) { first_conv_els = wmem_alloc0(pinfo->pool, sizeof(conversation_element_t) * 3); first_conv_els[0].type = CE_INT; first_conv_els[0].int_val = hfinfo->id; cur_conv_els = first_conv_els; } break; } } } if (sfe->type == SFT_STRINGZ && hfinfo->type == FT_STRINGZ) { proto_item *pi = proto_tree_add_string(fb_tree, bi->hf_ids[fld_idx], tvb, 0, plen, sfe->res_str); if (bi->field_flags[fld_idx] & BFF_INFO) { col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "%s", sfe->res_str); // Mark it hidden, otherwise we end up with a bunch of empty "Info" tree items. proto_item_set_hidden(pi); } int addr_fld_idx = bi->hf_id_to_addr_id[fld_idx]; if (addr_fld_idx >= 0) { ws_in4_addr v4_addr; ws_in6_addr v6_addr; proto_tree *addr_tree; proto_item *addr_item = NULL; if (ws_inet_pton4(sfe->res_str, &v4_addr)) { addr_tree = proto_item_add_subtree(pi, ett_address); addr_item = proto_tree_add_ipv4(addr_tree, bi->hf_v4_ids[addr_fld_idx], tvb, 0, 0, v4_addr); set_address(&pinfo->net_src, AT_IPv4, sizeof(ws_in4_addr), &v4_addr); } else if (ws_inet_pton6(sfe->res_str, &v6_addr)) { addr_tree = proto_item_add_subtree(pi, ett_address); addr_item = proto_tree_add_ipv6(addr_tree, bi->hf_v6_ids[addr_fld_idx], tvb, 0, 0, &v6_addr); set_address(&pinfo->net_src, AT_IPv6, sizeof(ws_in6_addr), &v6_addr); } if (addr_item) { proto_item_set_generated(addr_item); } if (cur_conv_filter) { wmem_strbuf_append(cur_conv_filter->strbuf, sfe->res_str); cur_conv_filter->is_present = true; } if (cur_conv_els) { cur_conv_els[1].type = CE_ADDRESS; copy_address(&cur_conv_els[1].addr_val, &pinfo->net_src); } } else { if (cur_conv_filter) { wmem_strbuf_append_printf(cur_conv_filter->strbuf, "\"%s\"", sfe->res_str); cur_conv_filter->is_present = true; } if (cur_conv_els) { cur_conv_els[1].type = CE_STRING; cur_conv_els[1].str_val = wmem_strdup(pinfo->pool, sfe->res_str); } } } else if (sfe->type == SFT_UINT64 && hfinfo->type == FT_UINT64) { proto_tree_add_uint64(fb_tree, bi->hf_ids[fld_idx], tvb, 0, plen, sfe->res_u64); if (cur_conv_filter) { switch (hfinfo->display) { case BASE_HEX: wmem_strbuf_append_printf(cur_conv_filter->strbuf, "%" PRIx64, sfe->res_u64); break; case BASE_OCT: wmem_strbuf_append_printf(cur_conv_filter->strbuf, "%" PRIo64, sfe->res_u64); break; default: wmem_strbuf_append_printf(cur_conv_filter->strbuf, "%" PRId64, sfe->res_u64); } cur_conv_filter->is_present = true; } if (cur_conv_els) { cur_conv_els[1].type = CE_UINT64; cur_conv_els[1].uint64_val = sfe->res_u64; } } else { REPORT_DISSECTOR_BUG("Field %s has an unrecognized or mismatched type %u != %u", hfinfo->abbrev, sfe->type, hfinfo->type); } } if (!rc) { REPORT_DISSECTOR_BUG("Falco plugin %s extract error", get_sinsp_source_name(bi->ssi)); } if (first_conv_els) { first_conv_els[2].type = CE_CONVERSATION_TYPE; first_conv_els[2].conversation_type_val = CONVERSATION_LOG; pinfo->conv_elements = first_conv_els; // conversation_t *conv = find_or_create_conversation(pinfo); // if (!conv) { // conversation_new_full(pinfo->fd->num, pinfo->conv_elements); // } } return plen; } void proto_reg_handoff_sdplugin(void) { }
Markdown
wireshark/plugins/epan/falco_bridge/README.md
# Falco Bridge This plugin is a bridge between [Falco plugins](https://github.com/falcosecurity/plugins/) and Wireshark, so that Falco plugins can be used as dissectors. It requires [libsinsp and libscap](https://github.com/falcosecurity/libs/). ## Building the Falco Bridge plugin 1. Download and compile [libsinsp and libscap](https://github.com/falcosecurity/libs/). You will probably want to pass `-DMINIMAL_BUILD=ON -DCREATE_TEST_TARGETS=OFF` to cmake. 1. Configure Wireshark with ``` cmake \ -DSINSP_INCLUDEDIR=/path/to/falcosecurity-libs \ -DSINSP_LIBDIR=/path/to/falcosecurity-libs/ \ -DFALCO_PLUGINS="/path/to/plugin1;/path/to/plugin2;/path/to/plugin3" \ [other cmake args] ``` ## Quick Start 1. Create a directory named "falco" at the same level as the "epan" plugin folder. You can find the global and per-user plugin folder locations on your system in About → Folders or in the [User's Guide](https://www.wireshark.org/docs/wsug_html_chunked/ChPluginFolders.html). 1. Build your desired [Falco plugin](https://github.com/falcosecurity/plugins/) and place it in the "falco" plugin directory. ## Conversations Falco plugins can mark individual fields with a conversation flag (EPF_CONVERSATION). The Falco Bridge dissector treats each of these as separate conversations, and for features such as navigation and packet list marking, the _first_ conversation field is used for matching packets. ## Licensing libsinsp and libscap are released under the Apache 2.0 license. They depend on the following libraries: - b64: MIT - c-ares: MIT - curl: MIT - GRPC: Apache 2.0 - jq: MIT - JsonCpp: MIT - LuaJIT: MIT - OpenSSL < 3.0: SSLeay - OpenSSL >= 3.0 : Apache 2.0 - Protobuf: BSD-3-Clause - oneTBB: Apache 2.0 - zlib: zlib Wireshark is released under the GPL version 2 (GPL-2.0-or-later). It and the Apache-2.0 license are compatible via the "any later version" provision in the GPL version 2. As discussed at https://www.wireshark.org/lists/wireshark-dev/202203/msg00020.html, combining Wireshark and libsinsp+libscap should be OK, but that in effect invokes the GPLv2's "any later version" provision, making the Wireshark portion of the combined work GPLv3+. Debian would appear to concur: https://lists.debian.org/debian-legal/2014/08/msg00102.html. No version of the GPL is compatible with the SSLeay license; you must ensure that libsinsp+libscap is linked with OpenSSL 3.0 or later.
C++
wireshark/plugins/epan/falco_bridge/sinsp-span.cpp
/* sinsp-span.cpp * * By Gerald Combs * Copyright (C) 2022 Sysdig, Inc. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <stddef.h> #include <stdint.h> #include <glib.h> #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4100) #pragma warning(disable:4267) #endif // epan/address.h and driver/ppm_events_public.h both define PT_NONE, so // handle libsinsp calls here. typedef struct hf_register_info hf_register_info; typedef struct ss_plugin_info ss_plugin_info; #include "sinsp-span.h" #include <sinsp.h> typedef struct sinsp_source_info_t { sinsp_plugin *source; sinsp_evt *evt; uint8_t *evt_storage; size_t evt_storage_size; const char *name; const char *description; char *last_error; const char *fields; } sinsp_source_info_t; typedef struct sinsp_span_t { sinsp inspector; } sinsp_span_t; sinsp_span_t *create_sinsp_span() { return new(sinsp_span_t); } void destroy_sinsp_span(sinsp_span_t *sinsp_span) { delete(sinsp_span); } /* * Populate a source_plugin_info struct with the symbols coming from a library loaded via libsinsp */ char * create_sinsp_source(sinsp_span_t *sinsp_span, const char* libname, sinsp_source_info_t **ssi_ptr) { char *err_str = NULL; sinsp_source_info_t *ssi = new sinsp_source_info_t(); try { auto sp = sinsp_span->inspector.register_plugin(libname); if (sp->caps() & CAP_EXTRACTION) { ssi->source = dynamic_cast<sinsp_plugin *>(sp.get()); } else { err_str = g_strdup_printf("%s has unsupported plugin capabilities 0x%02x", libname, sp->caps()); } } catch (const sinsp_exception& e) { err_str = g_strdup_printf("Caught sinsp exception %s", e.what()); } std::string init_err; if (!err_str) { if (!ssi->source->init("{}", init_err)) { err_str = g_strdup_printf("Unable to initialize %s: %s", libname, init_err.c_str()); } } if (err_str) { delete ssi; return err_str; } ssi->evt = new sinsp_evt(&sinsp_span->inspector); ssi->evt_storage_size = 4096; ssi->evt_storage = (uint8_t *) g_malloc(ssi->evt_storage_size); ssi->name = strdup(ssi->source->name().c_str()); ssi->description = strdup(ssi->source->description().c_str()); *ssi_ptr = ssi; return NULL; } uint32_t get_sinsp_source_id(sinsp_source_info_t *ssi) { return ssi->source->id(); } const char *get_sinsp_source_last_error(sinsp_source_info_t *ssi) { if (ssi->last_error) { free(ssi->last_error); } ssi->last_error = strdup(ssi->source->get_last_error().c_str()); return ssi->last_error; } const char *get_sinsp_source_name(sinsp_source_info_t *ssi) { return ssi->name; } const char *get_sinsp_source_description(sinsp_source_info_t *ssi) { return ssi->description; } size_t get_sinsp_source_nfields(sinsp_source_info_t *ssi) { return ssi->source->fields().size(); } bool get_sinsp_source_field_info(sinsp_source_info_t *ssi, size_t field_num, sinsp_field_info_t *field) { if (field_num >= ssi->source->fields().size()) { return false; } const filtercheck_field_info *ffi = &ssi->source->fields()[field_num]; switch (ffi->m_type) { case PT_CHARBUF: field->type = SFT_STRINGZ; break; case PT_UINT64: field->type = SFT_UINT64; break; default: field->type = SFT_UNKNOWN; } switch (ffi->m_print_format) { case PF_DEC: field->display_format = SFDF_DECIMAL; break; case PF_HEX: field->display_format = SFDF_HEXADECIMAL; break; case PF_OCT: field->display_format = SFDF_OCTAL; break; default: field->display_format = SFDF_UNKNOWN; } g_strlcpy(field->abbrev, ffi->m_name, sizeof(ffi->m_name)); g_strlcpy(field->display, ffi->m_display, sizeof(ffi->m_display)); g_strlcpy(field->description, ffi->m_description, sizeof(ffi->m_description)); field->is_hidden = ffi->m_flags & EPF_TABLE_ONLY; field->is_info = ffi->m_flags & EPF_INFO; field->is_conversation = ffi->m_flags & EPF_CONVERSATION; return true; } // The code below, falcosecurity/libs, and falcosecurity/plugins need to be in alignment. // The Makefile in /plugins defines FALCOSECURITY_LIBS_REVISION and uses that version of // plugin_info.h. We need to build against a compatible revision of /libs. bool extract_sisnp_source_fields(sinsp_source_info_t *ssi, uint8_t *evt_data, uint32_t evt_datalen, wmem_allocator_t *pool, sinsp_field_extract_t *sinsp_fields, uint32_t sinsp_field_len) { std::vector<ss_plugin_extract_field> fields; // PPME_PLUGINEVENT_E events have the following format: // | scap_evt header | uint32_t sizeof(id) = 4 | uint32_t evt_datalen | uint32_t id | uint8_t[] evt_data | uint32_t payload_hdr[3] = {4, evt_datalen, ssi->source->id()}; uint32_t tot_evt_len = (uint32_t)sizeof(scap_evt) + sizeof(payload_hdr) + evt_datalen; if (ssi->evt_storage_size < tot_evt_len) { while (ssi->evt_storage_size < tot_evt_len) { ssi->evt_storage_size *= 2; } ssi->evt_storage = (uint8_t *) g_realloc(ssi->evt_storage, ssi->evt_storage_size); } scap_evt *sevt = (scap_evt *) ssi->evt_storage; sevt->ts = -1; sevt->tid = -1; sevt->len = tot_evt_len; sevt->type = PPME_PLUGINEVENT_E; sevt->nparams = 2; // Plugin ID + evt_data memcpy(ssi->evt_storage + sizeof(scap_evt), payload_hdr, sizeof(payload_hdr)); memcpy(ssi->evt_storage + sizeof(scap_evt) + sizeof(payload_hdr), evt_data, evt_datalen); ssi->evt->init(ssi->evt_storage, 0); fields.resize(sinsp_field_len); // We must supply field_id, field, arg, and type. for (size_t i = 0; i < sinsp_field_len; i++) { fields.at(i).field_id = sinsp_fields[i].field_id; fields.at(i).field = sinsp_fields[i].field_name; if (sinsp_fields[i].type == SFT_STRINGZ) { fields.at(i).ftype = FTYPE_STRING; } else { fields.at(i).ftype = FTYPE_UINT64; } } bool status = true; if (!ssi->source->extract_fields(ssi->evt, sinsp_field_len, fields.data())) { status = false; } for (size_t i = 0; i < sinsp_field_len; i++) { sinsp_fields[i].is_present = fields.at(i).res_len > 0; if (sinsp_fields[i].is_present) { if (fields.at(i).ftype == PT_CHARBUF) { sinsp_fields[i].res_str = wmem_strdup(pool, *fields.at(i).res.str); } else if (fields.at(i).ftype == PT_UINT64) { sinsp_fields[i].res_u64 = *fields.at(i).res.u64; } else { status = false; } } } return status; } #ifdef _MSC_VER #pragma warning(pop) #endif
C/C++
wireshark/plugins/epan/falco_bridge/sinsp-span.h
/* sinsp-span.h * * By Gerald Combs * Copyright (C) 2022 Sysdig, Inc. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __SINSP_SPAN_H__ #define __SINSP_SPAN_H__ #include <stdint.h> #include <wsutil/wmem/wmem.h> #ifdef __cplusplus extern "C" { #endif // __cplusplus typedef struct sinsp_source_info_t sinsp_source_info_t; typedef struct sinsp_span_t sinsp_span_t; typedef enum sinsp_field_type_e { SFT_UNKNOWN, SFT_STRINGZ, SFT_UINT64, } sinsp_field_type_e; typedef enum sinsp_field_display_format_e { SFDF_UNKNOWN, SFDF_DECIMAL, SFDF_HEXADECIMAL, SFDF_OCTAL } sinsp_field_display_format_e; typedef struct sinsp_field_info_t { sinsp_field_type_e type; sinsp_field_display_format_e display_format; char abbrev[64]; // filter name char display[64]; // display name char description[1024]; bool is_hidden; bool is_conversation; bool is_info; } sinsp_field_info_t; typedef struct sinsp_field_extract_t { uint32_t field_id; // in const char *field_name; // in sinsp_field_type_e type; // in, out bool is_present; // out const char *res_str; // out uint64_t res_u64; // out } sinsp_field_extract_t; sinsp_span_t *create_sinsp_span(void); void destroy_sinsp_span(sinsp_span_t *sinsp_span); char *create_sinsp_source(sinsp_span_t *sinsp_span, const char* libname, sinsp_source_info_t **ssi_ptr); // Extractor plugin routines. // These roughly match common_plugin_info uint32_t get_sinsp_source_id(sinsp_source_info_t *ssi); const char *get_sinsp_source_last_error(sinsp_source_info_t *ssi); const char *get_sinsp_source_name(sinsp_source_info_t *ssi); const char* get_sinsp_source_description(sinsp_source_info_t *ssi); size_t get_sinsp_source_nfields(sinsp_source_info_t *ssi); bool get_sinsp_source_field_info(sinsp_source_info_t *ssi, size_t field_num, sinsp_field_info_t *field); bool extract_sisnp_source_fields(sinsp_source_info_t *ssi, uint8_t *evt_data, uint32_t evt_datalen, wmem_allocator_t *pool, sinsp_field_extract_t *sinsp_fields, uint32_t sinsp_field_len); #ifdef __cplusplus } #endif // __cplusplus #endif // __SINSP_SPAN_H__
wireshark/plugins/epan/gryphon/AUTHORS
Author : Steve Limkemann <[email protected]> Plugin conversion : Olivier Abad <[email protected]> Plugin conversion fixes and Gryphon Protocol additions: Mark Ciechanowski <[email protected]>
Text
wireshark/plugins/epan/gryphon/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(gryphon 0 0 4 0) set(DISSECTOR_SRC packet-gryphon.c ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ) add_wireshark_plugin_library(gryphon epan) target_link_libraries(gryphon epan) install_plugin(gryphon epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME gryphon SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C
wireshark/plugins/epan/gryphon/packet-gryphon.c
/* packet-gryphon.c * * Updated routines for Gryphon protocol packet dissection * By Mark C. <[email protected]> * Copyright (C) 2018 DG Technologies, Inc. (Dearborn Group, Inc.) USA * * Routines for Gryphon protocol packet disassembly * By Steve Limkemann <[email protected]> * Copyright 1998 Steve Limkemann * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later * * Specification: http://www.dgtech.com/product/gryphon/manual/html/GCprotocol/ * */ #include "config.h" #include <epan/packet.h> #include <epan/prefs.h> #include <epan/expert.h> #include <epan/proto_data.h> #include <epan/conversation.h> #include <epan/dissectors/packet-tcp.h> #include <wsutil/str_util.h> #include "packet-gryphon.h" /* * See * * https://www.dgtech.com/product/gryphon/manual/html/GCprotocol/ */ void proto_register_gryphon(void); void proto_reg_handoff_gryphon(void); static dissector_handle_t gryphon_handle; #define GRYPHON_TCP_PORT 7000 /* Not IANA registed */ static int proto_gryphon = -1; static int hf_gryphon_src = -1; static int hf_gryphon_srcchan = -1; static int hf_gryphon_srcchanclient = -1; static int hf_gryphon_dest = -1; static int hf_gryphon_destchan = -1; static int hf_gryphon_destchanclient = -1; static int hf_gryphon_type = -1; static int hf_gryphon_cmd = -1; static int hf_gryphon_cmd_context = -1; static int hf_gryphon_cmd_ioctl_context = -1; static int hf_gryphon_data = -1; static int hf_gryphon_data_length = -1; static int hf_gryphon_reserved = -1; static int hf_gryphon_padding = -1; static int hf_gryphon_ignored = -1; static int hf_gryphon_wait_flags = -1; static int hf_gryphon_wait_resp = -1; static int hf_gryphon_wait_prev_resp = -1; static int hf_gryphon_status = -1; static int hf_gryphon_response_in = -1; static int hf_gryphon_response_to = -1; static int hf_gryphon_response_time = -1; static int hf_gryphon_data_header_length = -1; static int hf_gryphon_data_header_length_bits = -1; static int hf_gryphon_data_data_length = -1; static int hf_gryphon_data_extra_data_length = -1; static int hf_gryphon_data_mode = -1; static int hf_gryphon_data_mode_transmitted = -1; static int hf_gryphon_data_mode_receive = -1; static int hf_gryphon_data_mode_local = -1; static int hf_gryphon_data_mode_remote = -1; static int hf_gryphon_data_mode_oneshot = -1; static int hf_gryphon_data_mode_combined = -1; static int hf_gryphon_data_mode_nomux = -1; static int hf_gryphon_data_mode_internal = -1; static int hf_gryphon_data_priority = -1; static int hf_gryphon_data_error_status = -1; static int hf_gryphon_data_time = -1; static int hf_gryphon_data_context = -1; static int hf_gryphon_data_header_data = -1; static int hf_gryphon_data_data = -1; static int hf_gryphon_data_extra_data = -1; static int hf_gryphon_data_padding = -1; static int hf_gryphon_event_id = -1; static int hf_gryphon_event_context = -1; static int hf_gryphon_event_time = -1; static int hf_gryphon_event_data = -1; static int hf_gryphon_event_padding = -1; static int hf_gryphon_misc_text = -1; static int hf_gryphon_misc_padding = -1; static int hf_gryphon_eventnum = -1; static int hf_gryphon_resp_time = -1; static int hf_gryphon_setfilt = -1; static int hf_gryphon_setfilt_length = -1; static int hf_gryphon_setfilt_discard_data = -1; static int hf_gryphon_setfilt_padding = -1; static int hf_gryphon_ioctl = -1; static int hf_gryphon_ioctl_nbytes = -1; static int hf_gryphon_ioctl_data = -1; static int hf_gryphon_addfilt_pass = -1; static int hf_gryphon_addfilt_active = -1; static int hf_gryphon_addfilt_blocks = -1; static int hf_gryphon_addfilt_handle = -1; static int hf_gryphon_modfilt = -1; static int hf_gryphon_modfilt_action = -1; static int hf_gryphon_filthan = -1; static int hf_gryphon_filthan_id = -1; static int hf_gryphon_filthan_padding = -1; static int hf_gryphon_dfiltmode = -1; static int hf_gryphon_filtmode = -1; static int hf_gryphon_event_name = -1; static int hf_gryphon_register_username = -1; static int hf_gryphon_register_password = -1; static int hf_gryphon_register_client_id = -1; static int hf_gryphon_register_privileges = -1; static int hf_gryphon_getspeeds_set_ioctl = -1; static int hf_gryphon_getspeeds_get_ioctl = -1; static int hf_gryphon_getspeeds_size = -1; static int hf_gryphon_getspeeds_preset = -1; static int hf_gryphon_getspeeds_data = -1; static int hf_gryphon_cmd_sort = -1; static int hf_gryphon_cmd_optimize = -1; static int hf_gryphon_config_device_name = -1; static int hf_gryphon_config_device_version = -1; static int hf_gryphon_config_device_serial_number = -1; static int hf_gryphon_config_num_channels = -1; static int hf_gryphon_config_name_version_ext = -1; static int hf_gryphon_config_driver_name = -1; static int hf_gryphon_config_driver_version = -1; static int hf_gryphon_config_device_security = -1; static int hf_gryphon_config_max_data_length = -1; static int hf_gryphon_config_min_data_length = -1; static int hf_gryphon_config_hardware_serial_number = -1; static int hf_gryphon_config_protocol_type = -1; static int hf_gryphon_config_channel_id = -1; static int hf_gryphon_config_card_slot_number = -1; static int hf_gryphon_config_max_extra_data = -1; static int hf_gryphon_config_min_extra_data = -1; static int hf_gryphon_sched_num_iterations = -1; static int hf_gryphon_sched_flags = -1; static int hf_gryphon_sched_flags_scheduler = -1; static int hf_gryphon_sched_sleep = -1; static int hf_gryphon_sched_transmit_count = -1; static int hf_gryphon_sched_transmit_period = -1; static int hf_gryphon_sched_transmit_flags = -1; static int hf_gryphon_sched_skip_transmit_period = -1; static int hf_gryphon_sched_skip_sleep = -1; static int hf_gryphon_sched_channel = -1; static int hf_gryphon_sched_channel0 = -1; static int hf_gryphon_sched_rep_id = -1; static int hf_gryphon_sched_rep_message_index = -1; static int hf_gryphon_blm_data_time = -1; static int hf_gryphon_blm_data_bus_load = -1; static int hf_gryphon_blm_data_current_bus_load = -1; static int hf_gryphon_blm_data_peak_bus_load = -1; static int hf_gryphon_blm_data_historic_peak_bus_load = -1; static int hf_gryphon_blm_stat_receive_frame_count = -1; static int hf_gryphon_blm_stat_transmit_frame_count = -1; static int hf_gryphon_blm_stat_receive_dropped_frame_count = -1; static int hf_gryphon_blm_stat_transmit_dropped_frame_count = -1; static int hf_gryphon_blm_stat_receive_error_count = -1; static int hf_gryphon_blm_stat_transmit_error_count = -1; static int hf_gryphon_addresp_flags = -1; static int hf_gryphon_addresp_flags_active = -1; static int hf_gryphon_addresp_blocks = -1; static int hf_gryphon_addresp_responses = -1; static int hf_gryphon_addresp_old_handle = -1; static int hf_gryphon_addresp_action = -1; static int hf_gryphon_addresp_action_period = -1; static int hf_gryphon_addresp_action_deact_on_event = -1; static int hf_gryphon_addresp_action_deact_after_period = -1; static int hf_gryphon_addresp_action_period_type = -1; static int hf_gryphon_addresp_handle = -1; static int hf_gryphon_ldf_list = -1; static int hf_gryphon_ldf_number = -1; static int hf_gryphon_ldf_nodenumber = -1; static int hf_gryphon_ldf_remaining = -1; static int hf_gryphon_ldf_name = -1; static int hf_gryphon_ldf_info_pv = -1; static int hf_gryphon_ldf_info_lv = -1; static int hf_gryphon_ldf_ui = -1; static int hf_gryphon_lin_nodename = -1; static int hf_gryphon_lin_data_length = -1; static int hf_gryphon_lin_slave_table_enable = -1; static int hf_gryphon_lin_slave_table_cs = -1; static int hf_gryphon_lin_slave_table_data = -1; static int hf_gryphon_lin_slave_table_datacs = -1; static int hf_gryphon_lin_masterevent = -1; static int hf_gryphon_lin_numdata = -1; static int hf_gryphon_lin_numextra = -1; static int hf_gryphon_ldf_description = -1; static int hf_gryphon_ldf_size = -1; static int hf_gryphon_ldf_exists = -1; static int hf_gryphon_ldf_blockn = -1; static int hf_gryphon_ldf_file = -1; static int hf_gryphon_ldf_desc_pad = -1; static int hf_gryphon_ldf_restore_session = -1; static int hf_gryphon_ldf_schedule_name = -1; static int hf_gryphon_ldf_schedule_msg_dbytes = -1; static int hf_gryphon_ldf_schedule_flags = -1; static int hf_gryphon_ldf_schedule_event = -1; static int hf_gryphon_ldf_schedule_sporadic = -1; static int hf_gryphon_ldf_ioctl_setflags = -1; static int hf_gryphon_ldf_numb_ids = -1; static int hf_gryphon_ldf_bitrate = -1; static int hf_gryphon_ldf_ioctl_setflags_flags = -1; static int hf_gryphon_ldf_sched_size_place = -1; static int hf_gryphon_ldf_sched_numb_place = -1; static int hf_gryphon_ldf_sched_size = -1; static int hf_gryphon_ldf_num_node_names = -1; static int hf_gryphon_ldf_num_frames = -1; static int hf_gryphon_ldf_num_signal_names = -1; static int hf_gryphon_ldf_num_schedules = -1; static int hf_gryphon_ldf_num_encodings = -1; static int hf_gryphon_ldf_encoding_value = -1; static int hf_gryphon_ldf_encoding_min = -1; static int hf_gryphon_ldf_encoding_max = -1; static int hf_gryphon_ldf_master_node_name = -1; static int hf_gryphon_ldf_slave_node_name = -1; static int hf_gryphon_ldf_node_name = -1; static int hf_gryphon_ldf_signal_name = -1; static int hf_gryphon_ldf_signal_encoding_name = -1; static int hf_gryphon_ldf_signal_encoding_type = -1; static int hf_gryphon_ldf_signal_encoding_logical = -1; static int hf_gryphon_ldf_signal_offset = -1; static int hf_gryphon_ldf_signal_length = -1; static int hf_gryphon_ldf_get_frame = -1; static int hf_gryphon_ldf_get_frame_num = -1; static int hf_gryphon_ldf_get_frame_pub = -1; static int hf_gryphon_ldf_get_frame_num_signals = -1; static int hf_gryphon_cnvt_valuef = -1; static int hf_gryphon_cnvt_valuei = -1; static int hf_gryphon_cnvt_values = -1; static int hf_gryphon_cnvt_units = -1; static int hf_gryphon_cnvt_flags_getvalues = -1; static int hf_gryphon_dd_stream = -1; static int hf_gryphon_dd_value = -1; static int hf_gryphon_dd_time = -1; static int hf_gryphon_modresp_handle = -1; static int hf_gryphon_modresp_action = -1; static int hf_gryphon_num_resphan = -1; static int hf_gryphon_handle = -1; static int hf_gryphon_transmit_sched_id = -1; static int hf_gryphon_desc_program_size = -1; static int hf_gryphon_desc_program_name = -1; static int hf_gryphon_desc_program_description = -1; static int hf_gryphon_desc_flags = -1; static int hf_gryphon_desc_flags_program = -1; static int hf_gryphon_desc_handle = -1; static int hf_gryphon_upload_block_number = -1; static int hf_gryphon_upload_handle = -1; static int hf_gryphon_upload_data = -1; static int hf_gryphon_delete = -1; static int hf_gryphon_list_block_number = -1; static int hf_gryphon_list_num_programs = -1; static int hf_gryphon_list_num_remain_programs = -1; static int hf_gryphon_list_name = -1; static int hf_gryphon_list_description = -1; static int hf_gryphon_start_arguments = -1; static int hf_gryphon_start_channel = -1; static int hf_gryphon_status_num_running_copies = -1; static int hf_gryphon_options_handle = -1; static int hf_gryphon_files = -1; static int hf_gryphon_usdt_flags_register = -1; static int hf_gryphon_usdt_action_flags = -1; static int hf_gryphon_usdt_action_flags_non_legacy = -1; static int hf_gryphon_usdt_action_flags_register = -1; static int hf_gryphon_usdt_action_flags_action = -1; static int hf_gryphon_usdt_transmit_options_flags = -1; static int hf_gryphon_usdt_transmit_options_flags_echo = -1; static int hf_gryphon_usdt_transmit_options_done_event = -1; static int hf_gryphon_usdt_transmit_options_echo_short = -1; static int hf_gryphon_usdt_transmit_options_rx_nth_fc = -1; static int hf_gryphon_usdt_transmit_options_action = -1; static int hf_gryphon_usdt_transmit_options_send_done = -1; static int hf_gryphon_usdt_receive_options_flags = -1; static int hf_gryphon_usdt_receive_options_action = -1; static int hf_gryphon_usdt_receive_options_firstframe_event = -1; static int hf_gryphon_usdt_receive_options_lastframe_event = -1; static int hf_gryphon_usdt_receive_options_tx_nth_fc = -1; static int hf_gryphon_usdt_length_options_flags = -1; static int hf_gryphon_usdt_length_control_j1939 = -1; static int hf_gryphon_usdt_stmin_fc = -1; static int hf_gryphon_usdt_bsmax_fc = -1; static int hf_gryphon_usdt_stmin_override = -1; static int hf_gryphon_usdt_stmin_override_active = -1; static int hf_gryphon_usdt_stmin_override_activate = -1; static int hf_gryphon_usdt_set_stmin_mul = -1; static int hf_gryphon_usdt_receive_options_firstframe = -1; static int hf_gryphon_usdt_receive_options_lastframe = -1; static int hf_gryphon_usdt_ext_address = -1; static int hf_gryphon_usdt_ext_address_id = -1; static int hf_gryphon_usdt_block_size = -1; static int hf_gryphon_bits_in_input1 = -1; static int hf_gryphon_bits_in_input2 = -1; static int hf_gryphon_bits_in_input3 = -1; static int hf_gryphon_bits_in_pushbutton = -1; static int hf_gryphon_bits_out_output1 = -1; static int hf_gryphon_bits_out_output2 = -1; static int hf_gryphon_init_strat_reset_limit = -1; static int hf_gryphon_init_strat_delay = -1; static int hf_gryphon_speed_baud_rate_index = -1; static int hf_gryphon_filter_block_filter_start = -1; static int hf_gryphon_filter_block_filter_length = -1; static int hf_gryphon_filter_block_filter_type = -1; static int hf_gryphon_filter_block_filter_operator = -1; static int hf_gryphon_filter_block_filter_value1 = -1; static int hf_gryphon_filter_block_filter_value2 = -1; static int hf_gryphon_filter_block_filter_value4 = -1; static int hf_gryphon_filter_block_filter_value_bytes = -1; static int hf_gryphon_blm_mode = -1; static int hf_gryphon_blm_mode_avg_period = -1; static int hf_gryphon_blm_mode_avg_frames = -1; static int hf_gryphon_command = -1; static int hf_gryphon_cmd_mode = -1; static int hf_gryphon_option = -1; static int hf_gryphon_option_data = -1; static int hf_gryphon_cmd_file = -1; static int hf_gryphon_bit_in_digital_data = -1; static int hf_gryphon_bit_out_digital_data = -1; static int hf_gryphon_filter_block_pattern = -1; static int hf_gryphon_filter_block_mask = -1; static int hf_gryphon_usdt_request = -1; static int hf_gryphon_usdt_request_ext = -1; static int hf_gryphon_usdt_nids = -1; static int hf_gryphon_usdt_response = -1; static int hf_gryphon_usdt_response_ext = -1; static int hf_gryphon_uudt_response = -1; static int hf_gryphon_uudt_response_ext = -1; static int hf_gryphon_more_filenames = -1; static int hf_gryphon_filenames = -1; static int hf_gryphon_program_channel_number = -1; static int hf_gryphon_valid_header_length = -1; static gint ett_gryphon = -1; static gint ett_gryphon_header = -1; static gint ett_gryphon_body = -1; static gint ett_gryphon_command_data = -1; static gint ett_gryphon_response_data = -1; static gint ett_gryphon_data_header = -1; static gint ett_gryphon_flags = -1; static gint ett_gryphon_data_body = -1; static gint ett_gryphon_cmd_filter_block = -1; static gint ett_gryphon_cmd_events_data = -1; static gint ett_gryphon_cmd_config_device = -1; static gint ett_gryphon_cmd_sched_data = -1; static gint ett_gryphon_cmd_sched_cmd = -1; static gint ett_gryphon_cmd_response_block = -1; static gint ett_gryphon_pgm_list = -1; static gint ett_gryphon_pgm_status = -1; static gint ett_gryphon_pgm_options = -1; static gint ett_gryphon_valid_headers = -1; static gint ett_gryphon_usdt_data = -1; static gint ett_gryphon_usdt_action_flags = -1; static gint ett_gryphon_usdt_tx_options_flags = -1; static gint ett_gryphon_usdt_rx_options_flags = -1; static gint ett_gryphon_usdt_len_options_flags = -1; static gint ett_gryphon_usdt_data_block = -1; static gint ett_gryphon_lin_emulate_node = -1; static gint ett_gryphon_ldf_block = -1; static gint ett_gryphon_ldf_schedule_name = -1; static gint ett_gryphon_lin_schedule_msg = -1; static gint ett_gryphon_cnvt_getflags = -1; static gint ett_gryphon_digital_data = -1; static gint ett_gryphon_blm_mode = -1; static expert_field ei_gryphon_type = EI_INIT; /* desegmentation of Gryphon */ static gboolean gryphon_desegment = TRUE; /* * Length of the frame header. */ #define GRYPHON_FRAME_HEADER_LEN 8 static int dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_msgresp_add); static int cmd_ioctl(tvbuff_t*, packet_info*, int, proto_tree*, guint32 ui_command); static int cmd_ioctl_resp(tvbuff_t*, packet_info*, int, proto_tree*, guint32 ui_command); static const value_string action_vals[] = { { FR_RESP_AFTER_EVENT, "Send response(s) for each conforming message" }, { FR_RESP_AFTER_PERIOD, "Send response(s) after the specified period expires following a conforming message" }, { FR_IGNORE_DURING_PER, "Send response(s) for a conforming message and ignore further messages until the specified period expires" }, { 0, NULL } }; static const value_string deact_on_event_vals[] = { { FR_DEACT_ON_EVENT, "Deactivate this response for a conforming message" }, { FR_DELETE|FR_DEACT_ON_EVENT, "Delete this response for a conforming message" }, { 0, NULL } }; static const value_string deact_after_per_vals[] = { { FR_DEACT_AFTER_PER, "Deactivate this response after the specified period following a conforming message" }, { FR_DELETE|FR_DEACT_AFTER_PER, "Delete this response after the specified period following a conforming message" }, { 0, NULL } }; static const value_string cmd_optimize_type[] = { {0, "Optimize for throughput (Nagle algorithm enabled)"}, {1, "Optimize for latency (Nagle algorithm disabled)"}, {0, NULL} }; static const value_string usdt_action_vals[] = { { 0, "Use 11 bit headers only" }, { 1, "Use 29 bit headers only" }, { 2, "Use both 11 & 29 bit headers" }, { 3, "undefined" }, { 0, NULL } }; static const value_string xmit_opt_nth_fc_event[] = { { 0, "Do not send a USDT_RX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is received" }, { 1, "Send a USDT_RX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is received" }, { 0, NULL } }; static const value_string xmit_opt_echo_short[] = { { 0, "Do not Echo short transmitted messages back to the client (message less than 8 bytes)" }, { 1, "Echo short transmitted messages back to the client (message less than 8 bytes)" }, { 0, NULL } }; static const value_string xmit_opt_done[] = { { 0, "Do not send a USDT_DONE event when the last frame of a multi-frame message is transmitted" }, { 1, "Send a USDT_DONE event when the last frame of a multi-frame message is transmitted" }, { 0, NULL } }; static const value_string xmit_opt_vals[] = { { 0, "Pad messages with less than 8 data bytes with 0x00's" }, { 1, "Pad messages with less than 8 data bytes with 0xFF's" }, { 2, "Do not pad messages with less than 8 data bytes" }, { 3, "undefined" }, { 0, NULL } }; static const value_string xmit_opt_echo_long[] = { { 0, "Do not Echo long transmitted messages back to the client (message longer than 6 or 7 bytes)" }, { 1, "Echo long transmitted messages back to the client (message longer than 6 or 7 bytes)" }, { 0, NULL } }; static const value_string recv_opt_nth_fc_event[] = { { 0, "Do not send a USDT_TX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is sent" }, { 1, "Send a USDT_TX_NTH_FLOWCONTROL event when the 1st, 2nd, 3rd, etc. flow control message is sent" }, { 0, NULL } }; static const value_string recv_opt_lastframe_event[] = { { 0, "Do not send a USDT_LASTFRAME event when the last frame of a multi-frame message is received" }, { 1, "Send a USDT_LASTFRAME event when the last frame of a multi-frame message is received" }, { 0, NULL } }; static const value_string recv_opt_firstframe_event[] = { { 0, "Do not send a USDT_FIRSTFRAME event when the first frame of a multi-frame message is received" }, { 1, "Send a USDT_FIRSTFRAME event when the first frame of a multi-frame message is received" }, { 0, NULL } }; static const value_string recv_opt_j1939[] = { { 0, "Treat the length as a regular 4-byte size in calculating the multi-ID block range (not J1939-style)" }, { 1, "Use J1939-style length (the source and destination bytes are swapped in response (for 29-bit ID/headers only))" }, { 2, "undefined" }, { 0, NULL } }; static const value_string recv_opt_vals[] = { { 0, "Do not verify the integrity of long received messages and do not send them to the client" }, { 1, "Verify the integrity of long received messages and send them to the client" }, { 2, "Verify the integrity of long received messages but do not send them to the client" }, { 3, "undefined" }, { 0, NULL } }; static const value_string register_unregister [] = { { 0, "Unregister" }, { 1, "Register" }, { 0, NULL } }; static const value_string ldf_exists[] = { { 0, "Name is OK, does not already exist" }, { 1, "*** Warning ***: LDF file with same name already exists" }, { 0, NULL } }; static const value_string lin_slave_table_enable[] = { { 0, "Disabled" }, { 1, "Enabled" }, { 2, "One-shot enabled" }, { 0, NULL } }; static const value_string lin_slave_table_cs[] = { { 0, "Good" }, { 1, "Bad" }, { 0, NULL } }; static const value_string lin_ldf_ioctl_setflags[] = { {0, "Clear all flags first"}, {1, "Leave existing flags intact"}, {0, NULL} }; static const value_string lin_cnvt_getflags[] = { {1, "Float value"}, {2, "Int value"}, {3, "Float and Int value"}, {4, "String value"}, {5, "Float and String value"}, {6, "Int and String value"}, {7, "Float, Int, and String value"}, {0, NULL} }; static const value_string lin_ioctl_masterevent[] = { {0, "LIN driver will not send an event on master schedule start-of-cycle"}, {1, "LIN driver will send an event on master schedule start-of-cycle"}, {0, NULL} }; static const value_string blm_mode_vals[] = { { 0, "Off" }, { 1, "Average over time" }, { 2, "Average over frame count" }, { 0, NULL } }; static const value_string dmodes[] = { {DEFAULT_FILTER_BLOCK, "Block"}, {DEFAULT_FILTER_PASS, "Pass"}, {0, NULL}, }; static const value_string frame_type[] = { {0, ""}, {1, "Command request"}, {2, "Command response"}, {3, "Network (vehicle) data"}, {4, "Event"}, {5, "Miscellaneous"}, {6, "Text string"}, {7, "Signal (vehicle) network"}, {0, NULL} }; static const value_string src_dest[] = { {SD_CARD, "Card"}, {SD_SERVER, "Server"}, {SD_CLIENT, "Client"}, {SD_SCHED, "Scheduler"}, {SD_SCRIPT, "Script Processor"}, {SD_PGM, "Program Loader"}, {SD_USDT, "USDT Server"}, {SD_BLM, "Bus Load Monitoring"}, {SD_LIN, "LIN LDF Server"}, /* 20171031 mc */ {SD_FLIGHT, "Flight Recorder / Data Logger"}, {SD_RESP, "Message Responder"}, {SD_IOPWR, "I/O and power"}, {SD_UTIL, "Utility/Miscellaneous"}, {SD_CNVT, "Signal Conversion Utility"}, /* 20171031 mc */ {0, NULL} }; /* 20180305 use with BASE_SPECIAL_VALS */ static const value_string channel_or_broadcast[] = { {CH_BROADCAST, "Broadcast"}, {0, NULL} }; static const value_string cmd_vals[] = { { CMD_INIT, "Initialize" }, { CMD_GET_STAT, "Get status" }, { CMD_GET_CONFIG, "Get configuration" }, { CMD_EVENT_ENABLE, "Enable event" }, { CMD_EVENT_DISABLE, "Disable event" }, { CMD_GET_TIME, "Get time" }, { CMD_GET_RXDROP, "Get number of dropped RX messages" }, { CMD_RESET_RXDROP, "Clear number of dropped RX messages" }, { CMD_BCAST_ON, "Set broadcasts on" }, { CMD_BCAST_OFF, "Set broadcasts off" }, { CMD_SET_TIME, "Set time" }, { CMD_CARD_SET_SPEED, "Set channel baud rate" }, { CMD_CARD_GET_SPEED, "Get channel baud rate" }, { CMD_CARD_SET_FILTER, "Set filter (deprecated)" }, { CMD_CARD_GET_FILTER, "Get filter" }, { CMD_CARD_TX, "Transmit message" }, { CMD_CARD_TX_LOOP_ON, "Set transmit loopback on" }, { CMD_CARD_TX_LOOP_OFF, "Set transmit loopback off" }, { CMD_CARD_IOCTL, "IOCTL pass-through" }, { CMD_CARD_ADD_FILTER, "Add a filter" }, { CMD_CARD_MODIFY_FILTER, "Modify a filter" }, { CMD_CARD_GET_FILTER_HANDLES, "Get filter handles" }, { CMD_CARD_SET_DEFAULT_FILTER, "Set default filter" }, { CMD_CARD_GET_DEFAULT_FILTER, "Get default filter mode" }, { CMD_CARD_SET_FILTER_MODE, "Set filter mode" }, { CMD_CARD_GET_FILTER_MODE, "Get filter mode" }, { CMD_CARD_GET_EVNAMES, "Get event names" }, { CMD_CARD_GET_SPEEDS, "Get defined speeds" }, { CMD_SERVER_REG, "Register with server" }, { CMD_SERVER_SET_SORT, "Set the sorting behavior" }, { CMD_SERVER_SET_OPT, "Set the type of optimization" }, { CMD_PGM_START2, "Start an uploaded program" }, { CMD_SCHED_TX, "Schedule transmission of messages" }, { CMD_SCHED_KILL_TX, "Stop and destroy a message schedule transmission" }, { CMD_SCHED_MSG_REPLACE, "Replace a scheduled message" }, { CMD_PGM_DESC, "Describe program to be uploaded" }, { CMD_PGM_UPLOAD, "Upload a program to the Gryphon" }, { CMD_PGM_DELETE, "Delete an uploaded program" }, { CMD_PGM_LIST, "Get a list of uploaded programs" }, { CMD_PGM_START, "Start an uploaded program" }, { CMD_PGM_STOP, "Stop an uploaded program" }, { CMD_PGM_STATUS, "Get status of an uploaded program" }, { CMD_PGM_OPTIONS, "Set program upload options" }, { CMD_PGM_FILES, "Get a list of files & directories" }, { CMD_USDT_REGISTER, "Register/Unregister with USDT server (deprecated)" }, { CMD_USDT_SET_FUNCTIONAL, "Set IDs to use extended addressing (deprecated)" }, { CMD_USDT_SET_STMIN_MULT, "Set USDT STMIN multiplier" }, { CMD_USDT_SET_STMIN_FC, "Set USDT STMIN flow control (new command July 2017)" }, { CMD_USDT_GET_STMIN_FC, "Get USDT STMIN flow control (new command July 2017)" }, { CMD_USDT_SET_BSMAX_FC, "Set USDT BSMAX flow control (new command July 2017)" }, { CMD_USDT_GET_BSMAX_FC, "Get USDT BSMAX flow control (new command July 2017)" }, { CMD_USDT_REGISTER_NON_LEGACY, "Register/Unregister with USDT (ISO-15765) server, non-legacy (new command July 2017)" }, { CMD_USDT_SET_STMIN_OVERRIDE, "Set USDT STMIN override (new command July 2017)" }, { CMD_USDT_GET_STMIN_OVERRIDE, "Get USDT STMIN override (new command July 2017)" }, { CMD_USDT_ACTIVATE_STMIN_OVERRIDE, "Activate/deactivate USDT STMIN override (new command July 2017)" }, { CMD_BLM_SET_MODE, "Set Bus Load Monitoring mode" }, { CMD_BLM_GET_MODE, "Get Bus Load Monitoring mode" }, { CMD_BLM_GET_DATA, "Get Bus Load data" }, { CMD_BLM_GET_STATS, "Get Bus Load statistics" }, { CMD_GET_FRAMES, "Get frames defined in the LIN LDF file" }, { CMD_LDF_DESC, "Set Name and description of LIN LDF file" }, { CMD_LDF_UPLOAD, "Upload a LIN LDF file to the Gryphon" }, { CMD_LDF_LIST, "Get list of loaded LIN LDFs" }, { CMD_LDF_DELETE, "Delete LIN LDF" }, { CMD_LDF_PARSE, "Parse an uploaded LIN LDF file" }, { CMD_GET_LDF_INFO, "Get info of a parsed LDF file" }, { CMD_GET_NODE_NAMES, "Get names of nodes defined in the LIN LDF file" }, { CMD_EMULATE_NODES, "Emulate LIN nodes" }, { CMD_GET_FRAME_INFO, "Get info from a frame defined in the LIN LDF file" }, { CMD_GET_SIGNAL_INFO, "Get info from a signal defined in the LIN LDF file" }, { CMD_GET_SIGNAL_DETAIL, "Get details from a signal defined in the LIN LDF file" }, { CMD_GET_ENCODING_INFO, "Get details from an encoding name defined in the LIN LDF file" }, { CMD_GET_SCHEDULES, "Get schedules of the LIN LDF file" }, { CMD_START_SCHEDULE, "Start a LIN schedule from the LIN LDF file" }, { CMD_SAVE_SESSION, "Save an internal representation of the LIN LDF file" }, { CMD_RESTORE_SESSION, "Restore a previously saved LIN LDF session" }, { CMD_GET_NODE_SIGNALS, "Get signal names of the node defined in the LIN LDF file" }, { CMD_FLIGHT_GET_CONFIG, "Get flight recorder channel info" }, { CMD_FLIGHT_START_MON, "Start flight recorder monitoring" }, { CMD_FLIGHT_STOP_MON, "Stop flight recorder monitoring" }, { CMD_MSGRESP_ADD, "Add response message" }, { CMD_MSGRESP_GET, "Get response message" }, { CMD_MSGRESP_MODIFY, "Modify response message state" }, { CMD_MSGRESP_GET_HANDLES, "Get response message handles" }, { CMD_IOPWR_GETINP, "Read current digital inputs" }, { CMD_IOPWR_GETLATCH, "Read latched digital inputs" }, { CMD_IOPWR_CLRLATCH, "Read & clear latched digital inputs" }, { CMD_IOPWR_GETOUT, "Read digital outputs" }, { CMD_IOPWR_SETOUT, "Write digital outputs" }, { CMD_IOPWR_SETBIT, "Set indicated output bits" }, { CMD_IOPWR_CLRBIT, "Clear indicated output bits" }, { CMD_IOPWR_GETPOWER, "Read digital inputs at power on time" }, { CMD_UTIL_SET_INIT_STRATEGY, "Set initialization strategy" }, { CMD_UTIL_GET_INIT_STRATEGY, "Get initialization strategy" }, { CMD_CNVT_GET_VALUES, "Read one or more signal values from LIN Signal Conversion" }, { CMD_CNVT_GET_UNITS, "Read one or more signal units from LIN Signal Conversion" }, { CMD_CNVT_SET_VALUES, "Write one or more signal values for LIN Signal Conversion" }, { CMD_CNVT_DESTROY_SESSION, "Destroy internal LIN Signal Conversion info" }, { CMD_CNVT_SAVE_SESSION, "Save an internal representation of the LIN Signal Conversion" }, { CMD_CNVT_RESTORE_SESSION, "Restore a previously saved LIN Signal Conversion session" }, { CMD_CNVT_GET_NODE_SIGNALS, "Get signal names of the node defined in the LIN Signal Conversion Session" }, { 0, NULL}, }; static value_string_ext cmd_vals_ext = VALUE_STRING_EXT_INIT(cmd_vals); static const value_string responses_vs[] = { {RESP_OK, "OK - no error"}, {RESP_UNKNOWN_ERR, "Unknown error"}, {RESP_UNKNOWN_CMD, "Unrecognised command"}, {RESP_UNSUPPORTED, "Unsupported command"}, {RESP_INVAL_CHAN, "Invalid channel specified"}, {RESP_INVAL_DST, "Invalid destination"}, {RESP_INVAL_PARAM, "Invalid parameter(s)"}, {RESP_INVAL_MSG, "Invalid message"}, {RESP_INVAL_LEN, "Invalid length field"}, {RESP_TX_FAIL, "Transmit failed"}, {RESP_RX_FAIL, "Receive failed"}, {RESP_AUTH_FAIL, "Authorization failed"}, {RESP_MEM_ALLOC_ERR, "Memory allocation error"}, {RESP_TIMEOUT, "Command timed out"}, {RESP_UNAVAILABLE, "Unavailable"}, {RESP_BUF_FULL, "Buffer full"}, {RESP_NO_SUCH_JOB, "No such job"}, {0, NULL}, }; static const value_string filter_data_types[] = { {FILTER_DATA_TYPE_HEADER_FRAME, "frame header"}, {FILTER_DATA_TYPE_HEADER, "data message header"}, {FILTER_DATA_TYPE_DATA, "data message data"}, {FILTER_DATA_TYPE_EXTRA_DATA, "data message extra data"}, {FILTER_EVENT_TYPE_HEADER, "event message header"}, {FILTER_EVENT_TYPE_DATA, "event message"}, {0, NULL}, }; static const value_string operators[] = { {BIT_FIELD_CHECK, "Bit field check"}, {SVALUE_GT, "Greater than (signed)"}, {SVALUE_GE, "Greater than or equal to (signed)"}, {SVALUE_LT, "Less than (signed)"}, {SVALUE_LE, "Less than or equal to (signed)"}, {VALUE_EQ, "Equal to"}, {VALUE_NE, "Not equal to"}, {UVALUE_GT, "Greater than (unsigned)"}, {UVALUE_GE, "Greater than or equal to (unsigned)"}, {UVALUE_LT, "Less than (unsigned)"}, {UVALUE_LE, "Less than or equal to (unsigned)"}, {DIG_LOW_TO_HIGH, "Digital, low to high transition"}, {DIG_HIGH_TO_LOW, "Digital, high to low transition"}, {DIG_TRANSITION, "Digital, change of state"}, {0, NULL}, }; static const value_string modes[] = { {FILTER_OFF_PASS_ALL, "Filter off, pass all messages"}, {FILTER_OFF_BLOCK_ALL, "Filter off, block all messages"}, {FILTER_ON, "Filter on"}, {0, NULL}, }; static const value_string filtacts[] = { {DELETE_FILTER, "Delete"}, {ACTIVATE_FILTER, "Activate"}, {DEACTIVATE_FILTER, "Deactivate"}, {0, NULL}, }; static const value_string ioctls[] = { {GINIT, "GINIT: Initialize"}, {GLOOPON, "GLOOPON: Loop on"}, {GLOOPOFF, "GLOOPOFF: Loop off"}, {GGETHWTYPE, "GGETHWTYPE: Get hardware type"}, {GGETREG, "GGETREG: Get register"}, {GSETREG, "GSETREG: Set register"}, {GGETRXCOUNT, "GGETRXCOUNT: Get the receive message counter"}, {GSETRXCOUNT, "GSETRXCOUNT: Set the receive message counter"}, {GGETTXCOUNT, "GGETTXCOUNT: Get the transmit message counter"}, {GSETTXCOUNT, "GSETTXCOUNT: Set the transmit message counter"}, {GGETRXDROP, "GGETRXDROP: Get the number of dropped receive messages"}, {GSETRXDROP, "GSETRXDROP: Set the number of dropped receive messages"}, {GGETTXDROP, "GGETTXDROP: Get the number of dropped transmit messages"}, {GSETTXDROP, "GSETTXDROP: Set the number of dropped transmit messages"}, {GGETRXBAD, "GGETRXBAD: Get the number of bad receive messages"}, {GGETTXBAD, "GGETTXBAD: Get the number of bad transmit messages"}, {GGETCOUNTS, "GGETCOUNTS: Get total message counter"}, {GGETBLMON, "GGETBLMON: Get bus load monitoring status"}, {GSETBLMON, "GSETBLMON: Set bus load monitoring status (turn on/off)"}, {GGETERRLEV, "GGETERRLEV: Get error level"}, {GSETERRLEV, "GSETERRLEV: Set error level"}, {GGETBITRATE, "GGETBITRATE: Get bit rate"}, {GGETRAM, "GGETRAM: Read value from RAM"}, {GSETRAM, "GSETRAM: Write value to RAM"}, {GCANGETBTRS, "GCANGETBTRS: Read CAN bit timing registers"}, {GCANSETBTRS, "GCANSETBTRS: Write CAN bit timing registers"}, {GCANGETBC, "GCANGETBC: Read CAN bus configuration register"}, {GCANSETBC, "GCANSETBC: Write CAN bus configuration register"}, {GCANGETMODE, "GCANGETMODE"}, {GCANSETMODE, "GCANSETMODE"}, {GCANGETTRANS, "GCANGETTRANS"}, {GCANSETTRANS, "GCANSETTRANS"}, {GCANSENDERR, "GCANSENDERR"}, {GCANRGETOBJ, "GCANRGETOBJ"}, {GCANRSETSTDID, "GCANRSETSTDID"}, {GCANRSETEXTID, "GCANRSETEXTID"}, {GCANRSETDATA, "GCANRSETDATA"}, {GCANRENABLE, "GCANRENABLE"}, {GCANRDISABLE, "GCANRDISABLE"}, {GCANRGETMASKS, "GCANRGETMASKS"}, {GCANRSETMASKS, "GCANRSETMASKS"}, {GCANSWGETMODE, "GCANSWGETMODE"}, {GCANSWSETMODE, "GCANSWSETMODE"}, {GDLCGETFOURX, "GDLCGETFOURX"}, {GDLCSETFOURX, "GDLCSETFOURX"}, {GDLCGETLOAD, "GDLCGETLOAD"}, {GDLCSETLOAD, "GDLCSETLOAD"}, {GDLCSENDBREAK, "GDLCSENDBREAK"}, {GDLCABORTTX, "GDLCABORTTX"}, {GDLCGETHDRMODE, "DLCGETHDRMODE"}, {GDLCSETHDRMODE, "GDLCSETHDRMODE"}, {GHONSLEEP, "GHONSLEEP"}, {GHONSILENCE, "GHONSILENCE"}, {GKWPSETPTIMES, "GKWPSETPTIMES"}, {GKWPSETWTIMES, "GKWPSETWTIMES"}, {GKWPDOWAKEUP, "GKWPDOWAKEUP"}, {GKWPGETBITTIME, "GKWPGETBITTIME"}, {GKWPSETBITTIME, "GKWPSETBITTIME"}, {GKWPSETNODEADDR, "GKWPSETNODEADDR"}, {GKWPGETNODETYPE, "GKWPGETNODETYPE"}, {GKWPSETNODETYPE, "GKWPSETNODETYPE"}, {GKWPSETWAKETYPE, "GKWPSETWAKETYPE"}, {GKWPSETTARGADDR, "GKWPSETTARGADDR"}, {GKWPSETKEYBYTES, "GKWPSETKEYBYTES"}, {GKWPSETSTARTREQ, "GKWPSETSTARTREQ"}, {GKWPSETSTARTRESP, "GKWPSETSTARTRESP"}, {GKWPSETPROTOCOL, "GKWPSETPROTOCOL"}, {GKWPGETLASTKEYBYTES, "GKWPGETLASTKEYBYTES"}, {GKWPSETLASTKEYBYTES, "GKWPSETLASTKEYBYTES"}, {GSCPGETBBR, "GSCPGETBBR"}, {GSCPSETBBR, "GSCPSETBBR"}, {GSCPGETID, "GSCPGETID"}, {GSCPSETID, "GSCPSETID"}, {GSCPADDFUNCID, "GSCPADDFUNCID"}, {GSCPCLRFUNCID, "GSCPCLRFUNCID"}, {GUBPGETBITRATE, "GUBPGETBITRATE"}, {GUBPSETBITRATE, "GUBPSETBITRATE"}, {GUBPGETINTERBYTE, "GUBPGETINTERBYTE"}, {GUBPSETINTERBYTE, "GUBPSETINTERBYTE"}, {GUBPGETNACKMODE, "GUBPGETNACKMODE"}, {GUBPSETNACKMODE, "GUBPSETNACKMODE"}, {GUBPGETRETRYDELAY, "GUBPGETRETRYDELAY"}, {GUBPSETRETRYDELAY, "GUBPSETRETRYDELAY"}, {GRESETHC08, "GRESETHC08: Reset the HC08 processor"}, {GTESTHC08COP, "GTESTHC08COP: Stop updating the HC08 watchdog timer"}, {GSJAGETLISTEN, "GSJAGETLISTEN"}, {GSJASETLISTEN, "GSJASETLISTEN"}, {GSJAGETSELFTEST, "GSJAGETSELFTEST"}, {GSJASETSELFTEST, "GSJASETSELFTEST"}, {GSJAGETXMITONCE, "GSJAGETXMITONCE"}, {GSJASETXMITONCE, "GSJASETXMITONCE"}, {GSJAGETTRIGSTATE, "GSJAGETTRIGSTATE"}, {GSJASETTRIGCTRL, "GSJASETTRIGCTRL"}, {GSJAGETTRIGCTRL, "GSJAGETTRIGCTRL"}, {GSJAGETOUTSTATE, "GSJAGETOUTSTATE"}, {GSJASETOUTSTATE, "GSJASETOUTSTATE"}, {GSJAGETFILTER, "GSJAGETFILTER"}, {GSJASETFILTER, "GSJASETFILTER"}, {GSJAGETMASK, "GSJAGETMASK"}, {GSJASETMASK, "GSJASETMASK"}, {GSJAGETINTTERM, "GSJAGETINTTERM"}, {GSJASETINTTERM, "GSJASETINTTERM"}, {GSJAGETFTTRANS, "GSJAGETFTTRANS"}, {GSJASETFTTRANS, "GSJASETFTTRANS"}, {GSJAGETFTERROR, "GSJAGETFTERROR"}, {GLINGETBITRATE, "GLINGETBITRATE: Get the current bit rate"}, {GLINSETBITRATE, "GLINSETBITRATE: Set the bit rate"}, {GLINGETBRKSPACE, "GLINGETBRKSPACE"}, {GLINSETBRKSPACE, "GLINSETBRKSPACE"}, {GLINGETBRKMARK, "GLINGETBRKMARK"}, {GLINSETBRKMARK, "GLINSETBRKMARK"}, {GLINGETIDDELAY, "GLINGETIDDELAY"}, {GLINSETIDDELAY, "GLINSETIDDELAY"}, {GLINGETRESPDELAY, "GLINGETRESPDELAY"}, {GLINSETRESPDELAY, "GLINSETRESPDELAY"}, {GLINGETINTERBYTE, "GLINGETINTERBYTE"}, {GLINSETINTERBYTE, "GLINSETINTERBYTE"}, {GLINGETWAKEUPDELAY, "GLINGETWAKEUPDELAY"}, {GLINSETWAKEUPDELAY, "GLINSETWAKEUPDELAY"}, {GLINGETWAKEUPTIMEOUT, "GLINGETWAKEUPTIMEOUT"}, {GLINSETWAKEUPTIMEOUT, "GLINSETWAKEUPTIMEOUT"}, {GLINGETWUTIMOUT3BR, "GLINGETWUTIMOUT3BR"}, {GLINSETWUTIMOUT3BR, "GLINSETWUTIMOUT3BR"}, {GLINSENDWAKEUP, "GLINSENDWAKEUP"}, {GLINGETMODE, "GLINGETMODE"}, {GLINSETMODE, "GLINSETMODE"}, /* 20171109 lin LDF */ {GLINGETSLEW, "GLINGETSLEW: get slew rate"}, {GLINSETSLEW, "GLINSETSLEW: set slew rate"}, {GLINADDSCHED, "GLINADDSCHED: add a LIN schedule"}, {GLINGETSCHED, "GLINGETSCHED: get a LIN schedule"}, {GLINGETSCHEDSIZE, "GLINGETSCHEDSIZE: get schedule size"}, {GLINDELSCHED, "GLINDELSCHED: delete a LIN schedule"}, {GLINACTSCHED, "GLINACTSCHED: activate a LIN schedule"}, {GLINDEACTSCHED, "GLINDEACTSCHED: deactivate a LIN schedule"}, {GLINGETACTSCHED, "GLINGETACTSCHED: get active LIN schedule"}, {GLINGETNUMSCHEDS, "GLINGETNUMSCHED: get number of LIN schedules"}, {GLINGETSCHEDNAMES, "GLINGETSCHEDNAMES: get LIN schedule names"}, {GLINGETMASTEREVENTENABLE, "GLINGETMASTEREVENTENABLE: get LIN master schedule event enable flag"}, {GLINSETMASTEREVENTENABLE, "GLINSETMASTEREVENTENABLE: set LIN master schedule event enable flag"}, {GLINGETNSLAVETABLE, "GLINGETNSLAVETABLE: set number of LIN slave table entries"}, {GLINGETSLAVETABLEPIDS, "GLINGETSLAVETABLEPIDS: get list of LIN slave table PIDs"}, {GLINGETSLAVETABLE, "GLINGETSLAVETABLE: get LIN slave table entry for this PID"}, {GLINSETSLAVETABLE, "GLINSETSLAVETABLE: set LIN slave table entry for this PID"}, {GLINCLEARSLAVETABLE, "GLINCLEARSLAVETABLE: clear LIN slave table entry for this PID"}, {GLINCLEARALLSLAVETABLE, "GLINCLEARALLSLAVETABLE: clear all LIN slave table entries"}, {GLINGETONESHOT, "GLINGETONESHOT: get LIN one-shot entry"}, {GLINSETONESHOT, "GLINSETONESHOT: set LIN one-shot entry"}, {GLINCLEARONESHOT, "GLINCLEARONESHOT: clear LIN one-shot entry"}, {GLINSETFLAGS, "GLINSETFLAGS"}, {GLINGETAUTOCHECKSUM, "GLINGETAUTOCHECKSUM: get LIN auto checksum"}, {GLINSETAUTOCHECKSUM, "GLINSETAUTOCHECKSUM: set LIN auto checksum"}, {GLINGETAUTOPARITY, "GLINGETAUTOPARITY: get LIN auto parity"}, {GLINSETAUTOPARITY, "GLINSETAUTOPARITY: set LIN auto parity"}, {GLINGETSLAVETABLEENABLE, "GLINGETSLAVETABLEENABLE: get LIN slave table enable"}, {GLINSETSLAVETABLEENABLE, "GLINSETSLAVETABLEENABLE: set LIN slave table enable"}, {GLINGETFLAGS, "GLINGETFLAGS"}, {GLINGETWAKEUPMODE, "GLINGETWAKEUPMODE: get LIN wakeup mode"}, {GLINSETWAKEUPMODE, "GLINSETWAKEUPMODE: set LIN wakeup mode"}, {GDLYGETHIVALUE, "GDLYGETHIVALUE: get the high water value"}, {GDLYSETHIVALUE, "GDLYSETHIVALUE: set the high water value"}, {GDLYGETLOVALUE, "GDLYGETLOVALUE: get the low water value"}, {GDLYSETLOVALUE, "GDLYSETLOVALUE: set the low water value"}, {GDLYGETHITIME, "GDLYGETHITIME: get the high water time"}, {GDLYSETHITIME, "GDLYSETHITIME: set the high water time"}, {GDLYGETLOTIME, "GDLYGETLOTIME: get the low water time"}, {GDLYSETLOTIME, "GDLYSETLOTIME: set the low water time"}, {GDLYGETLOREPORT, "GDLYGETLOREPORT:get the low water report flag"}, {GDLYFLUSHSTREAM, "GDLYFLUSHSTREAM: flush the delay buffer"}, {GDLYINITSTREAM, "GDLYINITSTREAM: set default hi & lo water marks"}, {GDLYPARTIALFLUSHSTREAM, "GDLYPARTIALFLUSHSTREAM: flush the delay buffer"}, {GINPGETINP, "GINPGETINP: Read current digital inputs"}, {GINPGETLATCH, "GINPGETLATCH: Read latched digital inputs"}, {GINPCLRLATCH, "GINPCLRLATCH: Read and clear latched digital inputs"}, {GOUTGET, "GOUTGET: Read digital outputs"}, {GOUTSET, "GOUTSET: Write digital outputs"}, {GOUTSETBIT, "GOUTSETBIT: Set digital output bits"}, {GOUTCLEARBIT, "GOUTCLEARBIT"}, {GPWRGETWHICH, "GPWRGETWHICH"}, {GPWROFF, "GPWROFF"}, {GPWROFFRESET, "GPWROFFRESET"}, {GPWRRESET, "GPWRRESET"}, {0, NULL}, }; static const value_string cmd_sort_type[] = { {0, "Do not sort messages"}, {1, "Sort into blocks of up to 16 messages"}, {0, NULL} }; static const value_string protocol_types[] = { {GDUMMY * 256 + GDGDMARKONE, "Dummy device driver"}, {GCAN * 256 + G82527, "CAN, 82527 subtype"}, {GCAN * 256 + GSJA1000, "CAN, SJA1000 subtype"}, {GCAN * 256 + G82527SW, "CAN, 82527 single wire subtype"}, {GCAN * 256 + G82527ISO11992, "CAN, 82527 ISO11992 subtype"}, {GCAN * 256 + G82527_SINGLECHAN, "CAN, Fiber Optic 82527 subtype"}, {GCAN * 256 + G82527SW_SINGLECHAN, "CAN, Fiber Optic 82527 single wire subtype"}, {GCAN * 256 + G82527ISO11992_SINGLECHAN, "CAN, Fiber Optic ISO11992 subtype"}, {GCAN * 256 + GSJA1000FT, "CAN, SJA1000 Fault Tolerant subtype"}, {GCAN * 256 + GSJA1000C, "CAN, SJA1000 onboard subtype"}, {GCAN * 256 + GSJA1000FT_FO, "CAN, SJA1000 Fiber Optic Fault Tolerant subtype"}, {GCAN * 256 + GSJA1000_BEACON_CANFD, "CAN, SJA1000 BEACON CAN-FD subtype"}, {GCAN * 256 + GSJA1000_BEACON_SW, "CAN, SJA1000 BEACON CAN single wire subtype"}, {GCAN * 256 + GSJA1000_BEACON_FT, "CAN, SJA1000 BEACON CAN Fault Tolerant subtype"}, {GJ1850 * 256 + GHBCCPAIR, "J1850, HBCC subtype"}, {GJ1850 * 256 + GDLC, "J1850, GM DLC subtype"}, {GJ1850 * 256 + GCHRYSLER, "J1850, Chrysler subtype"}, {GJ1850 * 256 + GDEHC12, "J1850, DE HC12 KWP/BDLC subtype"}, {GKWP2000 * 256 + GDEHC12KWP, "Keyword protocol 2000/ISO 9141"}, {GHONDA * 256 + GDGHC08, "Honda UART, DG HC08 subtype"}, {GFORDUBP * 256 + GDGUBP08, "Ford UBP, DG HC08 subtype"}, {GSCI * 256 + G16550SCI, "Chrysler SCI, UART subtype"}, {GCCD * 256 + G16550CDP68HC68, "Chrysler C2D, UART / CDP68HC68S1 subtype"}, {GLIN * 256 + GDGLIN08, "LIN, DG HC08 subtype"}, {GLIN * 256 + GDGLIN_BEACON, "LIN, BEACON LIN updated subtype"}, {0, NULL}, }; /* * Note: using external tfs strings doesn't work in a plugin. * The address of a data item exported from a shared library * such as libwireshark is not known until the library is * loaded, so "&data_item" is not a constant; MSVC complains * about that. * * (*Direct* references to the item in code can execute a * different code sequence to get the address and then load * from that address, but references from a data structure * can't do that.) */ static const true_false_string tfs_wait_response = { "Wait", "Don't Wait" }; static const true_false_string true_false = { "True", "False" }; static const true_false_string register_unregister_action_flags = { "Register", "Unregister" }; static const true_false_string tfs_passed_blocked = { "Pass", "Block" }; static const true_false_string active_inactive = { "Active", "Inactive" }; static const true_false_string critical_normal = { "Critical", "Normal" }; static const true_false_string skip_not_skip = { "Skip", "Do not skip" }; static const true_false_string frames_01seconds = { "Frames", "0.01 seconds" }; static const true_false_string present_not_present = { "Present", "Not present" }; static const true_false_string yes_no = { "Yes", "No" }; static const true_false_string set_not_set = { "Set", "Not set" }; /* * returns 1 if the ID is one of the special servers * return 0 otherwise */ static int is_special_client(guint32 id) { if((id == SD_SERVER) || (id == SD_CLIENT)) { return 1; } return 0; } static int decode_data(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree *tree; int hdrsize, datasize, extrasize, msgsize, padding; nstime_t timestamp; /*int hdrbits;*/ static int * const data_mode_flags[] = { &hf_gryphon_data_mode_transmitted, &hf_gryphon_data_mode_receive, &hf_gryphon_data_mode_local, &hf_gryphon_data_mode_remote, &hf_gryphon_data_mode_oneshot, &hf_gryphon_data_mode_combined, &hf_gryphon_data_mode_nomux, &hf_gryphon_data_mode_internal, NULL }; hdrsize = tvb_get_guint8(tvb, offset+0); /* hdrbits = tvb_get_guint8(tvb, offset+1); */ datasize = tvb_get_ntohs(tvb, offset+2); extrasize = tvb_get_guint8(tvb, offset+4); padding = 3 - (hdrsize + datasize + extrasize + 3) % 4; msgsize = hdrsize + datasize + extrasize + padding + 16; tree = proto_tree_add_subtree(pt, tvb, offset, 16, ett_gryphon_data_header, NULL, "Message header"); /* fixed major problem with header length, length is 1-byte not 2-bytes */ proto_tree_add_item(tree, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_data_header_length_bits, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_data_data_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_data_extra_data_length, tvb, offset+4, 1, ENC_BIG_ENDIAN); /* 20171012 always display mode bits, not just conditionally */ proto_tree_add_bitmask(tree, tvb, offset+5, hf_gryphon_data_mode, ett_gryphon_flags, data_mode_flags, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_data_priority, tvb, offset+6, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_data_error_status, tvb, offset+7, 1, ENC_BIG_ENDIAN); timestamp.secs = tvb_get_ntohl(tvb, offset+8)/100000; timestamp.nsecs = (tvb_get_ntohl(tvb, offset+8)%100000)*1000; proto_tree_add_time(tree, hf_gryphon_data_time, tvb, offset+8, 4, &timestamp); proto_tree_add_item(tree, hf_gryphon_data_context, tvb, offset+12, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+13, 3, ENC_NA); offset += 16; tree = proto_tree_add_subtree(pt, tvb, offset, msgsize-16-padding, ett_gryphon_data_body, NULL, "Message Body"); if (hdrsize) { proto_tree_add_item(tree, hf_gryphon_data_header_data, tvb, offset, hdrsize, ENC_NA); offset += hdrsize; } if (datasize) { proto_tree_add_item(tree, hf_gryphon_data_data, tvb, offset, datasize, ENC_NA); offset += datasize; } if (extrasize) { proto_tree_add_item(tree, hf_gryphon_data_extra_data, tvb, offset, extrasize, ENC_NA); offset += extrasize; } if (padding) { proto_tree_add_item(tree, hf_gryphon_data_padding, tvb, offset, padding, ENC_NA); offset += padding; } /*proto_tree_add_debug_text(pt, "decode_data() debug offset=%d msgsize=%d", offset, msgsize);*/ return offset; } static int decode_event(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen, msgend, padding, length; nstime_t timestamp; msglen = tvb_reported_length_remaining(tvb, offset); padding = 3 - (msglen + 3) % 4; msgend = offset + msglen; proto_tree_add_item(pt, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_event_context, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA); offset += 4; timestamp.secs = tvb_get_ntohl(tvb, offset)/100000; timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000; proto_tree_add_time(pt, hf_gryphon_event_time, tvb, offset, 4, &timestamp); offset += 4; if (offset < msgend) { length = msgend - offset; proto_tree_add_item(pt, hf_gryphon_event_data, tvb, offset, length, ENC_NA); offset += length; } if (padding) { proto_tree_add_item(pt, hf_gryphon_event_padding, tvb, offset, padding, ENC_NA); offset += padding; } return offset; } static int decode_misc (tvbuff_t *tvb, int offset, packet_info* pinfo, proto_tree *pt) { tvbuff_t *next_tvb; /* proto_tree_add_debug_text(pt, "decode_misc() debug a offset=%d msglen=%d",offset, msglen); */ while(tvb_reported_length_remaining(tvb, offset) > 0) { /* * 20180221 * This function is called because Gryphon Protocol MISC packets contain within * them Gryphon Protocol packets (including possibly MISC packets!). So, this * function decodes that packet and return the offset. Loop thru all such packets * in the MISC packet. */ next_tvb = tvb_new_subset_remaining(tvb, offset); offset += dissect_gryphon_message(next_tvb, pinfo, pt, TRUE); } return offset; } static int decode_text (tvbuff_t *tvb, int offset, int msglen, proto_tree *pt) { int padding, length; padding = 3 - (msglen + 3) % 4; proto_tree_add_item_ret_length(pt, hf_gryphon_misc_text, tvb, offset, -1, ENC_NA|ENC_ASCII, &length); offset += length; if (padding) { proto_tree_add_item(pt, hf_gryphon_misc_padding, tvb, offset, padding, ENC_NA); offset += padding; } return offset; } static int cmd_init(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 mode = tvb_get_guint8(tvb, offset); if (mode == 0) proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Always initialize"); else proto_tree_add_uint_format_value(pt, hf_gryphon_cmd_mode, tvb, offset, 1, mode, "Initialize if not previously initialized"); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int eventnum(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 event = tvb_get_guint8(tvb, offset); if (event) proto_tree_add_item(pt, hf_gryphon_eventnum, tvb, offset, 1, ENC_BIG_ENDIAN); else proto_tree_add_uint_format_value(pt, hf_gryphon_eventnum, tvb, offset, 1, 0, "All Events."); offset += 1; return offset; } static int resp_time(tvbuff_t *tvb, int offset, proto_tree *pt) { guint64 val; nstime_t timestamp; val = tvb_get_ntoh64(tvb, offset); timestamp.secs = (time_t)(val/100000); timestamp.nsecs = (int)((val%100000)*1000); proto_tree_add_time(pt, hf_gryphon_resp_time, tvb, offset, 8, &timestamp); offset += 8; return offset; } static int cmd_setfilt(tvbuff_t *tvb, int offset, proto_tree *pt) { int flag = tvb_get_ntohl(tvb, offset); int length, padding; length = tvb_get_guint8(tvb, offset+4) + tvb_get_guint8(tvb, offset+5) + tvb_get_ntohs(tvb, offset+6); proto_tree_add_uint_format_value(pt, hf_gryphon_setfilt, tvb, offset, 4, flag, "%s%s", ((flag) ? "Pass" : "Block"), ((length == 0) ? " all" : "")); proto_tree_add_uint(pt, hf_gryphon_setfilt_length, tvb, offset+4, 4, length); offset += 8; if (length) { proto_tree_add_item(pt, hf_gryphon_setfilt_discard_data, tvb, offset, length * 2, ENC_NA); offset += length * 2; } padding = 3 - (length * 2 + 3) % 4; if (padding) { proto_tree_add_item(pt, hf_gryphon_setfilt_padding, tvb, offset, padding, ENC_NA); offset += padding; } return offset; } static int cmd_ioctl_details(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, guint32 ui_command, int msglen) { char *string; int length; gint32 nbytes; gint32 block_nbytes; gint16 us_stream; gint16 us_value; proto_tree *tree; unsigned int msg; guint8 number_ids; guint8 number_bytes; guint8 number_extra_bytes; guint8 flags; guint8 pid; guint8 datalen; guint8 extralen; int i; guint32 mtime; guint16 us_nsched; float value; static int * const ldf_schedule_flags[] = { &hf_gryphon_ldf_schedule_event, &hf_gryphon_ldf_schedule_sporadic, NULL }; /* TODO Gryphon Protocol has LOTS more ioctls, for CANbus, etc. */ /* 20171109 mc */ switch(ui_command) { case GLINDEACTSCHED: { /* 20180104 done */ } break; case GLINACTSCHED: { /* schedule name */ proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; } break; case GLINGETNUMSCHEDS: { /* 20180227 */ us_nsched = tvb_get_letohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_numb_place, tvb, offset, 2, us_nsched, "%d", us_nsched); offset += 2; } break; case GLINGETSCHEDNAMES: { nbytes = tvb_reported_length_remaining(tvb, offset); while(nbytes > 0) { /* schedule name */ proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; nbytes -= 32; } } break; case GLINGETSCHED: { /* 20180227 */ nbytes = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_size, tvb, offset, 4, nbytes, "%d", nbytes); offset += 4; /* schedule name */ proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; /* delay time */ mtime = tvb_get_letohl(tvb, offset); value = (float)mtime / (float)10.0; proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 4, value, "%.1f milliseconds", value); offset += 4; number_ids = tvb_get_guint8(tvb, offset); /* header length, number of IDs to follow */ proto_tree_add_item(pt, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; number_bytes = tvb_get_guint8(tvb, offset); number_bytes &= 0x0F; /* bit0 thru bit3 */ /* data length, number data bytes to follow */ proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_schedule_msg_dbytes, tvb, offset, 1, number_bytes, "%d", number_bytes); /* sporadic, event-driven flags */ proto_tree_add_bitmask(pt, tvb, offset, hf_gryphon_ldf_schedule_flags, ett_gryphon_flags, ldf_schedule_flags, ENC_BIG_ENDIAN); offset += 1; /* id's */ proto_tree_add_item(pt, hf_gryphon_data_header_data, tvb, offset, number_ids, ENC_NA); offset += number_ids; proto_tree_add_item(pt, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA); offset += number_bytes; } break; case GLINGETSCHEDSIZE: { /* 20180227 */ nbytes = tvb_get_letohl(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_sched_size_place, tvb, offset, 4, nbytes, "%d", nbytes); offset += 4; /* schedule name */ proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; } break; case GLINDELSCHED: { string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII); /*proto_tree_add_debug_text(pt, "cmd_ioctl_details() debug offset=%d length=%d string='%s'",offset,length,string); */ if(string[0] == '\0') { proto_tree_add_string(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, "All schedules"); } else { proto_tree_add_string(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, string); } offset += 32; } break; case GLINADDSCHED: { /* 20180227 */ /* number of bytes to follow */ nbytes = tvb_get_letohl(tvb, offset); /*proto_tree_add_item(pt, hf_gryphon_ioctl_nbytes, tvb, offset, 4, ENC_BIG_ENDIAN);*/ proto_tree_add_uint_format_value(pt, hf_gryphon_ioctl_nbytes, tvb, offset, 4, nbytes, "%d", nbytes); offset += 4; nbytes -= 4; /* schedule name */ proto_tree_add_item(pt, hf_gryphon_ldf_schedule_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; nbytes -= 32; /* messages */ msg = 1; while(nbytes > 0) { /* calc the number of bytes in this block */ number_ids = tvb_get_guint8(tvb, offset+4); number_bytes = tvb_get_guint8(tvb, offset+5); number_bytes &= 0x0F; /* bit0 thru bit3 */ block_nbytes = 4 + 1 + 1 + number_ids + number_bytes; /* message number */ tree = proto_tree_add_subtree_format(pt, tvb, offset, block_nbytes, ett_gryphon_lin_schedule_msg, NULL, "LIN message %u", msg); /* delay time */ /*mtime = tvb_get_ntohl(tvb, offset);*/ mtime = tvb_get_letohl(tvb, offset); value = (float)mtime / (float)10.0; proto_tree_add_float_format_value(tree, hf_gryphon_init_strat_delay, tvb, offset, 4, value, "%.1f milliseconds", value); offset += 4; /* header length, number of IDs to follow */ proto_tree_add_item(tree, hf_gryphon_data_header_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* data length, number data bytes to follow */ /*proto_tree_add_item(tree, hf_gryphon_data_data_length, tvb, offset, 1, ENC_BIG_ENDIAN);*/ proto_tree_add_uint_format_value(tree, hf_gryphon_ldf_schedule_msg_dbytes, tvb, offset, 1, number_bytes, "%d", number_bytes); /* sporadic, event-driven flags */ proto_tree_add_bitmask(tree, tvb, offset, hf_gryphon_ldf_schedule_flags, ett_gryphon_flags, ldf_schedule_flags, ENC_BIG_ENDIAN); offset += 1; /* id's */ proto_tree_add_item(tree, hf_gryphon_data_header_data, tvb, offset, number_ids, ENC_NA); offset += number_ids; proto_tree_add_item(tree, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA); offset += number_bytes; nbytes -= block_nbytes; msg++; /* proto_tree_add_debug_text(pt, "cmd_ioctl_details() debug offset=%d msglen=%d nbytes=%d",offset,msglen,nbytes);*/ } } break; case GLINSETFLAGS: { /* 20171113 */ proto_tree_add_item(pt, hf_gryphon_ldf_ioctl_setflags, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; number_ids = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i = 0; i < number_ids; i++) { flags = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, flags, "0x%x %s",i,flags==0 ? "Classic checksum" : (flags==0x80?"Enhanced checksum":(flags==0x40?"Event":"UNKNOWN"))); offset += 1; } } break; case GLINSETBITRATE: { /* 20180227 */ /* 20171113 */ mtime = tvb_get_letohl(tvb, offset); value = (float)mtime / (float)1000.0; proto_tree_add_float_format_value(pt, hf_gryphon_ldf_bitrate, tvb, offset, 4, value, "%.3f Kbps", value); offset += 4; } break; case GLINGETNSLAVETABLE: { /* 20180104 */ proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; } break; case GLINGETSLAVETABLEPIDS: { /* 20180104 */ number_ids = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_numb_ids, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i = 0; i < number_ids; i++) { pid = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%x ",pid); offset += 1; } } break; case GLINGETSLAVETABLE: { /* 20180104 */ /* * byte 0: PID * byte 1: datalen * byte 2: extralen * byte 3: enabled=1 or disabled=0, 2=has one-shot * byte 4: good cs=0 or bad cs=1 * byte 5-13: data[datalen] * byte n: checksum */ pid = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid); offset += 1; datalen = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_lin_data_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; extralen = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_data_extra_data_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(pt, hf_gryphon_lin_slave_table_enable, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(pt, hf_gryphon_lin_slave_table_cs, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if(datalen != 0) { proto_tree_add_item(pt, hf_gryphon_lin_slave_table_data, tvb, offset, datalen, ENC_NA); offset += datalen; } if(extralen != 0) { proto_tree_add_item(pt, hf_gryphon_lin_slave_table_datacs, tvb, offset, 1, ENC_NA); offset += 1; } } break; case GLINSETSLAVETABLE: { /* 20180104 */ /* * byte 0: PID * byte 1: datalen * byte 2: extralen * byte 3: enabled=1 or disabled=0 * byte 4-12: data[datalen] * byte n: checksum */ pid = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid); offset += 1; datalen = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_lin_data_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; extralen = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_data_extra_data_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(pt, hf_gryphon_lin_slave_table_enable, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if(datalen != 0) { proto_tree_add_item(pt, hf_gryphon_lin_slave_table_data, tvb, offset, datalen, ENC_NA); offset += datalen; } if(extralen != 0) { proto_tree_add_item(pt, hf_gryphon_lin_slave_table_datacs, tvb, offset, 1, ENC_NA); offset += 1; } } break; case GLINCLEARSLAVETABLE: { /* 20180104 done */ pid = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%02x ",pid); offset += 1; } break; case GLINCLEARALLSLAVETABLE: { /* 20180104 done */ } break; case GLINGETMASTEREVENTENABLE: case GLINSETMASTEREVENTENABLE: { /* 20180227 */ proto_tree_add_item(pt, hf_gryphon_lin_masterevent, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; } break; case GLINGETONESHOT: case GLINSETONESHOT: { /* 20180104 */ /* 20180228 */ number_bytes = tvb_get_guint8(tvb, offset+1); number_extra_bytes = tvb_get_guint8(tvb, offset+2); /* id */ proto_tree_add_item(pt, hf_gryphon_data_header_data, tvb, offset, 1, ENC_NA); offset += 1; proto_tree_add_item(pt, hf_gryphon_lin_numdata, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(pt, hf_gryphon_lin_numextra, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (number_bytes) { proto_tree_add_item(pt, hf_gryphon_data_data, tvb, offset, number_bytes, ENC_NA); offset += number_bytes; } if (number_extra_bytes) { proto_tree_add_item(pt, hf_gryphon_data_extra_data, tvb, offset, number_extra_bytes, ENC_NA); offset += number_extra_bytes; } } break; case GLINCLEARONESHOT: { /* 20180104 */ /* 20180227 done */ } break; case GDLYGETHIVALUE: case GDLYSETHIVALUE: case GDLYGETLOVALUE: case GDLYSETLOVALUE: { /* 20180227 */ /* 20180104 */ us_stream = tvb_get_letohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_dd_stream, tvb, offset, 2, us_stream, "%d (0x%04X)", us_stream, us_stream); offset += 2; us_value = tvb_get_letohs(tvb, offset); /* proto_tree_add_item(pt, hf_gryphon_dd_value, tvb, offset, 2, ENC_BIG_ENDIAN);*/ proto_tree_add_uint_format_value(pt, hf_gryphon_dd_value, tvb, offset, 2, us_value, "%d (0x%04X)", us_value, us_value); offset += 2; } break; case GDLYGETHITIME: case GDLYSETHITIME: case GDLYGETLOTIME: case GDLYSETLOTIME: { /* 20180227 */ /* 20180104 */ us_stream = tvb_get_letohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_dd_stream, tvb, offset, 2, us_stream, "%d (0x%04X)", us_stream, us_stream); offset += 2; mtime = tvb_get_letohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_dd_time, tvb, offset, 2, mtime, "%d", mtime); offset += 2; } break; /* TODO implement remaining delay driver ioctls */ #if 0 case GDLYGETLOREPORT: /*get the low water report flag*/ break; case GDLYFLUSHSTREAM: /*flush the delay buffer*/ break; case GDLYINITSTREAM: /*set default hi & lo water marks*/ break; case GDLYPARTIALFLUSHSTREAM: /*flush the delay buffer */ break; #endif default: proto_tree_add_item(pt, hf_gryphon_ioctl_data, tvb, offset, msglen, ENC_NA); offset += msglen; break; } return offset; } /* * cmd_ioctl() performs the initial decode of the IOCTL command, then * calls cmd_ioctl_details() */ static int cmd_ioctl(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, guint32 ui_command) { int msglen; /*guint32 ioctl;*/ int padding; msglen = tvb_reported_length_remaining(tvb, offset); /* 20171109 mc */ /*ioctl = tvb_get_ntohl(tvb, offset);*/ /* 20171012 debug */ /*proto_tree_add_debug_text(pt, "cmd_ioctl() debug offset=%d msglen=%d",offset,msglen);*/ proto_tree_add_item(pt, hf_gryphon_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; if (msglen > 0) { offset = cmd_ioctl_details(tvb, pinfo, offset, pt, ui_command, msglen); } padding = tvb_reported_length_remaining(tvb, offset); /*proto_tree_add_debug_text(pt, "cmd_ioctl() debug offset=%d msglen=%d padding=%d",offset,msglen,padding);*/ if (padding > 0) { proto_tree_add_item(pt, hf_gryphon_setfilt_padding, tvb, offset, padding, ENC_NA); offset += padding; } return offset; } /* * cmd_ioctl_resp() * displays the IOCTL data in the IOCTL response to the IOCTL request * Here is an issue with the IOCTLs. The IOCTL request contains the IOCTL number, * but the IOCTL response does not contain the number. IOCTL response * contains the context byte of the request, so application software can match * the IOCTL response to the request. */ static int cmd_ioctl_resp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt, guint32 ui_command) { int msglen = tvb_reported_length_remaining(tvb, offset); /* 20171012 debug */ /*proto_tree_add_debug_text(pt, "cmd_ioctl_resp() debug offset=%d msglen=%d",offset,msglen);*/ if (msglen > 0) { /*proto_tree_add_item(pt, hf_gryphon_ioctl_data, tvb, offset, msglen, ENC_NA);*/ /*offset += msglen;*/ offset = cmd_ioctl_details(tvb, pinfo, offset, pt, ui_command, msglen); } return offset; } static int filter_block(tvbuff_t *tvb, int offset, proto_tree *pt) { guint32 op, length, padding; /* 20171017 fixed display of filter block padding */ /* start 2bytes */ proto_tree_add_item(pt, hf_gryphon_filter_block_filter_start, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* length 2bytes */ proto_tree_add_item_ret_uint(pt, hf_gryphon_filter_block_filter_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length); offset += 2; /* type 1byte */ proto_tree_add_item(pt, hf_gryphon_filter_block_filter_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* operator 1byte */ proto_tree_add_item_ret_uint(pt, hf_gryphon_filter_block_filter_operator, tvb, offset, 1, ENC_BIG_ENDIAN, &op); offset += 1; /* rsvd 2bytes */ proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 2, ENC_NA); offset += 2; if (op == BIT_FIELD_CHECK) { proto_tree_add_item(pt, hf_gryphon_filter_block_pattern, tvb, offset, length, ENC_NA); proto_tree_add_item(pt, hf_gryphon_filter_block_mask, tvb, offset + length, length, ENC_NA); offset += length * 2; padding = (length * 2) % 4; if (padding) { proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, padding, ENC_NA); offset += padding; } } else { switch (length) { case 1: proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value1, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; break; case 2: proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value2, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; break; case 4: proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value4, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; break; default: proto_tree_add_item(pt, hf_gryphon_filter_block_filter_value_bytes, tvb, offset, length, ENC_NA); offset += length; } padding = 3 - ((length + 3) % 4); if (padding) { proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, padding, ENC_NA); offset += padding; } } return offset; } static int cmd_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree *tree; int blocks, i, length; int padding; tree = proto_tree_add_subtree(pt, tvb, offset, 1, ett_gryphon_flags, NULL, "Flags"); proto_tree_add_item(tree, hf_gryphon_addfilt_pass, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_addfilt_active, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; blocks = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_addfilt_blocks, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 6, ENC_NA); offset += 7; for (i = 1; i <= blocks; i++) { length = tvb_get_ntohs(tvb, offset+2) + 8; /*length += 3 - (length + 3) % 4; */ padding = 3 - (length + 3) % 4; tree = proto_tree_add_subtree_format(pt, tvb, offset, length + padding, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i); offset = filter_block(tvb, offset, tree); } return offset; } static int resp_addfilt(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_addfilt_handle, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int cmd_modfilt(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 filter_handle = tvb_get_guint8(tvb, offset); if (filter_handle) proto_tree_add_item(pt, hf_gryphon_modfilt, tvb, offset, 1, ENC_BIG_ENDIAN); else proto_tree_add_uint_format_value(pt, hf_gryphon_modfilt, tvb, offset, 1, 0, "Filter handles: all"); proto_tree_add_item(pt, hf_gryphon_modfilt_action, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA); offset += 4; return offset; } static int resp_filthan(tvbuff_t *tvb, int offset, proto_tree *pt) { int handles = tvb_get_guint8(tvb, offset); int i, padding, handle; proto_tree_add_item(pt, hf_gryphon_filthan, tvb, offset, 1, ENC_BIG_ENDIAN); for (i = 1; i <= handles; i++){ handle = tvb_get_guint8(tvb, offset+i); proto_tree_add_uint_format_value(pt, hf_gryphon_filthan_id, tvb, offset+i, 1, handle, "Handle %d: %u", i, handle); } padding = 3 - (handles + 1 + 3) % 4; if (padding) proto_tree_add_item(pt, hf_gryphon_filthan_padding, tvb, offset+1+handles, padding, ENC_NA); offset += 1+handles+padding; return offset; } static int dfiltmode(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_dfiltmode, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int filtmode(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_filtmode, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int resp_events(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; unsigned int i; proto_tree *tree; msglen = tvb_reported_length_remaining(tvb, offset); i = 1; while (msglen != 0) { tree = proto_tree_add_subtree_format(pt, tvb, offset, 20, ett_gryphon_cmd_events_data, NULL, "Event %d:", i); proto_tree_add_item(tree, hf_gryphon_event_id, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_event_name, tvb, offset+1, 19, ENC_NA|ENC_ASCII); offset += 20; msglen -= 20; i++; } return offset; } static int cmd_register(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_register_username, tvb, offset, 16, ENC_NA|ENC_ASCII); offset += 16; proto_tree_add_item(pt, hf_gryphon_register_password, tvb, offset, 32, ENC_NA|ENC_ASCII); offset += 32; return offset; } static int resp_register(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_register_client_id, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_register_privileges, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA); offset += 4; return offset; } static int resp_getspeeds(tvbuff_t *tvb, int offset, proto_tree *pt) { int indx, size = tvb_get_guint8(tvb, offset+8), number = tvb_get_guint8(tvb, offset+9); proto_tree_add_item(pt, hf_gryphon_getspeeds_set_ioctl, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_getspeeds_get_ioctl, tvb, offset+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_getspeeds_size, tvb, offset+8, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_getspeeds_preset, tvb, offset+9, 1, ENC_BIG_ENDIAN); offset += 10; for (indx = 1; indx <= number; indx++) { proto_tree_add_bytes_format(pt, hf_gryphon_getspeeds_data, tvb, offset, size, tvb_get_ptr(tvb, offset, size), "Data for preset %d", indx); offset += size; } return offset; } static int cmd_sort(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_cmd_sort, tvb, offset, 1, ENC_BIG_ENDIAN); return (offset+1); } static int cmd_optimize(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_cmd_optimize, tvb, offset, 1, ENC_BIG_ENDIAN); return (offset+1); } static int resp_config(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree *ft, *tree; int devices; int i; unsigned int j, x; proto_tree_add_item(pt, hf_gryphon_config_device_name, tvb, offset, 20, ENC_NA|ENC_ASCII); offset += 20; proto_tree_add_item(pt, hf_gryphon_config_device_version, tvb, offset, 8, ENC_NA|ENC_ASCII); offset += 8; proto_tree_add_item(pt, hf_gryphon_config_device_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII); offset += 20; devices = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_config_num_channels, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_config_name_version_ext, tvb, offset+1, 11, ENC_NA|ENC_ASCII); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+12, 4, ENC_NA); offset += 16; for (i = 1; i <= devices; i++) { ft = proto_tree_add_subtree_format(pt, tvb, offset, 80, ett_gryphon_cmd_config_device, NULL, "Channel %d:", i); proto_tree_add_item(ft, hf_gryphon_config_driver_name, tvb, offset, 20, ENC_NA|ENC_ASCII); offset += 20; proto_tree_add_item(ft, hf_gryphon_config_driver_version, tvb, offset, 8, ENC_NA|ENC_ASCII); offset += 8; proto_tree_add_item(ft, hf_gryphon_config_device_security, tvb, offset, 16, ENC_NA|ENC_ASCII); offset += 16; x = tvb_get_ntohl (tvb, offset); if (x) { tree = proto_tree_add_subtree(ft, tvb, offset, 4, ett_gryphon_valid_headers, NULL, "Valid Header lengths"); for (j = 0; ; j++) { if (x & 1) { proto_tree_add_uint_format(tree, hf_gryphon_valid_header_length, tvb, offset, 4, j, "%d byte%s", j, j == 1 ? "" : "s"); } if ((x >>= 1) == 0) break; } } offset += 4; proto_tree_add_item(ft, hf_gryphon_config_max_data_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(ft, hf_gryphon_config_min_data_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(ft, hf_gryphon_config_hardware_serial_number, tvb, offset, 20, ENC_NA|ENC_ASCII); offset += 20; proto_tree_add_item(ft, hf_gryphon_config_protocol_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(ft, hf_gryphon_config_channel_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(ft, hf_gryphon_config_card_slot_number, tvb, offset, 1, ENC_BIG_ENDIAN); offset ++; proto_tree_add_item(ft, hf_gryphon_config_max_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(ft, hf_gryphon_config_min_extra_data, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } return offset; } static int cmd_sched(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; proto_item *item, *item1; proto_tree *tree, *tree1; int save_offset; unsigned int i, x, length; guint8 def_chan = tvb_get_guint8(tvb, offset-9); msglen = tvb_reported_length_remaining(tvb, offset); if (tvb_get_ntohl(tvb, offset) == 0xFFFFFFFF) proto_tree_add_uint_format_value(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4, 0, "\"infinite\""); else proto_tree_add_item(pt, hf_gryphon_sched_num_iterations, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; item = proto_tree_add_item(pt, hf_gryphon_sched_flags, tvb, offset, 4, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (item, ett_gryphon_flags); proto_tree_add_item(tree, hf_gryphon_sched_flags_scheduler, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; i = 1; while (msglen > 0) { length = 16 + tvb_get_guint8(tvb, offset+16) + tvb_get_ntohs(tvb, offset+18) + tvb_get_guint8(tvb, offset+20) + 16; length += 3 - (length + 3) % 4; tree = proto_tree_add_subtree_format(pt, tvb, offset, length, ett_gryphon_cmd_sched_data, NULL, "Message %d", i); proto_tree_add_item(tree, hf_gryphon_sched_sleep, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; proto_tree_add_item(tree, hf_gryphon_sched_transmit_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; proto_tree_add_item(tree, hf_gryphon_sched_transmit_period, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; item1 = proto_tree_add_item(tree, hf_gryphon_sched_transmit_flags, tvb, offset, 2, ENC_BIG_ENDIAN); tree1 = proto_item_add_subtree (item1, ett_gryphon_flags); proto_tree_add_item(tree1, hf_gryphon_sched_skip_transmit_period, tvb, offset, 2, ENC_BIG_ENDIAN); if (i == 1) { /* N.B. Same bit as skip_transmit_period..? */ proto_tree_add_item(tree1, hf_gryphon_sched_skip_sleep, tvb, offset, 2, ENC_BIG_ENDIAN); } x = tvb_get_guint8(tvb, offset+2); /* 20171026 */ if (x == 0) { x = def_chan; proto_tree_add_uint(tree, hf_gryphon_sched_channel0, tvb, offset+2, 1, x); } else { proto_tree_add_uint(tree, hf_gryphon_sched_channel, tvb, offset+2, 1, x); } proto_tree_add_item(tree, hf_gryphon_reserved, tvb, offset+3, 1, ENC_NA); offset += 4; msglen -= 4; tree1 = proto_tree_add_subtree(tree, tvb, offset, msglen, ett_gryphon_cmd_sched_cmd, NULL, "Message"); save_offset = offset; offset = decode_data(tvb, offset, tree1); msglen -= offset - save_offset; i++; } return offset; } static int cmd_sched_rep(tvbuff_t *tvb, int offset, proto_tree *pt) { unsigned int x; const char *type; x = tvb_get_ntohl(tvb, offset); if (x & 0x80000000) type = "Critical"; else type = "Normal"; proto_tree_add_uint_format_value(pt, hf_gryphon_sched_rep_id, tvb, offset, 4, x, "%s schedule ID: %u", type, x); offset += 4; proto_tree_add_item(pt, hf_gryphon_sched_rep_message_index, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; offset = decode_data(tvb, offset, pt); return offset; } static int resp_blm_data(tvbuff_t *tvb, int offset, proto_tree *pt) { int x; nstime_t timestamp; timestamp.secs = tvb_get_ntohl(tvb, offset)/100000; timestamp.nsecs = (tvb_get_ntohl(tvb, offset)%100000)*1000; proto_tree_add_time(pt, hf_gryphon_blm_data_time, tvb, offset, 4, &timestamp); offset += 4; x = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_bus_load, tvb, offset, 2, x, "%d.%02d%%", x / 100, x % 100); offset += 2; x = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_current_bus_load, tvb, offset, 2, x, "%d.%02d%%", x / 100, x % 100); offset += 2; x = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_peak_bus_load, tvb, offset, 2, x, "%d.%02d%%", x / 100, x % 100); offset += 2; x = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_blm_data_historic_peak_bus_load, tvb, offset, 2, x, "%d.%02d%%", x / 100, x % 100); offset += 2; return offset; } static int resp_blm_stat(tvbuff_t *tvb, int offset, proto_tree *pt) { offset = resp_blm_data(tvb, offset, pt); proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_dropped_frame_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_blm_stat_receive_error_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_blm_stat_transmit_error_count, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; return offset; } /* * command to get a list of LDFs */ static int cmd_ldf_list(tvbuff_t *tvb, int offset, proto_tree *pt) { /* block index */ proto_tree_add_item(pt, hf_gryphon_ldf_list, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; return offset; } static int resp_ldf_list(tvbuff_t *tvb, int offset, proto_tree *pt) { int blocks; int i; proto_tree *localTree; /* block index */ blocks = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_number, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* rsvd */ proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); offset += 1; /* number remaining */ proto_tree_add_item(pt, hf_gryphon_ldf_remaining, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* LDF blocks */ for(i=0;i<blocks;i++) { localTree = proto_tree_add_subtree_format(pt, tvb, offset, 32+80, ett_gryphon_ldf_block, NULL, "LDF %d",i+1); proto_tree_add_item(localTree, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; proto_tree_add_item(localTree, hf_gryphon_ldf_description, tvb, offset, 80, ENC_ASCII|ENC_NA); offset += 80; } return offset; } static int cmd_ldf_delete(tvbuff_t *tvb, int offset, proto_tree *pt) { /* name */ proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; return offset; } static int cmd_ldf_desc(tvbuff_t *tvb, int offset, proto_tree *pt) { guint32 size; /* size 4 bytes */ size = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_size, tvb, offset, 4, size, "%u", size); offset += 4; proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; proto_tree_add_item(pt, hf_gryphon_ldf_description, tvb, offset, 80, ENC_ASCII|ENC_NA); offset += 80; return offset; } static int resp_ldf_desc(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_ldf_exists, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(pt, hf_gryphon_ldf_desc_pad, tvb, offset, 2, ENC_NA); offset += 2; return offset; } static int cmd_ldf_upload(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; /*int blockn;*/ msglen = tvb_reported_length_remaining(tvb, offset); /* block number */ /*blockn = tvb_get_ntohs(tvb, offset);*/ /* 20171101 debug */ /*proto_tree_add_debug_text(pt, "------------------debug offset=%d blockn=%d msglen=%d",offset,blockn,msglen);*/ proto_tree_add_item(pt, hf_gryphon_ldf_blockn, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* 20171101 file string */ proto_tree_add_item(pt, hf_gryphon_ldf_file, tvb, offset, msglen - 2, ENC_NA|ENC_ASCII); offset += msglen - 2; return offset; } static int cmd_ldf_parse(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; return offset; } static int resp_get_ldf_info(tvbuff_t *tvb, int offset, proto_tree *pt) { guint32 bitrate; float value; proto_tree_add_item(pt, hf_gryphon_ldf_info_pv, tvb, offset, 16, ENC_ASCII|ENC_NA); offset += 16; proto_tree_add_item(pt, hf_gryphon_ldf_info_lv, tvb, offset, 16, ENC_ASCII|ENC_NA); offset += 16; bitrate = tvb_get_ntohl(tvb, offset); value = (float)bitrate / (float)1000.0; proto_tree_add_float_format_value(pt, hf_gryphon_ldf_bitrate, tvb, offset, 4, value, "%.3f Kbps", value); offset += 4; return offset; } static int cmd_cnvt_get_values(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 num_signals; int length; int i; num_signals = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i< num_signals; i++) { proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } return offset; } static int resp_cnvt_get_values(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 flag; guint8 num_signals; float fvalue; int i; int length; num_signals = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i< num_signals; i++) { /* flag */ flag = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_cnvt_flags_getvalues, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if(flag & 0x01) { /* float */ fvalue = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_float_format_value(pt, hf_gryphon_cnvt_valuef, tvb, offset, 4, fvalue, "%.1f", fvalue); offset += 4; } if(flag & 0x02) { /* int */ proto_tree_add_item(pt, hf_gryphon_cnvt_valuei, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } if(flag & 0x04) { /* string */ proto_tree_add_item_ret_length(pt, hf_gryphon_cnvt_values, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } } return offset; } static int cmd_cnvt_get_units(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 num_signals; int length; int i; num_signals = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i< num_signals; i++) { proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } return offset; } static int resp_cnvt_get_units(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 num_signals; int i; int length; num_signals = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i< num_signals; i++) { /* string */ proto_tree_add_item_ret_length(pt, hf_gryphon_cnvt_units, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } return offset; } static int cmd_cnvt_set_values(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 num_signals; int length; int i; float fvalue; num_signals = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i< num_signals; i++) { proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; fvalue = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_float_format_value(pt, hf_gryphon_cnvt_valuef, tvb, offset, 4, fvalue, "%.2f", fvalue); offset += 4; } return offset; } static int cmd_cnvt_destroy_session(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_ui, tvb, offset, msglen, ENC_NA); offset += msglen; return offset; } static int resp_ldf_get_node_names(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; guint16 us_num; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_node_names, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* master node name */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_master_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; us_num -= 1; while(us_num > 0) { /* slave node names */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_slave_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; us_num -= 1; } return offset; } static int cmd_ldf_get_frames(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int resp_ldf_get_frames(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; guint16 us_num; guint8 pid; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_frames, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(us_num > 0) { /* id */ pid = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, pid, "0x%x ",pid); offset += 1; /* frame name */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; us_num -= 1; } return offset; } static int cmd_ldf_get_frame_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { char *string; int length; guint8 id; string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII); if(length > 1) { proto_tree_add_string(pt, hf_gryphon_ldf_get_frame, tvb, offset, length, string); offset += length; proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, 0, "(Id not used)"); offset += 1; } else { id = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_ldf_ioctl_setflags_flags, tvb, offset, 1, id, "0x%x ",id); offset += 1; } return offset; } static int resp_ldf_get_frame_info(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; guint8 count, i; proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_get_frame_pub, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; count = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_get_frame_num_signals, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for (i = 0; i < count; i++) { proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } return offset; } static int cmd_ldf_get_signal_info(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int resp_ldf_get_signal_info(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; /* offset */ proto_tree_add_item(pt, hf_gryphon_ldf_signal_offset, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* length */ proto_tree_add_item(pt, hf_gryphon_ldf_signal_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* signal encoding name */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int cmd_ldf_get_signal_detail(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int resp_ldf_do_encoding_block(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { char *string; int length; /* encoding */ string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII); proto_tree_add_string(pt, hf_gryphon_ldf_signal_encoding_type, tvb, offset, 12, string); offset += 12; if(string[0] == 'l') { /* logical */ proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } else if(string[0] == 'p') { /* physical */ proto_tree_add_item(pt, hf_gryphon_ldf_encoding_min, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(pt, hf_gryphon_ldf_encoding_max, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_logical, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; } else if(string[0] == 'b') { proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* bcd */ } else if(string[0] == 'a') { proto_tree_add_item(pt, hf_gryphon_ldf_encoding_value, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* ascii */ } else { /* error */ } return(offset); } static int resp_ldf_get_signal_detail(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { guint16 us_num; /* offset */ proto_tree_add_item(pt, hf_gryphon_ldf_signal_offset, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* length */ proto_tree_add_item(pt, hf_gryphon_ldf_signal_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_encodings, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(us_num > 0) { offset = resp_ldf_do_encoding_block(tvb, pinfo, offset, pt); us_num -= 1; } return offset; } static int cmd_ldf_get_encoding_info(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_encoding_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int resp_ldf_get_encoding_info(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { guint16 us_num; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_encodings, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(us_num > 0) { /* encoding data */ offset = resp_ldf_do_encoding_block(tvb, pinfo, offset, pt); us_num -= 1; } return offset; } static int cmd_ldf_save_session(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_restore_session, tvb, offset, msglen, ENC_NA); offset += msglen; return offset; } static int cmd_ldf_emulate_nodes(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { int nnodes; int node_numb=1; int i; unsigned int xchannel; char *string; int length; proto_tree *tree2; nnodes = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_nodenumber, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; for(i=0;i<nnodes;i++) { /* first, find the end of the string, then use that string len to build a subtree */ string = tvb_get_stringz_enc(pinfo->pool, tvb, offset+1, &length, ENC_ASCII); tree2 = proto_tree_add_subtree_format(pt, tvb, offset, 1+length, ett_gryphon_lin_emulate_node, NULL, "Node %u", node_numb); xchannel = tvb_get_guint8(tvb, offset); proto_tree_add_uint(tree2, hf_gryphon_sched_channel, tvb, offset, 1, xchannel); offset += 1; proto_tree_add_string(tree2, hf_gryphon_lin_nodename, tvb, offset, length, string); offset += length; node_numb++; } return offset; } static int resp_ldf_get_schedules(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; guint16 us_num; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_schedules, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(us_num > 0) { /* slave node names */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_schedule_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; us_num -= 1; } return offset; } static int cmd_ldf_start_schedule(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_schedule_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int cmd_ldf_get_node_signals(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_node_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; return offset; } static int resp_ldf_get_node_signals(tvbuff_t *tvb, int offset, proto_tree *pt) { int length; guint16 us_num; /* number */ us_num = tvb_get_ntohs(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_num_signal_names, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(us_num > 0) { /* signal names */ proto_tree_add_item_ret_length(pt, hf_gryphon_ldf_signal_name, tvb, offset, -1, ENC_NA | ENC_ASCII, &length); offset += length; us_num -= 1; } return offset; } static int cmd_restore_session(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_ldf_restore_session, tvb, offset, msglen, ENC_NA); offset += msglen; return offset; } static int resp_restore_session(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_ldf_name, tvb, offset, 32, ENC_ASCII|ENC_NA); offset += 32; return offset; } static int cmd_addresp(tvbuff_t *tvb, int offset, packet_info* pinfo, proto_tree *pt) { proto_item *item; proto_tree *tree; guint blocks, responses, i, msglen, length; int padding; int action, actionType, actionValue; tvbuff_t *next_tvb; actionType = 0; /* flags */ item = proto_tree_add_item(pt, hf_gryphon_addresp_flags, tvb, offset, 1, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (item, ett_gryphon_flags); /* 20171017 fixed display of filter flags */ /* flags: active */ proto_tree_add_item(tree, hf_gryphon_addresp_flags_active, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* number of filter blocks */ proto_tree_add_item_ret_uint(pt, hf_gryphon_addresp_blocks, tvb, offset, 1, ENC_BIG_ENDIAN, &blocks); offset += 1; /* number of responses */ proto_tree_add_item_ret_uint(pt, hf_gryphon_addresp_responses, tvb, offset, 1, ENC_BIG_ENDIAN, &responses); offset += 1; /* old handle */ proto_tree_add_item(pt, hf_gryphon_addresp_old_handle, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* action */ action = tvb_get_guint8(tvb, offset); item = proto_tree_add_item(pt, hf_gryphon_addresp_action, tvb, offset, 1, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (item, ett_gryphon_flags); actionValue = tvb_get_ntohs(tvb, offset+2); if (actionValue) { if (action & FR_PERIOD_MSGS) { actionType = 1; } else { actionType = 0; } proto_tree_add_item(tree, hf_gryphon_addresp_action_period, tvb, offset, 1, ENC_BIG_ENDIAN); } proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_on_event, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gryphon_addresp_action_deact_after_period, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* reserved */ proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); offset += 1; if (actionValue) { if (actionType == 1) { proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb, offset, 2, actionValue, "Period: %d messages", actionValue); } else { proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb, offset, 2, actionValue, "Period: %d.%02d seconds", actionValue/100, actionValue%100); } } else { /* 20171017 */ /* value 2-bytes */ proto_tree_add_uint_format_value(pt, hf_gryphon_addresp_action_period_type, tvb, offset, 2, actionValue, "(not used)"); } offset += 2; for (i = 1; i <= blocks; i++) { length = tvb_get_ntohs(tvb, offset+2) + 8; padding = 3 - (length + 3) % 4; tree = proto_tree_add_subtree_format(pt, tvb, offset, length + padding, ett_gryphon_cmd_filter_block, NULL, "Filter block %d", i); /* 20171017 fixed display of filter block padding */ offset = filter_block(tvb, offset, tree); } for (i = 1; i <= responses; i++) { msglen = tvb_get_ntohs(tvb, offset+4) + 8; padding = 3 - (msglen + 3) % 4; tree = proto_tree_add_subtree_format(pt, tvb, offset, msglen + padding, ett_gryphon_cmd_response_block, NULL, "Response block %d", i); next_tvb = tvb_new_subset_length(tvb, offset, msglen + padding); dissect_gryphon_message(next_tvb, pinfo, tree, TRUE); offset += msglen + padding; } return offset; } static int resp_addresp(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_addresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int cmd_modresp(tvbuff_t *tvb, int offset, proto_tree *pt) { guint8 dest = tvb_get_guint8(tvb, offset-5), resp_handle = tvb_get_guint8(tvb, offset); if (resp_handle) proto_tree_add_item(pt, hf_gryphon_modresp_handle, tvb, offset, 1, ENC_BIG_ENDIAN); else if (dest) proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb, offset, 1, dest, "Response handles: all on channel %c", dest); else proto_tree_add_uint_format_value(pt, hf_gryphon_modresp_handle, tvb, offset, 1, 0, "Response handles: all"); proto_tree_add_item(pt, hf_gryphon_modresp_action, tvb, offset+1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA); offset += 4; return offset; } static int resp_resphan(tvbuff_t *tvb, int offset, proto_tree *pt) { int handles = tvb_get_guint8(tvb, offset); int i, padding, handle; proto_tree_add_item(pt, hf_gryphon_num_resphan, tvb, offset, 1, ENC_BIG_ENDIAN); for (i = 1; i <= handles; i++){ handle = tvb_get_guint8(tvb, offset+i); proto_tree_add_uint_format(pt, hf_gryphon_handle, tvb, offset+i, 1, handle, "Handle %d: %u", i, handle); } padding = 3 - (handles + 1 + 3) % 4; if (padding) proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset+1+handles, padding, ENC_NA); offset += 1+handles+padding; return offset; } static int resp_sched(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_transmit_sched_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; return offset; } static int cmd_desc(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_desc_program_size, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(pt, hf_gryphon_desc_program_name, tvb, offset, 32, ENC_NA|ENC_ASCII); offset += 32; proto_tree_add_item(pt, hf_gryphon_desc_program_description, tvb, offset, 80, ENC_NA|ENC_ASCII); offset += 80; return offset; } static int resp_desc(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_item *item; proto_tree *tree; item = proto_tree_add_item(pt, hf_gryphon_desc_flags, tvb, offset, 1, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (item, ett_gryphon_flags); proto_tree_add_item(tree, hf_gryphon_desc_flags_program, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_desc_handle, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+2, 2, ENC_NA); offset += 4; return offset; } static int cmd_upload(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; unsigned int length; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_upload_block_number, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_upload_handle, tvb, offset+2, 1, ENC_BIG_ENDIAN); offset += 3; msglen -= 3; length = msglen; proto_tree_add_item(pt, hf_gryphon_upload_data, tvb, offset, length, ENC_NA); offset += length; length = 3 - (length + 3) % 4; if (length) { proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA); offset += length; } return offset; } static int cmd_delete(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_delete, tvb, offset, 32, ENC_NA|ENC_ASCII); offset += 32; return offset; } static int cmd_list(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_list_block_number, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int resp_list(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree *tree; guint32 i, count; proto_tree_add_item_ret_uint(pt, hf_gryphon_list_num_programs, tvb, offset, 1, ENC_BIG_ENDIAN, &count); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 1, ENC_NA); offset += 2; proto_tree_add_item(pt, hf_gryphon_list_num_remain_programs, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; for (i = 1; i <= count; i++) { tree = proto_tree_add_subtree_format(pt, tvb, offset, 112, ett_gryphon_pgm_list, NULL, "Program %u", i); proto_tree_add_item(tree, hf_gryphon_list_name, tvb, offset, 32, ENC_NA|ENC_ASCII); offset += 32; proto_tree_add_item(tree, hf_gryphon_list_description, tvb, offset, 80, ENC_NA|ENC_ASCII); offset += 80; } return offset; } static int cmd_start(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *pt) { char *string; gint length; int msglen; int hdr_stuff = offset; msglen = tvb_reported_length_remaining(tvb, offset); offset = cmd_delete(tvb, offset, pt); /* decode the name */ if (offset < msglen + hdr_stuff) { string = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &length, ENC_ASCII); if (length > 1) { proto_tree_add_string(pt, hf_gryphon_start_arguments, tvb, offset, length, string); offset += length; length = 3 - (length + 3) % 4; if (length) { proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA); offset += length; } } } return offset; } static int resp_start(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; msglen = tvb_reported_length_remaining(tvb, offset); if (msglen > 0) { proto_tree_add_item(pt, hf_gryphon_start_channel, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; } return offset; } static int resp_status(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_item *item; proto_tree *tree; unsigned int i, copies, length, channel; copies = tvb_get_guint8(tvb, offset); item = proto_tree_add_item(pt, hf_gryphon_status_num_running_copies, tvb, offset, 1, ENC_BIG_ENDIAN); tree = proto_item_add_subtree (item, ett_gryphon_pgm_status); offset += 1; if (copies) { for (i = 1; i <= copies; i++) { channel = tvb_get_guint8(tvb, offset); proto_tree_add_uint_format(tree, hf_gryphon_program_channel_number, tvb, offset, 1, channel, "Program %u channel (client) number %u", i, channel); offset += 1; } } length = 3 - (copies + 1 + 3) % 4; if (length) { proto_tree_add_item(pt, hf_gryphon_padding, tvb, offset, length, ENC_NA); offset += length; } return offset; } static int cmd_options(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; proto_tree *tree; unsigned int i, size, padding, option, option_length, option_value; const char *string, *string1; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_options_handle, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; msglen -= 4; for (i = 1; msglen > 0; i++) { option_length = tvb_get_guint8(tvb, offset+1); size = option_length + 2; padding = 3 - ((size + 3) %4); tree = proto_tree_add_subtree_format(pt, tvb, offset, size + padding, ett_gryphon_pgm_options, NULL, "Option number %u", i); option = tvb_get_guint8(tvb, offset); switch (option_length) { case 1: option_value = tvb_get_guint8(tvb, offset+2); break; case 2: option_value = tvb_get_ntohs(tvb, offset+2); break; case 4: option_value = tvb_get_ntohl(tvb, offset+2); break; default: option_value = 0; } string = "unknown option"; string1 = "unknown option data"; switch (option) { case PGM_CONV: string = "Type of data in the file"; switch (option_value) { case PGM_BIN: string1 = "Binary - Don't modify"; break; case PGM_ASCII: string1 = "ASCII - Remove CR's"; break; } break; case PGM_TYPE: string = "Type of file"; switch (option_value) { case PGM_PGM: string1 = "Executable"; break; case PGM_DATA: string1 = "Data"; break; } break; } proto_tree_add_uint_format_value(tree, hf_gryphon_option, tvb, offset, 1, option, "%s", string); proto_tree_add_bytes_format_value(tree, hf_gryphon_option_data, tvb, offset+2, option_length, NULL, "%s", string1); if (padding) proto_tree_add_item(tree, hf_gryphon_padding, tvb, offset+option_length+2, padding, ENC_NA); offset += size + padding; msglen -= size + padding; } return offset; } static int cmd_files(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; guint8 file; msglen = tvb_reported_length_remaining(tvb, offset); file = tvb_get_guint8(tvb, offset); if (file == 0) proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "First group of names"); else proto_tree_add_uint_format(pt, hf_gryphon_cmd_file, tvb, offset, 1, file, "Subsequent group of names"); proto_tree_add_item(pt, hf_gryphon_files, tvb, offset+1, msglen-1, ENC_NA|ENC_ASCII); offset += msglen; return offset; } static int resp_files(tvbuff_t *tvb, int offset, proto_tree *pt) { int msglen; msglen = tvb_reported_length_remaining(tvb, offset); proto_tree_add_item(pt, hf_gryphon_more_filenames, tvb, offset, 1, ENC_NA); proto_tree_add_item(pt, hf_gryphon_filenames, tvb, offset+1, msglen-1, ENC_ASCII|ENC_NA); offset += msglen; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_register_non_legacy(tvbuff_t *tvb, int offset, proto_tree *pt) { int remain; unsigned int ui_block; guint32 ui_ids; int id_usdtreq; int id_usdtresp; int id_uudtresp; guint8 u8_options; guint8 u8USDTReqExtAddr_bit; guint8 u8USDTRespExtAddr_bit; guint8 u8UUDTRespExtAddr_bit; guint8 u8USDTReqExtAddr; guint8 u8USDTRespExtAddr; guint8 u8UUDTRespExtAddr; guint8 u8USDTReqHeaderSize; guint8 u8USDTRespHeaderSize; guint8 u8UUDTRespHeaderSize; guint8 flags; proto_tree *tree1; proto_tree *tree2; proto_tree *tree3; proto_tree *tree4; proto_tree *tree5; static int * const transmit_options_flags[] = { &hf_gryphon_usdt_transmit_options_flags_echo, &hf_gryphon_usdt_transmit_options_action, &hf_gryphon_usdt_transmit_options_done_event, &hf_gryphon_usdt_transmit_options_echo_short, &hf_gryphon_usdt_transmit_options_rx_nth_fc, NULL }; static int * const receive_options_flags[] = { &hf_gryphon_usdt_receive_options_action, &hf_gryphon_usdt_receive_options_firstframe_event, &hf_gryphon_usdt_receive_options_lastframe_event, &hf_gryphon_usdt_receive_options_tx_nth_fc, NULL }; static int * const length_options_flags[] = { &hf_gryphon_usdt_length_control_j1939, NULL }; remain = tvb_reported_length_remaining(tvb, offset); /* 20171012 */ /* Action flags */ flags = tvb_get_guint8(tvb, offset); tree1 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_action_flags, NULL, "Action flags 0x%02x", flags); proto_tree_add_item(tree1, hf_gryphon_usdt_action_flags_non_legacy, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; remain -= 1; /* tx options */ flags = tvb_get_guint8(tvb, offset); tree2 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_tx_options_flags, NULL, "Transmit options 0x%02x", flags); proto_tree_add_bitmask(tree2, tvb, offset, hf_gryphon_usdt_transmit_options_flags, ett_gryphon_flags, transmit_options_flags, ENC_BIG_ENDIAN); offset += 1; remain -= 1; /* rx options */ flags = tvb_get_guint8(tvb, offset); tree3 = proto_tree_add_subtree_format(pt, tvb, offset, 1, ett_gryphon_usdt_rx_options_flags, NULL, "Receive options 0x%02x", flags); proto_tree_add_bitmask(tree3, tvb, offset, hf_gryphon_usdt_receive_options_flags, ett_gryphon_flags, receive_options_flags, ENC_BIG_ENDIAN); offset += 1; remain -= 1; /* reserved */ proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); offset += 1; remain -= 1; /* blocks */ ui_block = 1; while (remain > 0) { tree4 = proto_tree_add_subtree_format(pt, tvb, offset, 20, ett_gryphon_usdt_data_block, NULL, "Block %u", ui_block); /* TODO implement J1939-style length address src and dst byte swap */ /* mask the upper bits of the long */ /* number of IDs in the block */ ui_ids = tvb_get_ntohl (tvb, offset); u8_options = ((ui_ids >> 24) & 0xE0); ui_ids &= 0x1FFFFFFF; /* mask the upper control bits */ proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_nids, tvb, offset, 4, ui_ids, "%u", ui_ids); if(ui_ids == 0) { proto_item_set_len(tree4, 20); } else { /* display control bits */ tree5 = proto_tree_add_subtree_format(tree4, tvb, offset, 1, ett_gryphon_usdt_len_options_flags, NULL, "Options 0x%02x", u8_options); proto_tree_add_bitmask(tree5, tvb, offset, hf_gryphon_usdt_length_options_flags, ett_gryphon_flags, length_options_flags, ENC_BIG_ENDIAN); offset += 4; remain -= 4; u8UUDTRespExtAddr = tvb_get_guint8(tvb, offset+10); u8USDTRespExtAddr = tvb_get_guint8(tvb, offset+13); u8USDTReqExtAddr = tvb_get_guint8(tvb, offset+16); if(ui_ids == 1) { /* single ID */ /* add extended address display of the IDs */ /* mask the upper bits of the IDs */ /* usdt req */ id_usdtreq = tvb_get_ntohl (tvb, offset); u8USDTReqExtAddr_bit = ((id_usdtreq >> 24) & 0x20); u8USDTReqHeaderSize = ((id_usdtreq >> 24) & 0x80); id_usdtreq &= 0x1FFFFFFF; /* usdt req */ if(u8USDTReqExtAddr_bit == 0) { if(u8USDTReqHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x (11-bit)", id_usdtreq); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x (29-bit)", id_usdtreq); } } else { u8USDTReqExtAddr = tvb_get_guint8(tvb, offset+16); if(u8USDTReqHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x (11-bit extended address %01x)", id_usdtreq, u8USDTReqExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x (29-bit extended address %01x)", id_usdtreq, u8USDTReqExtAddr); } } offset += 4; remain -= 4; /* usdt resp */ id_usdtresp = tvb_get_ntohl (tvb, offset); u8USDTRespExtAddr_bit = ((id_usdtresp >> 24) & 0x20); u8USDTRespHeaderSize = ((id_usdtresp >> 24) & 0x80); id_usdtresp &= 0x1FFFFFFF; /* usdt resp */ if(u8USDTRespExtAddr_bit == 0) { if(u8USDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x (11-bit)", id_usdtresp); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x (29-bit)", id_usdtresp); } } else { u8USDTRespExtAddr = tvb_get_guint8(tvb, offset+13); if(u8USDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x (11-bit extended address %01x)", id_usdtresp, u8USDTRespExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x (29-bit extended address %01x)", id_usdtresp, u8USDTRespExtAddr); } } offset += 4; remain -= 4; /* uudt resp */ id_uudtresp = tvb_get_ntohl (tvb, offset); u8UUDTRespExtAddr_bit = ((id_uudtresp >> 24) & 0x20); u8UUDTRespHeaderSize = ((id_uudtresp >> 24) & 0x80); id_uudtresp &= 0x1FFFFFFF; /* uudt resp */ if(u8UUDTRespExtAddr_bit == 0) { if(u8UUDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x (11-bit)", id_uudtresp); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x (29-bit)", id_uudtresp); } } else { u8UUDTRespExtAddr = tvb_get_guint8(tvb, offset+10); if(u8UUDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x (11-bit extended address %01x)", id_uudtresp, u8UUDTRespExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x (29-bit extended address %01x)", id_uudtresp, u8UUDTRespExtAddr); } } offset += 4; remain -= 4; } else { /* multiple IDs */ /* add extended address display of the IDs */ /* mask the upper bits of the IDs */ /* usdt req */ id_usdtreq = tvb_get_ntohl (tvb, offset); u8USDTReqExtAddr_bit = ((id_usdtreq >> 24) & 0x20); u8USDTReqHeaderSize = ((id_usdtreq >> 24) & 0x80); id_usdtreq &= 0x1FFFFFFF; /* usdt req */ if(u8USDTReqExtAddr_bit == 0) { if(u8USDTReqHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x through 0x%02x (11-bit)", id_usdtreq, id_usdtreq + ui_ids-1); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x through 0x%04x (29-bit)", id_usdtreq, id_usdtreq + ui_ids-1); } } else { u8USDTReqExtAddr = tvb_get_guint8(tvb, offset+16); if(u8USDTReqHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%02x through 0x%02x (11-bit extended address %0x)", id_usdtreq, id_usdtreq + ui_ids-1, u8USDTReqExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request, tvb, offset, 4, id_usdtreq, "0x%04x through 0x%04x (29-bit extended address %0x)", id_usdtreq, id_usdtreq + ui_ids-1, u8USDTReqExtAddr); } } offset += 4; remain -= 4; /* usdt resp */ id_usdtresp = tvb_get_ntohl (tvb, offset); u8USDTRespExtAddr_bit = ((id_usdtresp >> 24) & 0x20); u8USDTRespHeaderSize = ((id_usdtresp >> 24) & 0x80); id_usdtresp &= 0x1FFFFFFF; /* usdt resp */ if(u8USDTRespExtAddr_bit == 0) { if(u8USDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x through 0x%02x (11-bit)", id_usdtresp, id_usdtresp + ui_ids-1); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x through 0x%04x (29-bit)", id_usdtresp, id_usdtresp + ui_ids-1); } } else { u8USDTRespExtAddr = tvb_get_guint8(tvb, offset+13); if(u8USDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%02x through 0x%02x (11-bit extended address %01x)", id_usdtresp, id_usdtresp + ui_ids-1, u8USDTRespExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response, tvb, offset, 4, id_usdtresp, "0x%04x through 0x%04x (29-bit extended address %01x)", id_usdtresp, id_usdtresp + ui_ids-1, u8USDTRespExtAddr); } } offset += 4; remain -= 4; /* uudt resp */ id_uudtresp = tvb_get_ntohl (tvb, offset); u8UUDTRespExtAddr_bit = ((id_uudtresp >> 24) & 0x20); u8UUDTRespHeaderSize = ((id_uudtresp >> 24) & 0x80); id_uudtresp &= 0x1FFFFFFF; /* uudt resp */ if(u8UUDTRespExtAddr_bit == 0) { if(u8UUDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x through 0x%02x (11-bit)", id_uudtresp, id_uudtresp + ui_ids-1); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x through 0x%04x (29-bit)", id_uudtresp, id_uudtresp + ui_ids-1); } } else { u8UUDTRespExtAddr = tvb_get_guint8(tvb, offset+10); if(u8UUDTRespHeaderSize == 0) { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%02x through 0x%02x (11-bit extended address %01x)", id_uudtresp, id_uudtresp + ui_ids-1, u8UUDTRespExtAddr); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response, tvb, offset, 4, id_uudtresp, "0x%04x through 0x%04x (29-bit extended address %01x)", id_uudtresp, id_uudtresp + ui_ids-1, u8UUDTRespExtAddr); } } offset += 4; remain -= 4; } if(u8USDTReqExtAddr_bit == 0) { /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */ proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request_ext, tvb, offset, 1, 0, "(no extended address)"); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_request_ext, tvb, offset, 1, u8USDTReqExtAddr, "0x%01x", u8USDTReqExtAddr); } offset += 1; remain -= 1; if(u8USDTRespExtAddr_bit == 0) { /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */ proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response_ext, tvb, offset, 1, 0, "(no extended address)"); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_usdt_response_ext, tvb, offset, 1, u8USDTRespExtAddr, "0x%01x", u8USDTRespExtAddr); } offset += 1; remain -= 1; if(u8UUDTRespExtAddr_bit == 0) { /* proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); */ proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response_ext, tvb, offset, 1, 0, "(no extended address)"); } else { proto_tree_add_uint_format_value(tree4, hf_gryphon_uudt_response_ext, tvb, offset, 1, u8UUDTRespExtAddr, "0x%01x", u8UUDTRespExtAddr); } offset += 1; remain -= 1; proto_tree_add_item(tree4, hf_gryphon_reserved, tvb, offset, 1, ENC_NA); offset += 1; remain -= 1; } ui_block += 1; } return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_stmin_fc(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_usdt_stmin_fc, tvb, offset, 1, ENC_NA); offset += 1; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_bsmax_fc(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_usdt_bsmax_fc, tvb, offset, 1, ENC_NA); offset += 1; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_stmin_override(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override, tvb, offset, 1, ENC_NA); offset += 1; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_get_stmin_override(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override, tvb, offset, 1, ENC_NA); offset += 1; /* fixed this for get */ proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override_active, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_stmin_override_activate(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_usdt_stmin_override_activate, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; return offset; } /* 20171012 gryphon command for USDT */ static int cmd_usdt_set_stmin_mul(tvbuff_t *tvb, int offset, proto_tree *pt) { float value; /* TODO fix this float value? */ value = tvb_get_ntohieee_float (tvb, offset); proto_tree_add_float_format_value(pt, hf_gryphon_usdt_set_stmin_mul, tvb, offset, 4, value, "%.1f", value); offset += 4; return offset; } /* * legacy command for usdt register */ static int cmd_usdt(tvbuff_t *tvb, int offset, proto_tree *pt) { int ids, id, remain, size, i, bytes; guint8 flags; proto_tree *localTree; proto_item *localItem; flags = tvb_get_guint8(tvb, offset); proto_tree_add_item(pt, hf_gryphon_usdt_flags_register, tvb, offset, 1, ENC_BIG_ENDIAN); if (flags & 1) { static int * const action_flags[] = { &hf_gryphon_usdt_action_flags_register, &hf_gryphon_usdt_action_flags_action, NULL }; static int * const transmit_option_flags[] = { &hf_gryphon_usdt_transmit_options_flags_echo, &hf_gryphon_usdt_transmit_options_action, &hf_gryphon_usdt_transmit_options_send_done, NULL }; static int * const receive_option_flags[] = { &hf_gryphon_usdt_receive_options_action, &hf_gryphon_usdt_receive_options_firstframe, &hf_gryphon_usdt_receive_options_lastframe, NULL }; proto_tree_add_bitmask(pt, tvb, offset, hf_gryphon_usdt_action_flags, ett_gryphon_flags, action_flags, ENC_BIG_ENDIAN); proto_tree_add_bitmask(pt, tvb, offset+1, hf_gryphon_usdt_transmit_options_flags, ett_gryphon_flags, transmit_option_flags, ENC_BIG_ENDIAN); proto_tree_add_bitmask(pt, tvb, offset+2, hf_gryphon_usdt_receive_options_flags, ett_gryphon_flags, receive_option_flags, ENC_BIG_ENDIAN); if ((ids = tvb_get_guint8(tvb, offset+3))) { localItem = proto_tree_add_item(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1, ENC_BIG_ENDIAN); offset += 4; localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data); while (ids) { proto_tree_add_item(localTree, hf_gryphon_usdt_ext_address_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; ids--; } } else { proto_tree_add_uint_format_value(pt, hf_gryphon_usdt_ext_address, tvb, offset+3, 1, 0, "Using extended addressing for the single, internally defined, ID"); offset += 4; } for (i = 0; i < 2; i++) { bytes = tvb_reported_length_remaining (tvb, offset); if (bytes <= 0) break; localTree = proto_tree_add_subtree_format(pt, tvb, offset, 16, ett_gryphon_usdt_data, NULL, "%s block of USDT/UUDT IDs", i==0?"First":"Second"); size = tvb_get_ntohl (tvb, offset); localItem = proto_tree_add_item(localTree, hf_gryphon_usdt_block_size, tvb, offset, 4, ENC_BIG_ENDIAN); localTree = proto_item_add_subtree (localItem, ett_gryphon_usdt_data_block); if (size == 0) { proto_item_set_len(localItem, 16); } else { offset += 4; id = tvb_get_ntohl (tvb, offset); proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_request, tvb, offset, 4, id, "%04X through %04X", id, id+size-1); offset += 4; id = tvb_get_ntohl (tvb, offset); proto_tree_add_uint_format_value(localTree, hf_gryphon_usdt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1); offset += 4; id = tvb_get_ntohl (tvb, offset); proto_tree_add_uint_format_value(localTree, hf_gryphon_uudt_response, tvb, offset, 4, id, "%04X through %04X", id, id+size-1); offset += 4; } } } else { proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; } if ((remain = tvb_reported_length_remaining(tvb, offset))) { proto_tree_add_item(pt, hf_gryphon_ignored, tvb, offset, remain, ENC_NA); offset += remain; } return offset; } static int cmd_bits_in (tvbuff_t *tvb, int offset, proto_tree *pt) { int value; value = tvb_get_guint8(tvb, offset); if (value) { static int * const digital_values[] = { &hf_gryphon_bits_in_input1, &hf_gryphon_bits_in_input2, &hf_gryphon_bits_in_input3, &hf_gryphon_bits_in_pushbutton, NULL }; proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_in_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA); } else { proto_tree_add_uint_format(pt, hf_gryphon_bit_in_digital_data, tvb, offset, 1, value, "No digital values are set"); } offset++; return offset; } static int cmd_bits_out (tvbuff_t *tvb, int offset, proto_tree *pt) { int value; value = tvb_get_guint8(tvb, offset); if (value) { static int * const digital_values[] = { &hf_gryphon_bits_out_output1, &hf_gryphon_bits_out_output2, NULL }; proto_tree_add_bitmask(pt, tvb, 1, hf_gryphon_bit_out_digital_data, ett_gryphon_digital_data, digital_values, ENC_NA); } else { proto_tree_add_uint_format(pt, hf_gryphon_bit_out_digital_data, tvb, offset, 1, value, "No digital values are set"); } offset++; return offset; } static int cmd_init_strat (tvbuff_t *tvb, int offset, proto_tree *pt) { guint32 reset_limit; int msglen, indx; float value; msglen = tvb_reported_length_remaining(tvb, offset); reset_limit = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(pt, hf_gryphon_init_strat_reset_limit, tvb, offset, 4, reset_limit, "Reset Limit = %u messages", reset_limit); offset += 4; msglen -= 4; for (indx = 1; msglen; indx++, offset++, msglen--) { value = tvb_get_guint8(tvb, offset); if (value) proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1, value/4, "Delay %d = %.2f seconds", indx, value/4); else proto_tree_add_float_format_value(pt, hf_gryphon_init_strat_delay, tvb, offset, 1, 0, "Delay %d = infinite", indx); } return offset; } static int speed(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_tree_add_item(pt, hf_gryphon_speed_baud_rate_index, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset+1, 3, ENC_NA); offset += 4; return offset; } static int blm_mode(tvbuff_t *tvb, int offset, proto_tree *pt) { proto_item *item; proto_tree *tree; guint32 mode, milliseconds; item = proto_tree_add_item_ret_uint(pt, hf_gryphon_blm_mode, tvb, offset, 4, ENC_BIG_ENDIAN, &mode); tree = proto_item_add_subtree(item, ett_gryphon_blm_mode); offset += 4; switch (mode) { case 1: milliseconds = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(tree, hf_gryphon_blm_mode_avg_period, tvb, offset, 4, milliseconds, "%d.%03d seconds", milliseconds/1000, milliseconds%1000); break; case 2: proto_tree_add_item(tree, hf_gryphon_blm_mode_avg_frames, tvb, offset, 4, ENC_BIG_ENDIAN); break; default: proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset, 4, ENC_NA); break; } offset += 4; return offset; } static gryphon_conversation* get_conversation_data(packet_info* pinfo) { conversation_t *conversation; gryphon_conversation *conv_data; /* Find a conversation, create a new if no one exists */ conversation = find_or_create_conversation(pinfo); conv_data = (gryphon_conversation*)conversation_get_proto_data(conversation, proto_gryphon); if (conv_data == NULL) { conv_data = wmem_new(wmem_file_scope(), gryphon_conversation); conv_data->request_frame_data = wmem_list_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_gryphon, (void *)conv_data); } return conv_data; } static int decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int dst, proto_tree *pt) { guint32 cmd; guint32 context, ioctl_command; proto_tree *ft; proto_item *hi; gryphon_pkt_info_t *pkt_info; hi = proto_tree_add_item_ret_uint(pt, hf_gryphon_cmd, tvb, offset, 1, ENC_BIG_ENDIAN, &cmd); proto_item_set_hidden(hi); if (cmd > 0x3F) cmd += dst * 256; pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); if (!pkt_info) { /* Find a conversation, create a new if no one exists */ gryphon_conversation *conv_data = get_conversation_data(pinfo); pkt_info = wmem_new0(wmem_file_scope(), gryphon_pkt_info_t); /* load information into the request frame */ pkt_info->cmd = cmd; pkt_info->req_frame_num = pinfo->num; pkt_info->req_time = pinfo->abs_ts; wmem_list_prepend(conv_data->request_frame_data, pkt_info); p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb), pkt_info); } proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd); proto_tree_add_item_ret_uint(pt, hf_gryphon_cmd_context, tvb, offset + 1, 1, ENC_NA, &context); if (!pinfo->fd->visited) { pkt_info->cmd_context = context; } proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset + 2, 2, ENC_NA); if (pkt_info->rsp_frame_num > 0) { proto_item* it = proto_tree_add_uint(pt, hf_gryphon_response_in, tvb, 0, 0, pkt_info->rsp_frame_num); proto_item_set_generated(it); } offset += 4; msglen -= 4; if (msglen > 0) { ft = proto_tree_add_subtree_format(pt, tvb, offset, msglen, ett_gryphon_command_data, NULL, "Data: (%d byte%s)", msglen, plurality(msglen, "", "s")); switch (cmd) { case CMD_INIT: offset = cmd_init(tvb, offset, ft); break; case CMD_EVENT_ENABLE: case CMD_EVENT_DISABLE: offset = eventnum(tvb, offset, ft); break; case CMD_SET_TIME: offset = resp_time(tvb, offset, ft); break; case CMD_CARD_SET_SPEED: offset = speed(tvb, offset, ft); break; case CMD_CARD_SET_FILTER: offset = cmd_setfilt(tvb, offset, ft); break; case CMD_CARD_GET_FILTER: offset = resp_addfilt(tvb, offset, ft); break; case CMD_CARD_TX: offset = decode_data(tvb, offset, ft); break; case CMD_CARD_ADD_FILTER: offset = cmd_addfilt(tvb, offset, ft); break; case CMD_CARD_MODIFY_FILTER: offset = cmd_modfilt(tvb, offset, ft); break; case CMD_CARD_SET_DEFAULT_FILTER: offset = dfiltmode(tvb, offset, ft); break; case CMD_CARD_SET_FILTER_MODE: offset = filtmode(tvb, offset, ft); break; case CMD_SERVER_REG: offset = cmd_register(tvb, offset, ft); break; case CMD_SERVER_SET_SORT: offset = cmd_sort(tvb, offset, ft); break; case CMD_SERVER_SET_OPT: offset = cmd_optimize(tvb, offset, ft); break; case CMD_BLM_SET_MODE: offset = blm_mode(tvb, offset, ft); break; case CMD_LDF_LIST: offset = cmd_ldf_list(tvb, offset, ft); break; case CMD_LDF_DELETE: offset = cmd_ldf_delete(tvb, offset, ft); break; case CMD_LDF_DESC: offset = cmd_ldf_desc(tvb, offset, ft); break; case CMD_LDF_UPLOAD: offset = cmd_ldf_upload(tvb, offset, ft); break; case CMD_LDF_PARSE: offset = cmd_ldf_parse(tvb, offset, ft); break; case CMD_GET_NODE_SIGNALS: offset = cmd_ldf_get_node_signals(tvb, offset, ft); break; case CMD_GET_FRAMES: offset = cmd_ldf_get_frames(tvb, offset, ft); break; case CMD_GET_FRAME_INFO: offset = cmd_ldf_get_frame_info(tvb, pinfo, offset, ft); break; case CMD_GET_SIGNAL_INFO: offset = cmd_ldf_get_signal_info(tvb, offset, ft); break; case CMD_GET_SIGNAL_DETAIL: offset = cmd_ldf_get_signal_detail(tvb, offset, ft); break; case CMD_GET_ENCODING_INFO: offset = cmd_ldf_get_encoding_info(tvb, offset, ft); break; case CMD_SAVE_SESSION: offset = cmd_ldf_save_session(tvb, offset, ft); break; case CMD_EMULATE_NODES: offset = cmd_ldf_emulate_nodes(tvb, pinfo, offset, ft); break; case CMD_START_SCHEDULE: offset = cmd_ldf_start_schedule(tvb, offset, ft); break; case CMD_RESTORE_SESSION: offset = cmd_restore_session(tvb, offset, ft); break; case CMD_CNVT_GET_VALUES: offset = cmd_cnvt_get_values(tvb, offset, ft); break; case CMD_CNVT_GET_UNITS: offset = cmd_cnvt_get_units(tvb, offset, ft); break; case CMD_CNVT_SET_VALUES: offset = cmd_cnvt_set_values(tvb, offset, ft); break; case CMD_CNVT_SAVE_SESSION: offset = cmd_ldf_save_session(tvb, offset, ft); break; case CMD_CNVT_RESTORE_SESSION: offset = cmd_restore_session(tvb, offset, ft); break; case CMD_CNVT_DESTROY_SESSION: offset = cmd_cnvt_destroy_session(tvb, offset, ft); break; case CMD_CNVT_GET_NODE_SIGNALS: offset = cmd_ldf_get_node_signals(tvb, offset, ft); break; case CMD_MSGRESP_ADD: offset = cmd_addresp(tvb, offset, pinfo, ft); break; case CMD_MSGRESP_GET: offset = resp_addresp(tvb, offset, ft); break; case CMD_MSGRESP_MODIFY: offset = cmd_modresp(tvb, offset, ft); break; case CMD_PGM_DESC: offset = cmd_desc(tvb, offset, ft); break; case CMD_PGM_UPLOAD: offset = cmd_upload(tvb, offset, ft); break; case CMD_PGM_DELETE: offset = cmd_delete(tvb, offset, ft); break; case CMD_PGM_LIST: offset = cmd_list(tvb, offset, ft); break; case CMD_PGM_START: offset = cmd_start(tvb, pinfo, offset, ft); break; case CMD_PGM_STOP: offset = resp_start(tvb, offset, ft); break; case CMD_PGM_STATUS: offset = cmd_delete(tvb, offset, ft); break; case CMD_PGM_OPTIONS: offset = cmd_options(tvb, offset, ft); break; case CMD_PGM_FILES: offset = cmd_files(tvb, offset, ft); break; case CMD_SCHED_TX: offset = cmd_sched(tvb, offset, ft); break; case CMD_SCHED_KILL_TX: offset = resp_sched(tvb, offset, ft); break; case CMD_SCHED_MSG_REPLACE: offset = cmd_sched_rep(tvb, offset, ft); break; case CMD_USDT_REGISTER: offset = cmd_usdt(tvb, offset, ft); break; case CMD_USDT_SET_FUNCTIONAL: offset = cmd_usdt(tvb, offset, ft); break; case CMD_USDT_SET_STMIN_MULT: offset = cmd_usdt_set_stmin_mul(tvb, offset, ft); break; case CMD_USDT_REGISTER_NON_LEGACY: offset = cmd_usdt_register_non_legacy(tvb, offset, ft); break; case CMD_USDT_SET_STMIN_FC: offset = cmd_usdt_stmin_fc(tvb, offset, ft); break; case CMD_USDT_SET_BSMAX_FC: offset = cmd_usdt_bsmax_fc(tvb, offset, ft); break; case CMD_USDT_SET_STMIN_OVERRIDE: offset = cmd_usdt_stmin_override(tvb, offset, ft); break; case CMD_USDT_ACTIVATE_STMIN_OVERRIDE: offset = cmd_usdt_stmin_override_activate(tvb, offset, ft); break; case CMD_IOPWR_CLRLATCH: offset = cmd_bits_in(tvb, offset, ft); break; case CMD_IOPWR_SETOUT: case CMD_IOPWR_SETBIT: case CMD_IOPWR_CLRBIT: offset = cmd_bits_out(tvb, offset, ft); break; case CMD_UTIL_SET_INIT_STRATEGY: offset = cmd_init_strat(tvb, offset, ft); break; case CMD_CARD_IOCTL: ioctl_command = tvb_get_ntohl(tvb, offset); /* save the IOCTL in the context array for use during the command response */ if (!pinfo->fd->visited) { pkt_info->ioctl_command = ioctl_command; } offset = cmd_ioctl(tvb, pinfo, offset, ft, ioctl_command); break; default: proto_tree_add_item(ft, hf_gryphon_data, tvb, offset, msglen, ENC_NA); offset += msglen; break; } } return offset; } static int decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tree *pt) { int msglen; guint32 cmd; proto_tree *ft; gryphon_pkt_info_t *pkt_info, *pkt_info_list; msglen = tvb_reported_length_remaining(tvb, offset); cmd = tvb_get_guint8(tvb, offset); if (cmd > 0x3F) cmd += src * 256; pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); if (!pkt_info) { /* Find a conversation, create a new if no one exists */ gryphon_conversation *conv_data = get_conversation_data(pinfo); pkt_info = wmem_new0(wmem_file_scope(), gryphon_pkt_info_t); wmem_list_frame_t *frame = wmem_list_head(conv_data->request_frame_data); /* Step backward through all logged instances of request frames, looking for a request frame number that occurred immediately prior to current frame number that has a matching command */ while (frame) { pkt_info_list = (gryphon_pkt_info_t*)wmem_list_frame_data(frame); if ((pinfo->num > pkt_info_list->req_frame_num) && (pkt_info_list->rsp_frame_num == 0) && (pkt_info_list->cmd == cmd)) { pkt_info->req_frame_num = pkt_info_list->req_frame_num; pkt_info->cmd_context = pkt_info_list->cmd_context; pkt_info->ioctl_command = pkt_info_list->ioctl_command; pkt_info->req_time = pkt_info_list->req_time; pkt_info_list->rsp_frame_num = pinfo->num; break; } frame = wmem_list_frame_next(frame); } p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb), pkt_info); } /* * This is the old original way of displaying. * * XXX - is there some reason not to display the context for ioctl * commands, and to display the ioctl code here, rather than in * the part of the tree for the ioctl response? */ proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd); if (pkt_info->ioctl_command != 0) { proto_tree_add_uint(pt, hf_gryphon_cmd_ioctl_context, tvb, 0, 0, pkt_info->ioctl_command); } else { proto_tree_add_item(pt, hf_gryphon_cmd_context, tvb, offset + 1, 1, ENC_NA); } proto_tree_add_item(pt, hf_gryphon_reserved, tvb, offset + 2, 2, ENC_NA); offset += 4; msglen -= 4; proto_tree_add_item(pt, hf_gryphon_status, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; msglen -= 4; if (pkt_info->req_frame_num) { proto_item *it; nstime_t ns; it = proto_tree_add_uint(pt, hf_gryphon_response_to, tvb, 0, 0, pkt_info->req_frame_num); proto_item_set_generated(it); nstime_delta(&ns, &pinfo->fd->abs_ts, &pkt_info->req_time); it = proto_tree_add_time(pt, hf_gryphon_response_time, tvb, 0, 0, &ns); proto_item_set_generated(it); } if (msglen > 0) { ft = proto_tree_add_subtree_format(pt, tvb, offset, msglen, ett_gryphon_response_data, NULL, "Data: (%d byte%s)", msglen, plurality(msglen, "", "s")); switch (cmd) { case CMD_GET_CONFIG: offset = resp_config(tvb, offset, ft); break; case CMD_GET_TIME: offset = resp_time(tvb, offset, ft); break; case CMD_CARD_GET_SPEED: offset = speed(tvb, offset, ft); break; case CMD_CARD_GET_FILTER: offset = cmd_addfilt(tvb, offset, ft); break; case CMD_CARD_ADD_FILTER: offset = resp_addfilt(tvb, offset, ft); break; case CMD_CARD_GET_FILTER_HANDLES: offset = resp_filthan(tvb, offset, ft); break; case CMD_CARD_GET_DEFAULT_FILTER: offset = dfiltmode(tvb, offset, ft); break; case CMD_CARD_GET_FILTER_MODE: offset = filtmode(tvb, offset, ft); break; case CMD_CARD_GET_EVNAMES: offset = resp_events(tvb, offset, ft); break; case CMD_CARD_GET_SPEEDS: offset = resp_getspeeds(tvb, offset, ft); break; case CMD_SERVER_REG: offset = resp_register(tvb, offset, ft); break; case CMD_BLM_GET_MODE: offset = blm_mode(tvb, offset, ft); break; case CMD_BLM_GET_DATA: offset = resp_blm_data(tvb, offset, ft); break; case CMD_BLM_GET_STATS: offset = resp_blm_stat(tvb, offset, ft); break; case CMD_LDF_LIST: offset = resp_ldf_list(tvb, offset, ft); break; case CMD_LDF_DESC: offset = resp_ldf_desc(tvb, offset, ft); break; case CMD_GET_LDF_INFO: offset = resp_get_ldf_info(tvb, offset, ft); break; case CMD_GET_NODE_NAMES: offset = resp_ldf_get_node_names(tvb, offset, ft); break; case CMD_GET_NODE_SIGNALS: offset = resp_ldf_get_node_signals(tvb, offset, ft); break; case CMD_GET_FRAMES: offset = resp_ldf_get_frames(tvb, offset, ft); break; case CMD_GET_FRAME_INFO: offset = resp_ldf_get_frame_info(tvb, offset, ft); break; case CMD_GET_SIGNAL_INFO: offset = resp_ldf_get_signal_info(tvb, offset, ft); break; case CMD_GET_SIGNAL_DETAIL: offset = resp_ldf_get_signal_detail(tvb, pinfo, offset, ft); break; case CMD_GET_ENCODING_INFO: offset = resp_ldf_get_encoding_info(tvb, pinfo, offset, ft); break; case CMD_GET_SCHEDULES: offset = resp_ldf_get_schedules(tvb, offset, ft); break; case CMD_RESTORE_SESSION: offset = resp_restore_session(tvb, offset, ft); break; case CMD_CNVT_GET_VALUES: offset = resp_cnvt_get_values(tvb, offset, ft); break; case CMD_CNVT_GET_UNITS: offset = resp_cnvt_get_units(tvb, offset, ft); break; case CMD_CNVT_RESTORE_SESSION: offset = resp_restore_session(tvb, offset, ft); break; case CMD_CNVT_GET_NODE_SIGNALS: offset = resp_ldf_get_node_signals(tvb, offset, ft); break; case CMD_MSGRESP_ADD: offset = resp_addresp(tvb, offset, ft); break; case CMD_MSGRESP_GET: offset = cmd_addresp(tvb, offset, pinfo, ft); break; case CMD_MSGRESP_GET_HANDLES: offset = resp_resphan(tvb, offset, ft); break; case CMD_PGM_DESC: offset = resp_desc(tvb, offset, ft); break; case CMD_PGM_LIST: offset = resp_list(tvb, offset, ft); break; case CMD_PGM_START: case CMD_PGM_START2: offset = resp_start(tvb, offset, ft); break; case CMD_PGM_STATUS: case CMD_PGM_OPTIONS: offset = resp_status(tvb, offset, ft); break; case CMD_PGM_FILES: offset = resp_files(tvb, offset, ft); break; case CMD_SCHED_TX: offset = resp_sched(tvb, offset, ft); break; case CMD_USDT_GET_STMIN_FC: offset = cmd_usdt_stmin_fc(tvb, offset, ft); break; case CMD_USDT_GET_BSMAX_FC: offset = cmd_usdt_bsmax_fc(tvb, offset, ft); break; case CMD_USDT_GET_STMIN_OVERRIDE: offset = cmd_usdt_get_stmin_override(tvb, offset, ft); break; case CMD_IOPWR_GETINP: case CMD_IOPWR_GETLATCH: case CMD_IOPWR_CLRLATCH: case CMD_IOPWR_GETPOWER: offset = cmd_bits_in(tvb, offset, ft); break; case CMD_IOPWR_GETOUT: offset = cmd_bits_out(tvb, offset, ft); break; case CMD_UTIL_GET_INIT_STRATEGY: offset = cmd_init_strat(tvb, offset, ft); break; case CMD_CARD_IOCTL: offset = cmd_ioctl_resp(tvb, pinfo, offset, ft, pkt_info->ioctl_command); break; default: proto_tree_add_item(ft, hf_gryphon_data, tvb, offset, msglen, ENC_NA); offset += msglen; } } return offset; } /* * 20180221 * This function exists because Gryphon Protocol MISC packets contain within them Gryphon Protocol packets. * So, this function will decode a packet and return the offset. */ static int dissect_gryphon_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_msgresp_add) { proto_tree *gryphon_tree; proto_item *ti, *type_item; proto_tree *header_tree, *body_tree; int msgend, msglen, msgpad; int offset = 0; guint32 src, dest, i, frmtyp, flags; if (!is_msgresp_add) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "Gryphon"); col_clear(pinfo->cinfo, COL_INFO); ti = proto_tree_add_item(tree, proto_gryphon, tvb, 0, -1, ENC_NA); gryphon_tree = proto_item_add_subtree(ti, ett_gryphon); } else { gryphon_tree = tree; } header_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset, MSG_HDR_SZ, ett_gryphon_header, NULL, "Header"); /* src */ proto_tree_add_item_ret_uint(header_tree, hf_gryphon_src, tvb, offset, 1, ENC_BIG_ENDIAN, &src); /* 20180306 20171012 */ /* srcchan */ if (is_special_client(src)) { proto_tree_add_item(header_tree, hf_gryphon_srcchanclient, tvb, offset + 1, 1, ENC_BIG_ENDIAN); } else { proto_tree_add_item(header_tree, hf_gryphon_srcchan, tvb, offset + 1, 1, ENC_BIG_ENDIAN); } /* dest */ proto_tree_add_item_ret_uint(header_tree, hf_gryphon_dest, tvb, offset + 2, 1, ENC_BIG_ENDIAN, &dest); /* 20180306 20171012 */ /* destchan */ if (is_special_client(dest)) { proto_tree_add_item(header_tree, hf_gryphon_destchanclient, tvb, offset + 3, 1, ENC_BIG_ENDIAN); } else { proto_tree_add_item(header_tree, hf_gryphon_destchan, tvb, offset + 3, 1, ENC_BIG_ENDIAN); } proto_tree_add_item_ret_uint(header_tree, hf_gryphon_data_length, tvb, offset + 4, 2, ENC_BIG_ENDIAN, &msglen); flags = tvb_get_guint8(tvb, offset + 6); frmtyp = flags & ~RESPONSE_FLAGS; type_item = proto_tree_add_uint(header_tree, hf_gryphon_type, tvb, offset + 6, 1, frmtyp); /* * Indicate what kind of message this is. */ if (!is_msgresp_add) col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(frmtyp, frame_type, "- Invalid -")); if (is_msgresp_add) { static int * const wait_flags[] = { &hf_gryphon_wait_resp, &hf_gryphon_wait_prev_resp, NULL }; proto_tree_add_bitmask(header_tree, tvb, offset + 6, hf_gryphon_wait_flags, ett_gryphon_flags, wait_flags, ENC_NA); } proto_tree_add_item(header_tree, hf_gryphon_reserved, tvb, offset + 7, 1, ENC_NA); offset += MSG_HDR_SZ; msgpad = 3 - (msglen + 3) % 4; msgend = offset + msglen + msgpad; body_tree = proto_tree_add_subtree(gryphon_tree, tvb, offset, msglen, ett_gryphon_body, NULL, "Body"); switch (frmtyp) { case GY_FT_CMD: offset = decode_command(tvb, pinfo, msglen, offset, dest, body_tree); break; case GY_FT_RESP: offset = decode_response(tvb, pinfo, offset, src, body_tree); break; case GY_FT_DATA: offset = decode_data(tvb, offset, body_tree); break; case GY_FT_EVENT: offset = decode_event(tvb, offset, body_tree); break; case GY_FT_MISC: offset = decode_misc(tvb, offset, pinfo, body_tree); break; case GY_FT_TEXT: offset = decode_text(tvb, offset, msglen, body_tree); break; case GY_FT_SIG: break; default: expert_add_info(pinfo, type_item, &ei_gryphon_type); proto_tree_add_item(body_tree, hf_gryphon_data, tvb, offset, msglen, ENC_NA); break; } /*debug*/ /*i = msgend - offset;*/ /*proto_tree_add_debug_text(gryphon_tree, "debug offset=%d msgend=%d i=%d",offset,msgend,i);*/ if (offset < msgend) { i = msgend - offset; /* * worked when msglen=4, offset=8, msgend=12, get i=4 * did not work when msglen=5, offset=8, msgend=16, i is 8 */ proto_tree_add_item(gryphon_tree, hf_gryphon_padding, tvb, offset, i, ENC_NA); offset += i; } return offset; } static guint get_gryphon_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { guint16 plen; int padded_len; /* * Get the length of the Gryphon packet, and then get the length as * padded to a 4-byte boundary. */ plen = tvb_get_ntohs(tvb, offset + 4); padded_len = plen + 3 - (plen + 3) % 4; /* * That length doesn't include the fixed-length part of the header; * add that in. */ return padded_len + GRYPHON_FRAME_HEADER_LEN; } static int dissect_gryphon_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { dissect_gryphon_message(tvb, pinfo, tree, FALSE); return tvb_reported_length(tvb); } static int dissect_gryphon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, gryphon_desegment, GRYPHON_FRAME_HEADER_LEN, get_gryphon_pdu_len, dissect_gryphon_pdu, data); return tvb_reported_length(tvb); } void proto_register_gryphon(void) { static hf_register_info hf[] = { { &hf_gryphon_src, { "Source", "gryphon.src", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0, NULL, HFILL }}, { &hf_gryphon_srcchan, { "Source channel", "gryphon.srcchan", FT_UINT8, BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0, NULL, HFILL }}, { &hf_gryphon_srcchanclient, { "Source client id", "gryphon.srcchanclient", FT_UINT8, BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0, NULL, HFILL }}, { &hf_gryphon_dest, { "Destination", "gryphon.dest", FT_UINT8, BASE_HEX, VALS(src_dest), 0x0, NULL, HFILL }}, { &hf_gryphon_destchan, { "Destination channel", "gryphon.destchan", FT_UINT8, BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0, NULL, HFILL }}, { &hf_gryphon_destchanclient, { "Destination client id", "gryphon.destchanclient", FT_UINT8, BASE_DEC | BASE_SPECIAL_VALS, VALS(channel_or_broadcast), 0x0, NULL, HFILL }}, { &hf_gryphon_type, { "Frame type", "gryphon.type", FT_UINT8, BASE_DEC, VALS(frame_type), 0x0, NULL, HFILL }}, { &hf_gryphon_cmd, { "Command", "gryphon.cmd", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_context, { "Context", "gryphon.cmd.context", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_ioctl_context, { "IOCTL Response", "gryphon.cmd.ioctl_response", FT_UINT32, BASE_DEC, VALS(ioctls), 0x0, NULL, HFILL }}, { &hf_gryphon_data, { "Data", "gryphon.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_padding, { "Padding", "gryphon.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ignored, { "Ignored", "gryphon.ignored", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_length, { "Data length (bytes)", "gryphon.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_reserved, { "Reserved", "gryphon.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_wait_flags, { "Flags", "gryphon.wait_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_wait_resp, { "Wait for response", "gryphon.wait_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), DONT_WAIT_FOR_RESP, NULL, HFILL }}, { &hf_gryphon_wait_prev_resp, { "Wait for previous response", "gryphon.wait_prev_resp", FT_BOOLEAN, 8, TFS(&tfs_wait_response), WAIT_FOR_PREV_RESP, NULL, HFILL }}, { &hf_gryphon_status, { "Status", "gryphon.status", FT_UINT32, BASE_HEX, VALS(responses_vs), 0x0, NULL, HFILL }}, { &hf_gryphon_response_in, { "Response In", "gryphon.response_in", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0, "The response to this Gryphon request is in this frame", HFILL }}, { &hf_gryphon_response_to, { "Request In", "gryphon.response_to", FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0, "This is a response to the PANA request in this frame", HFILL }}, { &hf_gryphon_response_time, { "Response Time", "gryphon.response_time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the request and the response", HFILL }}, { &hf_gryphon_data_header_length, { "Header length (bytes)", "gryphon.data.header_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_header_length_bits, { "Header length (bits)", "gryphon.data.header_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_data_length, { "Data length (bytes)", "gryphon.data.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_extra_data_length, { "Extra data length (bytes)", "gryphon.data.extra_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_mode, { "Mode", "gryphon.data.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_mode_transmitted, { "Transmitted message", "gryphon.data.mode.transmitted", FT_BOOLEAN, 8, TFS(&true_false), 0x80, NULL, HFILL }}, { &hf_gryphon_data_mode_receive, { "Received message", "gryphon.data.mode.receive", FT_BOOLEAN, 8, TFS(&true_false), 0x40, NULL, HFILL }}, { &hf_gryphon_data_mode_local, { "Local message", "gryphon.data.mode.local", FT_BOOLEAN, 8, TFS(&true_false), 0x20, NULL, HFILL }}, { &hf_gryphon_data_mode_remote, { "Remote message (LIN)", "gryphon.data.mode.remote", FT_BOOLEAN, 8, TFS(&true_false), 0x10, NULL, HFILL }}, /* 20171012 added additional mode bits */ { &hf_gryphon_data_mode_oneshot, { "One-shot slave table message (LIN)", "gryphon.data.mode.oneshot", FT_BOOLEAN, 8, TFS(&true_false), 0x08, NULL, HFILL }}, { &hf_gryphon_data_mode_combined, { "Channel number is in context", "gryphon.data.mode.combined", FT_BOOLEAN, 8, TFS(&true_false), 0x04, NULL, HFILL }}, { &hf_gryphon_data_mode_nomux, { "Do not multiplex message", "gryphon.data.mode.nomux", FT_BOOLEAN, 8, TFS(&true_false), 0x02, NULL, HFILL }}, { &hf_gryphon_data_mode_internal, { "Internal message", "gryphon.data.mode.internal", FT_BOOLEAN, 8, TFS(&true_false), 0x01, NULL, HFILL }}, { &hf_gryphon_data_priority, { "Priority", "gryphon.data.priority", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_error_status, { "Error status", "gryphon.data.error_status", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_time, { "Timestamp", "gryphon.data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_context, { "Context", "gryphon.data.context", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_header_data, { "Header", "gryphon.data.header_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_data, { "Data", "gryphon.data.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_extra_data, { "Extra data", "gryphon.data.extra_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_data_padding, { "Padding", "gryphon.data.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_id, { "Event ID", "gryphon.event.id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_name, { "Event name", "gryphon.event.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_context, { "Event context", "gryphon.event.context", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_time, { "Timestamp", "gryphon.event.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_data, { "Data", "gryphon.event.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_event_padding, { "Padding", "gryphon.event.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_misc_text, { "Text", "gryphon.misc.text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_misc_padding, { "Padding", "gryphon.misc.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_eventnum, { "Event numbers", "gryphon.eventnum", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_resp_time, { "Date/Time", "gryphon.resp_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_setfilt, { "Pass/Block flag", "gryphon.setfilt.flag", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_setfilt_length, { "Length of Pattern & Mask", "gryphon.setfilt.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_setfilt_discard_data, { "Discarded data", "gryphon.setfilt.discard_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_setfilt_padding, { "Padding", "gryphon.setfilt.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ioctl, { "IOCTL", "gryphon.ioctl", FT_UINT32, BASE_HEX, VALS(ioctls), 0x0, NULL, HFILL }}, { &hf_gryphon_ioctl_nbytes, { "Number of bytes to follow (bytes)", "gryphon.ioctl_nbytes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ioctl_data, { "Data", "gryphon.ioctl.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addfilt_pass, { "Conforming messages", "gryphon.addfilt.pass", FT_BOOLEAN, 8, TFS(&tfs_passed_blocked), FILTER_PASS_FLAG, NULL, HFILL }}, { &hf_gryphon_addfilt_active, { "Filter", "gryphon.addfilt.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG, NULL, HFILL }}, { &hf_gryphon_addfilt_blocks, { "Number of filter blocks", "gryphon.addfilt.blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addfilt_handle, { "Filter handle", "gryphon.addfilt.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_modfilt, { "Filter handle", "gryphon.modfilt", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_modfilt_action, { "Action", "gryphon.modfilt.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0, NULL, HFILL }}, { &hf_gryphon_filthan, { "Number of filter handles", "gryphon.filthan", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filthan_id, { "Filter handle ID", "gryphon.filthan.id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filthan_padding, { "Padding", "gryphon.filthan.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_dfiltmode, { "Filter mode", "gryphon.dfiltmode", FT_UINT8, BASE_DEC, VALS(dmodes), 0x0, NULL, HFILL }}, { &hf_gryphon_filtmode, { "Filter mode", "gryphon.filtmode", FT_UINT8, BASE_DEC, VALS(modes), 0x0, NULL, HFILL }}, { &hf_gryphon_register_username, { "Username", "gryphon.register.username", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_register_password, { "Password", "gryphon.register.password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_register_client_id, { "Client ID", "gryphon.register.client_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_register_privileges, { "Privileges", "gryphon.register.privileges", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_getspeeds_set_ioctl, { "Set Speed IOCTL", "gryphon.getspeeds.set_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_getspeeds_get_ioctl, { "Get Speed IOCTL", "gryphon.getspeeds.get_ioctl", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_getspeeds_size, { "Speed data size (bytes)", "gryphon.getspeeds.size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_getspeeds_preset, { "Preset speed numbers", "gryphon.getspeeds.preset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_getspeeds_data, { "Data for preset", "gryphon.getspeeds.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_sort, { "Set sorting", "gryphon.cmd_sort", FT_UINT8, BASE_DEC, VALS(cmd_sort_type), 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_optimize, { "Set optimization", "gryphon.cmd_optimize", FT_UINT8, BASE_DEC, VALS(cmd_optimize_type), 0x0, NULL, HFILL }}, { &hf_gryphon_config_device_name, { "Device name", "gryphon.config.device_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_device_version, { "Device version", "gryphon.config.device_version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_device_serial_number, { "Device serial number", "gryphon.config.device_serial_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_num_channels, { "Number of channels", "gryphon.config.num_channels", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_name_version_ext, { "Name & version extension", "gryphon.config.name_version_ext", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_driver_name, { "Driver name", "gryphon.config.driver_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_driver_version, { "Driver version", "gryphon.config.driver_version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_device_security, { "Device security string", "gryphon.config.device_security", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_max_data_length, { "Maximum data length (bytes)", "gryphon.config.max_data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_min_data_length, { "Minimum data length (bytes)", "gryphon.config.min_data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_hardware_serial_number, { "Hardware serial number", "gryphon.config.hardware_serial_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_protocol_type, { "Protocol type & subtype", "gryphon.config.protocol_type", FT_UINT16, BASE_HEX, VALS(protocol_types), 0x0, NULL, HFILL }}, { &hf_gryphon_config_channel_id, { "Channel ID", "gryphon.config.channel_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_card_slot_number, { "Card slot number", "gryphon.config.card_slot_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_max_extra_data, { "Maximum extra data (bytes)", "gryphon.config.max_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_config_min_extra_data, { "Minimum extra data (bytes)", "gryphon.config.min_extra_data", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_num_iterations, { "Number of iterations", "gryphon.sched.num_iterations", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_flags, { "Flags", "gryphon.sched.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_flags_scheduler, { "Scheduler", "gryphon.sched.flags.scheduler", FT_BOOLEAN, 32, TFS(&critical_normal), 0x00000001, NULL, HFILL }}, { &hf_gryphon_sched_sleep, { "Sleep (milliseconds)", "gryphon.sched.sleep", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_transmit_count, { "Transmit count", "gryphon.sched.transmit_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_transmit_period, { "Transmit period (milliseconds)", "gryphon.sched.transmit_period", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_transmit_flags, { "Flags", "gryphon.sched.transmit_flags", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_skip_transmit_period, { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x0001, NULL, HFILL }}, { &hf_gryphon_sched_skip_sleep, { "Last transmit period", "gryphon.sched.skip_transmit_period", FT_BOOLEAN, 16, TFS(&skip_not_skip), 0x0001, NULL, HFILL }}, { &hf_gryphon_sched_channel, { "Channel", "gryphon.sched.channel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_channel0, { "Channel (specified by the destination channel)", "gryphon.sched.channel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_rep_id, { "Schedule ID", "gryphon.sched.rep_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_sched_rep_message_index, { "Message index", "gryphon.sched.rep_message_index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_data_time, { "Timestamp", "gryphon.blm_data.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_data_bus_load, { "Bus load average (%)", "gryphon.blm_data.bus_load", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_data_current_bus_load, { "Current bus load (%)", "gryphon.blm_data.current_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_data_peak_bus_load, { "Peak bus load (%)", "gryphon.blm_data.peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_data_historic_peak_bus_load, { "Historic peak bus load (%)", "gryphon.blm_data.historic_peak_bus_load", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_receive_frame_count, { "Receive frame count", "gryphon.blm_stat.receive_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_transmit_frame_count, { "Transmit frame count", "gryphon.blm_stat.transmit_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_receive_dropped_frame_count, { "Receive dropped frame count", "gryphon.blm_stat.receive_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_transmit_dropped_frame_count, { "Transmit dropped frame count", "gryphon.blm_stat.transmit_dropped_frame_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_receive_error_count, { "Receive error count", "gryphon.blm_stat.receive_error_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_stat_transmit_error_count, { "Transmit error count", "gryphon.blm_stat.transmit_error_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addresp_flags, { "Flags", "gryphon.addresp.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, /* 20171017 fixed display of filter flags */ { &hf_gryphon_addresp_flags_active, { "Filter active flag", "gryphon.addresp.flags.active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG, NULL, HFILL }}, { &hf_gryphon_addresp_blocks, { "Number of filter blocks", "gryphon.addresp.blocks", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_number, { "Number of LDF names", "gryphon.ldf.number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_nodenumber, { "Number of nodes", "gryphon.ldf.nodenumber", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_list, { "LDF block index", "gryphon.ldf.list", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_remaining, { "Remaining LDF names", "gryphon.ldf.remaining", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_name, { "File Name", "gryphon.ldf.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_info_pv, { "Protocol version", "gryphon.ldf.pv", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_info_lv, { "Language version", "gryphon.ldf.lv", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_ui, { "Unique identifier", "gryphon.ldf.ui", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_nodename, { "Node Name", "gryphon.lin.nodename", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_data_length, { "Data length (bytes)", "gryphon.lin.data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_slave_table_enable, { "Slave table entry", "gryphon.lin.slave_table_enable", FT_UINT8, BASE_DEC, VALS(lin_slave_table_enable), 0x0, NULL, HFILL }}, { &hf_gryphon_lin_slave_table_cs, { "Slave table checksum", "gryphon.lin.slave_table_cs", FT_UINT8, BASE_DEC, VALS(lin_slave_table_cs), 0x0, NULL, HFILL }}, { &hf_gryphon_lin_slave_table_data, { "Data", "gryphon.lin.slave_table_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_slave_table_datacs, { "Checksum", "gryphon.lin.slave_table_datacs", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_masterevent, { "Starting frame id", "gryphon.lin.masterevent", FT_UINT8, BASE_DEC, VALS(lin_ioctl_masterevent), 0x0, NULL, HFILL }}, { &hf_gryphon_lin_numdata, { "Number of data bytes", "gryphon.lin.numdata", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_lin_numextra, { "Number of extra bytes", "gryphon.lin.numextra", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_description, { "Description", "gryphon.ldf.description", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_size, { "Size of LDF to be uploaded", "gryphon.ldf.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_exists, { "LDF name existence check", "gryphon.ldf.exists", FT_UINT8, BASE_DEC, VALS(ldf_exists), 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_blockn, { "Block number", "gryphon.ldf.blockn", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_file, { "Upload text block", "gryphon.ldf.file", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_desc_pad, { "Padding (TODO: need to fix response data length)", "gryphon.ldf.desc_pad", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_restore_session, { "Session id", "gryphon.ldf.restore_session", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_schedule_name, { "Schedule name", "gryphon.ldf.schedule_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_schedule_msg_dbytes, { "Data length (bytes)", "gryphon.ldf.schedule_msg_dbytes", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_schedule_flags, { "Flags", "gryphon.ldf.schedule_flags", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_schedule_event, { "Event driven", "gryphon.ldf.schedule_event_ev", FT_BOOLEAN, 8, TFS(&true_false), 0x80, NULL, HFILL }}, { &hf_gryphon_ldf_schedule_sporadic, { "Sporadic", "gryphon.ldf.schedule_event_sp", FT_BOOLEAN, 8, TFS(&true_false), 0x40, NULL, HFILL }}, { &hf_gryphon_ldf_ioctl_setflags, { "Starting frame id", "gryphon.ldf.ioctl_setflags", FT_UINT8, BASE_DEC, VALS(lin_ldf_ioctl_setflags), 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_ioctl_setflags_flags, { "Id", "gryphon.ldf.ioctl_setflags_flags", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_numb_ids, { "Number of ids", "gryphon.ldf.numb_ids", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_bitrate, { "Bitrate", "gryphon.ldf.bitrate", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_sched_size_place, { "Placeholder for schedule size (bytes)", "gryphon.ldf.schedsize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_sched_numb_place, { "Placeholder for number of schedules", "gryphon.ldf.numbsched", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_sched_size, { "Schedule size (bytes)", "gryphon.ldf.schedsize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_num_node_names, { "Number of node names", "gryphon.ldf.num_node_names", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_num_frames, { "Number of frames", "gryphon.ldf.num_frames", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_get_frame, { "Frame", "gryphon.ldf.get_frame", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_get_frame_num, { "Number of data bytes in slave response", "gryphon.ldf.get_frame_num", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_get_frame_pub, { "Publisher", "gryphon.ldf.get_frame_pub", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_get_frame_num_signals, { "Number of signals", "gryphon.ldf.get_frame_num_signals", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_num_signal_names, { "Number of signal names", "gryphon.ldf.num_signal_names", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_num_schedules, { "Number of schedules", "gryphon.ldf.num_schedules", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_num_encodings, { "Number of encodings", "gryphon.ldf.num_encodings", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_encoding_value, { "Encoding value", "gryphon.ldf.encoding_value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_encoding_min, { "Encoding min value", "gryphon.ldf.encoding_min", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_encoding_max, { "Encoding max value", "gryphon.ldf.encoding_max", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_master_node_name, { "Master node name", "gryphon.ldf.master", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_slave_node_name, { "Slave node name", "gryphon.ldf.slave", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_node_name, { "Node name", "gryphon.ldf.node_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_name, { "Signal name", "gryphon.ldf.signal_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_encoding_name, { "Signal encoding name", "gryphon.ldf.signal_encoding_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_encoding_type, { "Signal encoding type", "gryphon.ldf.signal_encoding_type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_encoding_logical, { "Signal encoding string", "gryphon.ldf.signal_encoding_logical", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_offset, { "Offset (bits)", "gryphon.ldf.signal_offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_ldf_signal_length, { "Length (bits)", "gryphon.ldf.signal_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* cnvt */ { &hf_gryphon_cnvt_valuef, { "Float value", "gryphon.cnvt.valuef", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cnvt_valuei, { "Int value", "gryphon.cnvt.valuei", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cnvt_values, { "String value", "gryphon.cnvt.values", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cnvt_units, { "String units", "gryphon.cnvt.units", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cnvt_flags_getvalues, { "Flags", "gryphon.cnvt.flags.getvalues", FT_UINT8, BASE_DEC, VALS(lin_cnvt_getflags), 0x0, NULL, HFILL }}, /* delay driver */ { &hf_gryphon_dd_stream, { "Stream number", "gryphon.dd.stream", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_dd_value, { "Value (bytes)", "gryphon.dd.value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_dd_time, { "Time (msec)", "gryphon.dd.time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addresp_responses, { "Number of response blocks", "gryphon.addresp.responses", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addresp_old_handle, { "Old handle", "gryphon.addresp.old_handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addresp_action, { "Action", "gryphon.addresp.action", FT_UINT8, BASE_DEC, VALS(action_vals), 0x07, NULL, HFILL }}, { &hf_gryphon_addresp_action_period, { "Period", "gryphon.addresp.action_period", FT_BOOLEAN, 8, TFS(&frames_01seconds), FR_PERIOD_MSGS, NULL, HFILL }}, { &hf_gryphon_addresp_action_deact_on_event, { "Deact on event", "gryphon.addresp.action.deact_on_event", FT_UINT8, BASE_DEC, VALS(deact_on_event_vals), FR_DELETE|FR_DEACT_ON_EVENT, NULL, HFILL }}, { &hf_gryphon_addresp_action_deact_after_period, { "Deact on Period", "gryphon.addresp.action.deact_after_period", FT_UINT8, BASE_DEC, VALS(deact_after_per_vals), FR_DELETE|FR_DEACT_AFTER_PER, NULL, HFILL }}, { &hf_gryphon_addresp_action_period_type, { "Period", "gryphon.addresp.action_period_type", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_addresp_handle, { "Response handle", "gryphon.addresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_modresp_handle, { "Response handle", "gryphon.modresp.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_modresp_action, { "Action response", "gryphon.modresp.action", FT_UINT8, BASE_DEC, VALS(filtacts), 0x0, NULL, HFILL }}, { &hf_gryphon_num_resphan, { "Number of response handles", "gryphon.num_resphan", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_handle, { "Handle", "gryphon.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_transmit_sched_id, { "Transmit schedule ID", "gryphon.transmit_sched_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_desc_program_size, { "Program size", "gryphon.desc.program_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_desc_program_name, { "Program name", "gryphon.desc.program_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_desc_program_description, { "Program description", "gryphon.desc.program_description", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_desc_flags, { "Flags", "gryphon.desc.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_desc_flags_program, { "Period", "gryphon.desc.flags.program", FT_BOOLEAN, 8, TFS(&present_not_present), 0x01, NULL, HFILL }}, { &hf_gryphon_desc_handle, { "Handle", "gryphon.desc.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_upload_block_number, { "Block number", "gryphon.upload.block_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_upload_handle, { "Handle", "gryphon.upload.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_upload_data, { "Data", "gryphon.upload.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_delete, { "Program name", "gryphon.delete", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_list_block_number, { "Block number", "gryphon.list.block_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_list_num_programs, { "Number of programs in this response", "gryphon.list.num_programs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_list_num_remain_programs, { "Number of remaining programs", "gryphon.list.num_remain_programs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_list_name, { "Name", "gryphon.list.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_list_description, { "Description", "gryphon.list.description", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_start_arguments, { "Arguments", "gryphon.start.arguments", FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_start_channel, { "Channel (Client) number", "gryphon.start.channel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_status_num_running_copies, { "Number of running copies", "gryphon.status.num_running_copies", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_options_handle, { "Handle", "gryphon.options.handle", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_files, { "Directory", "gryphon.files", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_flags_register, { "USDT", "gryphon.usdt.flags_register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01, NULL, HFILL }}, { &hf_gryphon_usdt_action_flags, { "Action Flags", "gryphon.usdt.action_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, /* 20171012 added non legacy USDT */ { &hf_gryphon_usdt_action_flags_non_legacy, { "Action Flags", "gryphon.usdt.action_flags.non_legacy", FT_BOOLEAN, 8, TFS(&register_unregister_action_flags), 0x01, NULL, HFILL }}, { &hf_gryphon_usdt_action_flags_register, { "Register", "gryphon.usdt.action_flags.register", FT_UINT8, BASE_DEC, VALS(register_unregister), 0x01, NULL, HFILL }}, { &hf_gryphon_usdt_action_flags_action, { "Action", "gryphon.usdt.action_flags.action", FT_UINT8, BASE_DEC, VALS(usdt_action_vals), 0x06, NULL, HFILL }}, { &hf_gryphon_usdt_transmit_options_flags, { "Transmit options", "gryphon.usdt.transmit_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, /* 20171012 USDT tx options */ /* bit 0*/ { &hf_gryphon_usdt_transmit_options_flags_echo, { "Echo long", "gryphon.usdt.transmit_options_flags.echo_long", FT_UINT8, BASE_DEC, VALS(xmit_opt_echo_long), 0x01, NULL, HFILL }}, /* bits 1 & 2 */ { &hf_gryphon_usdt_transmit_options_action, { "Transmit Action", "gryphon.usdt.transmit_options_flags.action", FT_UINT8, BASE_DEC, VALS(xmit_opt_vals), 0x06, NULL, HFILL }}, /* bit 3 */ { &hf_gryphon_usdt_transmit_options_done_event, { "Done event", "gryphon.usdt.transmit_options_flags.done_event", FT_UINT8, BASE_DEC, VALS(xmit_opt_done), 0x08, NULL, HFILL }}, /* bit 4 */ { &hf_gryphon_usdt_transmit_options_echo_short, { "Echo short", "gryphon.usdt.transmit_options_flags.echo_log", FT_UINT8, BASE_DEC, VALS(xmit_opt_echo_short), 0x10, NULL, HFILL }}, /* bit 5 */ { &hf_gryphon_usdt_transmit_options_rx_nth_fc, { "Nth flowcontrol event", "gryphon.usdt.transmit_options_flags.nth_fc_event", FT_UINT8, BASE_DEC, VALS(xmit_opt_nth_fc_event), 0x20, NULL, HFILL }}, /* bit 5 */ { &hf_gryphon_usdt_transmit_options_send_done, { "Send a USDT_DONE event when the last frame of a multi-frame USDT message is transmitted", "gryphon.usdt.transmit_options_flags.send_done", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }}, /* 20171012 USDT rx options */ { &hf_gryphon_usdt_receive_options_flags, { "Receive options", "gryphon.usdt.receive_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, /* bits 0 & 1 */ { &hf_gryphon_usdt_receive_options_action, /* legacy */ { "Receive Action", "gryphon.usdt.receive_options_flags.action", FT_UINT8, BASE_DEC, VALS(recv_opt_vals), 0x03, NULL, HFILL }}, /* bit 2 */ { &hf_gryphon_usdt_receive_options_firstframe_event, { "First frame event", "gryphon.usdt.receive_options_flags.firstframe_event", FT_UINT8, BASE_DEC, VALS(recv_opt_firstframe_event), 0x04, NULL, HFILL }}, /* bit 3 */ { &hf_gryphon_usdt_receive_options_lastframe_event, { "Last frame event", "gryphon.usdt.receive_options_flags.lastframe_event", FT_UINT8, BASE_DEC, VALS(recv_opt_lastframe_event), 0x08, NULL, HFILL }}, /* bit 5 */ { &hf_gryphon_usdt_receive_options_tx_nth_fc, { "Nth flowcontrol event", "gryphon.usdt.receive_options_flags.nth_fc_event", FT_UINT8, BASE_DEC, VALS(recv_opt_nth_fc_event), 0x20, NULL, HFILL }}, /* J1939 options */ { &hf_gryphon_usdt_length_options_flags, { "Length options", "gryphon.usdt.length_options_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, /* bit 6 */ { &hf_gryphon_usdt_length_control_j1939, { "Length control bit", "gryphon.usdt.length_options_flags.j1939", FT_UINT8, BASE_DEC, VALS(recv_opt_j1939), 0x40, NULL, HFILL }}, /* 20171013 */ { &hf_gryphon_usdt_stmin_fc, { "STMIN flow control time (milliseconds)", "gryphon.usdt.set_stmin_fc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_set_stmin_mul, { "STMIN multiplier", "gryphon.usdt.set_stmin_mul", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_bsmax_fc, { "Block size max for flow control", "gryphon.usdt.set_bsmax_fc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_stmin_override, { "STMIN override time (milliseconds)", "gryphon.usdt.set_stmin_override", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_stmin_override_active, { "STMIN override active", "gryphon.usdt.stmin_active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG, NULL, HFILL }}, { &hf_gryphon_usdt_stmin_override_activate, { "STMIN override activate", "gryphon.usdt.stmin_active", FT_BOOLEAN, 8, TFS(&active_inactive), FILTER_ACTIVE_FLAG, NULL, HFILL }}, { &hf_gryphon_usdt_receive_options_firstframe, { "Send a USDT_FIRSTFRAME event when the first frame of a multi-frame USDT message is received", "gryphon.usdt.receive_options_flags.firstframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x04, NULL, HFILL }}, { &hf_gryphon_usdt_receive_options_lastframe, { "Send a USDT_LASTFRAME event when the first frame of a multi-frame USDT message is received", "gryphon.usdt.receive_options_flags.lastframe", FT_BOOLEAN, 8, TFS(&yes_no), 0x08, NULL, HFILL }}, { &hf_gryphon_usdt_ext_address, { "Using extended addressing for", "gryphon.usdt.ext_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_ext_address_id, { "ID", "gryphon.usdt.ext_address.id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_block_size, { "Number of IDs in the block", "gryphon.usdt.block_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_bits_in_input1, { "Input 1", "gryphon.bits_in.input1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01, NULL, HFILL }}, { &hf_gryphon_bits_in_input2, { "Input 2", "gryphon.bits_in.input2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02, NULL, HFILL }}, { &hf_gryphon_bits_in_input3, { "Input 3", "gryphon.bits_in.input3", FT_BOOLEAN, 8, TFS(&set_not_set), 0x04, NULL, HFILL }}, { &hf_gryphon_bits_in_pushbutton, { "Pushbutton", "gryphon.bits_in.pushbutton", FT_BOOLEAN, 8, TFS(&set_not_set), 0x08, NULL, HFILL }}, { &hf_gryphon_bits_out_output1, { "Input 1", "gryphon.bits_out.output1", FT_BOOLEAN, 8, TFS(&set_not_set), 0x01, NULL, HFILL }}, { &hf_gryphon_bits_out_output2, { "Input 2", "gryphon.bits_out.output2", FT_BOOLEAN, 8, TFS(&set_not_set), 0x02, NULL, HFILL }}, { &hf_gryphon_init_strat_reset_limit, { "Reset Limit", "gryphon.init_strat.reset_limit", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_init_strat_delay, { "Delay", "gryphon.init_strat.strat_delay", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_speed_baud_rate_index, { "Baud rate index", "gryphon.speed.baud_rate_index", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_start, { "Filter field starts at byte", "gryphon.filter_block.filter_start", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_length, { "Filter field length", "gryphon.filter_block.filter_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_type, { "Filtering on", "gryphon.filter_block.filter_type", FT_UINT8, BASE_DEC, VALS(filter_data_types), 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_operator, { "Type of comparison", "gryphon.filter_block.filter_operator", FT_UINT8, BASE_DEC, VALS(operators), 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_value1, { "Value", "gryphon.filter_block.filter_value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_value2, { "Value", "gryphon.filter_block.filter_value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_value4, { "Value", "gryphon.filter_block.filter_value", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_filter_value_bytes, { "Value", "gryphon.filter_block.filter_value_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_mode, { "Mode", "gryphon.blm_mode", FT_UINT32, BASE_DEC, VALS(blm_mode_vals), 0x0, NULL, HFILL }}, { &hf_gryphon_blm_mode_avg_period, { "Averaging period", "gryphon.blm_mode.avg_period", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_blm_mode_avg_frames, { "Averaging period (frames)", "gryphon.blm_mode.avg_frames", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_command, { "Command", "gryphon.command", FT_UINT32, BASE_HEX|BASE_EXT_STRING, &cmd_vals_ext, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_mode, { "Mode", "gryphon.command.mode", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_option, { "Option", "gryphon.option", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_option_data, { "Option data", "gryphon.option_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_file, { "File", "gryphon.command.file", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_bit_in_digital_data, { "Digital values set", "gryphon.bit_in_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_bit_out_digital_data, { "Digital values set", "gryphon.bit_out_digital_data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_pattern, { "Pattern", "gryphon.filter_block.pattern", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_filter_block_mask, { "Mask", "gryphon.filter_block.mask", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, /* 20171012 USDT */ { &hf_gryphon_usdt_nids, { "Number of IDs in block", "gryphon.nids", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_request, { "USDT request IDs", "gryphon.usdt_request", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_request_ext, { "USDT request extended address", "gryphon.usdt_request_ext", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_response, { "USDT response IDs", "gryphon.usdt_response", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_usdt_response_ext, { "USDT response extended address", "gryphon.usdt_response_ext", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_uudt_response, { "UUDT response IDs", "gryphon.uudt_response", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_uudt_response_ext, { "UUDT response extended address", "gryphon.usdt_response_ext", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_more_filenames, { "More filenames to return", "gryphon.more_filenames", FT_BOOLEAN, 8, TFS(&yes_no), 0x0, NULL, HFILL }}, { &hf_gryphon_filenames, { "File and directory names", "gryphon.filenames", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_program_channel_number, { "Program channel number", "gryphon.program_channel_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_valid_header_length, { "Valid Header length", "gryphon.valid_header_length", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_gryphon, &ett_gryphon_header, &ett_gryphon_body, &ett_gryphon_command_data, &ett_gryphon_response_data, &ett_gryphon_data_header, &ett_gryphon_flags, &ett_gryphon_data_body, &ett_gryphon_cmd_filter_block, &ett_gryphon_cmd_events_data, &ett_gryphon_cmd_config_device, &ett_gryphon_cmd_sched_data, &ett_gryphon_cmd_sched_cmd, &ett_gryphon_cmd_response_block, &ett_gryphon_pgm_list, &ett_gryphon_pgm_status, &ett_gryphon_pgm_options, &ett_gryphon_valid_headers, &ett_gryphon_usdt_data, &ett_gryphon_usdt_action_flags, &ett_gryphon_usdt_tx_options_flags, &ett_gryphon_usdt_rx_options_flags, &ett_gryphon_usdt_len_options_flags, &ett_gryphon_usdt_data_block, &ett_gryphon_lin_emulate_node, &ett_gryphon_ldf_block, &ett_gryphon_ldf_schedule_name, &ett_gryphon_lin_schedule_msg, &ett_gryphon_cnvt_getflags, &ett_gryphon_digital_data, &ett_gryphon_blm_mode }; static ei_register_info ei[] = { { &ei_gryphon_type,{ "gryphon.type.invalid", PI_PROTOCOL, PI_WARN, "Invalid frame type", EXPFILL } }, }; module_t *gryphon_module; expert_module_t* expert_gryphon; proto_gryphon = proto_register_protocol("DG Gryphon Protocol", "Gryphon", "gryphon"); proto_register_field_array(proto_gryphon, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_gryphon = expert_register_protocol(proto_gryphon); expert_register_field_array(expert_gryphon, ei, array_length(ei)); gryphon_handle = register_dissector("gryphon", dissect_gryphon, proto_gryphon); gryphon_module = prefs_register_protocol(proto_gryphon, NULL); prefs_register_bool_preference(gryphon_module, "desegment", "Desegment all Gryphon messages spanning multiple TCP segments", "Whether the Gryphon dissector should desegment all messages spanning multiple TCP segments", &gryphon_desegment); } void proto_reg_handoff_gryphon(void) { dissector_add_uint_with_preference("tcp.port", GRYPHON_TCP_PORT, gryphon_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/gryphon/packet-gryphon.h
/* packet-gryphon.h * * Updated routines for Gryphon protocol packet dissection * By Mark C. <[email protected]> * Copyright (C) 2018 DG Technologies, Inc. (Dearborn Group, Inc.) USA * * Definitions for Gryphon packet disassembly structures and routines * By Steve Limkemann <[email protected]> * Copyright 1998 Steve Limkemann * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #define MSG_HDR_SZ 8 #define CMD_HDR_SZ 4 /* source/destinations: */ #define SD_CARD 0x01 /* (vehicle) network interface */ #define SD_SERVER 0x02 #define SD_CLIENT 0x03 #define SD_KNOWN 0x10 /* Client ID >= are well known */ #define SD_SCHED 0x10 /* scheduler */ #define SD_SCRIPT 0x20 /* script processor */ #define SD_PGM 0x21 /* Program loader */ #define SD_USDT 0x22 /* USDT (Unacknowledged Segmented Data Transfer) */ #define SD_BLM 0x23 /* Bus Load Monitoring */ #define SD_LIN 0x24 /* LIN extensions */ #define SD_FLIGHT 0x25 /* Flight Recorder */ #define SD_LOGGER 0x25 /* data logger */ #define SD_RESP 0x26 /* Message Response */ #define SD_IOPWR 0x27 /* VNG / Compact Gryphon I/O & power */ #define SD_UTIL 0x28 /* Miscellaneous utility commands */ #define SD_CNVT 0x29 /* signal conversion commands */ #define CH_BROADCAST 0xFF /* broadcast message destination channel */ /* frame types: */ #define GY_FT_CMD 0x01 /* command to initiate some action */ #define GY_FT_RESP 0x02 /* response to a command */ #define GY_FT_DATA 0x03 /* (vehicle) network data */ #define GY_FT_EVENT 0x04 /* notification of an event */ #define GY_FT_MISC 0x05 /* misc data */ #define GY_FT_TEXT 0x06 /* null-terminated ASCII strings */ #define GY_FT_SIG 0x07 /* (vehicle) network signals */ /* generic (all SD type) commands: values 0x00 to 0x3f */ #define CMD_INIT 0x01 /* initialize target */ #define CMD_GET_STAT 0x02 /* request status */ #define CMD_GET_CONFIG 0x03 /* request configuration info */ #define CMD_EVENT_ENABLE 0x04 /* Enable event type */ #define CMD_EVENT_DISABLE 0x05 /* Disable event type */ #define CMD_GET_TIME 0x06 /* Get current value of timestamp */ #define CMD_GET_RXDROP 0x07 /* Get count of Rx msgs dropped */ #define CMD_RESET_RXDROP 0x08 /* Set count of Rx msgs dropped to zero */ #define CMD_BCAST_ON 0x09 /* broadcasts on */ #define CMD_BCAST_OFF 0x0a /* broadcasts off */ #define CMD_SET_TIME 0x0b /* set time */ /* SD-type specific commands: should start at 0x40, global uniqueness */ /* is prefered, but not mandatory. */ /* SD_CARD command types: */ #define CMD_CARD_SET_SPEED (SD_CARD * 256 + 0x40) /* set peripheral speed */ #define CMD_CARD_GET_SPEED (SD_CARD * 256 + 0x41) /* get peripheral speed */ #define CMD_CARD_SET_FILTER (SD_CARD * 256 + 0x42) /* set filter to pass or block all */ #define CMD_CARD_GET_FILTER (SD_CARD * 256 + 0x43) /* get a pass/block filter */ #define CMD_CARD_TX (SD_CARD * 256 + 0x44) /* transmit message */ #define CMD_CARD_TX_LOOP_ON (SD_CARD * 256 + 0x45) /* set transmit loopback on */ #define CMD_CARD_TX_LOOP_OFF (SD_CARD * 256 + 0x46) /* set transmit loopback off */ #define CMD_CARD_IOCTL (SD_CARD * 256 + 0x47) /* device driver ioctl pass-through */ #define CMD_CARD_ADD_FILTER (SD_CARD * 256 + 0x48) /* add a pass/block filter */ #define CMD_CARD_MODIFY_FILTER (SD_CARD * 256 + 0x49) /* modify a pass/block filter */ #define CMD_CARD_GET_FILTER_HANDLES (SD_CARD * 256 + 0x4A)/* get a list of filters */ #define CMD_CARD_SET_DEFAULT_FILTER (SD_CARD * 256 + 0x4B)/* set the default action */ #define CMD_CARD_GET_DEFAULT_FILTER (SD_CARD * 256 + 0x4C)/* get the defautl action */ #define CMD_CARD_SET_FILTER_MODE (SD_CARD * 256 + 0x4D) /* set the client data mode */ #define CMD_CARD_GET_FILTER_MODE (SD_CARD * 256 + 0x4E) /* get the client data mode */ #define CMD_CARD_GET_EVNAMES (SD_CARD * 256 + 0x4f) /* get event names */ #define CMD_CARD_GET_SPEEDS (SD_CARD * 256 + 0x50) /* get speed definitions */ /* SD_SERVER command types: */ #define CMD_SERVER_REG (SD_SERVER * 256 + 0x50) /* register connection */ #define CMD_SERVER_SET_SORT (SD_SERVER * 256 + 0x51) /* set sorting behavior */ #define CMD_SERVER_SET_OPT (SD_SERVER * 256 + 0x52) /* set type of optimization */ /* SD_CLIENT command types: */ #define CMD_CLIENT_GET_ID (SD_CLIENT * 256 + 0x60) /* get the ID (channel field) of this client? */ #define CMD_CLIENT_SET_ID (SD_CLIENT * 256 + 0x61) /* set the ID (channel field) of this client? */ #define CMD_CLIENT_SHUTDOWN (SD_CLIENT * 256 + 0x62) /* tell client to die ? */ /* Bus load monitor (SD_BLM) commands: */ #define CMD_BLM_SET_MODE (SD_BLM * 256 + 0xA0) #define CMD_BLM_GET_MODE (SD_BLM * 256 + 0xA1) #define CMD_BLM_GET_DATA (SD_BLM * 256 + 0xA2) #define CMD_BLM_GET_STATS (SD_BLM * 256 + 0xA3) /* SD_LIN command types: */ #define CMD_LDF_DESC (SD_LIN * 256 + 0xB8) /* */ #define CMD_LDF_UPLOAD (SD_LIN * 256 + 0xB9) /* */ #define CMD_LDF_LIST (SD_LIN * 256 + 0xBA) /* */ #define CMD_LDF_DELETE (SD_LIN * 256 + 0xBB) /* */ #define CMD_LDF_PARSE (SD_LIN * 256 + 0xBC) /* */ #define CMD_GET_LDF_INFO (SD_LIN * 256 + 0xBD) /* */ #define CMD_GET_NODE_NAMES (SD_LIN * 256 + 0xBE) /* */ #define CMD_EMULATE_NODES (SD_LIN * 256 + 0xBF) /* */ #define CMD_GET_FRAMES (SD_LIN * 256 + 0xB0) /* */ #define CMD_GET_FRAME_INFO (SD_LIN * 256 + 0xC1) /* */ #define CMD_GET_SIGNAL_INFO (SD_LIN * 256 + 0xC2) /* */ #define CMD_GET_SIGNAL_DETAIL (SD_LIN * 256 + 0xC3) /* */ #define CMD_GET_ENCODING_INFO (SD_LIN * 256 + 0xC4) /* */ #define CMD_GET_SCHEDULES (SD_LIN * 256 + 0xC5) /* */ #define CMD_START_SCHEDULE (SD_LIN * 256 + 0xC6) /* */ #define CMD_STOP_SCHEDULE (SD_LIN * 256 + 0xC7) /* */ #define CMD_STORE_DATA (SD_LIN * 256 + 0xC8) /* */ #define CMD_SEND_ID (SD_LIN * 256 + 0xC9) /* */ #define CMD_SEND_ID_DATA (SD_LIN * 256 + 0xCA) /* */ #define CMD_SAVE_SESSION (SD_LIN * 256 + 0xCB) /* */ #define CMD_RESTORE_SESSION (SD_LIN * 256 + 0xCC) /* */ #define CMD_GET_NODE_SIGNALS (SD_LIN * 256 + 0xCD) /* */ /* signal conversion (SD_CNVT) commands */ #define CMD_CNVT_GET_VALUES (SD_CNVT * 256 + 0x78) /* LIN Signal Conversion */ #define CMD_CNVT_GET_UNITS (SD_CNVT * 256 + 0x79) /* LIN Signal Conversion */ #define CMD_CNVT_SET_VALUES (SD_CNVT * 256 + 0x7A) /* LIN Signal Conversion */ #define CMD_CNVT_DESTROY_SESSION (SD_CNVT * 256 + 0x7B) /* LIN Signal Conversion */ #define CMD_CNVT_SAVE_SESSION (SD_CNVT * 256 + 0xCB) /* LIN Signal Conversion */ #define CMD_CNVT_RESTORE_SESSION (SD_CNVT * 256 + 0xCC) /* LIN Signal Conversion */ #define CMD_CNVT_GET_NODE_SIGNALS (SD_CNVT * 256 + 0xCD) /* LIN Signal Conversion */ /* Flight recorder (SD_FLIGHT) commands */ #define CMD_FLIGHT_GET_CONFIG (SD_FLIGHT * 256 + 0x50) /* get flight recorder channel info */ #define CMD_FLIGHT_START_MON (SD_FLIGHT * 256 + 0x51) /* start flight recorder monitoring */ #define CMD_FLIGHT_STOP_MON (SD_FLIGHT * 256 + 0x52) /* stop flight recorder monitoring */ /* Message responder (SD_RESP) commands: */ #define CMD_MSGRESP_ADD (SD_RESP * 256 + 0xB0) #define CMD_MSGRESP_GET (SD_RESP * 256 + 0xB1) #define CMD_MSGRESP_MODIFY (SD_RESP * 256 + 0xB2) #define CMD_MSGRESP_GET_HANDLES (SD_RESP * 256 + 0xB3) /* Program loader (SD_PGM) commands: */ #define CMD_PGM_DESC (SD_PGM * 256 + 0x90) /* Describe a program to be uploaded */ #define CMD_PGM_UPLOAD (SD_PGM * 256 + 0x91) /* Upload a program to the Gryphon */ #define CMD_PGM_DELETE (SD_PGM * 256 + 0x92) /* Delete an uploaded program */ #define CMD_PGM_LIST (SD_PGM * 256 + 0x93) /* Get a list of uploaded programs */ #define CMD_PGM_START (SD_PGM * 256 + 0x94) /* Start an uploaded program */ #define CMD_PGM_START2 (SD_CLIENT * 256 + 0x94) /* Start an uploaded program */ #define CMD_PGM_STOP (SD_PGM * 256 + 0x95) /* Stop an uploaded program */ #define CMD_PGM_STATUS (SD_PGM * 256 + 0x96) /* Get the status of an uploaded program */ #define CMD_PGM_OPTIONS (SD_PGM * 256 + 0x97) /* Set the upload options */ #define CMD_PGM_FILES (SD_PGM * 256 + 0x98) /* Get a list of files & directories */ /* Scheduler (SD_SCHED) target commands: */ #define CMD_SCHED_TX (SD_SCHED * 256 + 0x70) /* schedule transmission list */ #define CMD_SCHED_KILL_TX (SD_SCHED * 256 + 0x71) /* stop and destroy job */ #define CMD_SCHED_MSG_REPLACE (SD_SCHED * 256 + 0x72) /* replace a scheduled message */ /* USDT (SD_USDT) target commands: */ #define CMD_USDT_IOCTL (SD_USDT * 256 + 0x47) /* Register/Unregister with USDT */ #define CMD_USDT_REGISTER (SD_USDT * 256 + 0xB0) /* Register/Unregister with USDT */ #define CMD_USDT_SET_FUNCTIONAL (SD_USDT * 256 + 0xB1) /* Set to use extended addressing*/ #define CMD_USDT_SET_STMIN_MULT (SD_USDT * 256 + 0xB2) /* */ #define CMD_USDT_SET_STMIN_FC (SD_USDT * 256 + 0xB3) /* */ #define CMD_USDT_GET_STMIN_FC (SD_USDT * 256 + 0xB4) /* */ #define CMD_USDT_SET_BSMAX_FC (SD_USDT * 256 + 0xB5) /* */ #define CMD_USDT_GET_BSMAX_FC (SD_USDT * 256 + 0xB6) /* */ #define CMD_USDT_REGISTER_NON_LEGACY (SD_USDT * 256 + 0xB7) /* Register/Unregister with USDT */ #define CMD_USDT_SET_STMIN_OVERRIDE (SD_USDT * 256 + 0xB8) /* */ #define CMD_USDT_GET_STMIN_OVERRIDE (SD_USDT * 256 + 0xB9) /* */ #define CMD_USDT_ACTIVATE_STMIN_OVERRIDE (SD_USDT * 256 + 0xBA) /* */ /* I/O Power (SD_IOPWR) target commands: */ #define CMD_IOPWR_GETINP (SD_IOPWR * 256 + 0x40) /* Read current digital inputs */ #define CMD_IOPWR_GETLATCH (SD_IOPWR * 256 + 0x41) /* Read latched digital inputs */ #define CMD_IOPWR_CLRLATCH (SD_IOPWR * 256 + 0x42) /* Read & clear latched inputs */ #define CMD_IOPWR_GETOUT (SD_IOPWR * 256 + 0x43) /* Read digital outputs */ #define CMD_IOPWR_SETOUT (SD_IOPWR * 256 + 0x44) /* Write digital outputs */ #define CMD_IOPWR_SETBIT (SD_IOPWR * 256 + 0x45) /* Set indicated output bit(s) */ #define CMD_IOPWR_CLRBIT (SD_IOPWR * 256 + 0x46) /* Clear indicated output bit(s)*/ #define CMD_IOPWR_GETPOWER (SD_IOPWR * 256 + 0x47) /* Read inputs at power on time */ /* Miscellaneous (SD_UTIL) target commands: */ #define CMD_UTIL_SET_INIT_STRATEGY (SD_UTIL * 256 + 0x90) /* set the initialization strategy */ #define CMD_UTIL_GET_INIT_STRATEGY (SD_UTIL * 256 + 0x91) /* get the initialization strategy */ /* response frame (FT_RESP) response field definitions: */ #define RESP_OK 0x00 /* no error */ #define RESP_UNKNOWN_ERR 0x01 /* unknown error */ #define RESP_UNKNOWN_CMD 0x02 /* unrecognised command */ #define RESP_UNSUPPORTED 0x03 /* unsupported command */ #define RESP_INVAL_CHAN 0x04 /* invalid channel specified */ #define RESP_INVAL_DST 0x05 /* invalid destination */ #define RESP_INVAL_PARAM 0x06 /* invalid parameters */ #define RESP_INVAL_MSG 0x07 /* invalid message */ #define RESP_INVAL_LEN 0x08 /* invalid length field */ #define RESP_TX_FAIL 0x09 /* transmit failed */ #define RESP_RX_FAIL 0x0a /* receive failed */ #define RESP_AUTH_FAIL 0x0b #define RESP_MEM_ALLOC_ERR 0x0c /* memory allocation error */ #define RESP_TIMEOUT 0x0d /* command timed out */ #define RESP_UNAVAILABLE 0x0e #define RESP_BUF_FULL 0x0f /* buffer full */ #define RESP_NO_SUCH_JOB 0x10 /* Flight recorder (SD_FLIGHT) target definitions */ #define FR_RESP_AFTER_EVENT 0 #define FR_RESP_AFTER_PERIOD 1 #define FR_IGNORE_DURING_PER 2 #define FR_DEACT_AFTER_PER 0x80 #define FR_DEACT_ON_EVENT 0x40 #define FR_DELETE 0x20 #define FR_PERIOD_MSGS 0x10 /* Filter data types */ #define FILTER_DATA_TYPE_HEADER_FRAME 0x00 #define FILTER_DATA_TYPE_HEADER 0x01 #define FILTER_DATA_TYPE_DATA 0x02 #define FILTER_DATA_TYPE_EXTRA_DATA 0x03 #define FILTER_EVENT_TYPE_HEADER 0x04 #define FILTER_EVENT_TYPE_DATA 0x05 /* filter flags */ #define FILTER_PASS_FLAG 0x01 #define FILTER_ACTIVE_FLAG 0x02 /* Filter and Frame Responder Condition operators */ #define BIT_FIELD_CHECK 0 #define SVALUE_GT 1 #define SVALUE_GE 2 #define SVALUE_LT 3 #define SVALUE_LE 4 #define VALUE_EQ 5 #define VALUE_NE 6 #define UVALUE_GT 7 #define UVALUE_GE 8 #define UVALUE_LT 9 #define UVALUE_LE 10 #define DIG_LOW_TO_HIGH 11 #define DIG_HIGH_TO_LOW 12 #define DIG_TRANSITION 13 /* Modes available via CMD_CARD_SET_FILTERING_MODE */ #define FILTER_OFF_PASS_ALL 3 #define FILTER_OFF_BLOCK_ALL 4 #define FILTER_ON 5 /* Modes available via CMD_CARD_SET_DEFAULT_FILTER */ #define DEFAULT_FILTER_BLOCK 0 #define DEFAULT_FILTER_PASS 1 /* Actions available via CMD_CARD_MODIFY_FILTER */ #define DELETE_FILTER 0 #define ACTIVATE_FILTER 1 #define DEACTIVATE_FILTER 2 /* Flags to modify how FT_CMD (command) messages are handled */ /* These values are ORed with FT_CMD and stored in the Frame Header's */ /* Frame Type field for each response. */ #define DONT_WAIT_FOR_RESP 0x80 #define WAIT_FOR_PREV_RESP 0x40 #define RESPONSE_FLAGS (DONT_WAIT_FOR_RESP | WAIT_FOR_PREV_RESP) /* Program loader options */ #define PGM_CONV 1 /* Type of data conversion to perform */ #define PGM_TYPE 2 /* Type of file */ #define PGM_BIN 11 /* Binary, no conversion */ #define PGM_ASCII 12 /* ASCII, convert CR LF to LF */ #define PGM_PGM 21 /* Executable */ #define PGM_DATA 22 /* Data */ /* IOCTL definitions - comments indicate data size */ #define GINIT 0x11100001 #define GLOOPON 0x11100002 #define GLOOPOFF 0x11100003 #define GGETHWTYPE 0x11100004 #define GGETREG 0x11100005 #define GSETREG 0x11100006 #define GGETRXCOUNT 0x11100007 #define GSETRXCOUNT 0x11100008 #define GGETTXCOUNT 0x11100009 #define GSETTXCOUNT 0x1110000a #define GGETRXDROP 0x1110000b #define GSETRXDROP 0x1110000c #define GGETTXDROP 0x1110000d #define GSETTXDROP 0x1110000e #define GGETRXBAD 0x1110000f #define GGETTXBAD 0x11100011 #define GGETCOUNTS 0x11100013 #define GGETBLMON 0x11100014 #define GSETBLMON 0x11100015 #define GGETERRLEV 0x11100016 #define GSETERRLEV 0x11100017 #define GGETBITRATE 0x11100018 #define GGETRAM 0x11100019 #define GSETRAM 0x1110001a #define GCANGETBTRS 0x11200001 #define GCANSETBTRS 0x11200002 #define GCANGETBC 0x11200003 #define GCANSETBC 0x11200004 #define GCANGETMODE 0x11200005 #define GCANSETMODE 0x11200006 #define GCANGETTRANS 0x11200009 #define GCANSETTRANS 0x1120000a #define GCANSENDERR 0x1120000b #define GCANRGETOBJ 0x11210001 #define GCANRSETSTDID 0x11210002 #define GCANRSETEXTID 0x11210003 #define GCANRSETDATA 0x11210004 #define GCANRENABLE 0x11210005 #define GCANRDISABLE 0x11210006 #define GCANRGETMASKS 0x11210007 #define GCANRSETMASKS 0x11210008 #define GCANSWGETMODE 0x11220001 #define GCANSWSETMODE 0x11220002 #define GDLCGETFOURX 0x11400001 #define GDLCSETFOURX 0x11400002 #define GDLCGETLOAD 0x11400003 #define GDLCSETLOAD 0x11400004 #define GDLCSENDBREAK 0x11400005 #define GDLCABORTTX 0x11400006 #define GDLCGETHDRMODE 0x11400007 #define GDLCSETHDRMODE 0x11400008 #define GHONSLEEP 0x11600001 #define GHONSILENCE 0x11600002 #define GKWPSETPTIMES 0x11700011 #define GKWPSETWTIMES 0x11700010 #define GKWPDOWAKEUP 0x11700008 #define GKWPGETBITTIME 0x11700101 #define GKWPSETBITTIME 0x11700102 #define GKWPSETNODEADDR 0x11700104 #define GKWPGETNODETYPE 0x11700105 #define GKWPSETNODETYPE 0x11700106 #define GKWPSETWAKETYPE 0x11700108 #define GKWPSETTARGADDR 0x1170010a #define GKWPSETKEYBYTES 0x1170010c #define GKWPSETSTARTREQ 0x1170010e #define GKWPSETSTARTRESP 0x11700110 #define GKWPSETPROTOCOL 0x11700112 #define GKWPGETLASTKEYBYTES 0x11700201 #define GKWPSETLASTKEYBYTES 0x11700202 #define GSCPGETBBR 0x11300001 #define GSCPSETBBR 0x11300002 #define GSCPGETID 0x11300003 #define GSCPSETID 0x11300004 #define GSCPADDFUNCID 0x11300005 #define GSCPCLRFUNCID 0x11300006 #define GUBPGETBITRATE 0x11800001 #define GUBPSETBITRATE 0x11800002 #define GUBPGETINTERBYTE 0x11800003 #define GUBPSETINTERBYTE 0x11800004 #define GUBPGETNACKMODE 0x11800005 #define GUBPSETNACKMODE 0x11800006 #define GUBPGETRETRYDELAY 0x11800007 #define GUBPSETRETRYDELAY 0x11800008 #define GRESETHC08 0x11800009 #define GTESTHC08COP 0x1180000A #define GSJAGETLISTEN 0x11250001 #define GSJASETLISTEN 0x11250002 #define GSJAGETSELFTEST 0x11250003 #define GSJASETSELFTEST 0x11250004 #define GSJAGETXMITONCE 0x11250005 #define GSJASETXMITONCE 0x11250006 #define GSJAGETTRIGSTATE 0x11250007 #define GSJASETTRIGCTRL 0x11250008 #define GSJAGETTRIGCTRL 0x11250009 #define GSJAGETOUTSTATE 0x1125000A #define GSJASETOUTSTATE 0x1125000B #define GSJAGETFILTER 0x1125000C #define GSJASETFILTER 0x1125000D #define GSJAGETMASK 0x1125000E #define GSJASETMASK 0x1125000F #define GSJAGETINTTERM 0x11250010 #define GSJASETINTTERM 0x11250011 #define GSJAGETFTTRANS 0x11250012 #define GSJASETFTTRANS 0x11250013 #define GSJAGETFTERROR 0x11250014 /* LIN driver IOCTLs */ #define GLINGETBITRATE 0x11C00001 #define GLINSETBITRATE 0x11C00002 #define GLINGETBRKSPACE 0x11C00003 #define GLINSETBRKSPACE 0x11C00004 #define GLINGETBRKMARK 0x11C00005 #define GLINSETBRKMARK 0x11C00006 #define GLINGETIDDELAY 0x11C00007 #define GLINSETIDDELAY 0x11C00008 #define GLINGETRESPDELAY 0x11C00009 #define GLINSETRESPDELAY 0x11C0000A #define GLINGETINTERBYTE 0x11C0000B #define GLINSETINTERBYTE 0x11C0000C #define GLINGETWAKEUPDELAY 0x11C0000D #define GLINSETWAKEUPDELAY 0x11C0000E #define GLINGETWAKEUPTIMEOUT 0x11C0000F #define GLINSETWAKEUPTIMEOUT 0x11C00010 #define GLINGETWUTIMOUT3BR 0x11C00011 #define GLINSETWUTIMOUT3BR 0x11C00012 #define GLINSENDWAKEUP 0x11C00013 #define GLINGETMODE 0x11C00014 #define GLINSETMODE 0x11C00015 #define GLINGETSLEW 0x11C00016 #define GLINSETSLEW 0x11C00017 #define GLINADDSCHED 0x11C00018 #define GLINGETSCHED 0x11C00019 #define GLINGETSCHEDSIZE 0x11C0001A #define GLINDELSCHED 0x11C0001B #define GLINACTSCHED 0x11C0001C #define GLINDEACTSCHED 0x11C0001D #define GLINGETACTSCHED 0x11C0001E #define GLINGETNUMSCHEDS 0x11C0001F #define GLINGETSCHEDNAMES 0x11C00020 #define GLINSETFLAGS 0x11C00021 #define GLINGETAUTOCHECKSUM 0x11C00022 #define GLINSETAUTOCHECKSUM 0x11C00023 #define GLINGETAUTOPARITY 0x11C00024 #define GLINSETAUTOPARITY 0x11C00025 #define GLINGETSLAVETABLEENABLE 0x11C00026 #define GLINSETSLAVETABLEENABLE 0x11C00027 #define GLINGETFLAGS 0x11C00028 #define GLINGETWAKEUPMODE 0x11C00029 #define GLINSETWAKEUPMODE 0x11C0002A #define GLINGETMASTEREVENTENABLE 0x11C0002B /* 1 */ #define GLINSETMASTEREVENTENABLE 0x11C0002C /* 1 */ #define GLINGETNSLAVETABLE 0x11C0002D /* 1 get number of slave table entries */ #define GLINGETSLAVETABLEPIDS 0x11C0002E /* 1 + n get list of slave table PIDs */ #define GLINGETSLAVETABLE 0x11C0002F /* var., 4 + n */ #define GLINSETSLAVETABLE 0x11C00030 /* var., 4 + n */ #define GLINCLEARSLAVETABLE 0x11C00031 /* 1 */ #define GLINCLEARALLSLAVETABLE 0x11C00032 /* 0 */ #define GLINGETONESHOT 0x11C00033 /* var., 4 + n */ #define GLINSETONESHOT 0x11C00034 /* var., 4 + n */ #define GLINCLEARONESHOT 0x11C00035 /* 0 */ /* delay driver (real-time scheduler) IOCTLs */ #define GDLYGETHIVALUE 0x11D50001 /* 4 */ #define GDLYSETHIVALUE 0x11D50002 /* 4 set the high water value */ /* 2 bytes - stream number */ /* 2 bytes - high water value */ #define GDLYGETLOVALUE 0x11D50003 /* 4 */ #define GDLYSETLOVALUE 0x11D50004 /* 4 set the low water value */ /* 2 bytes - stream number */ /* 2 bytes - low water value */ #define GDLYGETHITIME 0x11D50005 /* 4 */ #define GDLYSETHITIME 0x11D50006 /* 4 set the high water time */ /* 2 bytes - stream number */ /* 2 bytes - high water time (ms) */ #define GDLYGETLOTIME 0x11D50007 /* 4 */ #define GDLYSETLOTIME 0x11D50008 /* 4 set the low water time */ /* 2 bytes - stream number */ /* 2 bytes - low water time (ms) */ #define GDLYGETLOREPORT 0x11D50009 /* 4 get the low water report flag */ /* 2 bytes - stream number */ /* 2 bytes - 1: report when low */ /* 0: do not report when low*/ #define GDLYFLUSHSTREAM 0x11D5000A /* 2 flush the delay buffer */ /* 2 bytes - stream number */ #define GDLYINITSTREAM 0x11D5000B /* 2 set default hi & lo water marks*/ /* 2 bytes - stream number */ #define GDLYPARTIALFLUSHSTREAM 0x11D5000C /* 4 flush the delay buffer */ /* 2 bytes - stream number */ /* 2 bytes - data to retain in ms */ #define GINPGETINP 0x11500001 #define GINPGETLATCH 0x11500002 #define GINPCLRLATCH 0x11500003 #define GOUTGET 0x11510001 #define GOUTSET 0x11510002 #define GOUTSETBIT 0x11510003 #define GOUTCLEARBIT 0x11510004 #define GPWRGETWHICH 0x11520001 #define GPWROFF 0x11520002 #define GPWROFFRESET 0x11520003 #define GPWRRESET 0x11520004 /* Hardware / driver TYPE and SUBTYPE definitions */ #define GDUMMY 0x01 /* Dummy device driver TYPE */ #define GDGDMARKONE 0x01 /* Dummy device driver SUBTYPE */ #define GCAN 0x02 /* CAN TYPE */ #define G82527 0x01 /* 82527 SUBTYPE */ #define GSJA1000 0x02 /* SJA1000 SUBTYPE */ #define G82527SW 0x03 /* 82527 single wire subtype */ #define G82527ISO11992 0x04 /* 82527 ISO11992 subtype */ #define G82527_SINGLECHAN 0x05 /* 82527 single channel */ #define G82527SW_SINGLECHAN 0x06 /* 82527 single wire single channel */ #define G82527ISO11992_SINGLECHAN 0x07 /* 82527 ISO11992 single channel */ #define GSJA1000FT 0x10 /* SJA1000 Fault Tolerant subtype */ #define GSJA1000C 0x11 /* SJA1000 Compact subtype */ #define GSJA1000FT_FO 0x12 /* SJA1000 single chsnnel Fault Tolerant subtype */ #define GSJA1000_BEACON_CANFD 0x1a /* SJA1000 BEACON CAN-FD subtype */ #define GSJA1000_BEACON_SW 0x1b /* SJA1000 BEACON CAN single wire subtype */ #define GSJA1000_BEACON_FT 0x1c /* SJA1000 BEACON CAN Fault Tolerant subtype */ #define GJ1850 0x03 /* 1850 TYPE */ #define GHBCCPAIR 0x01 /* HBCC SUBTYPE */ #define GDLC 0x02 /* GM DLC SUBTYPE */ #define GCHRYSLER 0x03 /* Chrysler SUBTYPE */ #define GDEHC12 0x04 /* DE HC12 KWP/BDLC SUBTYPE */ #define GKWP2000 0x04 /* Keyword protocol 2000 TYPE */ #define GDEHC12KWP 0x01 /* DE HC12 KWP/BDLC card SUBTYPE */ #define GHONDA 0x05 /* Honda UART TYPE */ #define GDGHC08 0x01 /* DG HC08 SUBTYPE */ #define GFORDUBP 0x06 /* FORD UBP TYPE */ #define GDGUBP08 0x01 /* DG HC08 SUBTYPE */ #define GSCI 0x09 /* Chrysler SCI TYPE */ #define G16550SCI 0x01 /* 16550 type UART based card SUBTYPE */ #define GCCD 0x0a /* Chrysler C2D TYPE */ #define G16550CDP68HC68 0x01 /* 16550 / CDP68HC68S1 card SUBTYPE */ #define GLIN 0x0b /* LIN TYPE */ #define GDGLIN08 0x01 /* DG HC08 SUBTYPE */ #define GDGLIN_BEACON 0x03 /* DG BEACON LIN SUBTYPE */ typedef struct { guint32 cmd; guint32 cmd_context; //typically just guint8, but let's room for expansion/improvement guint32 ioctl_command; //should be more generic, but IOCTL is currently the only user guint32 req_frame_num; guint32 rsp_frame_num; nstime_t req_time; } gryphon_pkt_info_t; /* List contains request data */ typedef struct { wmem_list_t *request_frame_data; } gryphon_conversation; /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
wireshark/plugins/epan/gryphon/README
Dearborn Group Technology has released under GPL this plugin for Wireshark. It decodes the protocol used by their Gryphon and BEACON automotive network tool. The plugin decodes the communication protocol, but not any vehicle network messages. Dearborn Group Technology can be found at https://www.dgtech.com The author is Steve Limkemann <[email protected]>, with fixes and updates by Mark Ciechanowski <[email protected]>
Text
wireshark/plugins/epan/irda/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(irda 0 0 6 0) set(DISSECTOR_SRC packet-ircomm.c packet-irda.c packet-sir.c ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ) add_wireshark_plugin_library(irda epan) target_link_libraries(irda epan) install_plugin(irda epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME irda SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C/C++
wireshark/plugins/epan/irda/irda-appl.h
/* irda-appl.h * Interface for IrDA application dissectors * By Jan Kiszka <[email protected]> * Copyright 2003 Jan Kiszka * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __IRDA_APPL_H__ #define __IRDA_APPL_H__ /* * Prototypes, defines, and typedefs needed for implementing IrDA application * layer dissectors. * There should be no need to modify this part. */ /* LM-IAS Attribute types */ #define IAS_MISSING 0 #define IAS_INTEGER 1 #define IAS_OCT_SEQ 2 #define IAS_STRING 3 /* Maximum number of handled list entries of an IAP result */ #define MAX_IAP_ENTRIES 32 typedef enum { CONNECT_PDU, DISCONNECT_PDU, DATA_PDU } pdu_type_t; typedef gboolean (*ias_value_dissector_t)(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index, guint8 attr_type, guint8 circuit_id); typedef const struct ias_attr_dissector { const char* attr_name; ias_value_dissector_t value_dissector; } ias_attr_dissector_t; typedef const struct ias_class_dissector { const char* class_name; ias_attr_dissector_t* pattr_dissector; } ias_class_dissector_t; extern gboolean check_iap_octet_result(tvbuff_t* tvb, proto_tree* tree, guint offset, const char* attr_name, guint8 attr_type); extern guint8 check_iap_lsap_result(tvbuff_t* tvb, proto_tree* tree, guint offset, const char* attr_name, guint8 attr_type); extern void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissector_handle_t dissector, guint8 circuit_id); extern unsigned dissect_param_tuple(tvbuff_t* tvb, proto_tree* tree, guint offset); /* * Protocol exports. * Modify the lines below to add new protocols. */ /* IrCOMM/IrLPT protocol */ extern void proto_register_ircomm(void); extern ias_attr_dissector_t ircomm_attr_dissector[]; extern ias_attr_dissector_t irlpt_attr_dissector[]; /* Serial Infrared (SIR) */ extern void proto_register_irsir(void); /* * Protocol hooks */ /* IAS class dissectors */ #define CLASS_DISSECTORS \ { "Device", device_attr_dissector }, \ { "IrDA:IrCOMM", ircomm_attr_dissector }, \ { "IrLPT", irlpt_attr_dissector }, \ { NULL, NULL } #endif /* __IRDA_APPL_H__ */
C
wireshark/plugins/epan/irda/packet-ircomm.c
/* packet-ircomm.c * Routines for IrCOMM dissection * Copyright 2003 Jan Kiszka <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> /* * See * * http://www.irdajp.info/specifications.php * * or * * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp * * for various IrDA specifications. */ #include "irda-appl.h" /* Parameters common to all service types */ #define IRCOMM_SERVICE_TYPE 0x00 #define IRCOMM_PORT_TYPE 0x01 /* Only used in LM-IAS */ #define IRCOMM_PORT_NAME 0x02 /* Only used in LM-IAS */ /* Parameters for both 3 wire and 9 wire */ #define IRCOMM_DATA_RATE 0x10 #define IRCOMM_DATA_FORMAT 0x11 #define IRCOMM_FLOW_CONTROL 0x12 #define IRCOMM_XON_XOFF 0x13 #define IRCOMM_ENQ_ACK 0x14 #define IRCOMM_LINE_STATUS 0x15 #define IRCOMM_BREAK 0x16 /* Parameters for 9 wire */ #define IRCOMM_DTE 0x20 #define IRCOMM_DCE 0x21 #define IRCOMM_POLL 0x22 /* Service type (details) */ #define IRCOMM_3_WIRE_RAW 0x01 #define IRCOMM_3_WIRE 0x02 #define IRCOMM_9_WIRE 0x04 #define IRCOMM_CENTRONICS 0x08 /* Port type (details) */ #define IRCOMM_SERIAL 0x01 #define IRCOMM_PARALLEL 0x02 /* Data format (details) */ #define IRCOMM_WSIZE_5 0x00 #define IRCOMM_WSIZE_6 0x01 #define IRCOMM_WSIZE_7 0x02 #define IRCOMM_WSIZE_8 0x03 #define IRCOMM_1_STOP_BIT 0x00 #define IRCOMM_2_STOP_BIT 0x04 /* 1.5 if char len 5 */ #define IRCOMM_PARITY_DISABLE 0x00 #define IRCOMM_PARITY_ENABLE 0x08 #define IRCOMM_PARITY_ODD 0x00 #define IRCOMM_PARITY_EVEN 0x10 #define IRCOMM_PARITY_MARK 0x20 #define IRCOMM_PARITY_SPACE 0x30 /* Flow control */ #define IRCOMM_XON_XOFF_IN 0x01 #define IRCOMM_XON_XOFF_OUT 0x02 #define IRCOMM_RTS_CTS_IN 0x04 #define IRCOMM_RTS_CTS_OUT 0x08 #define IRCOMM_DSR_DTR_IN 0x10 #define IRCOMM_DSR_DTR_OUT 0x20 #define IRCOMM_ENQ_ACK_IN 0x40 #define IRCOMM_ENQ_ACK_OUT 0x80 /* Line status */ #define IRCOMM_OVERRUN_ERROR 0x02 #define IRCOMM_PARITY_ERROR 0x04 #define IRCOMM_FRAMING_ERROR 0x08 /* DTE (Data terminal equipment) line settings */ #define IRCOMM_DELTA_DTR 0x01 #define IRCOMM_DELTA_RTS 0x02 #define IRCOMM_DTR 0x04 #define IRCOMM_RTS 0x08 /* DCE (Data communications equipment) line settings */ #define IRCOMM_DELTA_CTS 0x01 /* Clear to send has changed */ #define IRCOMM_DELTA_DSR 0x02 /* Data set ready has changed */ #define IRCOMM_DELTA_RI 0x04 /* Ring indicator has changed */ #define IRCOMM_DELTA_CD 0x08 /* Carrier detect has changed */ #define IRCOMM_CTS 0x10 /* Clear to send is high */ #define IRCOMM_DSR 0x20 /* Data set ready is high */ #define IRCOMM_RI 0x40 /* Ring indicator is high */ #define IRCOMM_CD 0x80 /* Carrier detect is high */ #define IRCOMM_DCE_DELTA_ANY 0x0f void proto_reg_handoff_ircomm(void); /* Initialize the subtree pointers */ static gint ett_ircomm = -1; static gint ett_ircomm_ctrl = -1; #define MAX_PARAMETERS 32 static gint ett_param[MAX_IAP_ENTRIES * MAX_PARAMETERS]; static dissector_handle_t ircomm_raw_handle; static dissector_handle_t ircomm_cooked_handle; static int proto_ircomm = -1; static int hf_ircomm_param = -1; /* static int hf_param_pi = -1; */ /* static int hf_param_pl = -1; */ /* static int hf_param_pv = -1; */ static int hf_control = -1; static int hf_control_len = -1; static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index, guint8 attr_type, guint8 circuit_id); static gboolean dissect_ircomm_ttp_lsap(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index, guint8 attr_type, guint8 circuit_id); static gboolean dissect_ircomm_lmp_lsap(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index, guint8 attr_type, guint8 circuit_id); ias_attr_dissector_t ircomm_attr_dissector[] = { /* IrDA:IrCOMM attribute dissectors */ { "Parameters", dissect_ircomm_parameters }, { "IrDA:TinyTP:LsapSel", dissect_ircomm_ttp_lsap }, { NULL, NULL } }; ias_attr_dissector_t irlpt_attr_dissector[] = { /* IrLPT attribute dissectors */ { "IrDA:IrLMP:LsapSel", dissect_ircomm_lmp_lsap }, { "IrDA:IrLMP:LSAPSel", dissect_ircomm_lmp_lsap }, /* according to IrCOMM V1.0, p25 */ { NULL, NULL } }; /* * Dissect the cooked IrCOMM protocol */ static int dissect_cooked_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { proto_item *ti; proto_tree *ircomm_tree, *ctrl_tree; guint offset = 0; guint clen; gint len = tvb_reported_length(tvb); if (len == 0) return len; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IrCOMM"); clen = tvb_get_guint8(tvb, offset); len -= 1 + clen; if (len > 0) col_add_fstr(pinfo->cinfo, COL_INFO, "Clen=%d, UserData: %d byte%s", clen, len, (len > 1)? "s": ""); else col_add_fstr(pinfo->cinfo, COL_INFO, "Clen=%d", clen); /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_ircomm, tvb, 0, -1, ENC_NA); ircomm_tree = proto_item_add_subtree(ti, ett_ircomm); ti = proto_tree_add_item(ircomm_tree, hf_control, tvb, 0, clen + 1, ENC_NA); ctrl_tree = proto_item_add_subtree(ti, ett_ircomm_ctrl); proto_tree_add_item(ctrl_tree, hf_control_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; call_data_dissector(tvb_new_subset_length(tvb, offset, clen), pinfo, ctrl_tree); offset += clen; call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, ircomm_tree); return len; } /* * Dissect the raw IrCOMM/IrLPT protocol */ static int dissect_raw_ircomm(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_) { guint len = tvb_reported_length(tvb); proto_item* ti; proto_tree* ircomm_tree; if (len == 0) return 0; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IrCOMM"); col_add_fstr(pinfo->cinfo, COL_INFO, "User Data: %d byte%s", len, (len > 1)? "s": ""); /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_ircomm, tvb, 0, -1, ENC_NA); ircomm_tree = proto_item_add_subtree(ti, ett_ircomm); call_data_dissector(tvb, pinfo, ircomm_tree); return len; } /* * Dissect IrCOMM IAS "Parameters" attribute */ static gboolean dissect_ircomm_parameters(tvbuff_t* tvb, guint offset, packet_info* pinfo _U_, proto_tree* tree, guint list_index, guint8 attr_type, guint8 circuit_id _U_) { guint len; guint n = 0; proto_item* ti; proto_tree* p_tree; char buf[256]; guint8 pv; if (!check_iap_octet_result(tvb, tree, offset, "Parameters", attr_type)) return TRUE; if (tree) { len = tvb_get_ntohs(tvb, offset) + offset + 2; offset += 2; while (offset < len) { guint8 p_len = tvb_get_guint8(tvb, offset + 1); ti = proto_tree_add_item(tree, hf_ircomm_param, tvb, offset, p_len + 2, ENC_NA); p_tree = proto_item_add_subtree(ti, ett_param[list_index * MAX_PARAMETERS + n]); buf[0] = 0; switch (tvb_get_guint8(tvb, offset)) { case IRCOMM_SERVICE_TYPE: proto_item_append_text(ti, ": Service Type ("); pv = tvb_get_guint8(tvb, offset+2); if (pv & IRCOMM_3_WIRE_RAW) (void) g_strlcat(buf, ", 3-Wire raw", 256); if (pv & IRCOMM_3_WIRE) (void) g_strlcat(buf, ", 3-Wire", 256); if (pv & IRCOMM_9_WIRE) (void) g_strlcat(buf, ", 9-Wire", 256); if (pv & IRCOMM_CENTRONICS) (void) g_strlcat(buf, ", Centronics", 256); (void) g_strlcat(buf, ")", 256); if (strlen(buf) > 2) proto_item_append_text(ti, "%s", buf+2); else proto_item_append_text(ti, "unknown)"); break; case IRCOMM_PORT_TYPE: proto_item_append_text(ti, ": Port Type ("); pv = tvb_get_guint8(tvb, offset+2); if (pv & IRCOMM_SERIAL) (void) g_strlcat(buf, ", serial", 256); if (pv & IRCOMM_PARALLEL) (void) g_strlcat(buf, ", parallel", 256); (void) g_strlcat(buf, ")", 256); if (strlen(buf) > 2) proto_item_append_text(ti, "%s", buf+2); else proto_item_append_text(ti, "unknown)"); break; case IRCOMM_PORT_NAME: /* XXX - the IrCOMM V1.0 spec says this "Normally human readable text, but not required". */ proto_item_append_text(ti, ": Port Name (\"%s\")", tvb_format_text(pinfo->pool, tvb, offset+2, p_len)); break; default: proto_item_append_text(ti, ": unknown"); } offset = dissect_param_tuple(tvb, p_tree, offset); n++; } } return TRUE; } /* * Dissect IrCOMM IAS "IrDA:TinyTP:LsapSel" attribute */ static gboolean dissect_ircomm_ttp_lsap(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index _U_, guint8 attr_type, guint8 circuit_id) { guint8 dlsap; if ((dlsap = check_iap_lsap_result(tvb, tree, offset, "IrDA:TinyTP:LsapSel", attr_type)) == 0) return FALSE; add_lmp_conversation(pinfo, dlsap, TRUE, ircomm_cooked_handle, circuit_id); return FALSE; } /* * Dissect IrCOMM/IrLPT IAS "IrDA:IrLMP:LsapSel" attribute */ static gboolean dissect_ircomm_lmp_lsap(tvbuff_t* tvb, guint offset, packet_info* pinfo, proto_tree* tree, guint list_index _U_, guint8 attr_type, guint8 circuit_id) { guint8 dlsap; if ((dlsap = check_iap_lsap_result(tvb, tree, offset, "IrDA:IrLMP:LsapSel", attr_type)) == 0) return FALSE; add_lmp_conversation(pinfo, dlsap, FALSE, ircomm_raw_handle, circuit_id); return FALSE; } /* * Register the IrCOMM protocol */ void proto_register_ircomm(void) { guint i; /* Setup list of header fields */ static hf_register_info hf_ircomm[] = { { &hf_ircomm_param, { "IrCOMM Parameter", "ircomm.parameter", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, #if 0 { &hf_param_pi, { "Parameter Identifier", "ircomm.pi", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_param_pl, { "Parameter Length", "ircomm.pl", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_param_pv, { "Parameter Value", "ircomm.pv", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, #endif { &hf_control, { "Control Channel", "ircomm.control", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_control_len, { "Clen", "ircomm.control.len", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }} }; /* Setup protocol subtree arrays */ static gint* ett[] = { &ett_ircomm, &ett_ircomm_ctrl }; gint* ett_p[MAX_IAP_ENTRIES * MAX_PARAMETERS]; /* Register protocol names and descriptions */ proto_ircomm = proto_register_protocol("IrCOMM Protocol", "IrCOMM", "ircomm"); ircomm_raw_handle = register_dissector("ircomm_raw", dissect_raw_ircomm, proto_ircomm); ircomm_cooked_handle = register_dissector("ircomm_cooked", dissect_cooked_ircomm, proto_ircomm); /* Required function calls to register the header fields */ proto_register_field_array(proto_ircomm, hf_ircomm, array_length(hf_ircomm)); /* Register subtrees */ proto_register_subtree_array(ett, array_length(ett)); for (i = 0; i < MAX_IAP_ENTRIES * MAX_PARAMETERS; i++) { ett_param[i] = -1; ett_p[i] = &ett_param[i]; } proto_register_subtree_array(ett_p, MAX_IAP_ENTRIES * MAX_PARAMETERS); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/irda/packet-irda.c
/* packet-irda.c * Routines for IrDA dissection * By Shaun Jackman <[email protected]> * Copyright 2000 Shaun Jackman * * Extended by Jan Kiszka <[email protected]> * Copyright 2003 Jan Kiszka * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <string.h> #include <epan/packet.h> #include <epan/address_types.h> #include <epan/to_str.h> #include <epan/strutil.h> #include <epan/conversation.h> #include <epan/xdlc.h> #include <wiretap/wtap.h> #include <epan/dissectors/packet-sll.h> #include "irda-appl.h" /* * This plugin dissects infrared data transmissions as defined by the IrDA * specification (www.irda.org). See * * http://www.irdajp.info/specifications.php * * or * * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp * * for various IrDA specifications. * * The plugin operates both offline with libpcap files and online on supported * platforms. Live dissection is currently available for Linux-IrDA * (irda.sourceforge.net) and for Windows if the Linux-IrDA port IrCOMM2k * (www.ircomm2k.de) is installed. */ /* * LAP */ /* Frame types and templates */ #define INVALID 0xff /* * XXX - the IrDA spec gives XID as 0x2c; HDLC (and other HDLC-derived * protocolc) use 0xAC. */ #define IRDA_XID_CMD 0x2c /* Exchange Station Identification */ #define CMD_FRAME 0x01 #define RSP_FRAME 0x00 /* Discovery Flags */ #define S_MASK 0x03 #define CONFLICT 0x04 /* Negotiation Parameters */ #define PI_BAUD_RATE 0x01 #define PI_MAX_TURN_TIME 0x82 #define PI_DATA_SIZE 0x83 #define PI_WINDOW_SIZE 0x84 #define PI_ADD_BOFS 0x85 #define PI_MIN_TURN_TIME 0x86 #define PI_LINK_DISC 0x08 /* * LMP */ /* IrLMP frame opcodes */ #define CONNECT_CMD 0x01 #define CONNECT_CNF 0x81 #define DISCONNECT 0x02 #define ACCESSMODE_CMD 0x03 #define ACCESSMODE_CNF 0x83 #define CONTROL_BIT 0x80 #define RESERVED_BIT 0x80 /* LSAP-SEL's */ #define LSAP_MASK 0x7f #define LSAP_IAS 0x00 #define LSAP_ANY 0xff #define LSAP_MAX 0x6f /* 0x70-0x7f are reserved */ #define LSAP_CONNLESS 0x70 /* Connectionless LSAP, mostly used for Ultra */ /* * IAP */ /* IrIAP Op-codes */ #define GET_INFO_BASE 0x01 #define GET_OBJECTS 0x02 #define GET_VALUE 0x03 #define GET_VALUE_BY_CLASS 0x04 #define GET_OBJECT_INFO 0x05 #define GET_ATTRIB_NAMES 0x06 #define IAP_LST 0x80 #define IAP_ACK 0x40 #define IAP_OP 0x3F #define IAS_SUCCESS 0 #define IAS_CLASS_UNKNOWN 1 #define IAS_ATTRIB_UNKNOWN 2 #define IAS_ATTR_TOO_LONG 3 #define IAS_DISCONNECT 10 #define IAS_UNSUPPORTED 0xFF /* * TTP */ #define TTP_PARAMETERS 0x80 #define TTP_MORE 0x80 void proto_reg_handoff_irda(void); void proto_register_irda(void); /* Initialize the protocol and registered fields */ static int proto_irlap = -1; static int hf_lap_a = -1; static int hf_lap_a_cr = -1; static int hf_lap_a_address = -1; static int hf_lap_c = -1; static int hf_lap_c_nr = -1; static int hf_lap_c_ns = -1; static int hf_lap_c_p = -1; static int hf_lap_c_f = -1; static int hf_lap_c_s = -1; static int hf_lap_c_u_cmd = -1; static int hf_lap_c_u_rsp = -1; static int hf_lap_c_i = -1; static int hf_lap_c_s_u = -1; static int hf_lap_i = -1; static int hf_snrm_saddr = -1; static int hf_snrm_daddr = -1; static int hf_snrm_ca = -1; static int hf_ua_saddr = -1; static int hf_ua_daddr = -1; static int hf_negotiation_param = -1; static int hf_param_pi = -1; static int hf_param_pl = -1; static int hf_param_pv = -1; static int hf_xid_ident = -1; static int hf_xid_saddr = -1; static int hf_xid_daddr = -1; static int hf_xid_flags = -1; static int hf_xid_s = -1; static int hf_xid_conflict = -1; static int hf_xid_slotnr = -1; static int hf_xid_version = -1; static int proto_irlmp = -1; static int hf_lmp_xid_hints = -1; static int hf_lmp_xid_charset = -1; static int hf_lmp_xid_name = -1; static int hf_lmp_xid_name_no_encoding = -1; static int hf_lmp_dst = -1; static int hf_lmp_dst_control = -1; static int hf_lmp_dst_lsap = -1; static int hf_lmp_src = -1; static int hf_lmp_src_r = -1; static int hf_lmp_src_lsap = -1; static int hf_lmp_opcode = -1; static int hf_lmp_rsvd = -1; static int hf_lmp_reason = -1; static int hf_lmp_mode = -1; static int hf_lmp_status = -1; static int proto_iap = -1; static int hf_iap_ctl = -1; static int hf_iap_ctl_lst = -1; static int hf_iap_ctl_ack = -1; static int hf_iap_ctl_opcode = -1; static int hf_iap_class_name = -1; static int hf_iap_attr_name = -1; static int hf_iap_return = -1; static int hf_iap_list_len = -1; static int hf_iap_list_entry = -1; static int hf_iap_obj_id = -1; static int hf_iap_attr_type = -1; static int hf_iap_int = -1; static int hf_iap_seq_len = -1; static int hf_iap_oct_seq = -1; static int hf_iap_char_set = -1; static int hf_iap_string = -1; static int hf_iap_invaloctet = -1; static int hf_iap_invallsap = -1; static int proto_ttp = -1; static int hf_ttp_p = -1; static int hf_ttp_icredit = -1; static int hf_ttp_m = -1; static int hf_ttp_dcredit = -1; static int proto_log = -1; static int hf_log_msg = -1; static int hf_log_missed = -1; /* Initialize the subtree pointers */ static gint ett_irlap = -1; static gint ett_lap_a = -1; static gint ett_lap_c = -1; static gint ett_lap_i = -1; static gint ett_xid_flags = -1; static gint ett_log = -1; static gint ett_irlmp = -1; static gint ett_lmp_dst = -1; static gint ett_lmp_src = -1; static gint ett_iap = -1; static gint ett_iap_ctl = -1; static gint ett_ttp = -1; #define MAX_PARAMETERS 32 static gint ett_param[MAX_PARAMETERS]; static gint ett_iap_entry[MAX_IAP_ENTRIES]; static int irda_address_type = -1; static dissector_handle_t irda_handle; static const xdlc_cf_items irlap_cf_items = { &hf_lap_c_nr, &hf_lap_c_ns, &hf_lap_c_p, &hf_lap_c_f, &hf_lap_c_s, &hf_lap_c_u_cmd, &hf_lap_c_u_rsp, &hf_lap_c_i, &hf_lap_c_s_u }; /* IAP conversation type */ typedef struct iap_conversation { struct iap_conversation* pnext; guint32 iap_query_frame; ias_attr_dissector_t* pattr_dissector; } iap_conversation_t; /* IrLMP conversation type */ typedef struct lmp_conversation { struct lmp_conversation* pnext; guint32 iap_result_frame; gboolean ttp; dissector_handle_t dissector; } lmp_conversation_t; static const true_false_string lap_cr_vals = { "Command", "Response" }; static const true_false_string set_notset = { "Set", "Not set" }; static const value_string lap_c_ftype_vals[] = { { XDLC_I, "Information frame" }, { XDLC_S, "Supervisory frame" }, { XDLC_U, "Unnumbered frame" }, { 0, NULL } }; static const value_string lap_c_u_cmd_abbr_vals[] = { { XDLC_SNRM, "SNRM" }, { XDLC_DISC, "DISC" }, { XDLC_UI, "UI" }, { IRDA_XID_CMD, "XID" }, { XDLC_TEST, "TEST" }, { 0, NULL } }; static const value_string lap_c_u_rsp_abbr_vals[] = { { XDLC_SNRM, "RNRM" }, { XDLC_UA, "UA" }, { XDLC_FRMR, "FRMR" }, { XDLC_DM, "DM" }, { XDLC_RD, "RD" }, { XDLC_UI, "UI" }, { XDLC_XID, "XID" }, { XDLC_TEST, "TEST" }, { 0, NULL } }; static const value_string lap_c_u_cmd_vals[] = { { XDLC_SNRM>>2, "Set Normal Response Mode" }, { XDLC_DISC>>2, "Disconnect" }, { XDLC_UI>>2, "Unnumbered Information" }, { IRDA_XID_CMD>>2, "Exchange Station Identification" }, { XDLC_TEST>>2, "Test" }, { 0, NULL } }; static const value_string lap_c_u_rsp_vals[] = { { XDLC_SNRM>>2, "Request Normal Response Mode" }, { XDLC_UA>>2, "Unnumbered Acknowledge" }, { XDLC_FRMR>>2, "Frame Reject" }, { XDLC_DM>>2, "Disconnect Mode" }, { XDLC_RD>>2, "Request Disconnect" }, { XDLC_UI>>2, "Unnumbered Information" }, { XDLC_XID>>2, "Exchange Station Identification" }, { XDLC_TEST>>2, "Test" }, { 0, NULL } }; static const value_string lap_c_s_vals[] = { { XDLC_RR>>2, "Receiver ready" }, { XDLC_RNR>>2, "Receiver not ready" }, { XDLC_REJ>>2, "Reject" }, { XDLC_SREJ>>2, "Selective reject" }, { 0, NULL } }; static const value_string xid_slot_numbers[] = { /* Number of XID slots */ { 0, "1" }, { 1, "6" }, { 2, "8" }, { 3, "16" }, { 0, NULL } }; static const value_string lmp_opcode_vals[] = { /* IrLMP frame opcodes */ { CONNECT_CMD, "Connect Command" }, { CONNECT_CNF, "Connect Confirm" }, { DISCONNECT, "Disconnect" }, { ACCESSMODE_CMD, "Access Mode Command" }, { ACCESSMODE_CNF, "Access Mode Confirm" }, { 0, NULL } }; static const value_string lmp_reason_vals[] = { /* IrLMP disconnect reasons */ { 0x01, "User Request" }, { 0x02, "Unexpected IrLAP Disconnect" }, { 0x03, "Failed to establish IrLAP connection" }, { 0x04, "IrLAP Reset" }, { 0x05, "Link Management Initiated Disconnect" }, { 0x06, "Data delivered on disconnected LSAP-Connection"}, { 0x07, "Non Responsive LM-MUX Client" }, { 0x08, "No available LM-MUX Client" }, { 0x09, "Connection Half Open" }, { 0x0A, "Illegal Source Address" }, { 0xFF, "Unspecified Disconnect Reason" }, { 0, NULL } }; static const value_string lmp_mode_vals[] = { /* IrLMP modes */ { 0x00, "Multiplexed" }, { 0x01, "Exclusive" }, { 0, NULL } }; static const value_string lmp_status_vals[] = { /* IrLMP status */ { 0x00, "Success" }, { 0x01, "Failure" }, { 0xFF, "Unsupported" }, { 0, NULL } }; #define LMP_CHARSET_ASCII 0 #define LMP_CHARSET_ISO_8859_1 1 #define LMP_CHARSET_ISO_8859_2 2 #define LMP_CHARSET_ISO_8859_3 3 #define LMP_CHARSET_ISO_8859_4 4 #define LMP_CHARSET_ISO_8859_5 5 #define LMP_CHARSET_ISO_8859_6 6 #define LMP_CHARSET_ISO_8859_7 7 #define LMP_CHARSET_ISO_8859_8 8 #define LMP_CHARSET_ISO_8859_9 9 #define LMP_CHARSET_UNICODE 0xFF /* UCS-2 (byte order?) */ static const value_string lmp_charset_vals[] = { /* IrLMP character set */ { LMP_CHARSET_ASCII, "ASCII" }, { LMP_CHARSET_ISO_8859_1, "ISO 8859-1" }, { LMP_CHARSET_ISO_8859_2, "ISO 8859-2" }, { LMP_CHARSET_ISO_8859_3, "ISO 8859-3" }, { LMP_CHARSET_ISO_8859_4, "ISO 8859-4" }, { LMP_CHARSET_ISO_8859_5, "ISO 8859-5" }, { LMP_CHARSET_ISO_8859_6, "ISO 8859-6" }, { LMP_CHARSET_ISO_8859_7, "ISO 8859-7" }, { LMP_CHARSET_ISO_8859_8, "ISO 8859-8" }, { LMP_CHARSET_ISO_8859_9, "ISO 8859-9" }, { LMP_CHARSET_UNICODE, "Unicode" }, { 0, NULL } }; static const value_string iap_opcode_vals[] = { /* IrIAP Op-codes */ { GET_INFO_BASE, "GetInfoBase" }, { GET_OBJECTS, "GetObjects" }, { GET_VALUE, "GetValue" }, { GET_VALUE_BY_CLASS, "GetValueByClass" }, { GET_OBJECT_INFO, "GetObjectInfo" }, { GET_ATTRIB_NAMES, "GetAttributeNames" }, { 0, NULL } }; static const value_string iap_return_vals[] = { /* IrIAP Return-codes */ { IAS_SUCCESS, "Success" }, { IAS_CLASS_UNKNOWN, "Class/Object Unknown" }, { IAS_ATTRIB_UNKNOWN, "Attribute Unknown" }, { IAS_ATTR_TOO_LONG, "Attribute List Too Long" }, { IAS_DISCONNECT, "Disconnect (Linux-IrDA only)" }, { IAS_UNSUPPORTED, "Unsupported Optional Operation" }, { 0, NULL } }; static const value_string iap_attr_type_vals[] = { /* LM-IAS Attribute types */ { IAS_MISSING, "Missing" }, { IAS_INTEGER, "Integer" }, { IAS_OCT_SEQ, "Octet Sequence" }, { IAS_STRING, "String" }, { 0, NULL } }; static ias_attr_dissector_t device_attr_dissector[] = { /* Device attribute dissectors */ /* { "IrLMPSupport", xxx }, not implemented yet... */ { NULL, NULL } }; /* IAS class dissectors */ static ias_class_dissector_t class_dissector[] = { CLASS_DISSECTORS }; /* * Dissect parameter tuple */ guint dissect_param_tuple(tvbuff_t* tvb, proto_tree* tree, guint offset) { guint8 len = tvb_get_guint8(tvb, offset + 1); if (tree) proto_tree_add_item(tree, hf_param_pi, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (tree) proto_tree_add_item(tree, hf_param_pl, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (len > 0) { if (tree) proto_tree_add_item(tree, hf_param_pv, tvb, offset, len, ENC_NA); offset += len; } return offset; } /* * Dissect TTP */ static guint dissect_ttp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, gboolean data) { guint offset = 0; guint8 head; char buf[128]; if (tvb_reported_length(tvb) == 0) return 0; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "TTP"); head = tvb_get_guint8(tvb, offset); snprintf(buf, 128, ", Credit=%d", head & ~TTP_PARAMETERS); col_append_str(pinfo->cinfo, COL_INFO, buf); if (root) { /* create display subtree for the protocol */ proto_item* ti = proto_tree_add_item(root, proto_ttp, tvb, 0, -1, ENC_NA); proto_tree* tree = proto_item_add_subtree(ti, ett_ttp); if (data) { proto_tree_add_item(tree, hf_ttp_m, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_ttp_dcredit, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } else { proto_tree_add_item(tree, hf_ttp_p, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_ttp_icredit, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } proto_item_set_len(tree, offset); } else offset++; return offset; } /* * Dissect IAP request */ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, guint8 circuit_id) { guint offset = 0; guint8 op; guint8 clen = 0; guint8 alen = 0; guint8 src; address srcaddr; address destaddr; conversation_t* conv; iap_conversation_t* iap_conv; if (tvb_reported_length(tvb) == 0) return; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IAP"); op = tvb_get_guint8(tvb, offset) & IAP_OP; switch (op) { case GET_VALUE_BY_CLASS: clen = MIN(tvb_get_guint8(tvb, offset + 1), 60); alen = MIN(tvb_get_guint8(tvb, offset + 1 + 1 + clen), 60); /* create conversation entry */ src = circuit_id ^ CMD_FRAME; set_address(&srcaddr, irda_address_type, 1, &src); set_address(&destaddr, irda_address_type, 1, &circuit_id); conv = find_conversation(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { iap_conv = (iap_conversation_t*)conversation_get_proto_data(conv, proto_iap); while (1) { if (iap_conv->iap_query_frame == pinfo->num) { iap_conv = NULL; break; } if (iap_conv->pnext == NULL) { iap_conv->pnext = wmem_new(wmem_file_scope(), iap_conversation_t); iap_conv = iap_conv->pnext; break; } iap_conv = iap_conv->pnext; } } else { conv = conversation_new(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); iap_conv = wmem_new(wmem_file_scope(), iap_conversation_t); conversation_add_proto_data(conv, proto_iap, (void*)iap_conv); } if (iap_conv) { iap_conv->pnext = NULL; iap_conv->iap_query_frame = pinfo->num; iap_conv->pattr_dissector = NULL; } char *class_name = (char *) tvb_get_string_enc(pinfo->pool, tvb, offset + 1 + 1, clen, ENC_ASCII|ENC_NA); char *attr_name = (char *) tvb_get_string_enc(pinfo->pool, tvb, offset + 1 + 1 + clen + 1, alen, ENC_ASCII|ENC_NA); col_add_fstr(pinfo->cinfo, COL_INFO, "GetValueByClass: \"%s\" \"%s\"", format_text(pinfo->pool, (guchar *) class_name, strlen(class_name)), format_text(pinfo->pool, (guchar *) attr_name, strlen(attr_name))); /* Dissect IAP query if it is new */ if (iap_conv) { int i, j; /* Find the attribute dissector */ for (i = 0; class_dissector[i].class_name != NULL; i++) if (strcmp(class_name, class_dissector[i].class_name) == 0) { for (j = 0; class_dissector[i].pattr_dissector[j].attr_name != NULL; j++) if (strcmp(attr_name, class_dissector[i].pattr_dissector[j].attr_name) == 0) { iap_conv->pattr_dissector = &class_dissector[i].pattr_dissector[j]; break; } break; } } } if (root) { /* create display subtree for the protocol */ proto_item* ti = proto_tree_add_item(root, proto_iap, tvb, 0, -1, ENC_NA); proto_tree* tree = proto_item_add_subtree(ti, ett_iap); proto_tree* ctl_tree; ti = proto_tree_add_item(tree, hf_iap_ctl, tvb, offset, 1, ENC_BIG_ENDIAN); ctl_tree = proto_item_add_subtree(ti, ett_iap_ctl); proto_tree_add_item(ctl_tree, hf_iap_ctl_lst, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ctl_tree, hf_iap_ctl_ack, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ctl_tree, hf_iap_ctl_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch (op) { case GET_VALUE_BY_CLASS: proto_tree_add_item(tree, hf_iap_class_name, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); offset += 1 + clen; proto_tree_add_item(tree, hf_iap_attr_name, tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN); offset += 1 + alen; break; } } else { offset++; switch (op) { case GET_VALUE_BY_CLASS: offset += 1 + clen + 1 + alen; break; } } /* If any bytes remain, send it to the generic data dissector */ tvb = tvb_new_subset_remaining(tvb, offset); call_data_dissector(tvb, pinfo, root); } /* * Dissect IAP result */ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, guint8 circuit_id) { guint offset = 0; guint len = tvb_reported_length(tvb); guint n = 0; guint list_len; guint8 op; guint8 retcode; guint8 type; guint16 attr_len; char buf[300]; guint8 src; address srcaddr; address destaddr; conversation_t* conv; iap_conversation_t* cur_iap_conv; iap_conversation_t* iap_conv = NULL; guint32 num; if (len == 0) return; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IAP"); op = tvb_get_guint8(tvb, offset) & IAP_OP; retcode = tvb_get_guint8(tvb, offset + 1); src = circuit_id ^ CMD_FRAME; set_address(&srcaddr, irda_address_type, 1, &src); set_address(&destaddr, irda_address_type, 1, &circuit_id); /* Find result value dissector */ conv = find_conversation(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { num = pinfo->num; iap_conv = (iap_conversation_t*)conversation_get_proto_data(conv, proto_iap); while (iap_conv && (iap_conv->iap_query_frame >= num)) iap_conv = iap_conv->pnext; if (iap_conv) { cur_iap_conv = iap_conv->pnext; while (cur_iap_conv) { if ((cur_iap_conv->iap_query_frame < num) && (cur_iap_conv->iap_query_frame > iap_conv->iap_query_frame)) { iap_conv = cur_iap_conv; } cur_iap_conv = cur_iap_conv->pnext; } } } col_set_str(pinfo->cinfo, COL_INFO, "Result: "); col_append_str(pinfo->cinfo, COL_INFO, val_to_str(retcode, iap_return_vals, "0x%02X")); switch (op) { case GET_VALUE_BY_CLASS: if (retcode == 0) { switch (tvb_get_guint8(tvb, offset + 6)) { case IAS_MISSING: col_append_str(pinfo->cinfo, COL_INFO, ", Missing"); break; case IAS_INTEGER: col_append_fstr(pinfo->cinfo, COL_INFO, ", Integer: %d", tvb_get_ntohl(tvb, offset + 7)); break; case IAS_OCT_SEQ: snprintf(buf, 300, ", %d Octets", tvb_get_ntohs(tvb, offset + 7)); break; case IAS_STRING: n = tvb_get_guint8(tvb, offset + 8); col_append_fstr(pinfo->cinfo, COL_INFO, ", \"%s\"", tvb_get_string_enc(pinfo->pool, tvb, offset + 9, n, ENC_ASCII)); break; default: break; } if (tvb_get_ntohs(tvb, offset + 2) > 1) col_append_str(pinfo->cinfo, COL_INFO, ", ..."); } break; } if (root) { /* create display subtree for the protocol */ proto_item* ti = proto_tree_add_item(root, proto_iap, tvb, 0, -1, ENC_NA); proto_tree* tree = proto_item_add_subtree(ti, ett_iap); proto_tree* ctl_tree; proto_tree* entry_tree; ti = proto_tree_add_item(tree, hf_iap_ctl, tvb, offset, 1, ENC_BIG_ENDIAN); ctl_tree = proto_item_add_subtree(ti, ett_iap_ctl); proto_tree_add_item(ctl_tree, hf_iap_ctl_lst, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ctl_tree, hf_iap_ctl_ack, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ctl_tree, hf_iap_ctl_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(tree, hf_iap_return, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch (op) { case GET_VALUE_BY_CLASS: if (retcode == 0) { list_len = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tree, hf_iap_list_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while ((offset < len) && (n < list_len)) { type = tvb_get_guint8(tvb, offset + 2); switch (type) { case IAS_INTEGER: attr_len = 4; break; case IAS_OCT_SEQ: attr_len = tvb_get_ntohs(tvb, offset + 2 + 1) + 2; break; case IAS_STRING: attr_len = tvb_get_guint8(tvb, offset + 2 + 1 + 1) + 2; break; default: attr_len = 0; } ti = proto_tree_add_item(tree, hf_iap_list_entry, tvb, offset, 2 + 1 + attr_len, ENC_NA); proto_item_append_text(ti, "%d", n + 1); entry_tree = proto_item_add_subtree(ti, ett_iap_entry[n]); proto_tree_add_item(entry_tree, hf_iap_obj_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(entry_tree, hf_iap_attr_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch (type) { case IAS_INTEGER: if (!iap_conv || !iap_conv->pattr_dissector || !iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, entry_tree, n, type, circuit_id)) proto_tree_add_item(entry_tree, hf_iap_int, tvb, offset, 4, ENC_BIG_ENDIAN); break; case IAS_OCT_SEQ: proto_tree_add_item(entry_tree, hf_iap_seq_len, tvb, offset, 2, ENC_BIG_ENDIAN); if (!iap_conv || !iap_conv->pattr_dissector || !iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, entry_tree, n, type, circuit_id)) proto_tree_add_item(entry_tree, hf_iap_oct_seq, tvb, offset + 2, attr_len - 2, ENC_NA); break; case IAS_STRING: proto_tree_add_item(entry_tree, hf_iap_char_set, tvb, offset, 1, ENC_BIG_ENDIAN); if (!iap_conv || !iap_conv->pattr_dissector || !iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, entry_tree, n, type, circuit_id)) proto_tree_add_item(entry_tree, hf_iap_string, tvb, offset + 1, 1, ENC_ASCII|ENC_BIG_ENDIAN); break; } offset += attr_len; n++; } } break; } } else { offset += 2; switch (op) { case GET_VALUE_BY_CLASS: if (retcode == 0) { offset += 2; while (offset < len) { offset += 2; type = tvb_get_guint8(tvb, offset); offset++; switch (type) { case IAS_INTEGER: attr_len = 4; if (iap_conv && iap_conv->pattr_dissector) iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, 0, n, type, circuit_id); break; case IAS_OCT_SEQ: attr_len = tvb_get_ntohs(tvb, offset) + 2; if (iap_conv && iap_conv->pattr_dissector) iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, 0, n, type, circuit_id); break; case IAS_STRING: attr_len = tvb_get_guint8(tvb, offset + 1) + 2; if (iap_conv && iap_conv->pattr_dissector) iap_conv->pattr_dissector->value_dissector(tvb, offset, pinfo, 0, n, type, circuit_id); break; default: attr_len = 0; } offset += attr_len; n++; } } break; } } /* If any bytes remain, send it to the generic data dissector */ tvb = tvb_new_subset_remaining(tvb, offset); call_data_dissector(tvb, pinfo, root); } /* * Check if IAP result is octet sequence */ gboolean check_iap_octet_result(tvbuff_t* tvb, proto_tree* tree, guint offset, const char* attr_name, guint8 attr_type) { if (attr_type != IAS_OCT_SEQ) { if (tree) { proto_item* ti = proto_tree_add_item(tree, hf_iap_invaloctet, tvb, offset, 0, ENC_NA); proto_item_append_text(ti, "%s", attr_name); proto_item_append_text(ti, "\" attribute must be octet sequence!"); } return FALSE; } else return TRUE; } /* * Check if IAP result is correct LsapSel */ guint8 check_iap_lsap_result(tvbuff_t* tvb, proto_tree* tree, guint offset, const char* attr_name, guint8 attr_type) { guint32 lsap; if ((attr_type != IAS_INTEGER) || ((lsap = tvb_get_ntohl(tvb, offset)) < 0x01) || (lsap > 0x6F)) { if (tree) { proto_item* ti = proto_tree_add_item(tree, hf_iap_invallsap, tvb, offset, 0, ENC_NA); proto_item_append_text(ti, "%s", attr_name); proto_item_append_text(ti, "\" attribute must be integer value between 0x01 and 0x6F!"); } return 0; } else return lsap; } /* * Dissect IrDA application protocol */ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, pdu_type_t pdu_type, guint8 circuit_id) { guint offset = 0; guint8 src; address srcaddr; address destaddr; conversation_t* conv; lmp_conversation_t* cur_lmp_conv; lmp_conversation_t* lmp_conv = NULL; guint32 num; src = circuit_id ^ CMD_FRAME; set_address(&srcaddr, irda_address_type, 1, &src); set_address(&destaddr, irda_address_type, 1, &circuit_id); /* Find result value dissector */ conv = find_conversation(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { num = pinfo->num; lmp_conv = (lmp_conversation_t*)conversation_get_proto_data(conv, proto_irlmp); while (lmp_conv && (lmp_conv->iap_result_frame >= num)) lmp_conv = lmp_conv->pnext; if (lmp_conv) { cur_lmp_conv = lmp_conv->pnext; while (cur_lmp_conv) { if ((cur_lmp_conv->iap_result_frame < num) && (cur_lmp_conv->iap_result_frame > lmp_conv->iap_result_frame)) { lmp_conv = cur_lmp_conv; } cur_lmp_conv = cur_lmp_conv->pnext; } } } if (lmp_conv) { /*ws_message("%x:%d->%x:%d = %p\n", src, pinfo->srcport, circuit_id, pinfo->destport, lmp_conv); */ /*ws_message("->%d: %d %d %p\n", pinfo->num, lmp_conv->iap_result_frame, lmp_conv->ttp, lmp_conv->proto_dissector); */ if ((lmp_conv->ttp) && (pdu_type != DISCONNECT_PDU)) { offset += dissect_ttp(tvb, pinfo, root, (pdu_type == DATA_PDU)); tvb = tvb_new_subset_remaining(tvb, offset); } call_dissector_with_data(lmp_conv->dissector, tvb, pinfo, root, GUINT_TO_POINTER(pdu_type)); } else call_data_dissector(tvb, pinfo, root); } /* * Dissect LMP */ static void dissect_irlmp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, guint8 circuit_id) { guint offset = 0; guint8 dlsap; guint8 slsap; guint8 cbit; guint8 opcode = 0; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IrLMP"); dlsap = tvb_get_guint8(tvb, offset); cbit = dlsap & CONTROL_BIT; dlsap &= ~CONTROL_BIT; slsap = tvb_get_guint8(tvb, offset+1) & ~CONTROL_BIT; /* save Lsaps in pinfo */ pinfo->srcport = slsap; pinfo->destport = dlsap; if (cbit != 0) { opcode = tvb_get_guint8(tvb, offset+2); col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d, ", slsap, dlsap); col_append_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, lmp_opcode_vals, "0x%02X")); if ((opcode == ACCESSMODE_CMD) || (opcode == ACCESSMODE_CNF)) { col_append_str(pinfo->cinfo, COL_INFO, " ("); col_append_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb, offset+4), lmp_mode_vals, "0x%02X")); col_append_str(pinfo->cinfo, COL_INFO, ")"); } } else col_add_fstr(pinfo->cinfo, COL_INFO, "%d > %d, Len=%d", slsap, dlsap, tvb_reported_length(tvb) - 2); if (root) { /* create display subtree for the protocol */ proto_item* ti = proto_tree_add_item(root, proto_irlmp, tvb, 0, -1, ENC_NA); proto_tree* tree = proto_item_add_subtree(ti, ett_irlmp); proto_tree* dst_tree; proto_tree* src_tree; ti = proto_tree_add_item(tree, hf_lmp_dst, tvb, offset, 1, ENC_BIG_ENDIAN); dst_tree = proto_item_add_subtree(ti, ett_lmp_dst); proto_tree_add_item(dst_tree, hf_lmp_dst_control, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(dst_tree, hf_lmp_dst_lsap, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; ti = proto_tree_add_item(tree, hf_lmp_src, tvb, offset, 1, ENC_BIG_ENDIAN); src_tree = proto_item_add_subtree(ti, ett_lmp_src); proto_tree_add_item(src_tree, hf_lmp_src_r, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(src_tree, hf_lmp_src_lsap, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (cbit != 0) { proto_tree_add_item(tree, hf_lmp_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; switch (opcode) { case CONNECT_CMD: case CONNECT_CNF: if (offset < tvb_reported_length(tvb)) { proto_tree_add_item(tree, hf_lmp_rsvd, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } break; case DISCONNECT: proto_tree_add_item(tree, hf_lmp_reason, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; break; case ACCESSMODE_CMD: proto_tree_add_item(tree, hf_lmp_rsvd, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(tree, hf_lmp_mode, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; break; case ACCESSMODE_CNF: proto_tree_add_item( tree, hf_lmp_status, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(tree, hf_lmp_mode, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; break; } } tvb = tvb_new_subset_remaining(tvb, offset); proto_item_set_len(tree, offset); } else { offset += 2; if (cbit != 0) { offset += 1; switch (opcode) { case CONNECT_CMD: case CONNECT_CNF: if (offset < tvb_reported_length(tvb)) offset++; break; case DISCONNECT: offset++; break; case ACCESSMODE_CMD: case ACCESSMODE_CNF: offset += 2; break; } } tvb = tvb_new_subset_remaining(tvb, offset); } if (cbit == 0) { if (dlsap == LSAP_IAS) dissect_iap_request(tvb, pinfo, root, circuit_id); else if (slsap == LSAP_IAS) dissect_iap_result(tvb, pinfo, root, circuit_id); else dissect_appl_proto(tvb, pinfo, root, DATA_PDU, circuit_id); } else { if ((dlsap == LSAP_IAS) || (slsap == LSAP_IAS)) call_data_dissector(tvb, pinfo, root); else switch (opcode) { case CONNECT_CMD: case CONNECT_CNF: dissect_appl_proto(tvb, pinfo, root, CONNECT_PDU, circuit_id); break; case DISCONNECT: dissect_appl_proto(tvb, pinfo, root, DISCONNECT_PDU, circuit_id); break; default: call_data_dissector(tvb, pinfo, root); } } } /* * Add LMP conversation */ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissector_handle_t dissector, guint8 circuit_id) { guint8 dest; address srcaddr; address destaddr; conversation_t* conv; lmp_conversation_t* lmp_conv = NULL; /*ws_message("%d: add_lmp_conversation(%p, %d, %d, %p) = ", pinfo->num, pinfo, dlsap, ttp, proto_dissector); */ set_address(&srcaddr, irda_address_type, 1, &circuit_id); dest = circuit_id ^ CMD_FRAME; set_address(&destaddr, irda_address_type, 1, &dest); conv = find_conversation(pinfo->num, &destaddr, &srcaddr, CONVERSATION_NONE, dlsap, 0, NO_PORT_B); if (conv) { lmp_conv = (lmp_conversation_t*)conversation_get_proto_data(conv, proto_irlmp); while (1) { /* Does entry already exist? */ if (lmp_conv->iap_result_frame == pinfo->num) return; if (lmp_conv->pnext == NULL) { lmp_conv->pnext = wmem_new(wmem_file_scope(), lmp_conversation_t); lmp_conv = lmp_conv->pnext; break; } lmp_conv = lmp_conv->pnext; } } else { conv = conversation_new(pinfo->num, &destaddr, &srcaddr, CONVERSATION_NONE, dlsap, 0, NO_PORT2); lmp_conv = wmem_new(wmem_file_scope(), lmp_conversation_t); conversation_add_proto_data(conv, proto_irlmp, (void*)lmp_conv); } lmp_conv->pnext = NULL; lmp_conv->iap_result_frame = pinfo->num; lmp_conv->ttp = ttp; lmp_conv->dissector = dissector; /*ws_message("%p\n", lmp_conv); */ } /* * Dissect Negotiation Parameters */ static guint dissect_negotiation(tvbuff_t* tvb, proto_tree* tree, guint offset) { guint n = 0; proto_item* ti; proto_tree* p_tree; char buf[256]; guint8 pv; while (tvb_reported_length_remaining(tvb, offset) > 0) { guint8 p_len = tvb_get_guint8(tvb, offset + 1); if (tree) { ti = proto_tree_add_item(tree, hf_negotiation_param, tvb, offset, p_len + 2, ENC_NA); p_tree = proto_item_add_subtree(ti, ett_param[n]); pv = tvb_get_guint8(tvb, offset+2); buf[0] = 0; switch (tvb_get_guint8(tvb, offset)) { case PI_BAUD_RATE: proto_item_append_text(ti, ": Baud Rate ("); if (pv & 0x01) (void) g_strlcat(buf, ", 2400", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 9600", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 19200", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 38400", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 57600", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 115200", 256); if (pv & 0x40) (void) g_strlcat(buf, ", 576000", 256); if (pv & 0x80) (void) g_strlcat(buf, ", 1152000", 256); if ((p_len > 1) && (tvb_get_guint8(tvb, offset+3) & 0x01)) (void) g_strlcat(buf, ", 4000000", 256); (void) g_strlcat(buf, " bps)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_MAX_TURN_TIME: proto_item_append_text(ti, ": Maximum Turn Time ("); if (pv & 0x01) (void) g_strlcat(buf, ", 500", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 250", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 100", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 50", 256); (void) g_strlcat(buf, " ms)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_DATA_SIZE: proto_item_append_text(ti, ": Data Size ("); if (pv & 0x01) (void) g_strlcat(buf, ", 64", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 128", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 256", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 512", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 1024", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 2048", 256); (void) g_strlcat(buf, " bytes)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_WINDOW_SIZE: proto_item_append_text(ti, ": Window Size ("); if (pv & 0x01) (void) g_strlcat(buf, ", 1", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 2", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 3", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 4", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 5", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 6", 256); if (pv & 0x40) (void) g_strlcat(buf, ", 7", 256); (void) g_strlcat(buf, " frame window)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_ADD_BOFS: proto_item_append_text(ti, ": Additional BOFs ("); if (pv & 0x01) (void) g_strlcat(buf, ", 48", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 24", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 12", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 5", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 3", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 2", 256); if (pv & 0x40) (void) g_strlcat(buf, ", 1", 256); if (pv & 0x80) (void) g_strlcat(buf, ", 0", 256); (void) g_strlcat(buf, " additional BOFs at 115200)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_MIN_TURN_TIME: proto_item_append_text(ti, ": Minimum Turn Time ("); if (pv & 0x01) (void) g_strlcat(buf, ", 10", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 5", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 1", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 0.5", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 0.1", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 0.05", 256); if (pv & 0x40) (void) g_strlcat(buf, ", 0.01", 256); if (pv & 0x80) (void) g_strlcat(buf, ", 0", 256); (void) g_strlcat(buf, " ms)", 256); proto_item_append_text(ti, "%s", buf+2); break; case PI_LINK_DISC: proto_item_append_text(ti, ": Link Disconnect/Threshold Time ("); if (pv & 0x01) (void) g_strlcat(buf, ", 3/0", 256); if (pv & 0x02) (void) g_strlcat(buf, ", 8/3", 256); if (pv & 0x04) (void) g_strlcat(buf, ", 12/3", 256); if (pv & 0x08) (void) g_strlcat(buf, ", 16/3", 256); if (pv & 0x10) (void) g_strlcat(buf, ", 20/3", 256); if (pv & 0x20) (void) g_strlcat(buf, ", 25/3", 256); if (pv & 0x40) (void) g_strlcat(buf, ", 30/3", 256); if (pv & 0x80) (void) g_strlcat(buf, ", 40/3", 256); (void) g_strlcat(buf, " s)", 256); proto_item_append_text(ti, "%s", buf+2); break; default: proto_item_append_text(ti, ": unknown"); } } else p_tree = NULL; offset = dissect_param_tuple(tvb, p_tree, offset); n++; } return offset; } /* * Dissect XID packet */ static void dissect_xid(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, proto_tree* lap_tree, gboolean is_command) { int offset = 0; proto_item* ti = NULL; proto_tree* i_tree = NULL; proto_tree* flags_tree; guint32 saddr, daddr; guint8 s; proto_tree* lmp_tree = NULL; if (lap_tree) { ti = proto_tree_add_item(lap_tree, hf_lap_i, tvb, offset, -1, ENC_NA); i_tree = proto_item_add_subtree(ti, ett_lap_i); proto_tree_add_item(i_tree, hf_xid_ident, tvb, offset, 1, ENC_BIG_ENDIAN); } offset++; saddr = tvb_get_letohl(tvb, offset); col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "0x%08X", saddr); if (lap_tree) proto_tree_add_uint(i_tree, hf_xid_saddr, tvb, offset, 4, saddr); offset += 4; daddr = tvb_get_letohl(tvb, offset); col_add_fstr(pinfo->cinfo, COL_DEF_DST, "0x%08X", daddr); if (lap_tree) proto_tree_add_uint(i_tree, hf_xid_daddr, tvb, offset, 4, daddr); offset += 4; if (lap_tree) { ti = proto_tree_add_item(i_tree, hf_xid_flags, tvb, offset, 1, ENC_BIG_ENDIAN); flags_tree = proto_item_add_subtree(ti, ett_xid_flags); proto_tree_add_item(flags_tree, hf_xid_s, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_xid_conflict, tvb, offset, 1, ENC_BIG_ENDIAN); } offset++; if (is_command) { s = tvb_get_guint8(tvb, offset); if (s == 0xFF) col_append_str(pinfo->cinfo, COL_INFO, ", s=final"); else col_append_fstr(pinfo->cinfo, COL_INFO, ", s=%u", s); if (lap_tree) { ti = proto_tree_add_uint(i_tree, hf_xid_slotnr, tvb, offset, 1, s); if (s == 0xFF) proto_item_append_text(ti, " (final)"); } } offset++; if (lap_tree) proto_tree_add_item(i_tree, hf_xid_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; if (lap_tree) { proto_item_set_end(lap_tree, tvb, offset); proto_item_set_end(i_tree, tvb, offset); } if (tvb_reported_length_remaining(tvb, offset) > 0) { guint hints_len; guint8 hint1 = 0; guint8 hint2 = 0; if (root) { ti = proto_tree_add_item(root, proto_irlmp, tvb, offset, -1, ENC_NA); lmp_tree = proto_item_add_subtree(ti, ett_irlmp); } for (hints_len = 0;;) { guint8 hint = tvb_get_guint8(tvb, offset + hints_len++); if (hints_len == 1) hint1 = hint; else if (hints_len == 2) hint2 = hint; if ((hint & 0x80) == 0) break; } if (root) { ti = proto_tree_add_item(lmp_tree, hf_lmp_xid_hints, tvb, offset, hints_len, ENC_NA); if ((hint1 | hint2) != 0) { char service_hints[256]; service_hints[0] = 0; if (hint1 & 0x01) (void) g_strlcat(service_hints, ", PnP Compatible", 256); if (hint1 & 0x02) (void) g_strlcat(service_hints, ", PDA/Palmtop", 256); if (hint1 & 0x04) (void) g_strlcat(service_hints, ", Computer", 256); if (hint1 & 0x08) (void) g_strlcat(service_hints, ", Printer", 256); if (hint1 & 0x10) (void) g_strlcat(service_hints, ", Modem", 256); if (hint1 & 0x20) (void) g_strlcat(service_hints, ", Fax", 256); if (hint1 & 0x40) (void) g_strlcat(service_hints, ", LAN Access", 256); if (hint2 & 0x01) (void) g_strlcat(service_hints, ", Telephony", 256); if (hint2 & 0x02) (void) g_strlcat(service_hints, ", File Server", 256); if (hint2 & 0x04) (void) g_strlcat(service_hints, ", IrCOMM", 256); if (hint2 & 0x20) (void) g_strlcat(service_hints, ", OBEX", 256); (void) g_strlcat(service_hints, ")", 256); service_hints[0] = ' '; service_hints[1] = '('; proto_item_append_text(ti, "%s", service_hints); } } offset += hints_len; if (tvb_reported_length_remaining(tvb, offset) > 0) { guint8 cset; gint name_len; gchar *name; gboolean have_encoding; guint encoding; cset = tvb_get_guint8(tvb, offset); if (root) proto_tree_add_uint(lmp_tree, hf_lmp_xid_charset, tvb, offset, 1, cset); offset++; name_len = tvb_reported_length_remaining(tvb, offset); if (name_len > 0) { switch (cset) { case LMP_CHARSET_ASCII: encoding = ENC_ASCII|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_1: encoding = ENC_ISO_8859_1|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_2: encoding = ENC_ISO_8859_2|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_3: encoding = ENC_ISO_8859_3|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_4: encoding = ENC_ISO_8859_4|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_5: encoding = ENC_ISO_8859_5|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_6: encoding = ENC_ISO_8859_6|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_7: encoding = ENC_ISO_8859_7|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_8: encoding = ENC_ISO_8859_8|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_ISO_8859_9: encoding = ENC_ISO_8859_9|ENC_NA; have_encoding = TRUE; break; case LMP_CHARSET_UNICODE: /* Presumably big-endian; assume just UCS-2 for now */ encoding = ENC_UCS_2|ENC_BIG_ENDIAN; have_encoding = TRUE; break; default: encoding = 0; have_encoding = FALSE; break; } if (have_encoding) { name = (gchar *) tvb_get_string_enc(pinfo->pool, tvb, offset, name_len, encoding); col_append_fstr(pinfo->cinfo, COL_INFO, ", \"%s\"", format_text(pinfo->pool, (guchar *) name, strlen(name))); if (root) proto_tree_add_item(lmp_tree, hf_lmp_xid_name, tvb, offset, -1, encoding); } else { if (root) proto_tree_add_item(lmp_tree, hf_lmp_xid_name_no_encoding, tvb, offset, -1, ENC_NA); } } } } } /* * Dissect Log Messages */ static void dissect_log(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root) { /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Log"); /* missed messages? */ if (pinfo->pseudo_header->irda.pkttype == IRDA_MISSED_MSG) { col_set_str(pinfo->cinfo, COL_INFO, "WARNING: Missed one or more messages while capturing!"); } else { guint length; char *buf; length = tvb_captured_length(tvb); buf = (char *) tvb_get_string_enc(pinfo->pool, tvb, 0, length, ENC_ASCII|ENC_NA); if (length > 0 && buf[length-1] == '\n') buf[length-1] = 0; else if (length > 1 && buf[length-2] == '\n') buf[length-2] = 0; col_add_str(pinfo->cinfo, COL_INFO, format_text(pinfo->pool, (guchar *) buf, strlen(buf))); } if (root) { proto_item* ti = proto_tree_add_item(root, proto_log, tvb, 0, -1, ENC_NA); proto_tree* tree = proto_item_add_subtree(ti, ett_log); if (pinfo->pseudo_header->irda.pkttype == IRDA_MISSED_MSG) proto_tree_add_item(tree, hf_log_missed, tvb, 0, 0, ENC_NA); else proto_tree_add_item(tree, hf_log_msg, tvb, 0, -1, ENC_ASCII|ENC_NA); } } /* * Dissect IrLAP */ static void dissect_irlap(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root) { int offset = 0; guint8 circuit_id, c; gboolean is_response; char addr[9]; proto_item* ti = NULL; proto_tree* tree = NULL; proto_tree* i_tree = NULL; guint32 saddr, daddr; guint8 ca; /* Make entries in Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "IrLAP"); /* Clear Info column */ col_clear(pinfo->cinfo, COL_INFO); /* set direction column */ switch (pinfo->pseudo_header->irda.pkttype) { case IRDA_OUTGOING: col_set_str(pinfo->cinfo, COL_IF_DIR, "Out"); break; case IRDA_INCOMING: col_set_str(pinfo->cinfo, COL_IF_DIR, "In"); break; } /* decode values used for demuxing */ circuit_id = tvb_get_guint8(tvb, 0); /* initially set address columns to connection address */ snprintf(addr, sizeof(addr)-1, "0x%02X", circuit_id >> 1); col_add_str(pinfo->cinfo, COL_DEF_SRC, addr); col_add_str(pinfo->cinfo, COL_DEF_DST, addr); if (root) { proto_tree* a_tree; proto_item* addr_item; /* create display subtree for the protocol */ ti = proto_tree_add_item(root, proto_irlap, tvb, 0, -1, ENC_NA); tree = proto_item_add_subtree(ti, ett_irlap); /* create subtree for the address field */ ti = proto_tree_add_item(tree, hf_lap_a, tvb, offset, 1, ENC_BIG_ENDIAN); a_tree = proto_item_add_subtree(ti, ett_lap_a); proto_tree_add_item(a_tree, hf_lap_a_cr, tvb, offset, 1, ENC_BIG_ENDIAN); addr_item = proto_tree_add_item(a_tree, hf_lap_a_address, tvb, offset, 1, ENC_BIG_ENDIAN); switch (circuit_id & ~CMD_FRAME) { case 0: proto_item_append_text(addr_item, " (NULL Address)"); break; case 0xFE: proto_item_append_text(addr_item, " (Broadcast)"); break; } } is_response = ((circuit_id & CMD_FRAME) == 0); offset++; /* process the control field */ c = dissect_xdlc_control(tvb, 1, pinfo, tree, hf_lap_c, ett_lap_c, &irlap_cf_items, NULL, lap_c_u_cmd_abbr_vals, lap_c_u_rsp_abbr_vals, is_response, FALSE, FALSE); offset++; if ((c & XDLC_I_MASK) == XDLC_I) { /* I frame */ proto_item_set_len(tree, offset); tvb = tvb_new_subset_remaining(tvb, offset); dissect_irlmp(tvb, pinfo, root, circuit_id); return; } if ((c & XDLC_S_U_MASK) == XDLC_U) { /* U frame */ switch (c & XDLC_U_MODIFIER_MASK) { case XDLC_SNRM: if (root) { ti = proto_tree_add_item(tree, hf_lap_i, tvb, offset, -1, ENC_NA); i_tree = proto_item_add_subtree(ti, ett_lap_i); } saddr = tvb_get_letohl(tvb, offset); if (!is_response) { col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "0x%08X", saddr); } if (root) proto_tree_add_uint(i_tree, hf_snrm_saddr, tvb, offset, 4, saddr); offset += 4; daddr = tvb_get_letohl(tvb, offset); if (!is_response) { col_add_fstr(pinfo->cinfo, COL_DEF_DST, "0x%08X", daddr); } if (root) proto_tree_add_uint(i_tree, hf_snrm_daddr, tvb, offset, 4, daddr); offset += 4; ca = tvb_get_guint8(tvb, offset); if (!is_response) { col_append_fstr(pinfo->cinfo, COL_INFO, ", ca=0x%02X", ca >> 1); } if (root) proto_tree_add_uint(i_tree, hf_snrm_ca, tvb, offset, 1, ca >> 1); offset++; offset = dissect_negotiation(tvb, i_tree, offset); if (root) proto_item_set_end(ti, tvb, offset); break; case IRDA_XID_CMD: tvb = tvb_new_subset_remaining(tvb, offset); dissect_xid(tvb, pinfo, root, tree, TRUE); return; case XDLC_UA: if (tvb_reported_length_remaining(tvb, offset) > 0) { if (root) { ti = proto_tree_add_item(tree, hf_lap_i, tvb, offset, -1, ENC_NA); i_tree = proto_item_add_subtree(ti, ett_lap_i); } saddr = tvb_get_letohl(tvb, offset); col_add_fstr(pinfo->cinfo, COL_DEF_SRC, "0x%08X", saddr); if (root) proto_tree_add_uint(i_tree, hf_ua_saddr, tvb, offset, 4, saddr); offset += 4; daddr = tvb_get_letohl(tvb, offset); col_add_fstr(pinfo->cinfo, COL_DEF_DST, "0x%08X", daddr); if (root) proto_tree_add_uint(i_tree, hf_ua_daddr, tvb, offset, 4, daddr); offset += 4; offset = dissect_negotiation(tvb, i_tree, offset); if (root) proto_item_set_end(ti, tvb, offset); } break; case XDLC_XID: tvb = tvb_new_subset_remaining(tvb, offset); dissect_xid(tvb, pinfo, root, tree, FALSE); return; } } /* If any bytes remain, send it to the generic data dissector */ if (tvb_reported_length_remaining(tvb, offset) > 0) { tvb = tvb_new_subset_remaining(tvb, offset); call_data_dissector(tvb, pinfo, root); } } /* * Dissect IrDA protocol */ static int dissect_irda(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, void* data _U_) { /* check if log message */ if ((pinfo->pseudo_header->irda.pkttype & IRDA_CLASS_MASK) == IRDA_CLASS_LOG) { dissect_log(tvb, pinfo, root); return tvb_captured_length(tvb); } dissect_irlap(tvb, pinfo, root); return tvb_captured_length(tvb); } static int irda_addr_to_str(const address* addr, gchar *buf, int buf_len _U_) { const guint8 *addrdata = (const guint8 *)addr->data; guint32_to_str_buf(*addrdata, buf, buf_len); return (int)strlen(buf); } static int irda_addr_str_len(const address* addr _U_) { return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */ } static const char* irda_col_filter_str(const address* addr _U_, gboolean is_src _U_) { return "irlap.a"; } static int irda_addr_len(void) { return 1; } /* * Register the protocol with Wireshark * This format is required because a script is used to build the C function * that calls all the protocol registrations. */ void proto_register_irda(void) { guint i; /* Setup list of header fields */ static hf_register_info hf_lap[] = { { &hf_lap_a, { "Address Field", "irlap.a", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_lap_a_cr, { "C/R", "irlap.a.cr", FT_BOOLEAN, 8, TFS(&lap_cr_vals), CMD_FRAME, NULL, HFILL }}, { &hf_lap_a_address, { "Address", "irlap.a.address", FT_UINT8, BASE_HEX, NULL, ~CMD_FRAME, NULL, HFILL }}, { &hf_lap_c, { "Control Field", "irlap.c", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_lap_c_nr, { "N(R)", "irlap.c.n_r", FT_UINT8, BASE_DEC, NULL, XDLC_N_R_MASK, NULL, HFILL }}, { &hf_lap_c_ns, { "N(S)", "irlap.c.n_s", FT_UINT8, BASE_DEC, NULL, XDLC_N_S_MASK, NULL, HFILL }}, { &hf_lap_c_p, { "Poll", "irlap.c.p", FT_BOOLEAN, 8, TFS(&set_notset), XDLC_P_F, NULL, HFILL }}, { &hf_lap_c_f, { "Final", "irlap.c.f", FT_BOOLEAN, 8, TFS(&set_notset), XDLC_P_F, NULL, HFILL }}, { &hf_lap_c_s, { "Supervisory frame type", "irlap.c.s_ftype", FT_UINT8, BASE_HEX, VALS(lap_c_s_vals), XDLC_S_FTYPE_MASK, NULL, HFILL }}, { &hf_lap_c_u_cmd, { "Command", "irlap.c.u_modifier_cmd", FT_UINT8, BASE_HEX, VALS(lap_c_u_cmd_vals), XDLC_U_MODIFIER_MASK, NULL, HFILL }}, { &hf_lap_c_u_rsp, { "Response", "irlap.c.u_modifier_resp", FT_UINT8, BASE_HEX, VALS(lap_c_u_rsp_vals), XDLC_U_MODIFIER_MASK, NULL, HFILL }}, { &hf_lap_c_i, { "Frame Type", "irlap.c.ftype", FT_UINT8, BASE_HEX, VALS(lap_c_ftype_vals), XDLC_I_MASK, NULL, HFILL }}, { &hf_lap_c_s_u, { "Frame Type", "irlap.c.ftype", FT_UINT8, BASE_HEX, VALS(lap_c_ftype_vals), XDLC_S_U_MASK, NULL, HFILL }}, { &hf_lap_i, { "Information Field", "irlap.i", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_snrm_saddr, { "Source Device Address", "irlap.snrm.saddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_snrm_daddr, { "Destination Device Address", "irlap.snrm.daddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_snrm_ca, { "Connection Address", "irlap.snrm.ca", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_negotiation_param, { "Negotiation Parameter", "irlap.negotiation", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_param_pi, { "Parameter Identifier", "irlap.pi", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_param_pl, { "Parameter Length", "irlap.pl", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_param_pv, { "Parameter Value", "irlap.pv", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_ua_saddr, { "Source Device Address", "irlap.ua.saddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_ua_daddr, { "Destination Device Address", "irlap.ua.daddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_xid_ident, { "Format Identifier", "irlap.xid.fi", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_xid_saddr, { "Source Device Address", "irlap.xid.saddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_xid_daddr, { "Destination Device Address", "irlap.xid.daddr", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_xid_flags, { "Discovery Flags", "irlap.xid.flags", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_xid_s, { "Number of Slots", "irlap.xid.s", FT_UINT8, BASE_DEC, VALS(xid_slot_numbers), S_MASK, NULL, HFILL }}, { &hf_xid_conflict, { "Conflict", "irlap.xid.conflict", FT_BOOLEAN, 8, TFS(&set_notset), CONFLICT, NULL, HFILL }}, { &hf_xid_slotnr, { "Slot Number", "irlap.xid.slotnr", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_xid_version, { "Version Number", "irlap.xid.version", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }} }; static hf_register_info hf_log[] = { { &hf_log_msg, { "Message", "log.msg", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_log_missed, { "WARNING: Missed one or more messages while capturing!", "log.missed", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }} }; static hf_register_info hf_lmp[] = { { &hf_lmp_xid_hints, { "Service Hints", "irlmp.xid.hints", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_lmp_xid_charset, { "Character Set", "irlmp.xid.charset", FT_UINT8, BASE_HEX, VALS(lmp_charset_vals), 0, NULL, HFILL }}, { &hf_lmp_xid_name, { "Device Nickname", "irlmp.xid.name", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_lmp_xid_name_no_encoding, { "Device Nickname (unsupported character set)", "irlmp.xid.name.no_encoding", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_lmp_dst, { "Destination", "irlmp.dst", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_lmp_dst_control, { "Control Bit", "irlmp.dst.c", FT_BOOLEAN, 8, TFS(&set_notset), CONTROL_BIT, NULL, HFILL }}, { &hf_lmp_dst_lsap, { "Destination LSAP", "irlmp.dst.lsap", FT_UINT8, BASE_DEC, NULL, ~CONTROL_BIT, NULL, HFILL }}, { &hf_lmp_src, { "Source", "irlmp.src", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_lmp_src_r, { "reserved", "irlmp.src.r", FT_UINT8, BASE_DEC, NULL, RESERVED_BIT, NULL, HFILL }}, { &hf_lmp_src_lsap, { "Source LSAP", "irlmp.src.lsap", FT_UINT8, BASE_DEC, NULL, ~RESERVED_BIT, NULL, HFILL }}, { &hf_lmp_opcode, { "Opcode", "irlmp.opcode", FT_UINT8, BASE_HEX, VALS(lmp_opcode_vals), 0x0, NULL, HFILL }}, { &hf_lmp_rsvd, { "Reserved", "irlmp.rsvd", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_lmp_reason, { "Reason", "irlmp.reason", FT_UINT8, BASE_HEX, VALS(lmp_reason_vals), 0x0, NULL, HFILL }}, { &hf_lmp_mode, { "Mode", "irlmp.mode", FT_UINT8, BASE_HEX, VALS(lmp_mode_vals), 0x0, NULL, HFILL }}, { &hf_lmp_status, { "Status", "irlmp.status", FT_UINT8, BASE_HEX, VALS(lmp_status_vals), 0x0, NULL, HFILL }} }; static hf_register_info hf_iap[] = { { &hf_iap_ctl, { "Control Field", "iap.ctl", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_iap_ctl_lst, { "Last Frame", "iap.ctl.lst", FT_BOOLEAN, 8, TFS(&set_notset), IAP_LST, NULL, HFILL }}, { &hf_iap_ctl_ack, { "Acknowledge", "iap.ctl.ack", FT_BOOLEAN, 8, TFS(&set_notset), IAP_ACK, NULL, HFILL }}, { &hf_iap_ctl_opcode, { "Opcode", "iap.ctl.opcode", FT_UINT8, BASE_HEX, VALS(iap_opcode_vals), IAP_OP, NULL, HFILL }}, { &hf_iap_class_name, { "Class Name", "iap.classname", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_iap_attr_name, { "Attribute Name", "iap.attrname", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_iap_return, { "Return", "iap.return", FT_UINT8, BASE_HEX, VALS(iap_return_vals), 0x0, NULL, HFILL }}, { &hf_iap_list_len, { "List Length", "iap.listlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_iap_list_entry, { "List Entry", "iap.listentry", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_iap_obj_id, { "Object Identifier", "iap.objectid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_iap_attr_type, { "Type", "iap.attrtype", FT_UINT8, BASE_DEC, VALS(iap_attr_type_vals), 0x0, NULL, HFILL }}, { &hf_iap_int, { "Value", "iap.int", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_iap_seq_len, { "Sequence Length", "iap.seqlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_iap_oct_seq, { "Sequence", "iap.octseq", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_iap_char_set, { "Character Set", "iap.charset", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_iap_string, { "String", "iap.string", FT_UINT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_iap_invaloctet, { "Malformed IAP result: \"", "iap.invaloctet", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_iap_invallsap, { "Malformed IAP result: \"", "iap.invallsap", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }} }; static hf_register_info hf_ttp[] = { { &hf_ttp_p, { "Parameter Bit", "ttp.p", FT_BOOLEAN, 8, TFS(&set_notset), TTP_PARAMETERS, NULL, HFILL }}, { &hf_ttp_icredit, { "Initial Credit", "ttp.icredit", FT_UINT8, BASE_DEC, NULL, ~TTP_PARAMETERS, NULL, HFILL }}, { &hf_ttp_m, { "More Bit", "ttp.m", FT_BOOLEAN, 8, TFS(&set_notset), TTP_MORE, NULL, HFILL }}, { &hf_ttp_dcredit, { "Delta Credit", "ttp.dcredit", FT_UINT8, BASE_DEC, NULL, ~TTP_MORE, NULL, HFILL }} }; /* Setup protocol subtree arrays */ static gint* ett[] = { &ett_irlap, &ett_lap_a, &ett_lap_c, &ett_lap_i, &ett_xid_flags, &ett_log, &ett_irlmp, &ett_lmp_dst, &ett_lmp_src, &ett_iap, &ett_iap_ctl, &ett_ttp }; gint* ett_p[MAX_PARAMETERS]; gint* ett_iap_e[MAX_IAP_ENTRIES]; /* Register protocol names and descriptions */ proto_irlap = proto_register_protocol("IrDA Link Access Protocol", "IrLAP", "irlap"); proto_log = proto_register_protocol("Log Message", "Log", "log"); proto_irlmp = proto_register_protocol("IrDA Link Management Protocol", "IrLMP", "irlmp"); proto_iap = proto_register_protocol("Information Access Protocol", "IAP", "iap"); proto_ttp = proto_register_protocol("Tiny Transport Protocol", "TTP", "ttp"); /* Register the dissector */ irda_handle = register_dissector("irda", dissect_irda, proto_irlap); /* Required function calls to register the header fields */ proto_register_field_array(proto_irlap, hf_lap, array_length(hf_lap)); proto_register_field_array(proto_log, hf_log, array_length(hf_log)); proto_register_field_array(proto_irlmp, hf_lmp, array_length(hf_lmp)); proto_register_field_array(proto_iap, hf_iap, array_length(hf_iap)); proto_register_field_array(proto_ttp, hf_ttp, array_length(hf_ttp)); /* Register subtrees */ proto_register_subtree_array(ett, array_length(ett)); for (i = 0; i < MAX_PARAMETERS; i++) { ett_param[i] = -1; ett_p[i] = &ett_param[i]; } proto_register_subtree_array(ett_p, MAX_PARAMETERS); for (i = 0; i < MAX_IAP_ENTRIES; i++) { ett_iap_entry[i] = -1; ett_iap_e[i] = &ett_iap_entry[i]; } proto_register_subtree_array(ett_iap_e, MAX_IAP_ENTRIES); irda_address_type = address_type_dissector_register("AT_IRDA", "IRDA Address", irda_addr_to_str, irda_addr_str_len, NULL, irda_col_filter_str, irda_addr_len, NULL, NULL); } /* If this dissector uses sub-dissector registration add a registration routine. This format is required because a script is used to find these routines and create the code that calls these routines. */ void proto_reg_handoff_irda(void) { dissector_add_uint("wtap_encap", WTAP_ENCAP_IRDA, irda_handle); dissector_add_uint("sll.ltype", LINUX_SLL_P_IRDA_LAP, irda_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/irda/packet-sir.c
/** Decode IrDA Serial Infrared (SIR) wrapped packets. * @author Shaun Jackman <[email protected]> * @copyright Copyright 2004 Shaun Jackman * @license GPL * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/expert.h> #include <epan/crc16-tvb.h> /** Serial infrared port. */ #define TCP_PORT_SIR 6417 /* Not IANA registered */ /** Beginning of frame. */ #define SIR_BOF 0xc0 /** End of frame. */ #define SIR_EOF 0xc1 /** Control escape. */ #define SIR_CE 0x7d /** Escapes this character. */ #define SIR_ESCAPE(x) ((x)^0x20) void proto_reg_handoff_irsir(void); void proto_register_irsir(void); /** Protocol handles. */ static dissector_handle_t irda_handle; static dissector_handle_t sir_handle; /** Protocol fields. */ static int proto_sir = -1; static int ett_sir = -1; static int hf_sir_bof = -1; /* static int hf_sir_ce = -1; */ static int hf_sir_eof = -1; static int hf_sir_fcs = -1; static int hf_sir_fcs_status = -1; static int hf_sir_length = -1; static int hf_sir_preamble = -1; static expert_field ei_sir_fcs = EI_INIT; /* Copied and renamed from proto.c because global value_strings don't work for plugins */ static const value_string plugin_proto_checksum_vals[] = { { PROTO_CHECKSUM_E_BAD, "Bad" }, { PROTO_CHECKSUM_E_GOOD, "Good" }, { PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" }, { PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" }, { 0, NULL } }; /** Unescapes the data. */ static tvbuff_t * unescape_data(tvbuff_t *tvb, packet_info *pinfo) { if (tvb_find_guint8(tvb, 0, -1, SIR_CE) == -1) { return tvb; } else { guint length = tvb_captured_length(tvb); guint offset; guint8 *data = (guint8 *)wmem_alloc(pinfo->pool, length); guint8 *dst = data; tvbuff_t *next_tvb; for (offset = 0; offset < length; ) { guint8 c = tvb_get_guint8(tvb, offset++); if ((c == SIR_CE) && (offset < length)) c = SIR_ESCAPE(tvb_get_guint8(tvb, offset++)); *dst++ = c; } next_tvb = tvb_new_child_real_data(tvb, data, (guint) (dst-data), (guint) (dst-data)); add_new_data_source(pinfo, next_tvb, "Unescaped SIR"); return next_tvb; } } /** Checksums the data. */ static tvbuff_t * checksum_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int len = tvb_reported_length(tvb) - 2; if (len < 0) return tvb; proto_tree_add_checksum(tree, tvb, len, hf_sir_fcs, hf_sir_fcs_status, &ei_sir_fcs, pinfo, crc16_ccitt_tvb(tvb, len), ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); return tvb_new_subset_length(tvb, 0, len); } /** Dissects an SIR packet. */ static int dissect_sir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root, void* data _U_) { gint offset = 0; gint bof_offset; gint eof_offset; while (tvb_reported_length_remaining(tvb, offset) > 0) { bof_offset = tvb_find_guint8(tvb, offset, -1, SIR_BOF); eof_offset = (bof_offset == -1) ? -1 : tvb_find_guint8(tvb, bof_offset, -1, SIR_EOF); if (bof_offset == -1 || eof_offset == -1) { if (pinfo->can_desegment) { pinfo->desegment_offset = offset; pinfo->desegment_len = 1; } return tvb_captured_length(tvb); } else { guint preamble_len = bof_offset - offset; gint data_offset = bof_offset + 1; tvbuff_t* next_tvb = tvb_new_subset_length_caplen(tvb, data_offset, eof_offset - data_offset, -1); next_tvb = unescape_data(next_tvb, pinfo); if (root) { guint data_len = tvb_reported_length(next_tvb) < 2 ? 0 : tvb_reported_length(next_tvb) - 2; proto_tree* ti = proto_tree_add_protocol_format(root, proto_sir, tvb, offset, eof_offset - offset + 1, "Serial Infrared, Len: %d", data_len); proto_tree* tree = proto_item_add_subtree(ti, ett_sir); if (preamble_len > 0) proto_tree_add_item(tree, hf_sir_preamble, tvb, offset, preamble_len, ENC_NA); proto_tree_add_item(tree, hf_sir_bof, tvb, bof_offset, 1, ENC_BIG_ENDIAN); proto_tree_add_uint(tree, hf_sir_length, next_tvb, 0, data_len, data_len); next_tvb = checksum_data(next_tvb, pinfo, tree); proto_tree_add_item(tree, hf_sir_eof, tvb, eof_offset, 1, ENC_BIG_ENDIAN); } else { next_tvb = checksum_data(next_tvb, pinfo, NULL); } call_dissector(irda_handle, next_tvb, pinfo, root); } offset = eof_offset + 1; } return tvb_captured_length(tvb); } /** Registers this dissector with the parent dissector. */ void proto_reg_handoff_irsir(void) { dissector_add_uint_with_preference("tcp.port", TCP_PORT_SIR, sir_handle); irda_handle = find_dissector("irda"); } /** Initializes this protocol. */ void proto_register_irsir(void) { static gint* ett[] = { &ett_sir }; static hf_register_info hf_sir[] = { { &hf_sir_bof, { "Beginning of frame", "sir.bof", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, #if 0 { &hf_sir_ce, { "Command escape", "sir.ce", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, #endif { &hf_sir_eof, { "End of frame", "sir.eof", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_sir_fcs, { "Frame check sequence", "sir.fcs", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_sir_fcs_status, { "Frame check sequence Status", "sir.fcs.status", FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_sir_length, { "Length", "sir.length", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_sir_preamble, { "Preamble", "sir.preamble", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }} }; static ei_register_info ei[] = { { &ei_sir_fcs, { "sir.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_sir; proto_sir = proto_register_protocol("Serial Infrared", "SIR", "sir"); sir_handle = register_dissector("sir", dissect_sir, proto_sir); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array( proto_sir, hf_sir, array_length(hf_sir)); expert_sir = expert_register_protocol(proto_sir); expert_register_field_array(expert_sir, ei, array_length(ei)); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
Text
wireshark/plugins/epan/mate/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(mate 1 0 1 0) set(DISSECTOR_SRC packet-mate.c ) set(DISSECTOR_SUPPORT_SRC mate_setup.c mate_runtime.c mate_util.c ) add_lemon_files(LEMON_FILES GENERATED_FILES mate_grammar.lemon ) add_lex_files(LEX_FILES GENERATED_FILES mate_parser.l ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ${GENERATED_FILES} ) set_source_files_properties( ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) add_wireshark_plugin_library(mate epan) target_link_libraries(mate epan) install_plugin(mate epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME mate SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ${DISSECTOR_HEADERS} # LEX files commented out due to use of malloc, free etc. # ${LEX_FILES} ${LEMON_FILES} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C/C++
wireshark/plugins/epan/mate/mate.h
/* mate.h * MATE -- Meta Analysis and Tracing Engine * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __MATE_H_ #define __MATE_H_ #define WS_LOG_DOMAIN "MATE" #include <wireshark.h> #include <gmodule.h> #include <stdio.h> #include <string.h> #include <wsutil/report_message.h> #include <wsutil/wslog.h> #include <epan/packet.h> #include <epan/exceptions.h> #include <epan/strutil.h> #include <epan/prefs.h> #include <epan/proto.h> #include <epan/epan_dissect.h> #include <wsutil/filesystem.h> #include "mate_util.h" /* defaults */ #define DEFAULT_GOG_EXPIRATION 2.0 #ifdef _WIN32 #define DIR_SEP '\\' #else #define DIR_SEP '/' #endif #define DEFAULT_MATE_LIB_PATH "matelib" #define MATE_ITEM_ID_SIZE 24 #define VALUE_TOO ((void*)1) #define MateConfigError 65535 typedef enum _gop_tree_mode_t { GOP_NULL_TREE, GOP_BASIC_TREE, GOP_FULL_TREE } gop_tree_mode_t; typedef enum _gop_pdu_tree { GOP_NO_TREE, GOP_PDU_TREE, GOP_FRAME_TREE, GOP_BASIC_PDU_TREE } gop_pdu_tree_t; typedef enum _accept_mode_t { ACCEPT_MODE, REJECT_MODE } accept_mode_t; typedef struct _mate_cfg_pdu { gchar* name; guint last_id; /* keeps the last id given to an item of this kind */ GHashTable* items; /* all the items of this type */ GPtrArray* transforms; /* transformations to be applied */ int hfid; int hfid_proto; int hfid_pdu_rel_time; int hfid_pdu_time_in_gop; GHashTable* my_hfids; /* for creating register info */ gint ett; gint ett_attr; GHashTable* hfids_attr; /* k=hfid v=avp_name */ gboolean discard; gboolean last_extracted; gboolean drop_unassigned; GPtrArray* transport_ranges; /* hfids of candidate transport ranges from which to extract attributes */ GPtrArray* payload_ranges; /* hfids of candidate payload ranges from which to extract attributes */ avpl_match_mode criterium_match_mode; accept_mode_t criterium_accept_mode; AVPL* criterium; } mate_cfg_pdu; typedef struct _mate_cfg_gop { gchar* name; guint last_id; /* keeps the last id given to an item of this kind */ GHashTable* items; /* all the items of this type */ GPtrArray* transforms; /* transformations to be applied */ gchar* on_pdu; AVPL* key; /* key candidate avpl */ AVPL* start; /* start candidate avpl */ AVPL* stop; /* stop candidate avpl */ AVPL* extra; /* attributes to be added */ float expiration; float idle_timeout; float lifetime; gboolean drop_unassigned; gop_pdu_tree_t pdu_tree_mode; gboolean show_times; GHashTable* my_hfids; /* for creating register info */ int hfid; int hfid_start_time; int hfid_stop_time; int hfid_last_time; int hfid_gop_pdu; int hfid_gop_num_pdus; gint ett; gint ett_attr; gint ett_times; gint ett_children; GHashTable* gop_index; GHashTable* gog_index; } mate_cfg_gop; typedef struct _mate_cfg_gog { gchar* name; GHashTable* items; /* all the items of this type */ guint last_id; /* keeps the last id given to an item of this kind */ GPtrArray* transforms; /* transformations to be applied */ LoAL* keys; AVPL* extra; /* attributes to be added */ float expiration; gop_tree_mode_t gop_tree_mode; gboolean show_times; GHashTable* my_hfids; /* for creating register info */ int hfid; int hfid_gog_num_of_gops; int hfid_gog_gop; int hfid_gog_gopstart; int hfid_gog_gopstop; int hfid_start_time; int hfid_stop_time; int hfid_last_time; gint ett; gint ett_attr; gint ett_times; gint ett_children; gint ett_gog_gop; } mate_cfg_gog; typedef struct _mate_config { gchar* mate_config_file; /* name of the config file */ int hfid_mate; GArray *wanted_hfids; /* hfids of protocols and fields MATE needs */ guint num_fields_wanted; /* number of fields MATE will look at */ FILE* dbg_facility; /* where to dump dbgprint output ws_message if null */ gchar* mate_lib_path; /* where to look for "Include" files first */ GHashTable* pducfgs; /* k=pducfg->name v=pducfg */ GHashTable* gopcfgs; /* k=gopcfg->name v=gopcfg */ GHashTable* gogcfgs; /* k=gogcfg->name v=gogcfg */ GHashTable* transfs; /* k=transform->name v=transform */ GPtrArray* pducfglist; /* pducfgs in order of "execution" */ GHashTable* gops_by_pduname; /* k=pducfg->name v=gopcfg */ GHashTable* gogs_by_gopname; /* k=gopname v=loal where avpl->name == matchedgop->name */ GArray* hfrs; gint ett_root; GArray* ett; /* defaults */ struct _mate_cfg_defaults { struct _pdu_defaults { avpl_match_mode match_mode; avpl_replace_mode replace_mode; gboolean last_extracted; gboolean drop_unassigned; gboolean discard; } pdu; struct _gop_defaults { float expiration; float idle_timeout; float lifetime; gop_pdu_tree_t pdu_tree_mode; gboolean show_times; gboolean drop_unassigned; } gop; struct _gog_defaults { float expiration; gboolean show_times; gop_tree_mode_t gop_tree_mode; } gog; } defaults; /* what to dbgprint */ int dbg_lvl; int dbg_pdu_lvl; int dbg_gop_lvl; int dbg_gog_lvl; GPtrArray* config_stack; GString* config_error; } mate_config; typedef struct _mate_config_frame { gchar* filename; guint linenum; } mate_config_frame; typedef struct _mate_runtime_data { guint current_items; /* a count of items */ float now; guint highest_analyzed_frame; GHashTable* frames; /* k=frame.num v=pdus */ } mate_runtime_data; typedef struct _mate_pdu mate_pdu; typedef struct _mate_gop mate_gop; typedef struct _mate_gog mate_gog; /* these are used to contain information regarding pdus, gops and gogs */ struct _mate_pdu { guint32 id; /* 1:1 -> saving a g_malloc */ mate_cfg_pdu* cfg; /* the type of this item */ AVPL* avpl; guint32 frame; /* wich frame I belog to? */ mate_pdu* next_in_frame; /* points to the next pdu in this frame */ float rel_time; /* time since start of capture */ mate_gop* gop; /* the gop the pdu belongs to (if any) */ mate_pdu* next; /* next in gop */ float time_in_gop; /* time since gop start */ gboolean first; /* is this the first pdu in this frame? */ gboolean is_start; /* this is the start pdu for this gop */ gboolean is_stop; /* this is the stop pdu for this gop */ gboolean after_release; /* this pdu comes after the stop */ }; struct _mate_gop { guint32 id; mate_cfg_gop* cfg; gchar* gop_key; AVPL* avpl; /* the attributes of the pdu/gop/gog */ guint last_n; mate_gog* gog; /* the gog of a gop */ mate_gop* next; /* next in gog; */ float expiration; /* when will it expire after release (all gops releases if gog)? */ float idle_expiration; /* when will it expire if no new pdus are assigned to it */ float time_to_die; float time_to_timeout; float start_time; /* time of start */ float release_time; /* when this gop/gog was released */ float last_time; /* the rel_time at which the last pdu has been added (to gop or gog's gop) */ int num_of_pdus; /* how many gops a gog has? */ int num_of_after_release_pdus; /* how many pdus have arrived since it's been released */ mate_pdu* pdus; /* pdus that belong to a gop (NULL in gog) */ mate_pdu* last_pdu; /* last pdu in pdu's list */ gboolean released; /* has this gop been released? */ }; struct _mate_gog { guint32 id; mate_cfg_gog* cfg; AVPL* avpl; /* the attributes of the pdu/gop/gog */ guint last_n; /* the number of attributes the avpl had the last time we checked */ gboolean released; /* has this gop been released? */ float expiration; /* when will it expire after release (all gops releases if gog)? */ float idle_expiration; /* when will it expire if no new pdus are assigned to it */ /* on gop and gog: */ float start_time; /* time of start */ float release_time; /* when this gog was released */ float last_time; /* the rel_time at which the last pdu has been added */ mate_gop* gops; /* gops that belong to a gog (NULL in gop) */ mate_gop* last_gop; /* last gop in gop's list */ int num_of_gops; /* how many gops a gog has? */ int num_of_counting_gops; /* how many of them count for gog release */ int num_of_released_gops; /* how many of them have already been released */ GPtrArray* gog_keys; /* the keys under which this gog is stored in the gogs hash */ }; typedef union _mate_max_size { mate_pdu pdu; mate_gop gop; mate_gog gog; } mate_max_size; /* from mate_runtime.c */ extern void initialize_mate_runtime(mate_config* mc); extern mate_pdu* mate_get_pdus(guint32 framenum); extern void mate_analyze_frame(mate_config *mc, packet_info *pinfo, proto_tree* tree); /* from mate_setup.c */ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid); extern mate_cfg_pdu* new_pducfg(mate_config* mc, gchar* name); extern mate_cfg_gop* new_gopcfg(mate_config* mc, gchar* name); extern mate_cfg_gog* new_gogcfg(mate_config* mc, gchar* name); extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* as, GHashTable* where); extern gchar* add_ranges(gchar* range, GPtrArray* range_ptr_arr); /* from mate_parser.l */ extern gboolean mate_load_config(const gchar* filename, mate_config* mc); /* Constructor/Destructor prototypes for Lemon Parser */ #define YYMALLOCARGTYPE gsize void *MateParserAlloc(void* (*)(YYMALLOCARGTYPE)); void MateParserFree(void*, void (*)(void *)); void MateParser(void*, int, gchar*, mate_config*); #endif
wireshark/plugins/epan/mate/mate_grammar.lemon
%include { /* mate_grammar.lemon * MATE's configuration language grammar * * Copyright 2005, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* * XXX - there's a Lemon bug where this grammar produces a parser that * fails assertions; to work around it, we disable assert() failures. */ #ifndef NDEBUG #define NDEBUG #endif #include "config.h" #include <errno.h> #include "mate.h" #include "mate_grammar.h" #include <wsutil/file_util.h> #include <wsutil/str_util.h> #define DUMMY void* typedef struct _extraction { gchar* as; header_field_info* hfi; struct _extraction* next; struct _extraction* last; } extraction_t; typedef struct _pdu_criteria_t { AVPL* criterium_avpl; avpl_match_mode criterium_match_mode; accept_mode_t criterium_accept_mode; } pdu_criteria_t; typedef struct _gop_options { gop_tree_mode_t pdu_tree_mode; gboolean drop_unassigned; gboolean show_times; float expiration; float idle_timeout; float lifetime; AVPL* start; AVPL* stop; AVPL* extras; } gop_options_t; typedef struct _gog_statements { float expiration; gop_tree_mode_t gop_tree_mode; GPtrArray* transform_list; AVPL* extras; LoAL* current_gogkeys; } gog_statement_t; typedef struct _transf_match_t { avpl_match_mode match_mode; AVPL* avpl; } transf_match_t; typedef struct _transf_action_t { avpl_replace_mode replace_mode; AVPL* avpl; } transf_action_t; static void configuration_error(mate_config* mc, const gchar* fmt, ...) { static gchar error_buffer[256]; const gchar* incl; gint i; mate_config_frame* current_frame; va_list list; va_start( list, fmt ); vsnprintf(error_buffer,sizeof(error_buffer),fmt,list); va_end( list ); i = (gint) mc->config_stack->len; while (i--) { if (i>0) { incl = "\n included from: "; } else { incl = " "; } current_frame = (mate_config_frame *)g_ptr_array_index(mc->config_stack,(guint)i); g_string_append_printf(mc->config_error,"%s%s at line %u",incl, current_frame->filename, current_frame->linenum); } g_string_append_printf(mc->config_error,": %s\n",error_buffer); THROW(MateConfigError); } static AVPL_Transf* new_transform_elem(AVPL* match, AVPL* replace, avpl_match_mode match_mode, avpl_replace_mode replace_mode) { AVPL_Transf* t = (AVPL_Transf *)g_malloc(sizeof(AVPL_Transf)); t->name = NULL; t->match = match; t->replace = replace; t->match_mode = match_mode; t->replace_mode = replace_mode; t->map = NULL; t->next = NULL; return t; } static gchar* recolonize(mate_config* mc, gchar* s) { GString* str = g_string_new(""); gchar** vec; gchar* r; guint i,v; gchar c; vec = g_strsplit(s,":",0); for (i = 0; vec[i]; i++) { ascii_strdown_inplace(vec[i]); v = 0; switch ( strlen(vec[i]) ) { case 2: c = vec[i][1]; vec[i][1] = vec[i][0]; vec[i][0] = c; if (vec[i][0] >= '0' && vec[i][0] <= '9') { v += (vec[i][1] - '0' )*16; } else { v += (vec[i][1] - 'a' + 10)*16; } /* FALL THROUGH */ case 1: if (vec[i][0] >= '0' && vec[i][0] <= '9') { v += (vec[i][0] - '0' ); } else { v += (vec[i][0] - 'a' + 10); } case 0: break; default: configuration_error(mc,"bad token %s",s); } g_string_append_printf(str,":%.2X",v); } g_strfreev(vec); g_string_erase(str,0,1); r = str->str; g_string_free(str,FALSE); return r; } DIAG_OFF_LEMON() } /* end of %include */ %code { DIAG_ON_LEMON() } %name MateParser %token_prefix TOKEN_ %token_type { gchar* } %token_destructor { (void) mc; /* Mark unused, similar to Q_UNUSED */ g_free($$); } %extra_argument { mate_config* mc } %syntax_error { configuration_error(mc,"Syntax Error before %s",yyminor); } %parse_failure { configuration_error(mc,"Parse Error"); } %type transform_decl { AVPL_Transf* } %type transform_body { AVPL_Transf* } %type transform_statements { AVPL_Transf* } %type transform_statement { AVPL_Transf* } %type transform_match { transf_match_t* } %type transform_action { transf_action_t* } %type match_mode { avpl_match_mode } %type action_mode { avpl_replace_mode } %type gop_name { gchar* } %type time_value { float } %type pdu_name { gchar* } %type gop_tree_mode { gop_tree_mode_t } %type true_false { gboolean } %type criteria_statement { pdu_criteria_t* } %type accept_mode { accept_mode_t } %type pdu_drop_unassigned_statement { gboolean } %type discard_pdu_data_statement { gboolean } %type last_extracted_statement { gboolean } %type extraction_statement {extraction_t*} %type extraction_statements {extraction_t*} %type gop_options { gop_options_t* } %type gop_start_statement { AVPL* } %type gop_stop_statement { AVPL* } %type extra_statement { AVPL* } %type gop_drop_unassigned_statement { gboolean } %type show_goptree_statement { gop_tree_mode_t } %type show_times_statement { gboolean } %type gop_expiration_statement { float } %type idle_timeout_statement { float } %type lifetime_statement { float } %type gog_statements { gog_statement_t* } %type gog_expiration_statement { float } %type gog_goptree_statement { gop_tree_mode_t } %type gog_key_statements { LoAL* } %type gog_key_statement { AVPL* } %type transform_list_statement { GPtrArray* } %type transform { AVPL_Transf* } %type gop_tree_type { gop_tree_mode_t } %type payload_statement { GPtrArray* } %type proto_stack { GPtrArray* } %type field { header_field_info* } %type transform_list { GPtrArray* } %type avpl { AVPL* } %type avps { AVPL* } %type avp { AVP* } %type value { gchar* } %type avp_oneoff { gchar* } mate_config ::= decls. decls ::= decls decl. decls ::= . decl ::= pdu_decl. decl ::= gop_decl. decl ::= gog_decl. decl ::= transform_decl. decl ::= defaults_decl. decl ::= debug_decl. decl ::= DONE_KW SEMICOLON. /************* DEBUG */ debug_decl ::= DEBUG_KW OPEN_BRACE dbgfile_default dbglevel_default pdu_dbglevel_default gop_dbglevel_default gog_dbglevel_default CLOSE_BRACE SEMICOLON. dbgfile_default ::= FILENAME_KW QUOTED(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= FILENAME_KW NAME(Filename) SEMICOLON. { mc->dbg_facility = ws_fopen(Filename,"w"); if (mc->dbg_facility == NULL) report_open_failure(Filename,errno,TRUE); } dbgfile_default ::= . dbglevel_default ::= LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_lvl = (int) strtol(LevelString,NULL,10); } dbglevel_default ::= . pdu_dbglevel_default ::= PDU_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_pdu_lvl = (int) strtol(LevelString,NULL,10); } pdu_dbglevel_default ::= . gop_dbglevel_default ::= GOP_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_gop_lvl = (int) strtol(LevelString,NULL,10); } gop_dbglevel_default ::= . gog_dbglevel_default ::= GOG_KW LEVEL_KW INTEGER(LevelString) SEMICOLON. { mc->dbg_gog_lvl = (int) strtol(LevelString,NULL,10); } gog_dbglevel_default ::= . /************* DEFAULTS */ defaults_decl ::= DEFAULT_KW OPEN_BRACE pdu_defaults gop_defaults gog_defaults CLOSE_BRACE SEMICOLON. pdu_defaults ::= PDU_KW OPEN_BRACE pdu_last_extracted_default pdu_drop_unassigned_default pdu_discard_default CLOSE_BRACE SEMICOLON. pdu_defaults ::= . pdu_last_extracted_default ::= LAST_EXTRACTED_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.last_extracted = Flag; } pdu_last_extracted_default ::= . pdu_drop_unassigned_default ::= DROP_UNASSIGNED_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.drop_unassigned = Flag; } pdu_drop_unassigned_default ::= . pdu_discard_default ::= DISCARD_PDU_DATA_KW true_false(Flag) SEMICOLON. { mc->defaults.pdu.discard = Flag; } pdu_discard_default ::= . gop_defaults ::= GOP_KW OPEN_BRACE gop_expiration_default gop_idle_timeout_default gop_lifetime_default gop_drop_unassigned_default gop_tree_mode_default gop_show_times_default CLOSE_BRACE SEMICOLON. gop_defaults ::= . gop_expiration_default ::= EXPIRATION_KW time_value(B) SEMICOLON. { mc->defaults.gop.expiration = B; } gop_expiration_default ::= . gop_idle_timeout_default ::= IDLE_TIMEOUT_KW time_value(B) SEMICOLON. { mc->defaults.gop.idle_timeout = B; } gop_idle_timeout_default ::= . gop_lifetime_default ::= LIFETIME_KW time_value(B) SEMICOLON. { mc->defaults.gop.lifetime = B; } gop_lifetime_default ::= . gop_drop_unassigned_default ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { mc->defaults.gop.drop_unassigned = B; } gop_drop_unassigned_default ::= . gop_tree_mode_default ::= SHOW_TREE_KW gop_tree_mode(B) SEMICOLON. { mc->defaults.gop.pdu_tree_mode = (gop_pdu_tree_t)B; } gop_tree_mode_default ::= . gop_show_times_default ::= SHOW_TIMES_KW true_false(B) SEMICOLON. { mc->defaults.gop.show_times = B; } gop_show_times_default ::= . gog_defaults ::= GOG_KW OPEN_BRACE gog_expiration_default gop_tree_mode_default gog_goptree_default gog_show_times_default CLOSE_BRACE SEMICOLON. gog_defaults ::= . gog_expiration_default ::= EXPIRATION_KW time_value(B) SEMICOLON. { mc->defaults.gop.expiration = B; } gog_expiration_default ::= . gog_goptree_default ::= GOP_TREE_KW gop_tree_type(B) SEMICOLON. { mc->defaults.gog.gop_tree_mode = B; } gog_goptree_default ::= . gog_show_times_default ::= SHOW_TIMES_KW true_false(B) SEMICOLON. { mc->defaults.gog.show_times = B; } gog_show_times_default ::= . /******************************************* TRANSFORM */ transform_decl(A) ::= TRANSFORM_KW NAME(B) transform_body(C) SEMICOLON. { AVPL_Transf* c; if ( g_hash_table_lookup(mc->transfs,B) ) { configuration_error(mc,"A transformation called '%s' exists already",B); } for ( c = C; c; c = c->next ) c->name = g_strdup(B); g_hash_table_insert(mc->transfs,C->name,C); A = NULL; } transform_body(A) ::= OPEN_BRACE transform_statements(B) CLOSE_BRACE. { A = B; } transform_statements(A) ::= transform_statements(C) transform_statement(B). { AVPL_Transf* c; for ( c = C; c->next; c = c->next ) ; c->next = B; A = C; } transform_statements(A) ::= transform_statement(B). { A = B; } transform_statement(A) ::= transform_match(Match) transform_action(Action) SEMICOLON. { A = new_transform_elem(Match->avpl,Action->avpl,Match->match_mode,Action->replace_mode); } transform_match(A) ::= MATCH_KW match_mode(Mode) avpl(Avpl). { A = (transf_match_t *)g_malloc(sizeof(transf_match_t)); A->match_mode = Mode; A->avpl = Avpl; } transform_match(A) ::= . { A = (transf_match_t *)g_malloc(sizeof(transf_match_t)); A->match_mode = AVPL_STRICT; A->avpl = new_avpl(""); } transform_action(A) ::= . { A = (transf_action_t *)g_malloc(sizeof(transf_action_t)); A->replace_mode = AVPL_INSERT; A->avpl = new_avpl(""); } transform_action(A) ::= action_mode(Mode) avpl(Avpl). { A = (transf_action_t *)g_malloc(sizeof(transf_action_t)); A->replace_mode = Mode; A->avpl = Avpl; } match_mode(A) ::= . { A = AVPL_STRICT; } match_mode(A) ::= STRICT_KW. { A = AVPL_STRICT; } match_mode(A) ::= EVERY_KW. { A = AVPL_EVERY; } match_mode(A) ::= LOOSE_KW. { A = AVPL_LOOSE; } action_mode(A) ::= REPLACE_KW. { A = AVPL_REPLACE; } action_mode(A) ::= INSERT_KW. { A = AVPL_INSERT; } action_mode(A) ::= . { A = AVPL_INSERT; } /******************************************* PDU */ pdu_decl ::= PDU_KW NAME(Name) PROTO_KW field(Field) TRANSPORT_KW proto_stack(Stack) OPEN_BRACE payload_statement(Payload) extraction_statements(Extraction) transform_list_statement(Transform) criteria_statement(Criteria) pdu_drop_unassigned_statement(DropUnassigned) discard_pdu_data_statement(DistcardPduData) last_extracted_statement(LastExtracted) CLOSE_BRACE SEMICOLON. { mate_cfg_pdu* cfg = new_pducfg(mc, Name); extraction_t *extraction, *next_extraction; GPtrArray* transport_stack = g_ptr_array_new(); int i; if (! cfg ) configuration_error(mc,"could not create Pdu %s.",Name); cfg->hfid_proto = Field->id; cfg->last_extracted = LastExtracted; cfg->discard = DistcardPduData; cfg->drop_unassigned = DropUnassigned; /* * Add this protocol to our table of wanted hfids. */ mc->wanted_hfids = g_array_append_val(mc->wanted_hfids, Field->id); /* flip the transport_stack */ for (i = Stack->len - 1; Stack->len; i--) { g_ptr_array_add(transport_stack,g_ptr_array_remove_index(Stack,i)); } g_ptr_array_free(Stack, TRUE); cfg->transport_ranges = transport_stack; cfg->payload_ranges = Payload; if (Criteria) { cfg->criterium = Criteria->criterium_avpl; cfg->criterium_match_mode = Criteria->criterium_match_mode; cfg->criterium_accept_mode = Criteria->criterium_accept_mode; } cfg->transforms = Transform; for (extraction = Extraction; extraction; extraction = next_extraction) { next_extraction = extraction->next; if ( ! add_hfid(mc, extraction->hfi, extraction->as, cfg->hfids_attr) ) { configuration_error(mc,"MATE: failed to create extraction rule '%s'",extraction->as); } g_free(extraction); } } payload_statement(A) ::= . { A = NULL; } payload_statement(A) ::= PAYLOAD_KW proto_stack(B) SEMICOLON. { A = B; } criteria_statement(A) ::= . { A = NULL; } criteria_statement(A) ::= CRITERIA_KW accept_mode(B) match_mode(C) avpl(D) SEMICOLON. { A = g_new(pdu_criteria_t, 1); A->criterium_avpl = D; A->criterium_match_mode = C; A->criterium_accept_mode = B; } accept_mode(A) ::= . { A = ACCEPT_MODE; } accept_mode(A) ::= ACCEPT_KW. { A = ACCEPT_MODE; } accept_mode(A) ::= REJECT_KW. { A = REJECT_MODE; } extraction_statements(A) ::= extraction_statements(B) extraction_statement(C). { A = B; A->last = A->last->next = C; } extraction_statements(A) ::= extraction_statement(B). { A = B; A->last = A; } extraction_statement(A) ::= EXTRACT_KW NAME(NAME) FROM_KW field(FIELD) SEMICOLON. { A = g_new(extraction_t, 1); A->as = NAME; A->hfi = FIELD; A->next = A->last = NULL; } pdu_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; } pdu_drop_unassigned_statement(A) ::= . { A = mc->defaults.pdu.drop_unassigned; } discard_pdu_data_statement(A) ::= DISCARD_PDU_DATA_KW true_false(B) SEMICOLON. { A = B; } discard_pdu_data_statement(A) ::= . { A = mc->defaults.pdu.discard; } last_extracted_statement(A) ::= LAST_PDU_KW true_false(B) SEMICOLON. { A = B; } last_extracted_statement(A) ::= . { A = mc->defaults.pdu.last_extracted; } proto_stack(A) ::= proto_stack(B) SLASH field(C). { int* hfidp = g_new(int, 1); *hfidp = C->id; g_ptr_array_add(B,hfidp); A = B; } proto_stack(A) ::= field(B). { int* hfidp = g_new(int, 1); *hfidp = B->id; A = g_ptr_array_new(); g_ptr_array_add(A,hfidp); } field(A) ::= NAME(B). { A = proto_registrar_get_byname(B); } /******************************************* GOP */ gop_decl(A) ::= GOP_KW NAME(Name) ON_KW pdu_name(PduName) MATCH_KW avpl(Key) OPEN_BRACE gop_start_statement(Start) gop_stop_statement(Stop) extra_statement(Extra) transform_list_statement(Transform) gop_expiration_statement(Expiration) idle_timeout_statement(IdleTimeout) lifetime_statement(Lifetime) gop_drop_unassigned_statement(DropUnassigned) show_goptree_statement(TreeMode) show_times_statement(ShowTimes) CLOSE_BRACE SEMICOLON. { mate_cfg_gop* cfg; if (g_hash_table_lookup(mc->gopcfgs,Name)) configuration_error(mc,"A Gop Named '%s' exists already.",Name); if (g_hash_table_lookup(mc->gops_by_pduname,PduName) ) configuration_error(mc,"Gop for Pdu '%s' exists already",PduName); cfg = new_gopcfg(mc, Name); g_hash_table_insert(mc->gops_by_pduname,PduName,cfg); g_hash_table_insert(mc->gopcfgs,cfg->name,cfg); cfg->on_pdu = PduName; cfg->key = Key; cfg->drop_unassigned = DropUnassigned; cfg->show_times = ShowTimes; cfg->pdu_tree_mode = (gop_pdu_tree_t)TreeMode; cfg->expiration = Expiration; cfg->idle_timeout = IdleTimeout; cfg->lifetime = Lifetime; cfg->start = Start; cfg->stop = Stop; cfg->transforms = Transform; merge_avpl(cfg->extra,Extra,TRUE); delete_avpl(Extra,TRUE); } gop_drop_unassigned_statement(A) ::= DROP_UNASSIGNED_KW true_false(B) SEMICOLON. { A = B; } gop_drop_unassigned_statement(A) ::= . { A = mc->defaults.gop.drop_unassigned; } gop_start_statement(A) ::= START_KW avpl(B) SEMICOLON. { A = B; } gop_start_statement(A) ::= . { A = NULL; } gop_stop_statement(A) ::= STOP_KW avpl(B) SEMICOLON. { A = B; } gop_stop_statement(A) ::= . { A = NULL; } show_goptree_statement(A) ::= SHOW_TREE_KW gop_tree_mode(B) SEMICOLON. { A = B; } show_goptree_statement(A) ::= . { A = (gop_tree_mode_t)mc->defaults.gop.pdu_tree_mode; } show_times_statement(A) ::= SHOW_TIMES_KW true_false(B) SEMICOLON. { A = B; } show_times_statement(A) ::= . { A = mc->defaults.gop.show_times; } gop_expiration_statement(A) ::= EXPIRATION_KW time_value(B) SEMICOLON. { A = B; } gop_expiration_statement(A) ::= . { A = mc->defaults.gop.lifetime; } idle_timeout_statement(A) ::= IDLE_TIMEOUT_KW time_value(B) SEMICOLON. { A = B; } idle_timeout_statement(A) ::= . { A = mc->defaults.gop.lifetime; } lifetime_statement(A) ::= LIFETIME_KW time_value(B) SEMICOLON. { A = B; } lifetime_statement(A) ::= . { A = mc->defaults.gop.lifetime; } gop_tree_mode(A) ::= NO_TREE_KW. { A = (gop_tree_mode_t)GOP_NO_TREE; } gop_tree_mode(A) ::= PDU_TREE_KW. { A = (gop_tree_mode_t)GOP_PDU_TREE; } gop_tree_mode(A) ::= FRAME_TREE_KW. { A = (gop_tree_mode_t)GOP_FRAME_TREE; } gop_tree_mode(A) ::= BASIC_TREE_KW. { A = (gop_tree_mode_t)GOP_BASIC_PDU_TREE; } true_false(A) ::= TRUE_KW. { A = TRUE; } true_false(A) ::= FALSE_KW. { A = FALSE; } pdu_name(A) ::= NAME(B). { mate_cfg_pdu* c; if (( c = (mate_cfg_pdu *)g_hash_table_lookup(mc->pducfgs,B) )) { A = c->name; } else { configuration_error(mc,"No such Pdu: '%s'",B); } } time_value(A) ::= FLOATING(B). { A = (float) g_ascii_strtod(B,NULL); } time_value(A) ::= INTEGER(B). { A = (float) g_ascii_strtod(B,NULL); } /************* GOG */ gog_decl ::= GOG_KW NAME(Name) OPEN_BRACE gog_key_statements(Keys) extra_statement(Extra) transform_list_statement(Transforms) gog_expiration_statement(Expiration) gog_goptree_statement(Tree) show_times_statement(ShowTimes) CLOSE_BRACE SEMICOLON. { mate_cfg_gog* cfg = NULL; if ( g_hash_table_lookup(mc->gogcfgs,Name) ) { configuration_error(mc,"Gog '%s' exists already ",Name); } cfg = new_gogcfg(mc, Name); cfg->expiration = Expiration; cfg->gop_tree_mode = Tree; cfg->transforms = Transforms; cfg->keys = Keys; cfg->show_times = ShowTimes; merge_avpl(cfg->extra,Extra,TRUE); delete_avpl(Extra,TRUE); } gog_goptree_statement(A) ::= GOP_TREE_KW gop_tree_type(B) SEMICOLON. { A = B; } gog_goptree_statement(A) ::= . { A = mc->defaults.gog.gop_tree_mode; } gog_expiration_statement(A) ::= EXPIRATION_KW time_value(B) SEMICOLON. { A = B; } gog_expiration_statement(A) ::= . { A = mc->defaults.gog.expiration; } gop_tree_type(A) ::= NULL_TREE_KW. { A = GOP_NULL_TREE; } gop_tree_type(A) ::= FULL_TREE_KW. { A = GOP_FULL_TREE; } gop_tree_type(A) ::= BASIC_TREE_KW. { A = GOP_BASIC_TREE; } gog_key_statements(A) ::= gog_key_statements(B) gog_key_statement(C). { loal_append(B,C); A = B; } gog_key_statements(A) ::= gog_key_statement(B). { A = new_loal(""); loal_append(A,B); } gog_key_statement(A) ::= MEMBER_KW gop_name(B) avpl(C) SEMICOLON. { rename_avpl(C,B); A = C; } gop_name(A) ::= NAME(B). { mate_cfg_gop* c; if (( c = (mate_cfg_gop *)g_hash_table_lookup(mc->gopcfgs,B) )) { A = c->name; } else { configuration_error(mc,"No Gop called '%s' has been already declared",B); } } /******************************************** GENERAL */ extra_statement(A) ::= EXTRA_KW avpl(B) SEMICOLON. { A = B; } extra_statement(A) ::= . { A = new_avpl(""); } transform_list_statement(A) ::= TRANSFORM_KW transform_list(B) SEMICOLON. { A = B; } transform_list_statement(A) ::= . { A = g_ptr_array_new(); } transform_list(A) ::= transform_list(B) COMMA transform(C). { A = B; g_ptr_array_add(B,C); } transform_list(A) ::= transform(B). { A = g_ptr_array_new(); g_ptr_array_add(A,B); } transform(A) ::= NAME(B). { AVPL_Transf* t; if (( t = (AVPL_Transf *)g_hash_table_lookup(mc->transfs,B) )) { A = t; } else { configuration_error(mc,"There's no such Transformation: %s",B); } } avpl(A) ::= OPEN_PARENS avps(B) CLOSE_PARENS. { A = B; } avpl(A) ::= OPEN_PARENS CLOSE_PARENS. { A = new_avpl(""); } avps(A) ::= avps(B) COMMA avp(C). { A = B; if ( ! insert_avp(B,C) ) delete_avp(C); } avps(A) ::= avp(B). { A = new_avpl(""); if ( ! insert_avp(A,B) ) delete_avp(B); } avp(A) ::= NAME(B) AVP_OPERATOR(C) value(D). { A = new_avp(B,D,*C); } avp(A) ::= NAME(B). { A = new_avp(B,"",'?'); } avp(A) ::= NAME(B) OPEN_BRACE avp_oneoff(C) CLOSE_BRACE. { A = new_avp(B,C,'|'); } avp_oneoff(A) ::= avp_oneoff(B) PIPE value(C). { A = ws_strdup_printf("%s|%s",B,C); } avp_oneoff(A) ::= value(B). { A = g_strdup(B); } value(A) ::= QUOTED(B). { A = g_strdup(B); } value(A) ::= NAME(B). { A = g_strdup(B); } value(A) ::= FLOATING(B). { A = g_strdup(B); } value(A) ::= INTEGER(B). { A = g_strdup(B); } value(A) ::= DOTED_IP(B). { A = g_strdup(B); } value(A) ::= COLONIZED(B). { A = recolonize(mc,B); }
wireshark/plugins/epan/mate/mate_parser.l
%top { /* Include this before everything else, for various large-file definitions */ #include "config.h" /* Include this before everything else, as it declares functions used here. */ #include "mate.h" } /* * We want a reentrant scanner. */ %option reentrant /* * We don't use input, so don't generate code for it. */ %option noinput /* * We don't use unput, so don't generate code for it. */ %option nounput /* * We don't read interactively from the terminal. */ %option never-interactive /* * We want to stop processing when we get to the end of the input. */ %option noyywrap /* * The type for the state we keep for a scanner. */ %option extra-type="Mate_scanner_state_t *" /* * We have to override the memory allocators so that we don't get * "unused argument" warnings from the yyscanner argument (which * we don't use, as we have a global memory allocator). * * We provide, as macros, our own versions of the routines generated by Flex, * which just call malloc()/realloc()/free() (as the Flex versions do), * discarding the extra argument. */ %option noyyalloc %option noyyrealloc %option noyyfree /* * Prefix scanner routines with "Mate_" rather than "yy", so this scanner * can coexist with other scanners. */ %option prefix="Mate_" %{ /* mate_parser.l * lexical analyzer for MATE configuration files * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mate_grammar.h" #include <wsutil/file_util.h> /* * Disable diagnostics in the code generated by Flex. */ DIAG_OFF_FLEX() void MateParseTrace(FILE*,char*); #define MAX_INCLUDE_DEPTH 10 typedef struct { mate_config* mc; mate_config_frame* current_frame; void* pParser; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr; } Mate_scanner_state_t; #define MATE_PARSE(token_type) MateParser(yyextra->pParser, (token_type), g_strdup(yytext), yyextra->mc); /* * Flex (v 2.5.35) uses this symbol to "exclude" unistd.h */ #ifdef _WIN32 #define YY_NO_UNISTD_H #endif static void free_config_frame(mate_config_frame *frame) { g_free(frame->filename); g_free(frame); } #define YY_USER_INIT BEGIN OUTSIDE; /* * Sleazy hack to suppress compiler warnings in yy_fatal_error(). */ #define YY_EXIT_FAILURE ((void)yyscanner, 2) /* * Macros for the allocators, to discard the extra argument. */ #define Mate_alloc(size, yyscanner) (void *)malloc(size) #define Mate_realloc(ptr, size, yyscanner) (void *)realloc((char *)(ptr), (size)) #define Mate_free(ptr, yyscanner) free((char *)ptr) %} pdu_kw Pdu gop_kw Gop gog_kw Gog transform_kw Transform match_kw Match always_kw Always strict_kw Strict every_kw Every loose_kw Loose replace_kw Replace insert_kw Insert gop_tree_kw GopTree member_kw Member on_kw On start_kw Start stop_kw Stop extra_kw Extra show_tree_kw ShowTree show_times_kw ShowTimes expiration_kw Expiration idle_timeout_kw IdleTimeout lifetime_kw Lifetime no_tree_kw NoTree pdu_tree_kw PduTree frame_tree_kw FrameTree basic_tree_kw BasicTree true_kw [Tt][Rr][Uu][Ee] false_kw [Ff][Aa][Ll][Ss][Ee] proto_kw Proto payload_kw Payload transport_kw Transport criteria_kw Criteria accept_kw Accept reject_kw Reject extract_kw Extract from_kw From drop_unassigned_kw DropUnassigned discard_pdu_data_kw DiscardPduData last_pdu_kw LastPdu done_kw Done filename_kw Filename debug_kw Debug level_kw Level default_kw Default open_parens "(" close_parens ")" open_brace "{" close_brace "}" comma "," semicolon ";" slash "/" pipe "|" integer [0-9]+ floating ([0-9]+\.[0-9]+) doted_ip [0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]? colonized [0-9A-Fa-f:]*[:][0-9A-Fa-f:]* name [a-z][-\.a-zA-Z0-9_]* avp_operator [$^~=<>!] quote ["] not_quoted [^"]* include "#include" filename [-A-Za-z0-9_/.]+ whitespace [[:blank:]\r]+ newline \n comment "//"[^\n]*\n blk_cmnt_start "/*" cmnt_char . blk_cmnt_stop "*/" %START OUTSIDE QUOTED INCLUDING COMMENT %% {newline} yyextra->current_frame->linenum++; {whitespace} ; <OUTSIDE>{include} BEGIN INCLUDING; <INCLUDING>{filename} { if ( yyextra->include_stack_ptr >= MAX_INCLUDE_DEPTH ) ws_error("dtd_preparse: include files nested too deeply"); yyextra->include_stack[yyextra->include_stack_ptr++] = YY_CURRENT_BUFFER; yyin = ws_fopen( yytext, "r" ); if (!yyin) { Mate__delete_buffer(YY_CURRENT_BUFFER, yyscanner); /* coverity[negative_sink] */ Mate__switch_to_buffer(yyextra->include_stack[--yyextra->include_stack_ptr], yyscanner); if (errno) g_string_append_printf(yyextra->mc->config_error, "Mate parser: Could not open file: '%s': %s", yytext, g_strerror(errno) ); } else { yyextra->current_frame = g_new(mate_config_frame, 1); yyextra->current_frame->filename = g_strdup(yytext); yyextra->current_frame->linenum = 1; g_ptr_array_add(yyextra->mc->config_stack,yyextra->current_frame); Mate__switch_to_buffer(Mate__create_buffer(yyin, YY_BUF_SIZE, yyscanner), yyscanner); } BEGIN OUTSIDE; } <<EOF>> { /* coverity[check_after_sink] */ if ( --yyextra->include_stack_ptr < 0 ) { yyterminate(); } else { Mate__delete_buffer(YY_CURRENT_BUFFER, yyscanner); Mate__switch_to_buffer(yyextra->include_stack[yyextra->include_stack_ptr], yyscanner); free_config_frame(yyextra->current_frame); yyextra->current_frame = (mate_config_frame *)g_ptr_array_remove_index(yyextra->mc->config_stack,yyextra->mc->config_stack->len-1); } } <OUTSIDE>{comment} ; <OUTSIDE>{blk_cmnt_start} BEGIN COMMENT; <COMMENT>{cmnt_char} ; <COMMENT>{blk_cmnt_stop} BEGIN OUTSIDE; <OUTSIDE>{pdu_kw} MATE_PARSE(TOKEN_PDU_KW); <OUTSIDE>{gop_kw} MATE_PARSE(TOKEN_GOP_KW); <OUTSIDE>{gog_kw} MATE_PARSE(TOKEN_GOG_KW); <OUTSIDE>{transform_kw} MATE_PARSE(TOKEN_TRANSFORM_KW); <OUTSIDE>{match_kw} MATE_PARSE(TOKEN_MATCH_KW); <OUTSIDE>{strict_kw} MATE_PARSE(TOKEN_STRICT_KW); <OUTSIDE>{every_kw} MATE_PARSE(TOKEN_EVERY_KW); <OUTSIDE>{loose_kw} MATE_PARSE(TOKEN_LOOSE_KW); <OUTSIDE>{replace_kw} MATE_PARSE(TOKEN_REPLACE_KW); <OUTSIDE>{insert_kw} MATE_PARSE(TOKEN_INSERT_KW); <OUTSIDE>{gop_tree_kw} MATE_PARSE(TOKEN_GOP_TREE_KW); <OUTSIDE>{member_kw} MATE_PARSE(TOKEN_MEMBER_KW); <OUTSIDE>{on_kw} MATE_PARSE(TOKEN_ON_KW); <OUTSIDE>{start_kw} MATE_PARSE(TOKEN_START_KW); <OUTSIDE>{stop_kw} MATE_PARSE(TOKEN_STOP_KW); <OUTSIDE>{extra_kw} MATE_PARSE(TOKEN_EXTRA_KW); <OUTSIDE>{show_tree_kw} MATE_PARSE(TOKEN_SHOW_TREE_KW); <OUTSIDE>{show_times_kw} MATE_PARSE(TOKEN_SHOW_TIMES_KW); <OUTSIDE>{expiration_kw} MATE_PARSE(TOKEN_EXPIRATION_KW); <OUTSIDE>{idle_timeout_kw} MATE_PARSE(TOKEN_IDLE_TIMEOUT_KW); <OUTSIDE>{lifetime_kw} MATE_PARSE(TOKEN_LIFETIME_KW); <OUTSIDE>{no_tree_kw} MATE_PARSE(TOKEN_NO_TREE_KW); <OUTSIDE>{pdu_tree_kw} MATE_PARSE(TOKEN_PDU_TREE_KW); <OUTSIDE>{frame_tree_kw} MATE_PARSE(TOKEN_FRAME_TREE_KW); <OUTSIDE>{basic_tree_kw} MATE_PARSE(TOKEN_BASIC_TREE_KW); <OUTSIDE>{true_kw} MATE_PARSE(TOKEN_TRUE_KW); <OUTSIDE>{false_kw} MATE_PARSE(TOKEN_FALSE_KW); <OUTSIDE>{proto_kw} MATE_PARSE(TOKEN_PROTO_KW); <OUTSIDE>{payload_kw} MATE_PARSE(TOKEN_PAYLOAD_KW); <OUTSIDE>{transport_kw} MATE_PARSE(TOKEN_TRANSPORT_KW); <OUTSIDE>{criteria_kw} MATE_PARSE(TOKEN_CRITERIA_KW); <OUTSIDE>{accept_kw} MATE_PARSE(TOKEN_ACCEPT_KW); <OUTSIDE>{reject_kw} MATE_PARSE(TOKEN_REJECT_KW); <OUTSIDE>{extract_kw} MATE_PARSE(TOKEN_EXTRACT_KW); <OUTSIDE>{from_kw} MATE_PARSE(TOKEN_FROM_KW); <OUTSIDE>{drop_unassigned_kw} MATE_PARSE(TOKEN_DROP_UNASSIGNED_KW); <OUTSIDE>{discard_pdu_data_kw} MATE_PARSE(TOKEN_DISCARD_PDU_DATA_KW); <OUTSIDE>{last_pdu_kw} MATE_PARSE(TOKEN_LAST_PDU_KW); <OUTSIDE>{done_kw} MATE_PARSE(TOKEN_DONE_KW); <OUTSIDE>{filename_kw} MATE_PARSE(TOKEN_FILENAME_KW); <OUTSIDE>{debug_kw} MATE_PARSE(TOKEN_DEBUG_KW); <OUTSIDE>{level_kw} MATE_PARSE(TOKEN_LEVEL_KW); <OUTSIDE>{default_kw} MATE_PARSE(TOKEN_DEFAULT_KW); <OUTSIDE>{open_parens} MATE_PARSE(TOKEN_OPEN_PARENS); <OUTSIDE>{close_parens} MATE_PARSE(TOKEN_CLOSE_PARENS); <OUTSIDE>{open_brace} MATE_PARSE(TOKEN_OPEN_BRACE); <OUTSIDE>{close_brace} MATE_PARSE(TOKEN_CLOSE_BRACE); <OUTSIDE>{comma} MATE_PARSE(TOKEN_COMMA); <OUTSIDE>{semicolon} MATE_PARSE(TOKEN_SEMICOLON); <OUTSIDE>{slash} MATE_PARSE(TOKEN_SLASH); <OUTSIDE>{pipe} MATE_PARSE(TOKEN_PIPE); <OUTSIDE>{integer} MATE_PARSE(TOKEN_INTEGER); <OUTSIDE>{floating} MATE_PARSE(TOKEN_FLOATING); <OUTSIDE>{doted_ip} MATE_PARSE(TOKEN_DOTED_IP); <OUTSIDE>{colonized} MATE_PARSE(TOKEN_COLONIZED); <OUTSIDE>{name} MATE_PARSE(TOKEN_NAME); <OUTSIDE>{avp_operator} MATE_PARSE(TOKEN_AVP_OPERATOR); <OUTSIDE>{quote} BEGIN QUOTED; <QUOTED>{not_quoted} MATE_PARSE(TOKEN_QUOTED); <QUOTED>{quote} BEGIN OUTSIDE; %% /* * Turn diagnostics back on, so we check the code that we've written. */ DIAG_ON_FLEX() static void ptr_array_free(gpointer data, gpointer user_data _U_) { free_config_frame((mate_config_frame *)data); } extern gboolean mate_load_config(const gchar* filename, mate_config* mc) { FILE *in; yyscan_t scanner; Mate_scanner_state_t state; volatile gboolean status = TRUE; in = ws_fopen(filename,"r"); if (!in) { g_string_append_printf(mc->config_error,"Mate parser: Could not open file: '%s', error: %s", filename, g_strerror(errno) ); return FALSE; } if (Mate_lex_init(&scanner) != 0) { g_string_append_printf(mc->config_error, "Mate parse: Could not initialize scanner: %s", g_strerror(errno)); fclose(in); return FALSE; } Mate_set_in(in, scanner); mc->config_stack = g_ptr_array_new(); state.mc = mc; state.current_frame = g_new(mate_config_frame, 1); state.current_frame->filename = g_strdup(filename); state.current_frame->linenum = 1; g_ptr_array_add(mc->config_stack,state.current_frame); state.pParser = MateParserAlloc(g_malloc); state.include_stack_ptr = 0; /* Associate the state with the scanner */ Mate_set_extra(&state, scanner); /* MateParserTrace(stdout,""); */ TRY { Mate_lex(scanner); /* Inform parser that end of input has reached. */ MateParser(state.pParser, 0, NULL, mc); MateParserFree(state.pParser, g_free); } CATCH(MateConfigError) { status = FALSE; } CATCH_ALL { status = FALSE; g_string_append_printf(mc->config_error,"An unexpected error occurred"); } ENDTRY; Mate_lex_destroy(scanner); fclose(in); g_ptr_array_foreach(mc->config_stack, ptr_array_free, NULL); g_ptr_array_free(mc->config_stack, TRUE); return status; }
C
wireshark/plugins/epan/mate/mate_runtime.c
/* mate_runtime.c * MATE -- Meta Analysis Tracing Engine * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include "mate.h" #include <wsutil/ws_assert.h> typedef struct _mate_range mate_range; struct _mate_range { guint start; guint end; }; typedef struct _tmp_pdu_data { GPtrArray* ranges; proto_tree* tree; mate_pdu* pdu; } tmp_pdu_data; typedef struct _gogkey { gchar* key; mate_cfg_gop* cfg; } gogkey; static mate_runtime_data* rd = NULL; static int zero = 5; static int* dbg = &zero; static int* dbg_pdu = &zero; static int* dbg_gop = &zero; static int* dbg_gog = &zero; static FILE* dbg_facility = NULL; static gboolean destroy_mate_pdus(gpointer k _U_, gpointer v, gpointer p _U_) { mate_pdu* pdu = (mate_pdu*) v; if (pdu->avpl) delete_avpl(pdu->avpl,TRUE); g_slice_free(mate_max_size, (mate_max_size *)pdu); return TRUE; } static gboolean destroy_mate_gops(gpointer k _U_, gpointer v, gpointer p _U_) { mate_gop* gop = (mate_gop*) v; if (gop->avpl) delete_avpl(gop->avpl,TRUE); if (gop->gop_key) { if (g_hash_table_lookup(gop->cfg->gop_index,gop->gop_key) == gop) { g_hash_table_remove(gop->cfg->gop_index,gop->gop_key); } g_free(gop->gop_key); } g_slice_free(mate_max_size,(mate_max_size*)gop); return TRUE; } static void gog_remove_keys (mate_gog* gog); static gboolean destroy_mate_gogs(gpointer k _U_, gpointer v, gpointer p _U_) { mate_gog* gog = (mate_gog*) v; if (gog->avpl) delete_avpl(gog->avpl,TRUE); if (gog->gog_keys) { gog_remove_keys(gog); g_ptr_array_free(gog->gog_keys, TRUE); } g_slice_free(mate_max_size,(mate_max_size*)gog); return TRUE; } static gboolean return_true(gpointer k _U_, gpointer v _U_, gpointer p _U_) { return TRUE; } static void destroy_pdus_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) { mate_cfg_pdu* c = (mate_cfg_pdu *)v; g_hash_table_foreach_remove(c->items,destroy_mate_pdus,NULL); c->last_id = 0; } static void destroy_gops_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) { mate_cfg_gop* c = (mate_cfg_gop *)v; g_hash_table_foreach_remove(c->gop_index,return_true,NULL); g_hash_table_destroy(c->gop_index); c->gop_index = g_hash_table_new(g_str_hash,g_str_equal); g_hash_table_foreach_remove(c->gog_index,return_true,NULL); g_hash_table_destroy(c->gog_index); c->gog_index = g_hash_table_new(g_str_hash,g_str_equal); g_hash_table_foreach_remove(c->items,destroy_mate_gops,NULL); c->last_id = 0; } static void destroy_gogs_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) { mate_cfg_gog* c = (mate_cfg_gog *)v; g_hash_table_foreach_remove(c->items,destroy_mate_gogs,NULL); c->last_id = 0; } void initialize_mate_runtime(mate_config* mc) { dbg_print (dbg,5,dbg_facility,"initialize_mate: entering"); if (mc) { if (rd == NULL ) { rd = g_new(mate_runtime_data, 1); } else { g_hash_table_foreach(mc->pducfgs,destroy_pdus_in_cfg,NULL); g_hash_table_foreach(mc->gopcfgs,destroy_gops_in_cfg,NULL); g_hash_table_foreach(mc->gogcfgs,destroy_gogs_in_cfg,NULL); g_hash_table_destroy(rd->frames); } rd->current_items = 0; rd->now = -1.0f; rd->highest_analyzed_frame = 0; rd->frames = g_hash_table_new(g_direct_hash,g_direct_equal); /*mc->dbg_gop_lvl = 5; mc->dbg_gog_lvl = 5; */ dbg_pdu = &(mc->dbg_pdu_lvl); dbg_gop = &(mc->dbg_gop_lvl); dbg_gog = &(mc->dbg_gog_lvl); dbg = &(mc->dbg_lvl); dbg_facility = mc->dbg_facility; dbg_print(dbg, 1, dbg_facility, "starting mate"); } else { rd = NULL; } } static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, gchar* key) { mate_gop* gop = (mate_gop*)g_slice_new(mate_max_size); gop->id = ++(cfg->last_id); gop->cfg = cfg; dbg_print(dbg_gop, 1, dbg_facility, "new_gop: %s: ``%s:%d''", key, gop->cfg->name, gop->id); gop->gop_key = key; gop->avpl = new_avpl(cfg->name); gop->last_n = 0; gop->gog = NULL; gop->next = NULL; gop->expiration = cfg->expiration > 0.0 ? cfg->expiration + rd->now : (float) -1.0 ; gop->idle_expiration = cfg->idle_timeout > 0.0 ? cfg->idle_timeout + rd->now : (float) -1.0 ; gop->time_to_die = cfg->lifetime > 0.0 ? cfg->lifetime + rd->now : (float) -1.0 ; gop->time_to_timeout = 0.0f; gop->last_time = gop->start_time = rd->now; gop->release_time = 0.0f; gop->num_of_pdus = 0; gop->num_of_after_release_pdus = 0; gop->pdus = pdu; gop->last_pdu = pdu; gop->released = FALSE; pdu->gop = gop; pdu->next = NULL; pdu->is_start = TRUE; pdu->time_in_gop = 0.0f; g_hash_table_insert(cfg->gop_index,gop->gop_key,gop); return gop; } static void adopt_gop(mate_gog* gog, mate_gop* gop) { dbg_print (dbg_gog,5,dbg_facility,"adopt_gop: gog=%p gop=%p",(void*)gog,(void*)gop); gop->gog = gog; gop->next = NULL; if (gop->cfg->start) { gog->num_of_counting_gops++; } gog->num_of_gops++; if (gog->last_gop) { gog->last_gop->next = gop; } gog->last_gop = gop; if (! gog->gops ) { gog->gops = gop; } } static mate_gog* new_gog(mate_cfg_gog* cfg, mate_gop* gop) { mate_gog* gog = (mate_gog*)g_slice_new(mate_max_size); gog->id = ++(cfg->last_id); gog->cfg = cfg; dbg_print (dbg_gog,1,dbg_facility,"new_gog: %s:%u for %s:%u",gog->cfg->name,gog->id,gop->cfg->name,gop->id); gog->avpl = new_avpl(cfg->name); gog->last_n = 0; gog->expiration = 0.0f; gog->idle_expiration = 0.0f; gog->start_time = rd->now; gog->release_time = 0.0f; gog->last_time = 0.0f; gog->gops = NULL; gog->last_gop = NULL; gog->num_of_gops = 0; gog->num_of_counting_gops = 0; gog->num_of_released_gops = 0; gog->gog_keys = g_ptr_array_new(); adopt_gop(gog,gop); return gog; } static void apply_transforms(GPtrArray* transforms, AVPL* avpl) { AVPL_Transf* transform = NULL; guint i; for (i = 0; i < transforms->len; i++) { transform = (AVPL_Transf *)g_ptr_array_index(transforms,i); avpl_transform(avpl, transform); } } /* applies the extras for which type to what avpl */ static void apply_extras(AVPL* from, AVPL* to, AVPL* extras) { AVPL* our_extras = new_avpl_loose_match("",from, extras, FALSE) ; if (our_extras) { merge_avpl(to,our_extras,TRUE); delete_avpl(our_extras,FALSE); } } static void gog_remove_keys (mate_gog* gog) { gogkey* gog_key; while (gog->gog_keys->len) { gog_key = (gogkey *)g_ptr_array_remove_index_fast(gog->gog_keys,0); if (g_hash_table_lookup(gog_key->cfg->gog_index,gog_key->key) == gog) { g_hash_table_remove(gog_key->cfg->gog_index,gog_key->key); } g_free(gog_key->key); g_free(gog_key); } } static void reanalyze_gop(mate_config* mc, mate_gop* gop) { LoAL* gog_keys = NULL; AVPL* curr_gogkey = NULL; mate_cfg_gop* gop_cfg = NULL; void* cookie = NULL; AVPL* gogkey_match = NULL; mate_gog* gog = gop->gog; gogkey* gog_key; if ( ! gog ) return; gog->last_time = rd->now; dbg_print (dbg_gog,1,dbg_facility,"reanalyze_gop: %s:%d",gop->cfg->name,gop->id); apply_extras(gop->avpl,gog->avpl,gog->cfg->extra); /* XXX: Instead of using the length of the avpl to check if an avpl has changed, which is not accurate at all, we should have apply_extras, apply_transformations and other functions that can modify the avpl to flag the avpl if it has changed, then we'll check for the flag and clear it after analysis */ if (gog->last_n != gog->avpl->len) { dbg_print (dbg_gog,2,dbg_facility,"reanalyze_gop: gog has new attributes let's look for new keys"); gog_keys = gog->cfg->keys; while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) { gop_cfg = (mate_cfg_gop *)g_hash_table_lookup(mc->gopcfgs,curr_gogkey->name); if (( gogkey_match = new_avpl_pairs_match(gop_cfg->name, gog->avpl, curr_gogkey, TRUE, FALSE) )) { gog_key = g_new(gogkey, 1); gog_key->key = avpl_to_str(gogkey_match); delete_avpl(gogkey_match,FALSE); gog_key->cfg = gop_cfg; if (g_hash_table_lookup(gop_cfg->gog_index,gog_key->key)) { g_free(gog_key->key); g_free(gog_key); gog_key = NULL; } if (! gog_key ) { /* XXX: since these gogs actually share key info we should try to merge (non released) gogs that happen to have equal keys */ } else { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: new key for gog=%s:%d : %s",gog->cfg->name,gog->id,gog_key->key); g_ptr_array_add(gog->gog_keys,gog_key); g_hash_table_insert(gog_key->cfg->gog_index,gog_key->key,gog); } } } gog->last_n = gog->avpl->len; } if (gog->num_of_released_gops == gog->num_of_counting_gops) { gog->released = TRUE; gog->expiration = gog->cfg->expiration + rd->now; } else { gog->released = FALSE; } } static void analyze_gop(mate_config* mc, mate_gop* gop) { mate_cfg_gog* cfg = NULL; LoAL* gog_keys = NULL; AVPL* curr_gogkey = NULL; void* cookie = NULL; AVPL* gogkey_match = NULL; mate_gog* gog = NULL; gchar* key = NULL; if ( ! gop->gog ) { /* no gog, let's either find one or create it if due */ dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gog"); gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,gop->cfg->name); if ( ! gog_keys ) { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gog_keys for this gop"); return; } /* We have gog_keys! look for matching gogkeys */ dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got gog_keys: %s",gog_keys->name) ; while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) { if (( gogkey_match = new_avpl_pairs_match(gop->cfg->name, gop->avpl, curr_gogkey, TRUE, TRUE) )) { key = avpl_to_str(gogkey_match); dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got gogkey_match: %s",key); if (( gog = (mate_gog *)g_hash_table_lookup(gop->cfg->gog_index,key) )) { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: got already a matching gog"); if (gog->num_of_counting_gops == gog->num_of_released_gops && gog->expiration < rd->now) { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: this is a new gog, not the old one, let's create it"); gog_remove_keys(gog); new_gog(gog->cfg,gop); break; } else { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: this is our gog"); if (! gop->gog ) adopt_gop(gog,gop); break; } } else { dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no such gog in hash, let's create a new %s",curr_gogkey->name); cfg = (mate_cfg_gog *)g_hash_table_lookup(mc->gogcfgs,curr_gogkey->name); if (cfg) { gog = new_gog(cfg,gop); gog->num_of_gops = 1; if (gop->cfg->start) { gog->num_of_counting_gops = 1; } } else { dbg_print (dbg_gog,0,dbg_facility,"analyze_gop: no such gog_cfg: %s",curr_gogkey->name); } break; } /** Can't get here because of "breaks" above */ ws_assert_not_reached(); } } /* while */ g_free(key); key = NULL; if (gogkey_match) delete_avpl(gogkey_match,TRUE); reanalyze_gop(mc, gop); } } static void analyze_pdu(mate_config* mc, mate_pdu* pdu) { /* TODO: return a g_boolean to tell we've destroyed the pdu when the pdu is unnassigned destroy the unassigned pdu */ mate_cfg_gop* cfg = NULL; mate_gop* gop = NULL; gchar* gop_key; gchar* orig_gop_key = NULL; AVPL* candidate_start = NULL; AVPL* candidate_stop = NULL; AVPL* is_start = NULL; AVPL* is_stop = NULL; AVPL* gopkey_match = NULL; LoAL* gog_keys = NULL; AVPL* curr_gogkey = NULL; void* cookie = NULL; AVPL* gogkey_match = NULL; gchar* gogkey_str = NULL; dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: %s",pdu->cfg->name); if (! (cfg = (mate_cfg_gop *)g_hash_table_lookup(mc->gops_by_pduname,pdu->cfg->name)) ) return; if ((gopkey_match = new_avpl_pairs_match("gop_key_match", pdu->avpl, cfg->key, TRUE, TRUE))) { gop_key = avpl_to_str(gopkey_match); g_hash_table_lookup_extended(cfg->gop_index,(gconstpointer)gop_key,(gpointer *)&orig_gop_key,(gpointer *)&gop); if ( gop ) { g_free(gop_key); /* is the gop dead ? */ if ( ! gop->released && ( ( gop->cfg->lifetime > 0.0 && gop->time_to_die >= rd->now) || ( gop->cfg->idle_timeout > 0.0 && gop->time_to_timeout >= rd->now) ) ) { dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: expiring released gop"); gop->released = TRUE; if (gop->gog && gop->cfg->start) gop->gog->num_of_released_gops++; } /* TODO: is the gop expired? */ gop_key = orig_gop_key; dbg_print (dbg_gop,2,dbg_facility,"analyze_pdu: got gop: %s",gop_key); if (( candidate_start = cfg->start )) { dbg_print (dbg_gop,2,dbg_facility,"analyze_pdu: got candidate start"); if (( is_start = new_avpl_pairs_match("", pdu->avpl, candidate_start, TRUE, FALSE) )) { delete_avpl(is_start,FALSE); if ( gop->released ) { dbg_print (dbg_gop,3,dbg_facility,"analyze_pdu: start on released gop, let's create a new gop"); g_hash_table_remove(cfg->gop_index,gop_key); gop->gop_key = NULL; gop = new_gop(cfg,pdu,gop_key); g_hash_table_insert(cfg->gop_index,gop_key,gop); } else { dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: duplicate start on gop"); } } } pdu->gop = gop; if (gop->last_pdu) gop->last_pdu->next = pdu; gop->last_pdu = pdu; pdu->next = NULL; pdu->time_in_gop = rd->now - gop->start_time; if (gop->released) pdu->after_release = TRUE; } else { dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: no gop already"); if ( ! cfg->start ) { /* there is no GopStart, we'll check for matching GogKeys if we have one we'll create the Gop */ apply_extras(pdu->avpl,gopkey_match,cfg->extra); gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,cfg->name); if (gog_keys) { while (( curr_gogkey = get_next_avpl(gog_keys,&cookie) )) { if (( gogkey_match = new_avpl_pairs_match(cfg->name, gopkey_match, curr_gogkey, TRUE, FALSE) )) { gogkey_str = avpl_to_str(gogkey_match); if (g_hash_table_lookup(cfg->gog_index,gogkey_str)) { gop = new_gop(cfg,pdu,gop_key); g_hash_table_insert(cfg->gop_index,gop_key,gop); delete_avpl(gogkey_match,FALSE); g_free(gogkey_str); break; } else { delete_avpl(gogkey_match,FALSE); g_free(gogkey_str); } } } if ( ! gop ) { g_free(gop_key); delete_avpl(gopkey_match,TRUE); return; } } else { g_free(gop_key); delete_avpl(gopkey_match,TRUE); return; } } else { candidate_start = cfg->start; if (( is_start = new_avpl_pairs_match("", pdu->avpl, candidate_start, TRUE, FALSE) )) { delete_avpl(is_start,FALSE); gop = new_gop(cfg,pdu,gop_key); } else { g_free(gop_key); return; } pdu->gop = gop; } } if (gop->last_pdu) gop->last_pdu->next = pdu; gop->last_pdu = pdu; pdu->next = NULL; pdu->time_in_gop = rd->now - gop->start_time; gop->num_of_pdus++; gop->time_to_timeout = cfg->idle_timeout > 0.0 ? cfg->idle_timeout + rd->now : (float) -1.0 ; dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: merge with key"); merge_avpl(gop->avpl,gopkey_match,TRUE); delete_avpl(gopkey_match,TRUE); dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: apply extras"); apply_extras(pdu->avpl,gop->avpl,gop->cfg->extra); gop->last_time = pdu->rel_time; if ( ! gop->released) { candidate_stop = cfg->stop; if (candidate_stop) { is_stop = new_avpl_pairs_match("", pdu->avpl, candidate_stop, TRUE, FALSE); } else { is_stop = new_avpl(""); } if(is_stop) { dbg_print (dbg_gop,1,dbg_facility,"analyze_pdu: is a `stop"); delete_avpl(is_stop,FALSE); if (! gop->released) { gop->released = TRUE; gop->release_time = pdu->rel_time; if (gop->gog && gop->cfg->start) gop->gog->num_of_released_gops++; } pdu->is_stop = TRUE; } } if (gop->last_n != gop->avpl->len) apply_transforms(gop->cfg->transforms,gop->avpl); gop->last_n = gop->avpl->len; if (gop->gog) { reanalyze_gop(mc, gop); } else { analyze_gop(mc, gop); } } else { dbg_print (dbg_gop,4,dbg_facility,"analyze_pdu: no match for this pdu"); pdu->gop = NULL; } } static void get_pdu_fields(gpointer k, gpointer v, gpointer p) { int hfid = *((int*) k); gchar* name = (gchar*) v; tmp_pdu_data* data = (tmp_pdu_data*) p; GPtrArray* fis; field_info* fi; guint i,j; mate_range* curr_range; guint start; guint end; AVP* avp; gchar* s; fis = proto_get_finfo_ptr_array(data->tree, hfid); if (fis) { for (i = 0; i < fis->len; i++) { fi = (field_info*) g_ptr_array_index(fis,i); start = fi->start; end = fi->start + fi->length; dbg_print(dbg_pdu,5,dbg_facility,"get_pdu_fields: found field %s, %i-%i, length %i", fi->hfinfo->abbrev, start, end, fi->length); for (j = 0; j < data->ranges->len; j++) { curr_range = (mate_range*) g_ptr_array_index(data->ranges,j); if (curr_range->end >= end && curr_range->start <= start) { avp = new_avp_from_finfo(name, fi); if (*dbg_pdu > 4) { s = avp_to_str(avp); dbg_print(dbg_pdu,0,dbg_facility,"get_pdu_fields: got %s",s); g_free(s); } if (! insert_avp(data->pdu->avpl,avp) ) { delete_avp(avp); } } } } } } static void ptr_array_free(gpointer data, gpointer user_data _U_) { g_free(data); } static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, proto_tree* tree) { mate_pdu* pdu = (mate_pdu*)g_slice_new(mate_max_size); field_info* cfi; GPtrArray* ptrs; mate_range* range; mate_range* proto_range; tmp_pdu_data data; guint i,j; gint min_dist; field_info* range_fi; gint32 last_start; gint32 first_end; gint32 curr_end; int hfid; dbg_print (dbg_pdu,1,dbg_facility,"new_pdu: type=%s framenum=%i",cfg->name,framenum); pdu->id = ++(cfg->last_id); pdu->cfg = cfg; pdu->avpl = new_avpl(cfg->name); pdu->frame = framenum; pdu->next_in_frame = NULL; pdu->rel_time = rd->now; pdu->gop = NULL; pdu->next = NULL; pdu->time_in_gop = -1.0f; pdu->first = FALSE; pdu->is_start = FALSE; pdu->is_stop = FALSE; pdu->after_release = FALSE; data.ranges = g_ptr_array_new(); data.pdu = pdu; data.tree = tree; /* first we create the proto range */ proto_range = g_new(mate_range, 1); proto_range->start = proto->start; proto_range->end = proto->start + proto->length; g_ptr_array_add(data.ranges,proto_range); dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: proto range %u-%u",proto_range->start,proto_range->end); last_start = proto_range->start; /* we move forward in the tranport */ for (i = cfg->transport_ranges->len; i--; ) { hfid = *((int*)g_ptr_array_index(cfg->transport_ranges,i)); ptrs = proto_get_finfo_ptr_array(tree, hfid); min_dist = 99999; range_fi = NULL; if (ptrs) { for (j=0; j < ptrs->len; j++) { cfi = (field_info*) g_ptr_array_index(ptrs,j); if (cfi->start < last_start && min_dist >= (last_start - cfi->start) ) { range_fi = cfi; min_dist = last_start - cfi->start; } } if ( range_fi ) { range = (mate_range *)g_malloc(sizeof(*range)); range->start = range_fi->start; range->end = range_fi->start + range_fi->length; g_ptr_array_add(data.ranges,range); last_start = range_fi->start; dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: transport(%i) range %i-%i",hfid,range->start,range->end); } else { /* we missed a range */ dbg_print(dbg_pdu,6,dbg_facility,"new_pdu: transport(%i) missed",hfid); } } } if (cfg->payload_ranges) { first_end = proto_range->end; for (i = 0 ; i < cfg->payload_ranges->len; i++) { hfid = *((int*)g_ptr_array_index(cfg->payload_ranges,i)); ptrs = proto_get_finfo_ptr_array(tree, hfid); min_dist = 99999; range_fi = NULL; if (ptrs) { for (j=0; j < ptrs->len; j++) { cfi = (field_info*) g_ptr_array_index(ptrs,j); curr_end = cfi->start + cfi->length; if (curr_end > first_end && min_dist >= (curr_end - first_end) ) { range_fi = cfi; min_dist = curr_end - first_end; } } if ( range_fi ) { range = (mate_range *)g_malloc(sizeof(*range)); range->start = range_fi->start; range->end = range_fi->start + range_fi->length; g_ptr_array_add(data.ranges,range); dbg_print(dbg_pdu,3,dbg_facility,"new_pdu: payload(%i) range %i-%i",hfid,range->start,range->end); } else { /* we missed a range */ dbg_print(dbg_pdu,5,dbg_facility,"new_pdu: payload(%i) missed",hfid); } } } } g_hash_table_foreach(cfg->hfids_attr,get_pdu_fields,&data); apply_transforms(pdu->cfg->transforms,pdu->avpl); g_ptr_array_foreach(data.ranges, ptr_array_free, NULL); g_ptr_array_free(data.ranges,TRUE); return pdu; } extern void mate_analyze_frame(mate_config *mc, packet_info *pinfo, proto_tree* tree) { mate_cfg_pdu* cfg; GPtrArray* protos; field_info* proto; guint i,j; AVPL* criterium_match; mate_pdu* pdu = NULL; mate_pdu* last = NULL; rd->now = (float) nstime_to_sec(&pinfo->rel_ts); if ( proto_tracking_interesting_fields(tree) && rd->highest_analyzed_frame < pinfo->num ) { for ( i = 0; i < mc->pducfglist->len; i++ ) { cfg = (mate_cfg_pdu *)g_ptr_array_index(mc->pducfglist,i); dbg_print (dbg_pdu,4,dbg_facility,"mate_analyze_frame: trying to extract: %s",cfg->name); protos = proto_get_finfo_ptr_array(tree, cfg->hfid_proto); if (protos) { pdu = NULL; for (j = 0; j < protos->len; j++) { dbg_print (dbg_pdu,3,dbg_facility,"mate_analyze_frame: found matching proto, extracting: %s",cfg->name); proto = (field_info*) g_ptr_array_index(protos,j); pdu = new_pdu(cfg, pinfo->num, proto, tree); if (cfg->criterium) { criterium_match = new_avpl_from_match(cfg->criterium_match_mode,"",pdu->avpl,cfg->criterium,FALSE); if (criterium_match) { delete_avpl(criterium_match,FALSE); } if ( (criterium_match && cfg->criterium_accept_mode == REJECT_MODE ) || ( ! criterium_match && cfg->criterium_accept_mode == ACCEPT_MODE )) { delete_avpl(pdu->avpl,TRUE); g_slice_free(mate_max_size,(mate_max_size*)pdu); pdu = NULL; continue; } } analyze_pdu(mc, pdu); if ( ! pdu->gop && cfg->drop_unassigned) { delete_avpl(pdu->avpl,TRUE); g_slice_free(mate_max_size,(mate_max_size*)pdu); pdu = NULL; continue; } if ( cfg->discard ) { delete_avpl(pdu->avpl,TRUE); pdu->avpl = NULL; } if (!last) { g_hash_table_insert(rd->frames,GINT_TO_POINTER(pinfo->num),pdu); last = pdu; } else { last->next_in_frame = pdu; last = pdu; } } if ( pdu && cfg->last_extracted ) break; } } rd->highest_analyzed_frame = pinfo->num; } } extern mate_pdu* mate_get_pdus(guint32 framenum) { if (rd) { return (mate_pdu*) g_hash_table_lookup(rd->frames,GUINT_TO_POINTER(framenum)); } else { return NULL; } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
C
wireshark/plugins/epan/mate/mate_setup.c
/* mate_setup.c * MATE -- Meta Analysis Tracing Engine * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include "mate.h" /* appends the formatted string to the current error log */ static void report_error(mate_config* mc, const gchar* fmt, ...) { static gchar error_buffer[DEBUG_BUFFER_SIZE]; va_list list; va_start( list, fmt ); vsnprintf(error_buffer,DEBUG_BUFFER_SIZE,fmt,list); va_end( list ); g_string_append(mc->config_error,error_buffer); g_string_append_c(mc->config_error,'\n'); } /* creates a blank pdu config is going to be called only by the grammar which will set all those elements that aren't set here */ extern mate_cfg_pdu* new_pducfg(mate_config* mc, gchar* name) { mate_cfg_pdu* cfg = g_new(mate_cfg_pdu, 1); cfg->name = g_strdup(name); cfg->last_id = 0; cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal); cfg->transforms = NULL; cfg->hfid = -1; cfg->hfid_pdu_rel_time = -1; cfg->hfid_pdu_time_in_gop = -1; cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal); cfg->ett = -1; cfg->ett_attr = -1; cfg->criterium = NULL; cfg->criterium_match_mode = AVPL_NO_MATCH; cfg->criterium_accept_mode = ACCEPT_MODE; g_ptr_array_add(mc->pducfglist,(gpointer) cfg); g_hash_table_insert(mc->pducfgs,(gpointer) cfg->name,(gpointer) cfg); cfg->hfids_attr = g_hash_table_new(g_int_hash,g_int_equal); return cfg; } extern mate_cfg_gop* new_gopcfg(mate_config* mc, gchar* name) { mate_cfg_gop* cfg = g_new(mate_cfg_gop, 1); cfg->name = g_strdup(name); cfg->last_id = 0; cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal); cfg->transforms = NULL; cfg->extra = new_avpl("extra"); cfg->hfid = -1; cfg->ett = -1; cfg->ett_attr = -1; cfg->ett_times = -1; cfg->ett_children = -1; cfg->hfid_start_time = -1; cfg->hfid_stop_time = -1; cfg->hfid_last_time = -1; cfg->hfid_gop_pdu = -1; cfg->hfid_gop_num_pdus = -1; cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal); cfg->gop_index = g_hash_table_new(g_str_hash,g_str_equal); cfg->gog_index = g_hash_table_new(g_str_hash,g_str_equal); g_hash_table_insert(mc->gopcfgs,(gpointer) cfg->name, (gpointer) cfg); return cfg; } extern mate_cfg_gog* new_gogcfg(mate_config* mc, gchar* name) { mate_cfg_gog* cfg = g_new(mate_cfg_gog, 1); cfg->name = g_strdup(name); cfg->last_id = 0; cfg->items = g_hash_table_new(g_direct_hash,g_direct_equal); cfg->transforms = NULL; cfg->extra = new_avpl("extra"); cfg->my_hfids = g_hash_table_new(g_str_hash,g_str_equal); cfg->hfid = -1; cfg->ett = -1; cfg->ett_attr = -1; cfg->ett_times = -1; cfg->ett_children = -1; cfg->ett_gog_gop = -1; cfg->hfid_gog_num_of_gops = -1; cfg->hfid_gog_gop = -1; cfg->hfid_gog_gopstart = -1; cfg->hfid_gog_gopstop = -1; cfg->hfid_start_time = -1; cfg->hfid_stop_time = -1; cfg->hfid_last_time = -1; g_hash_table_insert(mc->gogcfgs,(gpointer) cfg->name, (gpointer) cfg); return cfg; } extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, GHashTable* where) { header_field_info* first_hfi = NULL; gboolean exists = FALSE; gchar* as; gchar* h; int* ip; while(hfi) { first_hfi = hfi; hfi = (hfi->same_name_prev_id != -1) ? proto_registrar_get_nth(hfi->same_name_prev_id) : NULL; } hfi = first_hfi; while (hfi) { exists = TRUE; ip = g_new(int, 1); *ip = hfi->id; if (( as = (gchar *)g_hash_table_lookup(where,ip) )) { g_free(ip); if (! g_str_equal(as,how)) { report_error(mc, "MATE Error: add field to Pdu: attempt to add %s(%i) as %s" " failed: field already added as '%s'",hfi->abbrev,hfi->id,how,as); return FALSE; } } else { h = g_strdup(how); g_hash_table_insert(where,ip,h); } hfi = hfi->same_name_next; } if (! exists) { report_error(mc, "MATE Error: cannot find field for attribute %s",how); } return exists; } #if 0 /* * XXX - where is this suposed to be used? */ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) { gchar** ranges; guint i; header_field_info* hfi; int* hfidp; ranges = g_strsplit(range,"/",0); if (ranges) { for (i=0; ranges[i]; i++) { hfi = proto_registrar_get_byname(ranges[i]); if (hfi) { hfidp = g_new(int, 1); *hfidp = hfi->id; g_ptr_array_add(range_ptr_arr,(gpointer)hfidp); } else { g_strfreev(ranges); return ws_strdup_printf("no such proto: '%s'",ranges[i]); } } g_strfreev(ranges); } return NULL; } #endif static void new_attr_hfri(mate_config* mc, gchar* item_name, GHashTable* hfids, gchar* name) { int* p_id = g_new(int, 1); hf_register_info hfri; memset(&hfri, 0, sizeof hfri); *p_id = -1; hfri.p_id = p_id; hfri.hfinfo.name = g_strdup(name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.%s",item_name,name); hfri.hfinfo.type = FT_STRING; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.strings = NULL; hfri.hfinfo.bitmask = 0; hfri.hfinfo.blurb = ws_strdup_printf("%s attribute of %s",name,item_name); *p_id = -1; g_hash_table_insert(hfids,name,p_id); g_array_append_val(mc->hfrs,hfri); } typedef struct { mate_config* mc; mate_cfg_pdu* cfg; } analyze_pdu_hfids_arg; static void analyze_pdu_hfids(gpointer k, gpointer v, gpointer p) { analyze_pdu_hfids_arg* argp = (analyze_pdu_hfids_arg*)p; mate_config* mc = argp->mc; mate_cfg_pdu* cfg = argp->cfg; new_attr_hfri(mc, cfg->name,cfg->my_hfids,(gchar*) v); /* * Add this hfid to our table of wanted hfids. */ mc->wanted_hfids = g_array_append_val(mc->wanted_hfids, *(int *)k); mc->num_fields_wanted++; } static void analyze_transform_hfrs(mate_config* mc, gchar* name, GPtrArray* transforms, GHashTable* hfids) { guint i; void* cookie = NULL; AVPL_Transf* t; AVP* avp; for (i=0; i < transforms->len;i++) { for (t = (AVPL_Transf *)g_ptr_array_index(transforms,i); t; t=t->next ) { cookie = NULL; while(( avp = get_next_avp(t->replace,&cookie) )) { if (! g_hash_table_lookup(hfids,avp->n)) { new_attr_hfri(mc, name,hfids,avp->n); } } } } } static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) { hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}}; gint* ett; analyze_pdu_hfids_arg arg; hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("%s id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_pdu_rel_time); hfri.hfinfo.name = ws_strdup_printf("%s time",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.RelativeTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = "Seconds passed since the start of capture"; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_pdu_time_in_gop); hfri.hfinfo.name = ws_strdup_printf("%s time since beginning of Gop",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.TimeInGop",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = "Seconds passed since the start of the GOP"; g_array_append_val(mc->hfrs,hfri); arg.mc = mc; arg.cfg = cfg; g_hash_table_foreach(cfg->hfids_attr,analyze_pdu_hfids,&arg); /* Add the hfids of transport protocols as wanted hfids */ for (guint i = 0; i < cfg->transport_ranges->len; i++) { int hfid = *((int*)g_ptr_array_index(cfg->transport_ranges,i)); mc->wanted_hfids = g_array_append_val(mc->wanted_hfids, hfid); mc->num_fields_wanted++; } ett = &cfg->ett; g_array_append_val(mc->ett,ett); ett = &cfg->ett_attr; g_array_append_val(mc->ett,ett); analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids); } static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) { mate_config* mc = (mate_config*)p; mate_cfg_gop* cfg = (mate_cfg_gop *)v; void* cookie = NULL; AVP* avp; gint* ett; hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}}; hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("%s id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_start_time); hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_stop_time); hfri.hfinfo.name = ws_strdup_printf("%s hold time",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Time",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("Duration in seconds from start to stop of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_last_time); hfri.hfinfo.name = ws_strdup_printf("%s duration",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Duration",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gop_num_pdus); hfri.hfinfo.name = ws_strdup_printf("%s number of PDUs",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.NumOfPdus",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("Number of PDUs assigned to this %s",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gop_pdu); hfri.hfinfo.name = ws_strdup_printf("A PDU of %s",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Pdu",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("A PDU assigned to this %s",cfg->name); if (cfg->pdu_tree_mode == GOP_FRAME_TREE) { hfri.hfinfo.type = FT_FRAMENUM; hfri.hfinfo.display = BASE_NONE; g_array_append_val(mc->hfrs,hfri); } else if (cfg->pdu_tree_mode == GOP_PDU_TREE) { hfri.hfinfo.type = FT_UINT32; g_array_append_val(mc->hfrs,hfri); } else { cfg->pdu_tree_mode = GOP_NO_TREE; } while(( avp = get_next_avp(cfg->key,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); } } if(cfg->start) { cookie = NULL; while(( avp = get_next_avp(cfg->start,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); } } } if (cfg->stop) { cookie = NULL; while(( avp = get_next_avp(cfg->stop,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); } } } cookie = NULL; while(( avp = get_next_avp(cfg->extra,&cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); } } analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids); ett = &cfg->ett; g_array_append_val(mc->ett,ett); ett = &cfg->ett_attr; g_array_append_val(mc->ett,ett); ett = &cfg->ett_times; g_array_append_val(mc->ett,ett); ett = &cfg->ett_children; g_array_append_val(mc->ett,ett); g_hash_table_insert(mc->gops_by_pduname,cfg->name,cfg); } static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { mate_config* mc = (mate_config*)p; mate_cfg_gog* cfg = (mate_cfg_gog *)v; void* avp_cookie; void* avpl_cookie; AVP* avp; AVPL* avpl; AVPL* gopkey_avpl; AVPL* key_avps; LoAL* gog_keys = NULL; hf_register_info hfri = { NULL, {NULL, NULL, FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}}; gint* ett; /* create the hf array for this gog */ hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("%s Id",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gog_num_of_gops); hfri.hfinfo.name = "number of GOPs"; hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.NumOfGops",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; hfri.hfinfo.blurb = ws_strdup_printf("Number of GOPs assigned to this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gog_gopstart); hfri.hfinfo.name = "GopStart frame"; hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.GopStart",cfg->name); hfri.hfinfo.type = FT_FRAMENUM; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = g_strdup("The start frame of a GOP"); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_gog_gopstop); hfri.hfinfo.name = "GopStop frame"; hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.GopStop",cfg->name); hfri.hfinfo.type = FT_FRAMENUM; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = g_strdup("The stop frame of a GOP"); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_start_time); hfri.hfinfo.name = ws_strdup_printf("%s start time",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.StartTime",cfg->name); hfri.hfinfo.type = FT_FLOAT; hfri.hfinfo.blurb = ws_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_last_time); hfri.hfinfo.name = ws_strdup_printf("%s duration",cfg->name); hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Duration",cfg->name); hfri.hfinfo.blurb = ws_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); g_array_append_val(mc->hfrs,hfri); /* this might become mate.gogname.gopname */ hfri.p_id = &(cfg->hfid_gog_gop); hfri.hfinfo.name = "a GOP"; hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Gop",cfg->name); hfri.hfinfo.type = FT_STRING; hfri.hfinfo.display = BASE_NONE; hfri.hfinfo.blurb = ws_strdup_printf("a GOPs assigned to this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); /* index the keys of gog for every gop and insert the avps of the keys to the hfarray */ key_avps = new_avpl(""); avpl_cookie = NULL; while (( avpl = get_next_avpl(cfg->keys,&avpl_cookie) )) { if (! ( gog_keys = (LoAL *)g_hash_table_lookup(mc->gogs_by_gopname,avpl->name))) { gog_keys = new_loal(avpl->name); g_hash_table_insert(mc->gogs_by_gopname,gog_keys->name,gog_keys); } gopkey_avpl = new_avpl_from_avpl(cfg->name, avpl, TRUE); loal_append(gog_keys,gopkey_avpl); avp_cookie = NULL; while (( avp = get_next_avp(avpl,&avp_cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); insert_avp(key_avps,avp); } } } /* insert the extra avps to the hfarray */ avp_cookie = NULL; while (( avp = get_next_avp(cfg->extra,&avp_cookie) )) { if (! g_hash_table_lookup(cfg->my_hfids,avp->n)) { new_attr_hfri(mc, cfg->name,cfg->my_hfids,avp->n); } } /* every key_avp ios an extra as well. one day every Member will have its own extras */ merge_avpl(cfg->extra,key_avps,TRUE); analyze_transform_hfrs(mc, cfg->name,cfg->transforms,cfg->my_hfids); ett = &cfg->ett; g_array_append_val(mc->ett,ett); ett = &cfg->ett_attr; g_array_append_val(mc->ett,ett); ett = &cfg->ett_children; g_array_append_val(mc->ett,ett); ett = &cfg->ett_times; g_array_append_val(mc->ett,ett); ett = &cfg->ett_gog_gop; g_array_append_val(mc->ett,ett); } static void analyze_config(mate_config* mc) { guint i; for (i=0; i < mc->pducfglist->len; i++) { analyze_pdu_config(mc, (mate_cfg_pdu*) g_ptr_array_index(mc->pducfglist,i)); } g_hash_table_foreach(mc->gopcfgs,analyze_gop_config,mc); g_hash_table_foreach(mc->gogcfgs,analyze_gog_config,mc); } extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { mate_config* mc; gint* ett; avp_init(); mc = g_new(mate_config, 1); mc->hfid_mate = mate_hfid; mc->wanted_hfids = g_array_new(FALSE, FALSE, (guint)sizeof(int)); mc->num_fields_wanted = 0; mc->dbg_facility = NULL; mc->mate_lib_path = ws_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP); mc->pducfgs = g_hash_table_new(g_str_hash,g_str_equal); mc->gopcfgs = g_hash_table_new(g_str_hash,g_str_equal); mc->gogcfgs = g_hash_table_new(g_str_hash,g_str_equal); mc->transfs = g_hash_table_new(g_str_hash,g_str_equal); mc->pducfglist = g_ptr_array_new(); mc->gops_by_pduname = g_hash_table_new(g_str_hash,g_str_equal); mc->gogs_by_gopname = g_hash_table_new(g_str_hash,g_str_equal); mc->ett_root = -1; mc->hfrs = g_array_new(FALSE,FALSE,sizeof(hf_register_info)); mc->ett = g_array_new(FALSE,FALSE,sizeof(gint*)); mc->defaults.pdu.drop_unassigned = FALSE; mc->defaults.pdu.discard = FALSE; mc->defaults.pdu.last_extracted = FALSE; mc->defaults.pdu.match_mode = AVPL_STRICT; mc->defaults.pdu.replace_mode = AVPL_INSERT; /* gop prefs */ mc->defaults.gop.expiration = -1.0f; mc->defaults.gop.idle_timeout = -1.0f; mc->defaults.gop.lifetime = -1.0f; mc->defaults.gop.pdu_tree_mode = GOP_FRAME_TREE; mc->defaults.gop.show_times = TRUE; mc->defaults.gop.drop_unassigned = FALSE; /* gog prefs */ mc->defaults.gog.expiration = 5.0f; mc->defaults.gog.show_times = TRUE; mc->defaults.gog.gop_tree_mode = GOP_BASIC_TREE; /* what to dbgprint */ mc->dbg_lvl = 0; mc->dbg_pdu_lvl = 0; mc->dbg_gop_lvl = 0; mc->dbg_gog_lvl = 0; mc->config_error = g_string_new(""); ett = &mc->ett_root; g_array_append_val(mc->ett,ett); if ( mate_load_config(filename,mc) ) { analyze_config(mc); } else { report_failure("MATE failed to configure!\n" "It is recommended that you fix your config and restart Wireshark.\n" "The reported error is:\n%s\n",mc->config_error->str); /* if (mc) destroy_mate_config(mc,FALSE); */ return NULL; } if (mc->num_fields_wanted == 0) { /* We have no interest in any fields, so we have no work to do. */ /*destroy_mate_config(mc,FALSE);*/ return NULL; } return mc; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
C
wireshark/plugins/epan/mate/mate_util.c
/* mate_util.c * MATE -- Meta Analysis Tracing Engine * Utility Library: Single Copy Strings and Attribute Value Pairs * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include "mate.h" #include "mate_util.h" #include <errno.h> #include <wsutil/file_util.h> /*************************************************************************** * dbg_print *************************************************************************** * This is the debug facility of the thing. ***************************************************************************/ /* dbg_print: * which: a pointer to the current level of debugging for a feature * how: the level over which this message should be printed out * where: the file on which to print (ws_message if null) * fmt, ...: what to print */ void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... ) { static gchar debug_buffer[DEBUG_BUFFER_SIZE]; va_list list; if ( ! which || *which < how ) return; va_start( list, fmt ); vsnprintf(debug_buffer,DEBUG_BUFFER_SIZE,fmt,list); va_end( list ); if (! where) { ws_message("%s", debug_buffer); } else { fputs(debug_buffer,where); fputs("\n",where); } } /*************************************************************************** * single copy strings *************************************************************************** * Strings repeat more often than don't. In order to save memory * we'll keep only one copy of each as key to a hash with a count of * subscribers as value. ***************************************************************************/ /** * scs_init: * * Initializes the scs hash. **/ struct _scs_collection { GHashTable* hash; /* key: a string value: guint number of subscribers */ }; /* ToDo? free any string,ctr entries pointed to by the hash table ?? * XXX: AFAIKT destroy_scs_collection() might be called only when reading a * mate config file. Since reading a new config file can apparently currently * only be done once after starting Wireshark, in theory this fcn * currently should never be called since there will never be an existing * scs_collection to be destroyed. */ static void destroy_scs_collection(SCS_collection* c) { if (c->hash) g_hash_table_destroy(c->hash); } static SCS_collection* scs_init(void) { SCS_collection* c = g_new(SCS_collection, 1); c->hash = g_hash_table_new(g_str_hash,g_str_equal); return c; } /** * subscribe: * @param c the scs hash * @param s a string * * Checks if the given string exists already and if so it increases the count of * subsscribers and returns a pointer to the stored string. If not It will copy * the given string store it in the hash and return the pointer to the copy. * Remember, containment is handled internally, take care of your own strings. * * Return value: a pointer to the subscribed string. **/ gchar* scs_subscribe(SCS_collection* c, const gchar* s) { gchar* orig = NULL; guint* ip = NULL; size_t len = 0; g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer *)&orig,(gpointer *)&ip); if (ip) { (*ip)++; } else { ip = g_slice_new(guint); *ip = 0; len = strlen(s) + 1; if (len <= SCS_SMALL_SIZE) { len = SCS_SMALL_SIZE; } else if (len <= SCS_MEDIUM_SIZE) { len = SCS_MEDIUM_SIZE; } else if (len <= SCS_LARGE_SIZE) { len = SCS_LARGE_SIZE; } else if (len < SCS_HUGE_SIZE) { len = SCS_HUGE_SIZE; } else { len = SCS_HUGE_SIZE; ws_warning("mate SCS: string truncated due to huge size"); } orig = (gchar *)g_slice_alloc(len); (void) g_strlcpy(orig,s,len); g_hash_table_insert(c->hash,orig,ip); } return orig; } /** * unsubscribe: * @param c the scs hash * @param s a string. * * decreases the count of subscribers, if zero frees the internal copy of * the string. **/ void scs_unsubscribe(SCS_collection* c, gchar* s) { gchar* orig = NULL; guint* ip = NULL; size_t len = 0xffff; g_hash_table_lookup_extended(c->hash,(gconstpointer)s,(gpointer *)&orig,(gpointer *)&ip); if (ip) { if (*ip == 0) { g_hash_table_remove(c->hash,orig); len = strlen(orig); if (len < SCS_SMALL_SIZE) { len = SCS_SMALL_SIZE; } else if (len < SCS_MEDIUM_SIZE) { len = SCS_MEDIUM_SIZE; } else if (len < SCS_LARGE_SIZE) { len = SCS_LARGE_SIZE; } else { len = SCS_HUGE_SIZE; } g_slice_free1(len, orig); g_slice_free(guint,ip); } else { (*ip)--; } } else { ws_warning("unsubscribe: not subscribed"); } } /** * scs_subscribe_printf: * @param fmt a format string ... * * Formats the input and subscribes it. * * Return value: the stored copy of the formated string. * **/ gchar* scs_subscribe_printf(SCS_collection* c, gchar* fmt, ...) { va_list list; static gchar buf[SCS_HUGE_SIZE]; va_start( list, fmt ); vsnprintf(buf, SCS_HUGE_SIZE, fmt, list); va_end( list ); return scs_subscribe(c,buf); } /*************************************************************************** * AVPs & Co. *************************************************************************** * The Thing operates mainly on avps, avpls and loals * - attribute value pairs (two strings: the name and the value and an operator) * - avp lists a somehow sorted list of avps * - loal (list of avp lists) an arbitrarily sorted list of avpls * * ***************************************************************************/ typedef union _any_avp_type { AVP avp; AVPN avpn; AVPL avpl; LoAL loal; LoALnode loaln; } any_avp_type; static SCS_collection* avp_strings = NULL; #ifdef _AVP_DEBUGGING static FILE* dbg_fp = NULL; static int dbg_level = 0; static int* dbg = &dbg_level; static int dbg_avp_level = 0; static int* dbg_avp = &dbg_avp_level; static int dbg_avp_op_level = 0; static int* dbg_avp_op = &dbg_avp_op_level; static int dbg_avpl_level = 0; static int* dbg_avpl = &dbg_avpl_level; static int dbg_avpl_op_level = 0; static int* dbg_avpl_op = &dbg_avpl_op_level; /** * setup_avp_debug: * @param fp the file in which to send debugging output. * @param general a pointer to the level of debugging of facility "general" * @param avp a pointer to the level of debugging of facility "avp" * @param avp_op a pointer to the level of debugging of facility "avp_op" * @param avpl a pointer to the level of debugging of facility "avpl" * @param avpl_op a pointer to the level of debugging of facility "avpl_op" * * If enabled sets up the debug facilities for the avp library. * **/ extern void setup_avp_debug(FILE* fp, int* general, int* avp, int* avp_op, int* avpl, int* avpl_op) { dbg_fp = fp; dbg = general; dbg_avp = avp; dbg_avp_op = avp_op; dbg_avpl = avpl; dbg_avpl_op = avpl_op; } #endif /* _AVP_DEBUGGING */ /** * avp_init: * * (Re)Initializes the avp library. * **/ extern void avp_init(void) { if (avp_strings) destroy_scs_collection(avp_strings); avp_strings = scs_init(); } /** * new_avp_from_finfo: * @param name the name the avp will have. * @param finfo the field_info from which to fetch the data. * * Creates an avp from a field_info record. * * Return value: a pointer to the newly created avp. * **/ extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) { AVP* new_avp_val = (AVP*)g_slice_new(any_avp_type); gchar* value; gchar* repr; new_avp_val->n = scs_subscribe(avp_strings, name); repr = fvalue_to_string_repr(NULL, finfo->value, FTREPR_DISPLAY, finfo->hfinfo->display); if (repr) { value = scs_subscribe(avp_strings, repr); wmem_free(NULL, repr); #ifdef _AVP_DEBUGGING dbg_print (dbg_avp,2,dbg_fp,"new_avp_from_finfo: from string: %s",value); #endif } else { #ifdef _AVP_DEBUGGING dbg_print (dbg_avp,2,dbg_fp,"new_avp_from_finfo: a proto: %s",finfo->hfinfo->abbrev); #endif value = scs_subscribe(avp_strings, ""); } new_avp_val->v = value; new_avp_val->o = '='; #ifdef _AVP_DEBUGGING dbg_print (dbg_avp,1,dbg_fp,"new_avp_from_finfo: %p %s%c%s;",new_avp_val,new_avp_val->n,new_avp_val->o,new_avp_val->v); #endif return new_avp_val; } /** * new_avp: * @param name the name the avp will have. * @param value the value the avp will have. * @param o the operator of this avp. * * Creates an avp given every parameter. * * Return value: a pointer to the newly created avp. * **/ extern AVP* new_avp(const gchar* name, const gchar* value, gchar o) { AVP* new_avp_val = (AVP*)g_slice_new(any_avp_type); new_avp_val->n = scs_subscribe(avp_strings, name); new_avp_val->v = scs_subscribe(avp_strings, value); new_avp_val->o = o; #ifdef _AVP_DEBUGGING dbg_print(dbg_avp,1,dbg_fp,"new_avp_val: %p %s%c%s;",new_avp_val,new_avp_val->n,new_avp_val->o,new_avp_val->v); #endif return new_avp_val; } /** * delete_avp: * @param avp the avp to delete. * * Destroys an avp and releases the resources it uses. * **/ extern void delete_avp(AVP* avp) { #ifdef _AVP_DEBUGGING dbg_print(dbg_avp,1,dbg_fp,"delete_avp: %p %s%c%s;",avp,avp->n,avp->o,avp->v); #endif scs_unsubscribe(avp_strings, avp->n); scs_unsubscribe(avp_strings, avp->v); g_slice_free(any_avp_type,(any_avp_type*)avp); } /** * avp_copy: * @param from the avp to be copied. * * Creates an avp whose name op and value are copies of the given one. * * Return value: a pointer to the newly created avp. * **/ extern AVP* avp_copy(AVP* from) { AVP* new_avp_val = (AVP*)g_slice_new(any_avp_type); new_avp_val->n = scs_subscribe(avp_strings, from->n); new_avp_val->v = scs_subscribe(avp_strings, from->v); new_avp_val->o = from->o; #ifdef _AVP_DEBUGGING dbg_print(dbg_avp,1,dbg_fp,"copy_avp: %p %s%c%s;",new_avp_val,new_avp_val->n,new_avp_val->o,new_avp_val->v); #endif return new_avp_val; } /** * new_avpl: * @param name the name the avpl will have. * * Creates an empty avpl. * * Return value: a pointer to the newly created avpl. * **/ extern AVPL* new_avpl(const gchar* name) { AVPL* new_avpl_p = (AVPL*)g_slice_new(any_avp_type); #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,7,dbg_fp,"new_avpl_p: %p name=%s",new_avpl_p,name); #endif new_avpl_p->name = name ? scs_subscribe(avp_strings, name) : scs_subscribe(avp_strings, ""); new_avpl_p->len = 0; new_avpl_p->null.avp = NULL; new_avpl_p->null.next = &new_avpl_p->null; new_avpl_p->null.prev = &new_avpl_p->null; return new_avpl_p; } extern void rename_avpl(AVPL* avpl, gchar* name) { scs_unsubscribe(avp_strings,avpl->name); avpl->name = scs_subscribe(avp_strings,name); } /** * insert_avp_before_node: * @param avpl the avpl in which to insert. * @param next_node the next node before which the new avpn has to be inserted. * @param avp the avp to be inserted. * @param copy_avp whether the original AVP or a copy thereof must be inserted. * * Pre-condition: the avp is sorted before before_avp and does not already exist * in the avpl. */ static void insert_avp_before_node(AVPL* avpl, AVPN* next_node, AVP *avp, gboolean copy_avp) { AVPN* new_avp_val = (AVPN*)g_slice_new(any_avp_type); new_avp_val->avp = copy_avp ? avp_copy(avp) : avp; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,7,dbg_fp,"new_avpn: %p",new_avp_val); dbg_print(dbg_avpl,5,dbg_fp,"insert_avp: inserting %p in %p before %p;",avp,avpl,next_node); #endif new_avp_val->next = next_node; new_avp_val->prev = next_node->prev; next_node->prev->next = new_avp_val; next_node->prev = new_avp_val; avpl->len++; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl,4,dbg_fp,"avpl: %p new len: %i",avpl,avpl->len); #endif } /** * insert_avp: * @param avpl the avpl in which to insert. * @param avp the avp to be inserted. * * Inserts the given AVP into the given AVPL if an identical one isn't yet there. * * Return value: whether it was inserted or not. * * BEWARE: Check the return value, you might need to delete the avp if * it is not inserted. **/ extern gboolean insert_avp(AVPL* avpl, AVP* avp) { AVPN* c; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,4,dbg_fp,"insert_avp: %p %p %s%c%s;",avpl,avp,avp->n,avp->o,avp->v); #endif /* get to the insertion point */ for (c=avpl->null.next; c->avp; c = c->next) { int name_diff = strcmp(avp->n, c->avp->n); if (name_diff == 0) { int value_diff = strcmp(avp->v, c->avp->v); if (value_diff < 0) { break; } if (value_diff == 0) { // ignore duplicate values, prevents (a=1, a=1) // note that this is also used to insert // conditions AVPs, so really check if the name, // value and operator are all equal. if (c->avp->o == avp->o && avp->o == AVP_OP_EQUAL) { return FALSE; } } } if (name_diff < 0) { break; } } insert_avp_before_node(avpl, c, avp, FALSE); return TRUE; } /** * get_avp_by_name: * @param avpl the avpl from which to try to get the avp. * @param name the name of the avp we are looking for. * @param cookie variable in which to store the state between calls. * * Gets pointer to the next avp whose name is given; uses cookie to store its * state between calls. * * Return value: a pointer to the next matching avp if there's one, else NULL. * **/ extern AVP* get_avp_by_name(AVPL* avpl, gchar* name, void** cookie) { AVPN* curr; AVPN* start = (AVPN*) *cookie; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,7,dbg_fp,"get_avp_by_name: entering: %p %s %p",avpl,name,*cookie); #endif name = scs_subscribe(avp_strings, name); if (!start) start = avpl->null.next; for ( curr = start; curr->avp; curr = curr->next ) { if ( curr->avp->n == name ) { break; } } *cookie = curr; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"get_avp_by_name: got avp: %p",curr); #endif scs_unsubscribe(avp_strings, name); return curr->avp; } /** * extract_avp_by_name: * @param avpl the avpl from which to try to extract the avp. * @param name the name of the avp we are looking for. * * Extracts from the avpl the next avp whose name is given; * * Return value: a pointer to extracted avp if there's one, else NULL. * **/ extern AVP* extract_avp_by_name(AVPL* avpl, gchar* name) { AVPN* curr; AVP* avp = NULL; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,7,dbg_fp,"extract_avp_by_name: entering: %p %s",avpl,name); #endif name = scs_subscribe(avp_strings, name); for ( curr = avpl->null.next; curr->avp; curr = curr->next ) { if ( curr->avp->n == name ) { break; } } scs_unsubscribe(avp_strings, name); if( ! curr->avp ) return NULL; curr->next->prev = curr->prev; curr->prev->next = curr->next; avp = curr->avp; g_slice_free(any_avp_type,(any_avp_type*)curr); (avpl->len)--; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl,4,dbg_fp,"avpl: %p new len: %i",avpl,avpl->len); #endif #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"extract_avp_by_name: got avp: %p",avp); #endif return avp; } /** * extract_first_avp: * @param avpl the avpl from which to try to extract the avp. * * Extracts the fisrt avp from the avpl. * * Return value: a pointer to extracted avp if there's one, else NULL. * **/ extern AVP* extract_first_avp(AVPL* avpl) { AVP* avp; AVPN* node; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,7,dbg_fp,"extract_first_avp: %p",avpl); #endif node = avpl->null.next; avpl->null.next->prev = &avpl->null; avpl->null.next = node->next; avp = node->avp; if (avp) { g_slice_free(any_avp_type,(any_avp_type*)node); (avpl->len)--; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl,4,dbg_fp,"avpl: %p new len: %i",avpl,avpl->len); #endif } #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"extract_first_avp: got avp: %p",avp); #endif return avp; } /** * extract_last_avp: * @param avpl the avpl from which to try to extract the avp. * * Extracts the last avp from the avpl. * * Return value: a pointer to extracted avp if there's one, else NULL. * **/ extern AVP* extract_last_avp(AVPL* avpl) { AVP* avp; AVPN* node; node = avpl->null.prev; avpl->null.prev->next = &avpl->null; avpl->null.prev = node->prev; avp = node->avp; if (avp) { g_slice_free(any_avp_type,(any_avp_type*)node); (avpl->len)--; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl,4,dbg_fp,"avpl: %p new len: %i",avpl,avpl->len); #endif } #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"extract_last_avp: got avp: %p",avp); #endif return avp; } /** * delete_avpl: * @param avpl the avpl from which to try to extract the avp. * @param avps_too whether or not it should delete the avps as well. * * Destroys an avpl and releases the resources it uses. If told to do * so releases the avps as well. * **/ extern void delete_avpl(AVPL* avpl, gboolean avps_too) { AVP* avp; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl,3,dbg_fp,"delete_avpl: %p",avpl); #endif while(( avp = extract_last_avp(avpl))) { if (avps_too) { delete_avp(avp); } } scs_unsubscribe(avp_strings,avpl->name); g_slice_free(any_avp_type,(any_avp_type*)avpl); } /** * get_next_avp: * @param avpl the avpl from which to try to get the avps. * @param cookie variable in which to store the state between calls. * * Iterates on an avpl to get its avps. * * Return value: a pointer to the next avp if there's one, else NULL. * **/ extern AVP* get_next_avp(AVPL* avpl, void** cookie) { AVPN* node; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"get_next_avp: avpl: %p avpn: %p",avpl,*cookie); #endif if (*cookie) { node = (AVPN*) *cookie; } else { node = avpl->null.next; } *cookie = node->next; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,5,dbg_fp,"extract_last_avp: got avp: %p",node->avp); #endif return node->avp; } /** * avpl_to_str: * @param avpl the avpl to represent. * * Creates a newly allocated string containing a representation of an avpl. * * Return value: a pointer to the newly allocated string. * **/ gchar* avpl_to_str(AVPL* avpl) { AVPN* c; GString* s = g_string_new(""); gchar* avp_s; gchar* r; for(c=avpl->null.next; c->avp; c = c->next) { avp_s = avp_to_str(c->avp); g_string_append_printf(s," %s;",avp_s); g_free(avp_s); } r = g_string_free(s,FALSE); /* g_strchug(r); ? */ return r; } extern gchar* avpl_to_dotstr(AVPL* avpl) { AVPN* c; GString* s = g_string_new(""); gchar* avp_s; gchar* r; for(c=avpl->null.next; c->avp; c = c->next) { avp_s = avp_to_str(c->avp); g_string_append_printf(s," .%s;",avp_s); g_free(avp_s); } r = g_string_free(s,FALSE); /* g_strchug(r); ? */ return r; } /** * merge_avpl: * @param dst the avpl in which to merge the avps. * @param src the avpl from which to get the avps. * @param copy_avps whether avps should be copied instead of referenced. * * Adds the avps of src that are not existent in dst into dst. * **/ extern void merge_avpl(AVPL* dst, AVPL* src, gboolean copy_avps) { AVPN* cd = NULL; AVPN* cs = NULL; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"merge_avpl: %p %p",dst,src); #endif cs = src->null.next; cd = dst->null.next; while (cs->avp && cd->avp) { int name_diff = strcmp(cd->avp->n, cs->avp->n); if (name_diff < 0) { // dest < source, advance dest to find a better place to insert cd = cd->next; } else if (name_diff > 0) { // dest > source, so it can be definitely inserted here. insert_avp_before_node(dst, cd, cs->avp, copy_avps); cs = cs->next; } else { // attribute names are equal. Ignore duplicate values but ensure that other values are sorted. int value_diff = strcmp(cd->avp->v, cs->avp->v); if (value_diff < 0) { // dest < source, do not insert it yet cd = cd->next; } else if (value_diff > 0) { // dest > source, insert AVP before the current dest AVP insert_avp_before_node(dst, cd, cs->avp, copy_avps); cs = cs->next; } else { // identical AVPs, do not create a duplicate. cs = cs->next; } } } // if there are remaing source AVPs while there are no more destination // AVPs (cd now represents the NULL item, after the last item), append // all remaining source AVPs to the end while (cs->avp) { insert_avp_before_node(dst, cd, cs->avp, copy_avps); cs = cs->next; } #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,8,dbg_fp,"merge_avpl: done"); #endif return; } /** * new_avpl_from_avpl: * @param name the name of the new avpl. * @param avpl the avpl from which to get the avps. * @param copy_avps whether avps should be copied instead of referenced. * * Creates a new avpl containing the same avps as the given avpl * It will either reference or copie the avps. * * Return value: a pointer to the newly allocated string. * **/ extern AVPL* new_avpl_from_avpl(const gchar* name, AVPL* avpl, gboolean copy_avps) { AVPL* newavpl = new_avpl(name); void* cookie = NULL; AVP* avp; AVP* copy; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"new_avpl_from_avpl: %p from=%p name='%s'",newavpl,avpl,name); #endif while(( avp = get_next_avp(avpl,&cookie) )) { if (copy_avps) { copy = avp_copy(avp); if ( ! insert_avp(newavpl,copy) ) { delete_avp(copy); } } else { insert_avp(newavpl,avp); } } #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,8,dbg_fp,"new_avpl_from_avpl: done"); #endif return newavpl; } /** * match_avp: * @param src an src to be compared agains an "op" avp * @param op the "op" avp that will be matched against the src avp * * Checks whether or not two avp's match. * * Return value: a pointer to the src avp if there's a match. * **/ extern AVP* match_avp(AVP* src, AVP* op) { gchar** splited; int i; gchar* p; guint ls; guint lo; float fs = 0.0f; float fo = 0.0f; gboolean lower = FALSE; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"match_avp: %s%c%s; vs. %s%c%s;",src->n,src->o,src->v,op->n,op->o,op->v); #endif if ( src->n != op->n ) { return NULL; } switch (op->o) { case AVP_OP_EXISTS: return src; case AVP_OP_EQUAL: return src->v == op->v ? src : NULL; case AVP_OP_NOTEQUAL: return !( src->v == op->v) ? src : NULL; case AVP_OP_STARTS: return strncmp(src->v,op->v,strlen(op->v)) == 0 ? src : NULL; case AVP_OP_ONEOFF: splited = g_strsplit(op->v,"|",0); if (splited) { for (i=0;splited[i];i++) { if(g_str_equal(splited[i],src->v)) { g_strfreev(splited); return src; } } g_strfreev(splited); } return NULL; case AVP_OP_LOWER: lower = TRUE; /* FALLTHRU */ case AVP_OP_HIGHER: fs = (float) g_ascii_strtod(src->v, NULL); fo = (float) g_ascii_strtod(op->v, NULL); if (lower) { if (fs<fo) return src; else return NULL; } else { if (fs>fo) return src; else return NULL; } case AVP_OP_ENDS: /* does this work? */ ls = (guint) strlen(src->v); lo = (guint) strlen(op->v); if ( ls < lo ) { return NULL; } else { p = src->v + ( ls - lo ); return g_str_equal(p,op->v) ? src : NULL; } /* case AVP_OP_TRANSF: */ /* return do_transform(src,op); */ case AVP_OP_CONTAINS: return g_strrstr(src->v, op->v) ? src : NULL;; } /* will never get here */ return NULL; } /** * new_avpl_loose_match: * @param name the name of the resulting avpl * @param src the data AVPL to be matched against a condition AVPL * @param op the conditions AVPL that will be matched against the data AVPL * @param copy_avps whether the avps in the resulting avpl should be copied * * Creates a new AVP list containing all data AVPs that matched any of the * conditions AVPs. If there are no matches, an empty list will be returned. * * Note: Loose will always be considered a successful match, it matches zero or * more conditions. */ extern AVPL* new_avpl_loose_match(const gchar* name, AVPL* src, AVPL* op, gboolean copy_avps) { AVPL* newavpl = new_avpl(scs_subscribe(avp_strings, name)); AVPN* co = NULL; AVPN* cs = NULL; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"new_avpl_loose_match: %p src=%p op=%p name='%s'",newavpl,src,op,name); #endif cs = src->null.next; co = op->null.next; while (cs->avp && co->avp) { int name_diff = strcmp(co->avp->n, cs->avp->n); if (name_diff < 0) { // op < source, op is not matching co = co->next; } else if (name_diff > 0) { // op > source, source is not matching cs = cs->next; } else { // attribute match found, let's see if there is any condition (op) that accepts this data AVP. AVPN *cond = co; do { if (match_avp(cs->avp, cond->avp)) { insert_avp_before_node(newavpl, newavpl->null.prev, cs->avp, copy_avps); break; } cond = cond->next; } while (cond->avp && cond->avp->n == cs->avp->n); cs = cs->next; } } // return matches (possible none) return newavpl; } /** * new_avpl_pairs_match: * @param name the name of the resulting avpl * @param src the data AVPL to be matched against a condition AVPL * @param op the conditions AVPL that will be matched against the data AVPL * @param strict TRUE if every condition must have a matching data AVP, FALSE if * it is also acceptable that only one of the condition AVPs for the same * attribute is matching. * @param copy_avps whether the avps in the resulting avpl should be copied * * Creates an AVP list by matching pairs of conditions and data AVPs, returning * the data AVPs. If strict is TRUE, then each condition must be paired with a * matching data AVP. If strict is FALSE, then some conditions are allowed to * fail when other conditions for the same attribute do have a match. Note that * if the condition AVPL is empty, the result will be a match (an empty list). * * Return value: a pointer to the newly created avpl containing the * matching avps or NULL if there is no match. */ extern AVPL* new_avpl_pairs_match(const gchar* name, AVPL* src, AVPL* op, gboolean strict, gboolean copy_avps) { AVPL* newavpl; AVPN* co = NULL; AVPN* cs = NULL; const gchar *last_match = NULL; gboolean matched = TRUE; newavpl = new_avpl(scs_subscribe(avp_strings, name)); #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"%s: %p src=%p op=%p name='%s'",G_STRFUNC,newavpl,src,op,name); #endif cs = src->null.next; co = op->null.next; while (cs->avp && co->avp) { int name_diff = g_strcmp0(co->avp->n, cs->avp->n); const gchar *failed_match = NULL; if (name_diff < 0) { // op < source, op has no data avp with same attribute. failed_match = co->avp->n; co = co->next; } else if (name_diff > 0) { // op > source, the source avp is not matched by any condition cs = cs->next; } else { // Matching attributes found, now try to find a matching data AVP for the condition. if (match_avp(cs->avp, co->avp)) { insert_avp_before_node(newavpl, newavpl->null.prev, cs->avp, copy_avps); last_match = co->avp->n; cs = cs->next; } else { failed_match = co->avp->n; } co = co->next; } // condition did not match, check if we can continue matching. if (failed_match) { if (strict) { matched = FALSE; break; } else if (last_match != failed_match) { // None of the conditions so far matched the attribute, check for other candidates if (!co->avp || co->avp->n != last_match) { matched = FALSE; break; } } } } // if there are any conditions remaining, then those could not be matched if (matched && strict && co->avp) { matched = FALSE; } if (matched) { // there was a match, accept it return newavpl; } else { // no match, only delete AVPs too if they were copied delete_avpl(newavpl, copy_avps); return NULL; } } /** * new_avpl_from_match: * @param mode The matching method, one of AVPL_STRICT, AVPL_LOOSE, AVPL_EVERY. * @param name the name of the resulting avpl * @param src the data AVPL to be matched agains a condition AVPL * @param op the conditions AVPL that will be matched against the data AVPL * * Matches the conditions AVPL against the original AVPL according to the mode. * If there is no match, NULL is returned. If there is actually a match, then * the matching AVPs (a subset of the data) are returned. */ extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps) { AVPL* avpl = NULL; switch (mode) { case AVPL_STRICT: avpl = new_avpl_pairs_match(name, src, op, TRUE, copy_avps); break; case AVPL_LOOSE: avpl = new_avpl_loose_match(name,src,op,copy_avps); break; case AVPL_EVERY: avpl = new_avpl_pairs_match(name, src, op, FALSE, copy_avps); break; case AVPL_NO_MATCH: // XXX this seems unused avpl = new_avpl_from_avpl(name,src,copy_avps); merge_avpl(avpl, op, copy_avps); break; } return avpl; } /** * delete_avpl_transform: * @param op a pointer to the avpl transformation object * * Destroys an avpl transformation object and releases all the resources it * uses. * **/ extern void delete_avpl_transform(AVPL_Transf* op) { AVPL_Transf* next; for (; op ; op = next) { next = op->next; g_free(op->name); if (op->match) { delete_avpl(op->match,TRUE); } if (op->replace) { delete_avpl(op->replace,TRUE); } g_free(op); } } /** * avpl_transform: * @param src the source avpl for the transform operation. * @param op a pointer to the avpl transformation object to apply. * * Applies the "op" transformation to an avpl, matches it and eventually * replaces or inserts the transformed avps. * * Return value: whether the transformation was performed or not. **/ extern void avpl_transform(AVPL* src, AVPL_Transf* op) { AVPL* avpl = NULL; AVPN* cs; AVPN* cm; AVPN* n; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"avpl_transform: src=%p op=%p",src,op); #endif for ( ; op ; op = op->next) { avpl = new_avpl_from_match(op->match_mode, src->name,src, op->match, TRUE); if (avpl) { switch (op->replace_mode) { case AVPL_NO_REPLACE: delete_avpl(avpl,TRUE); return; case AVPL_INSERT: merge_avpl(src,op->replace,TRUE); delete_avpl(avpl,TRUE); return; case AVPL_REPLACE: cs = src->null.next; cm = avpl->null.next; // Removes AVPs from the source which are in the matched data. // Assume that the matched set is a subset of the source. while (cs->avp && cm->avp) { if (cs->avp->n == cm->avp->n && cs->avp->v == cm->avp->v) { n = cs->next; cs->prev->next = cs->next; cs->next->prev = cs->prev; g_slice_free(any_avp_type,(any_avp_type*)cs); cs = n; cm = cm->next; } else { // Current matched AVP is not equal to the current // source AVP. Since there must be a source AVP for // each matched AVP, advance current source and not // the match AVP. cs = cs->next; } } merge_avpl(src,op->replace,TRUE); delete_avpl(avpl,TRUE); return; } } } } /** * new_loal: * @param name the name the loal will take. * * Creates an empty list of avp lists. * * Return value: a pointer to the newly created loal. **/ extern LoAL* new_loal(const gchar* name) { LoAL* new_loal_p = (LoAL*)g_slice_new(any_avp_type); if (! name) { name = "anonymous"; } #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"new_loal_p: %p name=%s",new_loal_p,name); #endif new_loal_p->name = scs_subscribe(avp_strings,name); new_loal_p->null.avpl = NULL; new_loal_p->null.next = &new_loal_p->null; new_loal_p->null.prev = &new_loal_p->null; new_loal_p->len = 0; return new_loal_p; } /** * loal_append: * @param loal the loal on which to operate. * @param avpl the avpl to append. * * Appends an avpl to a loal. * **/ extern void loal_append(LoAL* loal, AVPL* avpl) { LoALnode* node = (LoALnode*)g_slice_new(any_avp_type); #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"new_loal_node: %p",node); #endif node->avpl = avpl; node->next = &loal->null; node->prev = loal->null.prev; loal->null.prev->next = node; loal->null.prev = node; loal->len++; } /** * extract_first_avpl: * @param loal the loal on which to operate. * * Extracts the first avpl contained in a loal. * * Return value: a pointer to the extracted avpl. * **/ extern AVPL* extract_first_avpl(LoAL* loal) { LoALnode* node; AVPL* avpl; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"extract_first_avpl: from: %s",loal->name); #endif node = loal->null.next; loal->null.next->next->prev = &loal->null; loal->null.next = node->next; loal->len--; avpl = node->avpl; if ( avpl ) { g_slice_free(any_avp_type,(any_avp_type*)node); #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"extract_first_avpl: got %s",avpl->name); dbg_print(dbg_avpl_op,3,dbg_fp,"delete_loal_node: %p",node); #endif } return avpl; } /** * extract_first_avpl: * @param loal the loal on which to operate. * * Extracts the last avpl contained in a loal. * * Return value: a pointer to the extracted avpl. * **/ extern AVPL* extract_last_avpl(LoAL* loal){ LoALnode* node; AVPL* avpl; node = loal->null.prev; loal->null.prev->prev->next = &loal->null; loal->null.prev = node->prev; loal->len--; avpl = node->avpl; if ( avpl ) { g_slice_free(any_avp_type,(any_avp_type*)node); #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"delete_loal_node: %p",node); #endif } return avpl; } /** * extract_first_avpl: * @param loal the loal on which to operate. * @param cookie pointer to the pointer variable to contain the state between calls * * At each call will return the following avpl from a loal. The given cookie * will be used to manatain the state between calls. * * Return value: a pointer to the next avpl. * **/ extern AVPL* get_next_avpl(LoAL* loal,void** cookie) { LoALnode* node; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"get_next_avpl: loal=%p node=%p",loal,*cookie); #endif if (*cookie) { node = (LoALnode*) *cookie; } else { node = loal->null.next; } *cookie = node->next; return node->avpl; } /** * delete_loal: * @param loal the loal to be deleted. * @param avpls_too whether avpls contained by the loal should be deleted as well * @param avps_too whether avps contained by the avpls should be also deleted * * Destroys a loal and eventually desstroys avpls and avps. * **/ extern void delete_loal(LoAL* loal, gboolean avpls_too, gboolean avps_too) { AVPL* avpl; #ifdef _AVP_DEBUGGING dbg_print(dbg_avpl_op,3,dbg_fp,"delete_loal: %p",loal); #endif while(( avpl = extract_last_avpl(loal) )) { if (avpls_too) { delete_avpl(avpl,avps_too); } } scs_unsubscribe(avp_strings,loal->name); g_slice_free(any_avp_type,(any_avp_type*)loal); } /**************************************************************************** ******************* the following are used in load_loal_from_file ****************************************************************************/ /** * load_loal_error: * Used by loal_from_file to handle errors while loading. **/ static LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, const gchar* fmt, ...) { va_list list; gchar* desc; LoAL* ret = NULL; gchar* err; va_start( list, fmt ); desc = ws_strdup_vprintf(fmt, list); va_end( list ); if (loal) { err = ws_strdup_printf("Error Loading LoAL from file: in %s at line: %i, %s",loal->name,linenum,desc); } else { err = ws_strdup_printf("Error Loading LoAL at line: %i, %s",linenum,desc); } ret = new_loal(err); g_free(desc); g_free(err); if (fp) fclose(fp); if (loal) delete_loal(loal,TRUE,TRUE); if (curr) delete_avpl(curr,TRUE); return ret; } /* the maximum length allowed for a line */ #define MAX_ITEM_LEN 8192 /* this two ugly things are used for tokenizing */ #define AVP_OP_CHAR '=': case '^': case '$': case '~': case '<': case '>': case '?': case '|': case '&' : case '!' #define AVP_NAME_CHAR 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J':\ case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T':\ case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case 'a': case 'b': case 'c': case 'd':\ case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':\ case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x':\ case 'y': case 'z': case '_': case '0': case '1': case '2': case '3': case '4': case '5': case '6':\ case '7': case '8': case '9': case '.' /** * loal_from_file: * @param filename the file containing a loals text representation. * * Given a filename it will attempt to load a loal containing a copy of * the avpls represented in the file. * * Return value: if successful a pointer to the new populated loal, else NULL. * **/ extern LoAL* loal_from_file(gchar* filename) { FILE *fp = NULL; gchar c; int i = 0; guint32 linenum = 1; gchar *linenum_buf; gchar *name; gchar *value; gchar op = '?'; LoAL *loal_error, *loal = new_loal(filename); AVPL* curr = NULL; AVP* avp; enum _load_loal_states { START, BEFORE_NAME, IN_NAME, IN_VALUE, MY_IGNORE } state; linenum_buf = (gchar*)g_malloc(MAX_ITEM_LEN); name = (gchar*)g_malloc(MAX_ITEM_LEN); value = (gchar*)g_malloc(MAX_ITEM_LEN); #ifndef _WIN32 if (! getuid()) { loal_error = load_loal_error(fp,loal,curr,linenum,"MATE Will not run as root"); goto error; } #endif state = START; if (( fp = ws_fopen(filename,"r") )) { while(( c = (gchar) fgetc(fp) )){ if ( feof(fp) ) { if ( ferror(fp) ) { report_read_failure(filename,errno); loal_error = load_loal_error(fp,loal,curr,linenum,"Error while reading '%f'",filename); goto error; } break; } if ( c == '\n' ) { linenum++; } if ( i >= MAX_ITEM_LEN - 1 ) { loal_error = load_loal_error(fp,loal,curr,linenum,"Maximum item length exceeded"); goto error; } switch(state) { case MY_IGNORE: switch (c) { case '\n': state = START; i = 0; continue; default: continue; } case START: switch (c) { case ' ': case '\t': /* ignore whitespace at line start */ continue; case '\n': /* ignore empty lines */ i = 0; continue; case AVP_NAME_CHAR: state = IN_NAME; i = 0; name[i++] = c; name[i] = '\0'; snprintf(linenum_buf,MAX_ITEM_LEN,"%s:%u",filename,linenum); curr = new_avpl(linenum_buf); continue; case '#': state = MY_IGNORE; continue; default: loal_error = load_loal_error(fp,loal,curr,linenum,"expecting name got: '%c'",c); goto error; } case BEFORE_NAME: i = 0; name[0] = '\0'; switch (c) { case '\\': c = (gchar) fgetc(fp); if (c != '\n') ungetc(c,fp); continue; case ' ': case '\t': continue; case AVP_NAME_CHAR: state = IN_NAME; name[i++] = c; name[i] = '\0'; continue; case '\n': loal_append(loal,curr); state = START; continue; default: loal_error = load_loal_error(fp,loal,curr,linenum,"expecting name got: '%c'",c); goto error; } case IN_NAME: switch (c) { case ';': state = BEFORE_NAME; op = '?'; name[i] = '\0'; value[0] = '\0'; i = 0; avp = new_avp(name,value,op); if (! insert_avp(curr,avp) ) { delete_avp(avp); } continue; case AVP_OP_CHAR: name[i] = '\0'; i = 0; op = c; state = IN_VALUE; continue; case AVP_NAME_CHAR: name[i++] = c; continue; case '\n': loal_error = load_loal_error(fp,loal,curr,linenum,"operator expected found new line"); goto error; default: loal_error = load_loal_error(fp,loal,curr,linenum,"name or match operator expected found '%c'",c); goto error; } case IN_VALUE: switch (c) { case '\\': value[i++] = (gchar) fgetc(fp); continue; case ';': state = BEFORE_NAME; value[i] = '\0'; i = 0; avp = new_avp(name,value,op); if (! insert_avp(curr,avp) ) { delete_avp(avp); } continue; case '\n': loal_error = load_loal_error(fp,loal,curr,linenum,"';' expected found new line"); goto error; default: value[i++] = c; continue; } } } fclose (fp); g_free(linenum_buf); g_free(name); g_free(value); return loal; } else { report_open_failure(filename,errno,FALSE); loal_error = load_loal_error(NULL,loal,NULL,0,"Cannot Open file '%s'",filename); } error: g_free(linenum_buf); g_free(name); g_free(value); return loal_error; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
C/C++
wireshark/plugins/epan/mate/mate_util.h
/* mate_util.h * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __AVP_H_ #define __AVP_H_ #include "epan/proto.h" #include <sys/types.h> /* #define _AVP_DEBUGGING */ /******* dbg_print *********/ #define DEBUG_BUFFER_SIZE 4096 extern void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... ) G_GNUC_PRINTF(4, 5); /******* single copy strings *********/ typedef struct _scs_collection SCS_collection; #define SCS_SMALL_SIZE 16 #define SCS_MEDIUM_SIZE 256 #define SCS_LARGE_SIZE 4096 #define SCS_HUGE_SIZE 65536 extern gchar* scs_subscribe(SCS_collection* collection, const gchar* s); extern void scs_unsubscribe(SCS_collection* collection, gchar* s); extern gchar* scs_subscribe_printf(SCS_collection* collection, gchar* fmt, ...) G_GNUC_PRINTF(2, 3); /******* AVPs & Co. *********/ /* these are the defined oreators of avps */ #define AVP_OP_EQUAL '=' #define AVP_OP_NOTEQUAL '!' #define AVP_OP_STARTS '^' #define AVP_OP_ENDS '$' #define AVP_OP_CONTAINS '~' #define AVP_OP_LOWER '<' #define AVP_OP_HIGHER '>' #define AVP_OP_EXISTS '?' #define AVP_OP_ONEOFF '|' #define AVP_OP_TRANSF '&' /* an avp is an object made of a name a value and an operator */ typedef struct _avp { gchar* n; gchar* v; gchar o; } AVP; /* avp nodes are used in avp lists */ typedef struct _avp_node { AVP* avp; struct _avp_node* next; struct _avp_node* prev; } AVPN; /* an avp list is a sorted set of avps */ typedef struct _avp_list { gchar* name; guint32 len; AVPN null; } AVPL; /* an avpl transformation operation */ typedef enum _avpl_match_mode { AVPL_NO_MATCH, AVPL_STRICT, AVPL_LOOSE, AVPL_EVERY } avpl_match_mode; typedef enum _avpl_replace_mode { AVPL_NO_REPLACE, AVPL_INSERT, AVPL_REPLACE } avpl_replace_mode; typedef struct _avpl_transf AVPL_Transf; struct _avpl_transf { gchar* name; AVPL* match; AVPL* replace; avpl_match_mode match_mode; avpl_replace_mode replace_mode; GHashTable* map; AVPL_Transf* next; }; /* loalnodes are used in LoALs */ typedef struct _loal_node { AVPL* avpl; struct _loal_node *next; struct _loal_node *prev; } LoALnode; /* a loal is a list of avp lists */ typedef struct _loal { gchar* name; guint len; LoALnode null; } LoAL; /* avp library (re)initialization */ extern void avp_init(void); /* If enabled set's up the debug facilities for the avp library */ #ifdef _AVP_DEBUGGING extern void setup_avp_debug(FILE* fp, int* general, int* avp, int* avp_op, int* avpl, int* avpl_op); #endif /* _AVP_DEBUGGING */ /* * avp constructors */ /* creates a new avp */ extern AVP* new_avp(const gchar* name, const gchar* value, gchar op); /* creates a copy od an avp */ extern AVP* avp_copy(AVP* from); /* creates an avp from a field_info record */ extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo); /* * avp destructor */ extern void delete_avp(AVP* avp); /* * avp methods */ /* returns a newly allocated string containing a representation of the avp */ #define avp_to_str(avp) (ws_strdup_printf("%s%c%s",avp->n,avp->o,avp->v)) /* returns the src avp if the src avp matches(*) the op avp or NULL if it doesn't */ extern AVP* match_avp(AVP* src, AVP* op); /* * avplist constructors */ /* creates an empty avp list */ extern AVPL* new_avpl(const gchar* name); /* creates a copy of an avp list */ extern AVPL* new_avpl_from_avpl(const gchar* name, AVPL* avpl, gboolean copy_avps); extern AVPL* new_avpl_loose_match(const gchar* name, AVPL* src, AVPL* op, gboolean copy_avps); extern AVPL* new_avpl_pairs_match(const gchar* name, AVPL* src, AVPL* op, gboolean strict, gboolean copy_avps); /* uses mode to call one of the former matches. NO_MATCH = merge(merge(copy(src),op)) */ extern AVPL* new_avpl_from_match(avpl_match_mode mode, const gchar* name,AVPL* src, AVPL* op, gboolean copy_avps); /* * functions on avpls */ /* it will insert an avp to an avpl */ extern gboolean insert_avp(AVPL* avpl, AVP* avp); /* renames an avpl */ extern void rename_avpl(AVPL* avpl, gchar* name); /* it will add all the avps in src which don't match(*) any attribute in dest */ extern void merge_avpl(AVPL* dest, AVPL* src, gboolean copy); /* it will return the first avp in an avpl whose name matches the given name. will return NULL if there is not anyone matching */ extern AVP* get_avp_by_name(AVPL* avpl, gchar* name, void** cookie); /* it will get the next avp from an avpl, using cookie to keep state */ extern AVP* get_next_avp(AVPL* avpl, void** cookie); /* it will extract the first avp from an avp list */ extern AVP* extract_first_avp(AVPL* avpl); /* it will extract the last avp from an avp list */ extern AVP* extract_last_avp(AVPL* avpl); /* it will extract the first avp in an avpl whose name matches the given name. it will not extract any and return NULL if there is not anyone matching */ extern AVP* extract_avp_by_name(AVPL* avpl, gchar* name); /* returns a newly allocated string containing a representation of the avp list */ extern gchar* avpl_to_str(AVPL* avpl); extern gchar* avpl_to_dotstr(AVPL*); /* deletes an avp list and eventually its contents */ extern void delete_avpl(AVPL* avpl, gboolean avps_too); /* * AVPL transformations */ extern void delete_avpl_transform(AVPL_Transf* it); extern void avpl_transform(AVPL* src, AVPL_Transf* op); /* * Lists of AVP lists */ /* creates an empty list of avp lists */ extern LoAL* new_loal(const gchar* name); /* given a file loads all the avpls contained in it every line is formatted as it is the output of avplist_to_string */ extern LoAL* loal_from_file(gchar* filename); /* inserts an avplist into a LoAL */ extern void loal_append(LoAL* loal, AVPL* avpl); /* extracts the first avp list from the loal */ extern AVPL* extract_first_avpl(LoAL* loal); /* extracts the last avp list from the loal */ extern AVPL* extract_last_avpl(LoAL* loal); /* it will get the next avp list from a LoAL, using cookie to keep state */ extern AVPL* get_next_avpl(LoAL* loal,void** cookie); /* deletes a loal and eventually its contents */ extern void delete_loal(LoAL* loal, gboolean avpls_too, gboolean avps_too); #endif
C
wireshark/plugins/epan/mate/packet-mate.c
/* packet-mate.c * Routines for the mate Facility's Pseudo-Protocol dissection * * Copyright 2004, Luis E. Garcia Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /************************************************************************** * This is the pseudo protocol dissector for the mate module. *** * It is intended for this to be just the user interface to the module. *** **************************************************************************/ #include "config.h" #include "mate.h" #include <epan/expert.h> void proto_register_mate(void); void proto_reg_handoff_mate(void); static mate_config* mc = NULL; static int proto_mate = -1; static int hf_mate_released_time = -1; static int hf_mate_duration = -1; static int hf_mate_number_of_pdus = -1; static int hf_mate_started_at = -1; static int hf_mate_gop_key = -1; static expert_field ei_mate_undefined_attribute = EI_INIT; static const gchar* pref_mate_config_filename = ""; static const gchar* current_mate_config_filename = NULL; #ifdef _AVP_DEBUGGING static int pref_avp_debug_general = 0; static int pref_avp_debug_avp = 0; static int pref_avp_debug_avp_op = 0; static int pref_avp_debug_avpl = 0; static int pref_avp_debug_avpl_op = 0; #endif static dissector_handle_t mate_handle; static void pdu_attrs_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_pdu* pdu) { AVPN* c; proto_tree *avpl_t; int* hfi_p; avpl_t = proto_tree_add_subtree_format(tree,tvb,0,0,pdu->cfg->ett_attr,NULL,"%s Attributes",pdu->cfg->name); for ( c = pdu->avpl->null.next; c->avp; c = c->next) { hfi_p = (int *)g_hash_table_lookup(pdu->cfg->my_hfids,(char*)c->avp->n); if (hfi_p) { proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v); } else { proto_tree_add_expert_format(avpl_t,pinfo,&ei_mate_undefined_attribute,tvb,0,0,"Undefined attribute: %s=%s",c->avp->n, c->avp->v); } } } static void gop_attrs_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_gop* gop) { AVPN* c; proto_tree *avpl_t; int* hfi_p; avpl_t = proto_tree_add_subtree_format(tree,tvb,0,0,gop->cfg->ett_attr,NULL,"%s Attributes",gop->cfg->name); for ( c = gop->avpl->null.next; c->avp; c = c->next) { hfi_p = (int *)g_hash_table_lookup(gop->cfg->my_hfids,(char*)c->avp->n); if (hfi_p) { proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v); } else { proto_tree_add_expert_format(avpl_t,pinfo,&ei_mate_undefined_attribute,tvb,0,0,"Undefined attribute: %s=%s",c->avp->n, c->avp->v); } } } static void gog_attrs_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_gog* gog) { AVPN* c; proto_tree *avpl_t; int* hfi_p; avpl_t = proto_tree_add_subtree_format(tree,tvb,0,0,gog->cfg->ett_attr,NULL,"%s Attributes",gog->cfg->name); for ( c = gog->avpl->null.next; c->avp; c = c->next) { hfi_p = (int *)g_hash_table_lookup(gog->cfg->my_hfids,(char*)c->avp->n); if (hfi_p) { proto_tree_add_string(avpl_t,*hfi_p,tvb,0,0,c->avp->v); } else { proto_tree_add_expert_format(avpl_t,pinfo,&ei_mate_undefined_attribute,tvb,0,0,"Undefined attribute: %s=%s",c->avp->n, c->avp->v); } } } static void mate_gop_tree(proto_tree* pdu_tree, packet_info *pinfo, tvbuff_t *tvb, mate_gop* gop); static void mate_gog_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_gog* gog, mate_gop* gop) { proto_item *gog_item; proto_tree *gog_tree; proto_tree *gog_time_tree; proto_item *gog_gops_item; proto_tree *gog_gops_tree; mate_gop* gog_gops; proto_item *gog_gop_item; proto_tree *gog_gop_tree; mate_pdu* pdu; gog_item = proto_tree_add_uint(tree,gog->cfg->hfid,tvb,0,0,gog->id); gog_tree = proto_item_add_subtree(gog_item,gog->cfg->ett); gog_attrs_tree(gog_tree,pinfo,tvb,gog); if (gog->cfg->show_times) { gog_time_tree = proto_tree_add_subtree_format(gog_tree,tvb,0,0,gog->cfg->ett_times,NULL,"%s Times",gog->cfg->name); proto_tree_add_float(gog_time_tree, gog->cfg->hfid_start_time, tvb, 0, 0, gog->start_time); proto_tree_add_float(gog_time_tree, gog->cfg->hfid_last_time, tvb, 0, 0, gog->last_time - gog->start_time); } gog_gops_item = proto_tree_add_uint(gog_tree, gog->cfg->hfid_gog_num_of_gops, tvb, 0, 0, gog->num_of_gops); gog_gops_tree = proto_item_add_subtree(gog_gops_item, gog->cfg->ett_children); for (gog_gops = gog->gops; gog_gops; gog_gops = gog_gops->next) { if (gop != gog_gops) { if (gog->cfg->gop_tree_mode == GOP_FULL_TREE) { mate_gop_tree(gog_gops_tree, pinfo, tvb, gog_gops); } else { gog_gop_item = proto_tree_add_uint(gog_gops_tree,gog_gops->cfg->hfid,tvb,0,0,gog_gops->id); if (gog->cfg->gop_tree_mode == GOP_BASIC_TREE) { gog_gop_tree = proto_item_add_subtree(gog_gop_item, gog->cfg->ett_gog_gop); proto_tree_add_float(gog_gop_tree, hf_mate_started_at, tvb,0,0,gog_gops->start_time); proto_tree_add_float_format(gog_gop_tree, hf_mate_duration, tvb,0,0, gog_gops->last_time - gog_gops->start_time, "%s Duration: %f", gog_gops->cfg->name, gog_gops->last_time - gog_gops->start_time); if (gog_gops->released) proto_tree_add_float_format(gog_gop_tree, hf_mate_released_time, tvb,0,0, gog_gops->release_time - gog_gops->start_time, "%s has been released, Time: %f", gog_gops->cfg->name, gog_gops->release_time - gog_gops->start_time); proto_tree_add_uint(gog_gop_tree, hf_mate_number_of_pdus, tvb,0,0, gog_gops->num_of_pdus); if (gop->pdus && gop->cfg->pdu_tree_mode != GOP_NO_TREE) { proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstart,tvb,0,0,gog_gops->pdus->frame); for (pdu = gog_gops->pdus->next ; pdu; pdu = pdu->next) { if (pdu->is_stop) { proto_tree_add_uint(gog_gop_tree,gog->cfg->hfid_gog_gopstop,tvb,0,0,pdu->frame); break; } } } } } } else { proto_tree_add_uint_format(gog_gops_tree,gop->cfg->hfid,tvb,0,0,gop->id,"current %s Gop: %d",gop->cfg->name,gop->id); } } } static void mate_gop_tree(proto_tree* tree, packet_info *pinfo, tvbuff_t *tvb, mate_gop* gop) { proto_item *gop_item; proto_tree *gop_time_tree; proto_tree *gop_tree; proto_item *gop_pdu_item; proto_tree *gop_pdu_tree; mate_pdu* gop_pdus; float rel_time; float pdu_rel_time; const gchar* pdu_str; const gchar* type_str; guint32 pdu_item; gop_item = proto_tree_add_uint(tree,gop->cfg->hfid,tvb,0,0,gop->id); gop_tree = proto_item_add_subtree(gop_item, gop->cfg->ett); if (gop->gop_key) proto_tree_add_string(gop_tree,hf_mate_gop_key,tvb,0,0,gop->gop_key); gop_attrs_tree(gop_tree,pinfo,tvb,gop); if (gop->cfg->show_times) { gop_time_tree = proto_tree_add_subtree_format(gop_tree,tvb,0,0,gop->cfg->ett_times,NULL,"%s Times",gop->cfg->name); proto_tree_add_float(gop_time_tree, gop->cfg->hfid_start_time, tvb, 0, 0, gop->start_time); if (gop->released) { proto_tree_add_float(gop_time_tree, gop->cfg->hfid_stop_time, tvb, 0, 0, gop->release_time - gop->start_time); proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time); } else { proto_tree_add_float(gop_time_tree, gop->cfg->hfid_last_time, tvb, 0, 0, gop->last_time - gop->start_time); } } gop_pdu_item = proto_tree_add_uint(gop_tree, gop->cfg->hfid_gop_num_pdus, tvb, 0, 0,gop->num_of_pdus); if (gop->cfg->pdu_tree_mode != GOP_NO_TREE) { gop_pdu_tree = proto_item_add_subtree(gop_pdu_item, gop->cfg->ett_children); rel_time = gop->start_time; type_str = (gop->cfg->pdu_tree_mode == GOP_FRAME_TREE ) ? "in frame:" : "id:"; for (gop_pdus = gop->pdus; gop_pdus; gop_pdus = gop_pdus->next) { pdu_item = (gop->cfg->pdu_tree_mode == GOP_FRAME_TREE ) ? gop_pdus->frame : gop_pdus->id; if (gop_pdus->is_start) { pdu_str = "Start "; } else if (gop_pdus->is_stop) { pdu_str = "Stop "; } else if (gop_pdus->after_release) { pdu_str = "After stop "; } else { pdu_str = ""; } pdu_rel_time = gop_pdus->time_in_gop != 0.0 ? gop_pdus->time_in_gop - rel_time : (float) 0.0; proto_tree_add_uint_format(gop_pdu_tree,gop->cfg->hfid_gop_pdu,tvb,0,0,pdu_item, "%sPDU: %s %i (%f : %f)",pdu_str, type_str, pdu_item, gop_pdus->time_in_gop, pdu_rel_time); rel_time = gop_pdus->time_in_gop; } } } static void mate_pdu_tree(mate_pdu *pdu, packet_info *pinfo, tvbuff_t *tvb, proto_item *item, proto_tree* tree) { proto_item *pdu_item; proto_tree *pdu_tree; if ( ! pdu ) return; if (pdu->gop && pdu->gop->gog) { proto_item_append_text(item," %s:%d->%s:%d->%s:%d", pdu->cfg->name,pdu->id, pdu->gop->cfg->name,pdu->gop->id, pdu->gop->gog->cfg->name,pdu->gop->gog->id); } else if (pdu->gop) { proto_item_append_text(item," %s:%d->%s:%d", pdu->cfg->name,pdu->id, pdu->gop->cfg->name,pdu->gop->id); } else { proto_item_append_text(item," %s:%d",pdu->cfg->name,pdu->id); } pdu_item = proto_tree_add_uint(tree,pdu->cfg->hfid,tvb,0,0,pdu->id); pdu_tree = proto_item_add_subtree(pdu_item, pdu->cfg->ett); proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_rel_time, tvb, 0, 0, pdu->rel_time); if (pdu->gop) { proto_tree_add_float(pdu_tree,pdu->cfg->hfid_pdu_time_in_gop, tvb, 0, 0, pdu->time_in_gop); mate_gop_tree(tree,pinfo,tvb,pdu->gop); if (pdu->gop->gog) mate_gog_tree(tree,pinfo,tvb,pdu->gop->gog,pdu->gop); } if (pdu->avpl) { pdu_attrs_tree(pdu_tree,pinfo,tvb,pdu); } } static int mate_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { mate_pdu* pdus; proto_item *mate_i; proto_tree *mate_t; /* If there is no MATE configuration, don't claim the packet */ if ( mc == NULL) return 0; /* There is a MATE configuration, just no tree, so there's nothing to do */ if ( tree == NULL) return tvb_captured_length(tvb); mate_analyze_frame(mc, pinfo,tree); if (( pdus = mate_get_pdus(pinfo->num) )) { for ( ; pdus; pdus = pdus->next_in_frame) { mate_i = proto_tree_add_protocol_format(tree,mc->hfid_mate,tvb,0,0,"MATE"); mate_t = proto_item_add_subtree(mate_i, mc->ett_root); mate_pdu_tree(pdus,pinfo,tvb,mate_i,mate_t); } } return tvb_captured_length(tvb); } static void initialize_mate(void) { initialize_mate_runtime(mc); #ifdef _AVP_DEBUGGING setup_avp_debug(mc->dbg_facility, &pref_avp_debug_general, &pref_avp_debug_avp, &pref_avp_debug_avp_op, &pref_avp_debug_avpl, &pref_avp_debug_avpl_op); #endif } static void flush_mate_debug(void) { /* Flush debug information */ if (mc->dbg_facility) fflush(mc->dbg_facility); } extern void proto_reg_handoff_mate(void) { if ( *pref_mate_config_filename != '\0' ) { if (current_mate_config_filename) { report_failure("MATE cannot reconfigure itself.\n" "For changes to be applied you have to restart Wireshark\n"); return; } if (!mc) { mc = mate_make_config(pref_mate_config_filename,proto_mate); if (mc) { /* XXX: alignment warnings, what do they mean? */ proto_register_field_array(proto_mate, (hf_register_info*)(void *)mc->hfrs->data, mc->hfrs->len ); proto_register_subtree_array((gint**)(void*)mc->ett->data, mc->ett->len); register_init_routine(initialize_mate); register_postseq_cleanup_routine(flush_mate_debug); /* * Set the list of hfids we want. */ set_postdissector_wanted_hfids(mate_handle, mc->wanted_hfids); initialize_mate_runtime(mc); } current_mate_config_filename = pref_mate_config_filename; } } } extern void proto_register_mate(void) { static hf_register_info hf[] = { { &hf_mate_started_at, { "Started at", "mate.started_at", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_mate_duration, { "Duration", "mate.duration", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_mate_released_time, { "Release time", "mate.released_time", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_mate_number_of_pdus, { "Number of Pdus", "mate.number_of_pdus", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_mate_gop_key, { "GOP Key", "mate.gop_key", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static ei_register_info ei[] = { { &ei_mate_undefined_attribute, { "mate.undefined_attribute", PI_PROTOCOL, PI_ERROR, "Undefined attribute", EXPFILL }}, }; expert_module_t* expert_mate; module_t *mate_module; proto_mate = proto_register_protocol("Meta Analysis Tracing Engine", "MATE", "mate"); proto_register_field_array(proto_mate, hf, array_length(hf)); expert_mate = expert_register_protocol(proto_mate); expert_register_field_array(expert_mate, ei, array_length(ei)); mate_handle = register_dissector("mate",mate_tree,proto_mate); mate_module = prefs_register_protocol(proto_mate, proto_reg_handoff_mate); prefs_register_filename_preference(mate_module, "config", "Configuration Filename", "The name of the file containing the mate module's configuration", &pref_mate_config_filename, FALSE); #ifdef _AVP_DEBUGGING prefs_register_uint_preference(mate_module, "avp_debug_general", "AVP Debug general", "General debugging level (0..5)", 10, &pref_avp_debug_general); prefs_register_uint_preference(mate_module, "avp_debug_avp", "Debug AVP", "Attribute Value Pairs debugging level (0..5)", 10, &pref_avp_debug_avp); prefs_register_uint_preference(mate_module, "avp_debug_avp_op", "Debug AVP operations", "Attribute Value Pairs operations debugging level (0..5)", 10, &pref_avp_debug_avp_op); prefs_register_uint_preference(mate_module, "avp_debug_avpl", "Debug AVP list", "Attribute Value Pairs list debugging level (0..5)", 10, &pref_avp_debug_avpl); prefs_register_uint_preference(mate_module, "avp_debug_avpl_op", "Debug AVP list operations", "Attribute Value Pairs list operations debugging level (0..5)", 10, &pref_avp_debug_avpl_op); #endif register_postdissector(mate_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
wireshark/plugins/epan/mate/examples/call.mate
# call.mate Action=Settings; DiscardPduData=TRUE; ShowGopTimes=FALSE; ShowPduTree=FALSE; Action=PduDef; Name=q931_pdu; Proto=q931; Stop=TRUE; Transport=tcp/ip; addr=ip.addr; call_ref=q931.call_ref; q931_msg=q931.message_type; Action=PduDef; Name=ras_pdu; Proto=h225.RasMessage; Transport=udp/ip; addr=ip.addr; ras_sn=h225.requestSeqNum; ras_msg=h225.RasMessage; Action=PduDef; Name=isup_pdu; Proto=isup; Transport=mtp3; m3pc=mtp3.dpc; m3pc=mtp3.opc; cic=isup.cic; isup_msg=isup.message_type; Action=PduExtra; For=q931_pdu; guid=h225.guid; calling=q931.calling_party_number.digits; q931_cause=q931.cause_value; Action=PduExtra; For=isup_pdu; calling=isup.calling; isup_cause=isup.cause_indicator; Action=PduExtra; For=ras_pdu; guid=h225.guid; Action=GopDef; Name=q931_leg; On=q931_pdu; addr; addr; call_ref; Action=GopStart; For=q931_leg; q931_msg=5; Action=GopStop; For=q931_leg; q931_msg=90; Action=GopExtra; For=q931_leg; calling; q931_cause; guid; Action=GopDef; Name=isup_leg; On=isup_pdu; ShowPduTree=TRUE; ShowGopTimes=TRUE; m3pc; m3pc; cic; Action=GopStart; For=isup_leg; isup_msg=1; Action=GopStop; For=isup_leg; isup_msg=16; Action=GopExtra; For=isup_leg; calling; isup_cause; Action=GopDef; Name=ras_leg; On=ras_pdu; addr; addr; ras_sn; Action=GopStart; For=ras_leg; ras_msg|0|3|6|9|12|15|18|21|26|30; Action=GopStop; For=ras_leg; ras_msg|1|2|4|5|7|8|10|11|13|14|16|17|19|20|22|24|27|28|29|31; Action=GopExtra; For=ras_leg; guid; Action=GogDef; Name=call; GogExpiration=0.75; Action=GogKey; For=call; On=isup_leg; calling; Action=GogKey; For=call; On=q931_leg; calling; Action=GogKey; For=call; On=q931_leg; guid; Action=GogKey; For=call; On=ras_leg; guid; Action=GogExtra; For=call; isup_cause; Action=GogExtra; For=call; q931_cause;
wireshark/plugins/epan/mate/examples/mms.mate
# mms.mate # MMSE over HTTP Action=PduDef; Name=mmse_over_http_pdu; Proto=http; Transport=tcp/ip; Payload=mmse; addr=ip.addr; port=tcp.port; http_rq=http.request; content=http.content_type; Action=PduExtra; For=mmse_over_http_pdu; resp=http.response.code; method=http.request.method; host=http.host; content=http.content_type; Action=PduExtra; For=mmse_over_http_pdu; method=http.request.method; host=http.host; Action=PduExtra; For=mmse_over_http_pdu; trx=mmse.transaction_id; msg_type=mmse.message_type; notify_status=mmse.status; send_status=mmse.response_status; Action=Transform; Name=rm_client_from_http_resp1; Mode=Insert; Match=Strict; http_rq; Action=Transform; Name=rm_client_from_http_resp1; Mode=Insert; Match=Every; addr; .not_rq; Action=Transform; Name=rm_client_from_http_resp2; Mode=Replace; Match=Strict; not_rq; ue; Action=PduTransform; For=mmse_over_http_pdu; Name=rm_client_from_http_resp1; Action=PduTransform; For=mmse_over_http_pdu; Name=rm_client_from_http_resp2; Action=GopDef; Name=mmse_over_http; On=mmse_over_http_pdu; addr; addr; port; port; Action=GopStart; For=mmse_over_http; http_rq; Action=GopStop; For=mmse_over_http; http_rs; Action=GopExtra; For=mmse_over_http; host; ue; resp; notify_status; send_status; trx; # MMSE over WSP Action=PduDef; Name=mmse_over_wsp_pdu; Proto=wsp; Payload=mmse; Transport=ip; trx=mmse.transaction_id; msg_type=mmse.message_type; notify_status=mmse.status; send_status=mmse.response_status; Action=Transform; Name=mms_start; Match=Loose; .mms_start; Action=PduTransform; Name=mms_start; For=mmse_over_wsp_pdu; Action=GopDef; Name=mmse_over_wsp; On=mmse_over_wsp_pdu; trx; Action=GopStart; For=mmse_over_wsp; mms_start; Action=GopStop; For=mmse_over_wsp; never; Action=GopExtra; For=mmse_over_wsp; ue; notify_status; send_status; # the MMS GoG Action=GogDef; Name=mms; GogExpiration=60.0; Action=GogKey; For=mms; On=mmse_over_http; trx; Action=GogKey; For=mms; On=mmse_over_wsp; trx; Action=GogExtra; For=mms; ue; notify_status; send_status; resp; host; trx;
wireshark/plugins/epan/mate/examples/pasv_ftp.mate
# pasv_ftp.mate Action=PduDef; Name=ftp_pdu; Proto=ftp; Transport=tcp/ip; Stop=TRUE; ftp_addr=ip.addr; ftp_port=tcp.port; ftp_resp=ftp.response.code; ftp_req=ftp.request.command; server_addr=ftp.passive.ip; server_port=ftp.passive.port; Action=PduDef; Name=ftp_data_pdu; Proto=ftp-data; Transport=tcp/ip; server_addr=ip.src; server_port=tcp.srcport; Action=GopDef; Name=ftp_data; On=ftp_data_pdu; server_addr; server_port; Action=GopStart; For=ftp_data; server_addr; Action=GopDef; Name=ftp_ctl; On=ftp_pdu; ftp_addr; ftp_addr; ftp_port; ftp_port; Action=GopStart; For=ftp_ctl; ftp_resp=220; Action=GopStop; For=ftp_ctl; ftp_resp=221; Action=GopExtra; For=ftp_ctl; server_addr; server_port; Action=GogDef; Name=ftp_ses; Action=GogKey; For=ftp_ses; On=ftp_ctl; ftp_addr; ftp_addr; ftp_port; ftp_port; Action=GogKey; For=ftp_ses; On=ftp_data; server_addr; server_port;
wireshark/plugins/epan/mate/examples/tcp.mate
# tcp.mate Action=PduDef; Name=tcp_pdu; Proto=tcp; Transport=ip; addr=ip.addr; port=tcp.port; tcp_start=tcp.flags.syn; tcp_stop=tcp.flags.fin; tcp_stop=tcp.flags.reset; Action=GopDef; Name=tcp_session; On=tcp_pdu; addr; addr; port; port; Action=GopStart; For=tcp_session; tcp_start=1; Action=GopStop; For=tcp_session; tcp_stop=1;
wireshark/plugins/epan/mate/examples/web.mate
# web.mate Action=PduDef; Name=dns_pdu; Proto=dns; Transport=ip; addr=ip.addr; dns_resp=dns.flags.response; host=dns.qry.name; client_addr=ip.src; dns_id=dns.id; Action=PduDef; Name=http_pdu; Proto=http; Transport=tcp/ip; addr=ip.addr; port=tcp.port; http_rq=http.request.method; http_rs=http.response; host=http.host; client_addr=ip.src; Action=GopDef; Name=dns_req; On=dns_pdu; addr; addr; dns_id; Action=GopStart; For=dns_req; dns_resp=0; Action=GopStop; For=dns_req; dns_resp=1; Action=GopDef; Name=http_req; On=http_pdu; addr; addr; port; port; Action=GopStart; For=http_req; http_rq; Action=GopStop; For=http_req; http_rs; Action=Transform; Name=rm_client_from_dns_resp; Mode=Replace; Match=Every; dns_resp=1; client_addr; .dns_resp=1; Action=PduTransform; For=dns_pdu; Name=rm_client_from_dns_resp; Action=Transform; Name=rm_client_from_http_resp; Mode=Replace; Match=Every; http_rs; client_addr; .http_rs=; Action=PduTransform; For=http_pdu; Name=rm_client_from_http_resp; Action=GopExtra; For=http_req; host; client_addr; Action=GopExtra; For=dns_req; host; client_addr; Action=GogDef; Name=http_use; GogExpiration=0.75; Action=GogKey; For=http_use; On=http_req; host; client_addr; Action=GogKey; For=http_use; On=dns_req; host;client_addr; Action=GogExtra; For=http_use; host; client_addr;
wireshark/plugins/epan/mate/matelib/dns.mate
# dns.mate Action=PduDef; Name=dns_pdu; Proto=dns; Transport=udp/ip; addr=ip.addr; port=udp.port; dns_id=dns.id; dns_rsp=dns.flags.response; Action=GopDef; Name=dns_req; On=dns_pdu; addr; addr; port!53; dns_id; Action=GopStart; For=dns_req; dns_rsp=0; Action=GopStop; For=dns_req; dns_rsp=1;
wireshark/plugins/epan/mate/matelib/h225_ras.mate
# h225_ras.mate Action=PduDef; Name=ras_pdu; Proto=h225.RasMessage; Transport=udp/ip; ras_sn=h225.requestSeqNum; ras_msg=h225.RasMessage; addr=ip.addr; Action=GopDef; Name=ras_leg; On=ras_pdu; addr; addr; ras_sn; Action=GopStart; For=ras_leg; ras_msg|0|3|6|9|12|15|18|21|26|30; Action=GopStop; For=ras_leg; ras_msg|1|2|4|5|7|8|10|11|13|14|16|17|19|20|22|24|27|28|29|31; Action=PduExtra; For=ras_pdu; guid=h225.guid; Action=GopExtra; For=ras_leg; guid;
wireshark/plugins/epan/mate/matelib/isup.mate
# isup.mate #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=1; .isup_IAM=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=2; .isup_SAM=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=3; .isup_INR=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=4; .isup_INF=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=5; .isup_COT=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=6; .isup_ACM=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=7; .isup_CON=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=8; .isup_FOT=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=9; .isup_ANM=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=12; .isup_REL=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=13; .isup_SUS=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=14; .isup_RES=; #Action=Transform; Name=isup_msg_type; Mode=Insert; Match=Strict; isup_msg=16; .isup_RLC=; Action=PduDef; Name=isup_pdu; Proto=isup; Transport=mtp3; mtp3pc=mtp3.dpc; mtp3pc=mtp3.opc; cic=isup.cic; isup_msg=isup.message_type; #Action=PduTransform; For=isup_pdu; Name=isup_msg_type; Action=GopDef; Name=isup_leg; On=isup_pdu; ShowPduTree=TRUE; mtp3pc; mtp3pc; cic; Action=GopStart; For=isup_leg; isup_msg=1; Action=GopStop; For=isup_leg; isup_msg=16;
wireshark/plugins/epan/mate/matelib/megaco.mate
# megaco.mate Action=PduDef; Name=mgc_pdu; Proto=megaco; Transport=ip; addr=ip.addr; megaco_ctx=megaco.context; megaco_trx=megaco.transid; megaco_msg=megaco.transaction; term=megaco.termid; Action=GopDef; Name=mgc_tr; On=mgc_pdu; addr; addr; megaco_trx; Action=GopStart; For=mgc_tr; megaco_msg|Request|Notify; Action=GopStop; For=mgc_tr; megaco_msg=Reply; Action=GopExtra; For=mgc_tr; term^DS1; megaco_ctx!Choose one;
wireshark/plugins/epan/mate/matelib/q931.mate
# q931.thing Action=PduDef; Name=q931_pdu; Proto=q931; Stop=TRUE; Transport=tcp/ip; addr=ip.addr; call_ref=q931.call_ref; q931_msg=q931.message_type; Action=GopDef; Name=q931_leg; On=q931_pdu; addr; addr; call_ref; Action=GopStart; For=q931_leg; q931_msg=5; Action=GopStop; For=q931_leg; q931_msg=90;
wireshark/plugins/epan/mate/matelib/radius.mate
# radius.mate Action=Transform; Name=radius_same_port; Mode=Insert; Match=Strict; radius_port; radius_port; Action=Transform; Name=radius_same_port; Mode=Insert; Match=Every; radius_port; .radius_port=0; Action=PduDef; Name=radius_pdu; Proto=radius; Transport=udp/ip; radius_addr=ip.addr; radius_port=udp.port; radius_id=radius.id; radius_code=radius.code; Action=PduTransform; For=radius_pdu; Name=radius_same_port; Action=GopDef; Name=radius_req; On=radius_pdu; radius_id; radius_addr; radius_addr; radius_port; radius_port; Action=GopStart; For=radius_req; radius_code|1|4|7; Action=GopStop; For=radius_req; radius_code|2|3|5|8|9;
wireshark/plugins/epan/mate/matelib/rtsp.mate
# rtsp.mate Action=PduDef; Name=rtsp_pdu; Proto=rtsp; Transport=tcp/ip; addr=ip.addr; port=tcp.port; rtsp_method=rtsp.method; Action=PduExtra; For=rtsp_pdu; rtsp_ses=rtsp.session; rtsp_url=rtsp.url; Action=GopDef; Name=rtsp_ses; On=rtsp_pdu; addr; addr; port; port; Action=GopStart; For=rtsp_ses; rtsp_method=DESCRIBE; Action=GopStop; For=rtsp_ses; rtsp_method=TEARDOWN; Action=GopExtra; For=rtsp_ses; rtsp_ses; rtsp_url;
wireshark/plugins/epan/mate/matelib/sip.mate
# sip.mate Action=PduDef; Name=sip_pdu; Proto=sip; Transport=tcp/ip; addr=ip.addr; port=tcp.port; sip_method=sip.Method; sip_callid=sip.Call-ID; calling=sdp.owner.username; Action=GopDef; Name=sip_leg; On=sip_pdu; addr; addr; port; port; Action=GopStart; For=sip_leg; sip_method=INVITE; Action=GopStop; For=sip_leg; sip_method=BYE; Action=PduDef; Name=sip_trunk_pdu; Proto=sip; Transport=udp/ip; addr=ip.addr; port=udp.port; sip_method=sip.Method; sip_callid=sip.Call-ID; calling=sdp.owner.username; Action=GopDef; Name=sip_trunk_leg; On=sip_trunk_pdu; addr; addr; sip_callid; Action=GopStart; For=sip_trunk_leg; sip_method=INVITE; Action=GopStop; For=sip_trunk_leg; sip_method=BYE;
wireshark/plugins/epan/opcua/AUTHORS
Authors : Gerhard Gappmeier <[email protected]> Hannes Mezger <[email protected]> ascolab GmbH http://www.ascolab.com
wireshark/plugins/epan/opcua/ChangeLog
Overview of changes in OpcUa plugin: Version 0.0.1: * initial implementation without security Version 1.0.0: * released implementation that works for OPC UA V1.0. - The protocol is not compatible to the previous version. Transport-layer, security-layer as well as the application-layer data types have changed. - This implementation is compliant to "OPC UA Part 6 - Mappings 1.00 Specification" - The security-layer is always present, but this plugin can only decode communication with security policy http://opcfoundation.org/UA/SecurityPolicy#None, which means that neither encryption nor signing is active.
Text
wireshark/plugins/epan/opcua/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(opcua 1 0 0 0) set(DISSECTOR_SRC opcua.c ) set(DISSECTOR_SUPPORT_SRC opcua_transport_layer.c opcua_security_layer.c opcua_application_layer.c opcua_serviceparser.c opcua_complextypeparser.c opcua_enumparser.c opcua_simpletypes.c opcua_servicetable.c opcua_extensionobjecttable.c opcua_hfindeces.c opcua_statuscode.c ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) add_wireshark_plugin_library(opcua epan) target_link_libraries(opcua epan) install_plugin(opcua epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME opcua SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ${DISSECTOR_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
wireshark/plugins/epan/opcua/Doxyfile
# Doxyfile 1.4.1-KDevelop #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = opcua.kdevelop PROJECT_NUMBER = $VERSION$ OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = YES STRIP_FROM_PATH = /home/gergap/ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = /home/gergap/work/wireshark/plugins/opcua FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.mm \ *.dox \ *.C \ *.CC \ *.C++ \ *.II \ *.I++ \ *.H \ *.HH \ *.H++ \ *.CS \ *.PHP \ *.PHP3 \ *.M \ *.MM \ *.C \ *.H \ *.tlh \ *.diff \ *.patch \ *.moc \ *.xpm \ *.dox RECURSIVE = yes EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = YES LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = yes XML_OUTPUT = xml XML_SCHEMA = XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = opcua.tag ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO
C
wireshark/plugins/epan/opcua/opcua.c
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Protocol Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include <epan/reassemble.h> #include <epan/dissectors/packet-tcp.h> #include "opcua_transport_layer.h" #include "opcua_security_layer.h" #include "opcua_application_layer.h" #include "opcua_complextypeparser.h" #include "opcua_serviceparser.h" #include "opcua_enumparser.h" #include "opcua_simpletypes.h" #include "opcua_hfindeces.h" void proto_register_opcua(void); extern const value_string g_requesttypes[]; extern const int g_NumServices; /* forward reference */ void proto_reg_handoff_opcua(void); /* declare parse function pointer */ typedef int (*FctParse)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int proto_opcua = -1; static dissector_handle_t opcua_handle; /** Official IANA registered port for OPC UA Binary Protocol. */ #define OPCUA_PORT_RANGE "4840" /** subtree types used in opcua_transport_layer.c */ gint ett_opcua_extensionobject = -1; gint ett_opcua_nodeid = -1; /** subtree types used locally */ static gint ett_opcua_transport = -1; static gint ett_opcua_fragment = -1; static gint ett_opcua_fragments = -1; static int hf_opcua_fragments = -1; static int hf_opcua_fragment = -1; static int hf_opcua_fragment_overlap = -1; static int hf_opcua_fragment_overlap_conflicts = -1; static int hf_opcua_fragment_multiple_tails = -1; static int hf_opcua_fragment_too_long_fragment = -1; static int hf_opcua_fragment_error = -1; static int hf_opcua_fragment_count = -1; static int hf_opcua_reassembled_in = -1; static int hf_opcua_reassembled_length = -1; static const fragment_items opcua_frag_items = { /* Fragment subtrees */ &ett_opcua_fragment, &ett_opcua_fragments, /* Fragment fields */ &hf_opcua_fragments, &hf_opcua_fragment, &hf_opcua_fragment_overlap, &hf_opcua_fragment_overlap_conflicts, &hf_opcua_fragment_multiple_tails, &hf_opcua_fragment_too_long_fragment, &hf_opcua_fragment_error, &hf_opcua_fragment_count, /* Reassembled in field */ &hf_opcua_reassembled_in, /* Reassembled length field */ &hf_opcua_reassembled_length, /* Reassembled data field */ NULL, /* Tag */ "Message fragments" }; static reassembly_table opcua_reassembly_table; /** OpcUa Transport Message Types */ enum MessageType { MSG_HELLO = 0, MSG_ACKNOWLEDGE, MSG_ERROR, MSG_REVERSEHELLO, MSG_MESSAGE, MSG_OPENSECURECHANNEL, MSG_CLOSESECURECHANNEL, MSG_INVALID }; /** OpcUa Transport Message Type Names */ static const char* g_szMessageTypes[] = { "Hello message", "Acknowledge message", "Error message", "Reverse Hello message", "UA Secure Conversation Message", "OpenSecureChannel message", "CloseSecureChannel message", "Invalid message" }; /** header length that is needed to compute * the pdu length. * @see get_opcua_message_len */ #define FRAME_HEADER_LEN 8 /** returns the length of an OpcUa message. * This function reads the length information from * the transport header. */ static guint get_opcua_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) { gint32 plen; /* the message length starts at offset 4 */ plen = tvb_get_letohl(tvb, offset + 4); return plen; } /** The OpcUa message dissector. * This method dissects full OpcUa messages. * It gets only called with reassembled data * from tcp_dissect_pdus. */ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { FctParse pfctParse = NULL; enum MessageType msgtype = MSG_INVALID; col_set_str(pinfo->cinfo, COL_PROTOCOL, "OpcUa"); /* parse message type */ if (tvb_memeql(tvb, 0, (const guint8 * )"HEL", 3) == 0) { msgtype = MSG_HELLO; pfctParse = parseHello; } else if (tvb_memeql(tvb, 0, (const guint8*)"ACK", 3) == 0) { msgtype = MSG_ACKNOWLEDGE; pfctParse = parseAcknowledge; } else if (tvb_memeql(tvb, 0, (const guint8*)"ERR", 3) == 0) { msgtype = MSG_ERROR; pfctParse = parseError; } else if (tvb_memeql(tvb, 0, (const guint8*)"RHE", 3) == 0) { msgtype = MSG_REVERSEHELLO; pfctParse = parseReverseHello; } else if (tvb_memeql(tvb, 0, (const guint8*)"MSG", 3) == 0) { msgtype = MSG_MESSAGE; pfctParse = parseMessage; } else if (tvb_memeql(tvb, 0, (const guint8*)"OPN", 3) == 0) { msgtype = MSG_OPENSECURECHANNEL; pfctParse = parseOpenSecureChannel; } else if (tvb_memeql(tvb, 0, (const guint8*)"CLO", 3) == 0) { msgtype = MSG_CLOSESECURECHANNEL; pfctParse = parseCloseSecureChannel; } else { msgtype = MSG_INVALID; /* Clear out stuff in the info column */ col_set_str(pinfo->cinfo, COL_INFO, g_szMessageTypes[msgtype]); /* add empty item to make filtering by 'opcua' work */ proto_tree_add_item(tree, proto_opcua, tvb, 0, -1, ENC_NA); return tvb_reported_length(tvb); } /* Clear out stuff in the info column */ col_set_str(pinfo->cinfo, COL_INFO, g_szMessageTypes[msgtype]); if (pfctParse) { gint offset = 0; int iServiceId = -1; tvbuff_t *next_tvb = tvb; gboolean bParseService = TRUE; gboolean bIsLastFragment = FALSE; /* we are being asked for details */ proto_item *ti = NULL; proto_tree *transport_tree = NULL; ti = proto_tree_add_item(tree, proto_opcua, tvb, 0, -1, ENC_NA); transport_tree = proto_item_add_subtree(ti, ett_opcua_transport); /* MSG_MESSAGE might be fragmented, check for that */ if (msgtype == MSG_MESSAGE) { guint8 chunkType = 0; guint32 opcua_seqid = 0; guint32 opcua_num = 0; guint32 opcua_seqnum; fragment_head *frag_msg = NULL; fragment_item *frag_i = NULL; offset = 3; chunkType = tvb_get_guint8(tvb, offset); offset += 1; offset += 4; /* Message Size */ offset += 4; /* SecureChannelId */ offset += 4; /* Security Token Id */ opcua_num = tvb_get_letohl(tvb, offset); offset += 4; /* Security Sequence Number */ opcua_seqid = tvb_get_letohl(tvb, offset); offset += 4; /* Security RequestId */ if (chunkType == 'A') { fragment_delete(&opcua_reassembly_table, pinfo, opcua_seqid, NULL); col_clear_fence(pinfo->cinfo, COL_INFO); col_set_str(pinfo->cinfo, COL_INFO, "Abort message"); offset = 0; (*pfctParse)(transport_tree, tvb, pinfo, &offset); parseAbort(transport_tree, tvb, pinfo, &offset); return tvb_reported_length(tvb); } /* check if tvb is part of a chunked message: the UA protocol does not tell us that, so we look into opcua_reassembly_table if the opcua_seqid belongs to a chunked message */ frag_msg = fragment_get(&opcua_reassembly_table, pinfo, opcua_seqid, NULL); if (frag_msg == NULL) { frag_msg = fragment_get_reassembled_id(&opcua_reassembly_table, pinfo, opcua_seqid); } if (frag_msg != NULL || chunkType != 'F') { gboolean bSaveFragmented = pinfo->fragmented; gboolean bMoreFragments = TRUE; tvbuff_t *new_tvb = NULL; pinfo->fragmented = TRUE; if (frag_msg == NULL) { /* first fragment */ opcua_seqnum = 0; } else { /* the UA protocol does not number the chunks beginning from 0 but from a arbitrary value, so we have to fake the numbers in the stored fragments. this way Wireshark reassembles the message, as it expects the fragment sequence numbers to start at 0 */ for (frag_i = frag_msg->next; frag_i; frag_i = frag_i->next) {} if (frag_i) { opcua_seqnum = frag_i->offset + 1; } else { /* We should never have a fragment head with no fragment items, but * just in case. */ opcua_seqnum = 0; } if (chunkType == 'F') { bMoreFragments = FALSE; } } frag_msg = fragment_add_seq_check(&opcua_reassembly_table, tvb, offset, pinfo, opcua_seqid, /* ID for fragments belonging together */ NULL, opcua_seqnum, /* fragment sequence number */ tvb_captured_length_remaining(tvb, offset), /* fragment length - to the end */ bMoreFragments); /* More fragments? */ new_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled Message", frag_msg, &opcua_frag_items, NULL, transport_tree); if (new_tvb) { /* Reassembled */ bIsLastFragment = TRUE; } else { /* Not last packet of reassembled UA message */ col_append_fstr(pinfo->cinfo, COL_INFO, " (Message fragment %u)", opcua_num); } if (new_tvb) { /* take it all */ next_tvb = new_tvb; } else { /* only show transport header */ bParseService = FALSE; next_tvb = tvb_new_subset_remaining(tvb, 0); } pinfo->fragmented = bSaveFragmented; } } offset = 0; /* call the transport message dissector */ iServiceId = (*pfctParse)(transport_tree, tvb, pinfo, &offset); /* parse the service if not chunked or last chunk */ if (msgtype == MSG_MESSAGE && bParseService) { if (bIsLastFragment != FALSE) { offset = 0; } iServiceId = parseService(transport_tree, next_tvb, pinfo, &offset); } /* display the service type in addition to the message type */ if (iServiceId != -1) { const gchar *szServiceName = val_to_str((guint32)iServiceId, g_requesttypes, "ServiceId %d"); if (bIsLastFragment == FALSE) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", g_szMessageTypes[msgtype], szServiceName); } else { col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s (Message Reassembled)", g_szMessageTypes[msgtype], szServiceName); } } } return tvb_reported_length(tvb); } /** The main OpcUa dissector functions. * It uses tcp_dissect_pdus from packet-tcp.h * to reassemble the TCP data. */ static int dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN, get_opcua_message_len, dissect_opcua_message, data); return tvb_reported_length(tvb); } /** plugin entry functions. * This registers the OpcUa protocol. */ void proto_register_opcua(void) { static hf_register_info hf[] = { /* id full name abbreviation type display strings bitmask blurb HFILL */ {&hf_opcua_fragments, {"Message fragments", "opcua.fragments", FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment, {"Message fragment", "opcua.fragment", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_overlap, {"Message fragment overlap", "opcua.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_overlap_conflicts, {"Message fragment overlapping with conflicting data", "opcua.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_multiple_tails, {"Message has multiple tail fragments", "opcua.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_too_long_fragment, {"Message fragment too long", "opcua.fragment.too_long_fragment", FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_error, {"Message defragmentation error", "opcua.fragment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_fragment_count, {"Message fragment count", "opcua.fragment.count", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_reassembled_in, {"Reassembled in", "opcua.reassembled.in", FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}}, {&hf_opcua_reassembled_length, {"Reassembled length", "opcua.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL}} }; /** Setup protocol subtree array */ static gint *ett[] = { &ett_opcua_extensionobject, &ett_opcua_nodeid, &ett_opcua_transport, &ett_opcua_fragment, &ett_opcua_fragments }; proto_opcua = proto_register_protocol("OpcUa Binary Protocol", "OpcUa", "opcua"); opcua_handle = register_dissector("opcua", dissect_opcua, proto_opcua); registerTransportLayerTypes(proto_opcua); registerSecurityLayerTypes(proto_opcua); registerApplicationLayerTypes(proto_opcua); registerSimpleTypes(proto_opcua); registerEnumTypes(proto_opcua); registerComplexTypes(); registerServiceTypes(); registerFieldTypes(proto_opcua); proto_register_subtree_array(ett, array_length(ett)); proto_register_field_array(proto_opcua, hf, array_length(hf)); reassembly_table_register(&opcua_reassembly_table, &addresses_reassembly_table_functions); } void proto_reg_handoff_opcua(void) { dissector_add_uint_range_with_preference("tcp.port", OPCUA_PORT_RANGE, opcua_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/opcua/opcua_application_layer.c
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Application Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_application_layer.h" /** NodeId encoding mask table */ static const value_string g_nodeidmasks[] = { { 0x00, "Two byte encoded Numeric" }, { 0x01, "Four byte encoded Numeric" }, { 0x02, "Numeric of arbitrary length" }, { 0x03, "String" }, { 0x04, "GUID" }, { 0x05, "Opaque" }, { 0, NULL } }; /** Service type table */ extern const value_string g_requesttypes[]; static int hf_opcua_nodeid_encodingmask = -1; static int hf_opcua_app_nsid = -1; static int hf_opcua_app_numeric = -1; /** Register application layer types. */ void registerApplicationLayerTypes(int proto) { /** header field definitions */ static hf_register_info hf[] = { /* id full name abbreviation type display strings bitmask blurb HFILL */ {&hf_opcua_nodeid_encodingmask, {"NodeId EncodingMask", "opcua.servicenodeid.encodingmask", FT_UINT8, BASE_HEX, VALS(g_nodeidmasks), 0x0, NULL, HFILL}}, {&hf_opcua_app_nsid, {"NodeId Namespace Index", "opcua.servicenodeid.nsid", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_app_numeric, {"NodeId Identifier Numeric", "opcua.servicenodeid.numeric", FT_UINT32, BASE_DEC, VALS(g_requesttypes), 0x0, NULL, HFILL}} }; proto_register_field_array(proto, hf, array_length(hf)); } /** Parses an OpcUa Service NodeId and returns the service type. * In this cases the NodeId is always from type numeric and NSId = 0. */ int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) { gint iOffset = *pOffset; guint8 EncodingMask; guint32 Numeric = 0; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset++; switch(EncodingMask) { case 0x00: /* two byte node id */ Numeric = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; break; case 0x01: /* four byte node id */ proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; Numeric = tvb_get_letohs(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; Numeric = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 4, ENC_LITTLE_ENDIAN); iOffset+=4; break; case 0x03: /* string */ case 0x04: /* guid */ case 0x05: /* opaque*/ /* NOT USED */ break; }; *pOffset = iOffset; return Numeric; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/opcua/opcua_application_layer.h
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Application Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ void registerApplicationLayerTypes(int proto); /* Ua type parsers */ int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset);
C
wireshark/plugins/epan/opcua/opcua_complextypeparser.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Complex Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_complextypeparser.h" #include "opcua_enumparser.h" #include "opcua_simpletypes.h" #include "opcua_hfindeces.h" gint ett_opcua_TrustListDataType = -1; gint ett_opcua_array_TrustListDataType = -1; gint ett_opcua_Node = -1; gint ett_opcua_array_Node = -1; gint ett_opcua_InstanceNode = -1; gint ett_opcua_array_InstanceNode = -1; gint ett_opcua_TypeNode = -1; gint ett_opcua_array_TypeNode = -1; gint ett_opcua_ObjectNode = -1; gint ett_opcua_array_ObjectNode = -1; gint ett_opcua_ObjectTypeNode = -1; gint ett_opcua_array_ObjectTypeNode = -1; gint ett_opcua_VariableNode = -1; gint ett_opcua_array_VariableNode = -1; gint ett_opcua_VariableTypeNode = -1; gint ett_opcua_array_VariableTypeNode = -1; gint ett_opcua_ReferenceTypeNode = -1; gint ett_opcua_array_ReferenceTypeNode = -1; gint ett_opcua_MethodNode = -1; gint ett_opcua_array_MethodNode = -1; gint ett_opcua_ViewNode = -1; gint ett_opcua_array_ViewNode = -1; gint ett_opcua_DataTypeNode = -1; gint ett_opcua_array_DataTypeNode = -1; gint ett_opcua_ReferenceNode = -1; gint ett_opcua_array_ReferenceNode = -1; gint ett_opcua_Argument = -1; gint ett_opcua_array_Argument = -1; gint ett_opcua_EnumValueType = -1; gint ett_opcua_array_EnumValueType = -1; gint ett_opcua_OptionSet = -1; gint ett_opcua_array_OptionSet = -1; gint ett_opcua_TimeZoneDataType = -1; gint ett_opcua_array_TimeZoneDataType = -1; gint ett_opcua_ApplicationDescription = -1; gint ett_opcua_array_ApplicationDescription = -1; gint ett_opcua_RequestHeader = -1; gint ett_opcua_array_RequestHeader = -1; gint ett_opcua_ResponseHeader = -1; gint ett_opcua_array_ResponseHeader = -1; gint ett_opcua_ServerOnNetwork = -1; gint ett_opcua_array_ServerOnNetwork = -1; gint ett_opcua_UserTokenPolicy = -1; gint ett_opcua_array_UserTokenPolicy = -1; gint ett_opcua_EndpointDescription = -1; gint ett_opcua_array_EndpointDescription = -1; gint ett_opcua_RegisteredServer = -1; gint ett_opcua_array_RegisteredServer = -1; gint ett_opcua_MdnsDiscoveryConfiguration = -1; gint ett_opcua_array_MdnsDiscoveryConfiguration = -1; gint ett_opcua_ChannelSecurityToken = -1; gint ett_opcua_array_ChannelSecurityToken = -1; gint ett_opcua_SignedSoftwareCertificate = -1; gint ett_opcua_array_SignedSoftwareCertificate = -1; gint ett_opcua_SignatureData = -1; gint ett_opcua_array_SignatureData = -1; gint ett_opcua_UserIdentityToken = -1; gint ett_opcua_array_UserIdentityToken = -1; gint ett_opcua_AnonymousIdentityToken = -1; gint ett_opcua_array_AnonymousIdentityToken = -1; gint ett_opcua_UserNameIdentityToken = -1; gint ett_opcua_array_UserNameIdentityToken = -1; gint ett_opcua_X509IdentityToken = -1; gint ett_opcua_array_X509IdentityToken = -1; gint ett_opcua_KerberosIdentityToken = -1; gint ett_opcua_array_KerberosIdentityToken = -1; gint ett_opcua_IssuedIdentityToken = -1; gint ett_opcua_array_IssuedIdentityToken = -1; gint ett_opcua_NodeAttributes = -1; gint ett_opcua_array_NodeAttributes = -1; gint ett_opcua_ObjectAttributes = -1; gint ett_opcua_array_ObjectAttributes = -1; gint ett_opcua_VariableAttributes = -1; gint ett_opcua_array_VariableAttributes = -1; gint ett_opcua_MethodAttributes = -1; gint ett_opcua_array_MethodAttributes = -1; gint ett_opcua_ObjectTypeAttributes = -1; gint ett_opcua_array_ObjectTypeAttributes = -1; gint ett_opcua_VariableTypeAttributes = -1; gint ett_opcua_array_VariableTypeAttributes = -1; gint ett_opcua_ReferenceTypeAttributes = -1; gint ett_opcua_array_ReferenceTypeAttributes = -1; gint ett_opcua_DataTypeAttributes = -1; gint ett_opcua_array_DataTypeAttributes = -1; gint ett_opcua_ViewAttributes = -1; gint ett_opcua_array_ViewAttributes = -1; gint ett_opcua_AddNodesItem = -1; gint ett_opcua_array_AddNodesItem = -1; gint ett_opcua_AddNodesResult = -1; gint ett_opcua_array_AddNodesResult = -1; gint ett_opcua_AddReferencesItem = -1; gint ett_opcua_array_AddReferencesItem = -1; gint ett_opcua_DeleteNodesItem = -1; gint ett_opcua_array_DeleteNodesItem = -1; gint ett_opcua_DeleteReferencesItem = -1; gint ett_opcua_array_DeleteReferencesItem = -1; gint ett_opcua_ViewDescription = -1; gint ett_opcua_array_ViewDescription = -1; gint ett_opcua_BrowseDescription = -1; gint ett_opcua_array_BrowseDescription = -1; gint ett_opcua_ReferenceDescription = -1; gint ett_opcua_array_ReferenceDescription = -1; gint ett_opcua_BrowseResult = -1; gint ett_opcua_array_BrowseResult = -1; gint ett_opcua_RelativePathElement = -1; gint ett_opcua_array_RelativePathElement = -1; gint ett_opcua_RelativePath = -1; gint ett_opcua_array_RelativePath = -1; gint ett_opcua_BrowsePath = -1; gint ett_opcua_array_BrowsePath = -1; gint ett_opcua_BrowsePathTarget = -1; gint ett_opcua_array_BrowsePathTarget = -1; gint ett_opcua_BrowsePathResult = -1; gint ett_opcua_array_BrowsePathResult = -1; gint ett_opcua_EndpointConfiguration = -1; gint ett_opcua_array_EndpointConfiguration = -1; gint ett_opcua_SupportedProfile = -1; gint ett_opcua_array_SupportedProfile = -1; gint ett_opcua_SoftwareCertificate = -1; gint ett_opcua_array_SoftwareCertificate = -1; gint ett_opcua_QueryDataDescription = -1; gint ett_opcua_array_QueryDataDescription = -1; gint ett_opcua_NodeTypeDescription = -1; gint ett_opcua_array_NodeTypeDescription = -1; gint ett_opcua_QueryDataSet = -1; gint ett_opcua_array_QueryDataSet = -1; gint ett_opcua_NodeReference = -1; gint ett_opcua_array_NodeReference = -1; gint ett_opcua_ContentFilterElement = -1; gint ett_opcua_array_ContentFilterElement = -1; gint ett_opcua_ContentFilter = -1; gint ett_opcua_array_ContentFilter = -1; gint ett_opcua_ElementOperand = -1; gint ett_opcua_array_ElementOperand = -1; gint ett_opcua_LiteralOperand = -1; gint ett_opcua_array_LiteralOperand = -1; gint ett_opcua_AttributeOperand = -1; gint ett_opcua_array_AttributeOperand = -1; gint ett_opcua_SimpleAttributeOperand = -1; gint ett_opcua_array_SimpleAttributeOperand = -1; gint ett_opcua_ContentFilterElementResult = -1; gint ett_opcua_array_ContentFilterElementResult = -1; gint ett_opcua_ContentFilterResult = -1; gint ett_opcua_array_ContentFilterResult = -1; gint ett_opcua_ParsingResult = -1; gint ett_opcua_array_ParsingResult = -1; gint ett_opcua_ReadValueId = -1; gint ett_opcua_array_ReadValueId = -1; gint ett_opcua_HistoryReadValueId = -1; gint ett_opcua_array_HistoryReadValueId = -1; gint ett_opcua_HistoryReadResult = -1; gint ett_opcua_array_HistoryReadResult = -1; gint ett_opcua_ReadEventDetails = -1; gint ett_opcua_array_ReadEventDetails = -1; gint ett_opcua_ReadRawModifiedDetails = -1; gint ett_opcua_array_ReadRawModifiedDetails = -1; gint ett_opcua_ReadProcessedDetails = -1; gint ett_opcua_array_ReadProcessedDetails = -1; gint ett_opcua_ReadAtTimeDetails = -1; gint ett_opcua_array_ReadAtTimeDetails = -1; gint ett_opcua_HistoryData = -1; gint ett_opcua_array_HistoryData = -1; gint ett_opcua_ModificationInfo = -1; gint ett_opcua_array_ModificationInfo = -1; gint ett_opcua_HistoryModifiedData = -1; gint ett_opcua_array_HistoryModifiedData = -1; gint ett_opcua_HistoryEvent = -1; gint ett_opcua_array_HistoryEvent = -1; gint ett_opcua_WriteValue = -1; gint ett_opcua_array_WriteValue = -1; gint ett_opcua_HistoryUpdateDetails = -1; gint ett_opcua_array_HistoryUpdateDetails = -1; gint ett_opcua_UpdateDataDetails = -1; gint ett_opcua_array_UpdateDataDetails = -1; gint ett_opcua_UpdateStructureDataDetails = -1; gint ett_opcua_array_UpdateStructureDataDetails = -1; gint ett_opcua_UpdateEventDetails = -1; gint ett_opcua_array_UpdateEventDetails = -1; gint ett_opcua_DeleteRawModifiedDetails = -1; gint ett_opcua_array_DeleteRawModifiedDetails = -1; gint ett_opcua_DeleteAtTimeDetails = -1; gint ett_opcua_array_DeleteAtTimeDetails = -1; gint ett_opcua_DeleteEventDetails = -1; gint ett_opcua_array_DeleteEventDetails = -1; gint ett_opcua_HistoryUpdateResult = -1; gint ett_opcua_array_HistoryUpdateResult = -1; gint ett_opcua_CallMethodRequest = -1; gint ett_opcua_array_CallMethodRequest = -1; gint ett_opcua_CallMethodResult = -1; gint ett_opcua_array_CallMethodResult = -1; gint ett_opcua_DataChangeFilter = -1; gint ett_opcua_array_DataChangeFilter = -1; gint ett_opcua_EventFilter = -1; gint ett_opcua_array_EventFilter = -1; gint ett_opcua_AggregateConfiguration = -1; gint ett_opcua_array_AggregateConfiguration = -1; gint ett_opcua_AggregateFilter = -1; gint ett_opcua_array_AggregateFilter = -1; gint ett_opcua_EventFilterResult = -1; gint ett_opcua_array_EventFilterResult = -1; gint ett_opcua_AggregateFilterResult = -1; gint ett_opcua_array_AggregateFilterResult = -1; gint ett_opcua_MonitoringParameters = -1; gint ett_opcua_array_MonitoringParameters = -1; gint ett_opcua_MonitoredItemCreateRequest = -1; gint ett_opcua_array_MonitoredItemCreateRequest = -1; gint ett_opcua_MonitoredItemCreateResult = -1; gint ett_opcua_array_MonitoredItemCreateResult = -1; gint ett_opcua_MonitoredItemModifyRequest = -1; gint ett_opcua_array_MonitoredItemModifyRequest = -1; gint ett_opcua_MonitoredItemModifyResult = -1; gint ett_opcua_array_MonitoredItemModifyResult = -1; gint ett_opcua_NotificationMessage = -1; gint ett_opcua_array_NotificationMessage = -1; gint ett_opcua_DataChangeNotification = -1; gint ett_opcua_array_DataChangeNotification = -1; gint ett_opcua_MonitoredItemNotification = -1; gint ett_opcua_array_MonitoredItemNotification = -1; gint ett_opcua_EventNotificationList = -1; gint ett_opcua_array_EventNotificationList = -1; gint ett_opcua_EventFieldList = -1; gint ett_opcua_array_EventFieldList = -1; gint ett_opcua_HistoryEventFieldList = -1; gint ett_opcua_array_HistoryEventFieldList = -1; gint ett_opcua_StatusChangeNotification = -1; gint ett_opcua_array_StatusChangeNotification = -1; gint ett_opcua_SubscriptionAcknowledgement = -1; gint ett_opcua_array_SubscriptionAcknowledgement = -1; gint ett_opcua_TransferResult = -1; gint ett_opcua_array_TransferResult = -1; gint ett_opcua_ScalarTestType = -1; gint ett_opcua_array_ScalarTestType = -1; gint ett_opcua_ArrayTestType = -1; gint ett_opcua_array_ArrayTestType = -1; gint ett_opcua_CompositeTestType = -1; gint ett_opcua_array_CompositeTestType = -1; gint ett_opcua_BuildInfo = -1; gint ett_opcua_array_BuildInfo = -1; gint ett_opcua_RedundantServerDataType = -1; gint ett_opcua_array_RedundantServerDataType = -1; gint ett_opcua_EndpointUrlListDataType = -1; gint ett_opcua_array_EndpointUrlListDataType = -1; gint ett_opcua_NetworkGroupDataType = -1; gint ett_opcua_array_NetworkGroupDataType = -1; gint ett_opcua_SamplingIntervalDiagnosticsDataType = -1; gint ett_opcua_array_SamplingIntervalDiagnosticsDataType = -1; gint ett_opcua_ServerDiagnosticsSummaryDataType = -1; gint ett_opcua_array_ServerDiagnosticsSummaryDataType = -1; gint ett_opcua_ServerStatusDataType = -1; gint ett_opcua_array_ServerStatusDataType = -1; gint ett_opcua_SessionDiagnosticsDataType = -1; gint ett_opcua_array_SessionDiagnosticsDataType = -1; gint ett_opcua_SessionSecurityDiagnosticsDataType = -1; gint ett_opcua_array_SessionSecurityDiagnosticsDataType = -1; gint ett_opcua_ServiceCounterDataType = -1; gint ett_opcua_array_ServiceCounterDataType = -1; gint ett_opcua_StatusResult = -1; gint ett_opcua_array_StatusResult = -1; gint ett_opcua_SubscriptionDiagnosticsDataType = -1; gint ett_opcua_array_SubscriptionDiagnosticsDataType = -1; gint ett_opcua_ModelChangeStructureDataType = -1; gint ett_opcua_array_ModelChangeStructureDataType = -1; gint ett_opcua_SemanticChangeStructureDataType = -1; gint ett_opcua_array_SemanticChangeStructureDataType = -1; gint ett_opcua_Range = -1; gint ett_opcua_array_Range = -1; gint ett_opcua_EUInformation = -1; gint ett_opcua_array_EUInformation = -1; gint ett_opcua_ComplexNumberType = -1; gint ett_opcua_array_ComplexNumberType = -1; gint ett_opcua_DoubleComplexNumberType = -1; gint ett_opcua_array_DoubleComplexNumberType = -1; gint ett_opcua_AxisInformation = -1; gint ett_opcua_array_AxisInformation = -1; gint ett_opcua_XVType = -1; gint ett_opcua_array_XVType = -1; gint ett_opcua_ProgramDiagnosticDataType = -1; gint ett_opcua_array_ProgramDiagnosticDataType = -1; gint ett_opcua_Annotation = -1; gint ett_opcua_array_Annotation = -1; void parseTrustListDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_TrustListDataType, &ti, "%s: TrustListDataType", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedLists); /* Array length field ignored: NoOfTrustedCertificates */ parseArraySimple(subtree, tvb, pinfo, pOffset, "TrustedCertificates", "ByteString", hf_opcua_TrustedCertificates, parseByteString, ett_opcua_array_ByteString); /* Array length field ignored: NoOfTrustedCrls */ parseArraySimple(subtree, tvb, pinfo, pOffset, "TrustedCrls", "ByteString", hf_opcua_TrustedCrls, parseByteString, ett_opcua_array_ByteString); /* Array length field ignored: NoOfIssuerCertificates */ parseArraySimple(subtree, tvb, pinfo, pOffset, "IssuerCertificates", "ByteString", hf_opcua_IssuerCertificates, parseByteString, ett_opcua_array_ByteString); /* Array length field ignored: NoOfIssuerCrls */ parseArraySimple(subtree, tvb, pinfo, pOffset, "IssuerCrls", "ByteString", hf_opcua_IssuerCrls, parseByteString, ett_opcua_array_ByteString); proto_item_set_end(ti, tvb, *pOffset); } void parseNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_Node, &ti, "%s: Node", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); proto_item_set_end(ti, tvb, *pOffset); } void parseInstanceNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_InstanceNode, &ti, "%s: InstanceNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); proto_item_set_end(ti, tvb, *pOffset); } void parseTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_TypeNode, &ti, "%s: TypeNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); proto_item_set_end(ti, tvb, *pOffset); } void parseObjectNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ObjectNode, &ti, "%s: ObjectNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_EventNotifier); proto_item_set_end(ti, tvb, *pOffset); } void parseObjectTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ObjectTypeNode, &ti, "%s: ObjectTypeNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseVariableNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_VariableNode, &ti, "%s: VariableNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseVariant(subtree, tvb, pinfo, pOffset, "Value"); parseNodeId(subtree, tvb, pinfo, pOffset, "DataType"); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ValueRank); /* Array length field ignored: NoOfArrayDimensions */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ArrayDimensions", "UInt32", hf_opcua_ArrayDimensions, parseUInt32, ett_opcua_array_UInt32); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_AccessLevel); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_UserAccessLevel); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_MinimumSamplingInterval); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Historizing); proto_item_set_end(ti, tvb, *pOffset); } void parseVariableTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_VariableTypeNode, &ti, "%s: VariableTypeNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseVariant(subtree, tvb, pinfo, pOffset, "Value"); parseNodeId(subtree, tvb, pinfo, pOffset, "DataType"); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ValueRank); /* Array length field ignored: NoOfArrayDimensions */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ArrayDimensions", "UInt32", hf_opcua_ArrayDimensions, parseUInt32, ett_opcua_array_UInt32); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseReferenceTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReferenceTypeNode, &ti, "%s: ReferenceTypeNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Symmetric); parseLocalizedText(subtree, tvb, pinfo, pOffset, "InverseName"); proto_item_set_end(ti, tvb, *pOffset); } void parseMethodNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MethodNode, &ti, "%s: MethodNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Executable); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UserExecutable); proto_item_set_end(ti, tvb, *pOffset); } void parseViewNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ViewNode, &ti, "%s: ViewNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ContainsNoLoops); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_EventNotifier); proto_item_set_end(ti, tvb, *pOffset); } void parseDataTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DataTypeNode, &ti, "%s: DataTypeNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceNode", parseReferenceNode, ett_opcua_array_ReferenceNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseReferenceNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReferenceNode, &ti, "%s: ReferenceNode", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsInverse); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TargetId"); proto_item_set_end(ti, tvb, *pOffset); } void parseArgument(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_Argument, &ti, "%s: Argument", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Name); parseNodeId(subtree, tvb, pinfo, pOffset, "DataType"); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ValueRank); /* Array length field ignored: NoOfArrayDimensions */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ArrayDimensions", "UInt32", hf_opcua_ArrayDimensions, parseUInt32, ett_opcua_array_UInt32); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); proto_item_set_end(ti, tvb, *pOffset); } void parseEnumValueType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EnumValueType, &ti, "%s: EnumValueType", szFieldName); parseInt64(subtree, tvb, pinfo, pOffset, hf_opcua_Value); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); proto_item_set_end(ti, tvb, *pOffset); } void parseOptionSet(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_OptionSet, &ti, "%s: OptionSet", szFieldName); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_Value); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ValidBits); proto_item_set_end(ti, tvb, *pOffset); } void parseTimeZoneDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_TimeZoneDataType, &ti, "%s: TimeZoneDataType", szFieldName); parseInt16(subtree, tvb, pinfo, pOffset, hf_opcua_Offset); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_DaylightSavingInOffset); proto_item_set_end(ti, tvb, *pOffset); } void parseApplicationDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ApplicationDescription, &ti, "%s: ApplicationDescription", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ApplicationUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductUri); parseLocalizedText(subtree, tvb, pinfo, pOffset, "ApplicationName"); parseApplicationType(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_GatewayServerUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_DiscoveryProfileUri); /* Array length field ignored: NoOfDiscoveryUrls */ parseArraySimple(subtree, tvb, pinfo, pOffset, "DiscoveryUrls", "String", hf_opcua_DiscoveryUrls, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseRequestHeader(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const returnDiagnostics_mask[] = { &hf_opcua_returnDiag_mask_sl_symbolicId, &hf_opcua_returnDiag_mask_sl_localizedText, &hf_opcua_returnDiag_mask_sl_additionalinfo, &hf_opcua_returnDiag_mask_sl_innerstatuscode, &hf_opcua_returnDiag_mask_sl_innerdiagnostics, &hf_opcua_returnDiag_mask_ol_symbolicId, &hf_opcua_returnDiag_mask_ol_localizedText, &hf_opcua_returnDiag_mask_ol_additionalinfo, &hf_opcua_returnDiag_mask_ol_innerstatuscode, &hf_opcua_returnDiag_mask_ol_innerdiagnostics, NULL}; proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_RequestHeader, &ti, "%s: RequestHeader", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "AuthenticationToken"); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_Timestamp); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestHandle); proto_tree_add_bitmask(subtree, tvb, *pOffset, hf_opcua_returnDiag, ett_opcua_returnDiagnostics, returnDiagnostics_mask, ENC_LITTLE_ENDIAN); *pOffset += 4; parseString(subtree, tvb, pinfo, pOffset, hf_opcua_AuditEntryId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TimeoutHint); parseExtensionObject(subtree, tvb, pinfo, pOffset, "AdditionalHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseResponseHeader(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ResponseHeader, &ti, "%s: ResponseHeader", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_Timestamp); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestHandle); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_ServiceResult); parseDiagnosticInfo(subtree, tvb, pinfo, pOffset, "ServiceDiagnostics"); /* Array length field ignored: NoOfStringTable */ parseArraySimple(subtree, tvb, pinfo, pOffset, "StringTable", "String", hf_opcua_StringTable, parseString, ett_opcua_array_String); parseExtensionObject(subtree, tvb, pinfo, pOffset, "AdditionalHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseServerOnNetwork(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ServerOnNetwork, &ti, "%s: ServerOnNetwork", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RecordId); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_DiscoveryUrl); /* Array length field ignored: NoOfServerCapabilities */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ServerCapabilities", "String", hf_opcua_ServerCapabilities, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseUserTokenPolicy(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UserTokenPolicy, &ti, "%s: UserTokenPolicy", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); parseUserTokenType(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IssuedTokenType); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IssuerEndpointUrl); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityPolicyUri); proto_item_set_end(ti, tvb, *pOffset); } void parseEndpointDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EndpointDescription, &ti, "%s: EndpointDescription", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EndpointUrl); parseApplicationDescription(subtree, tvb, pinfo, pOffset, "Server"); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerCertificate); parseMessageSecurityMode(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityPolicyUri); /* Array length field ignored: NoOfUserIdentityTokens */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "UserIdentityTokens", "UserTokenPolicy", parseUserTokenPolicy, ett_opcua_array_UserTokenPolicy); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_TransportProfileUri); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityLevel); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisteredServer(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_RegisteredServer, &ti, "%s: RegisteredServer", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductUri); /* Array length field ignored: NoOfServerNames */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ServerNames", "LocalizedText", parseLocalizedText, ett_opcua_array_LocalizedText); parseApplicationType(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_GatewayServerUri); /* Array length field ignored: NoOfDiscoveryUrls */ parseArraySimple(subtree, tvb, pinfo, pOffset, "DiscoveryUrls", "String", hf_opcua_DiscoveryUrls, parseString, ett_opcua_array_String); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SemaphoreFilePath); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsOnline); proto_item_set_end(ti, tvb, *pOffset); } void parseMdnsDiscoveryConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MdnsDiscoveryConfiguration, &ti, "%s: MdnsDiscoveryConfiguration", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_MdnsServerName); /* Array length field ignored: NoOfServerCapabilities */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ServerCapabilities", "String", hf_opcua_ServerCapabilities, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseChannelSecurityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ChannelSecurityToken, &ti, "%s: ChannelSecurityToken", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ChannelId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TokenId); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_CreatedAt); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedLifetime); proto_item_set_end(ti, tvb, *pOffset); } void parseSignedSoftwareCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SignedSoftwareCertificate, &ti, "%s: SignedSoftwareCertificate", szFieldName); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_CertificateData); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_Signature); proto_item_set_end(ti, tvb, *pOffset); } void parseSignatureData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SignatureData, &ti, "%s: SignatureData", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Algorithm); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_Signature); proto_item_set_end(ti, tvb, *pOffset); } void parseUserIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UserIdentityToken, &ti, "%s: UserIdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); proto_item_set_end(ti, tvb, *pOffset); } void parseAnonymousIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AnonymousIdentityToken, &ti, "%s: AnonymousIdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); proto_item_set_end(ti, tvb, *pOffset); } void parseUserNameIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UserNameIdentityToken, &ti, "%s: UserNameIdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_UserName); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_Password); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EncryptionAlgorithm); proto_item_set_end(ti, tvb, *pOffset); } void parseX509IdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_X509IdentityToken, &ti, "%s: X509IdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_CertificateData); proto_item_set_end(ti, tvb, *pOffset); } void parseKerberosIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_KerberosIdentityToken, &ti, "%s: KerberosIdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_TicketData); proto_item_set_end(ti, tvb, *pOffset); } void parseIssuedIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_IssuedIdentityToken, &ti, "%s: IssuedIdentityToken", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_PolicyId); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_TokenData); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EncryptionAlgorithm); proto_item_set_end(ti, tvb, *pOffset); } void parseNodeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_NodeAttributes, &ti, "%s: NodeAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); proto_item_set_end(ti, tvb, *pOffset); } void parseObjectAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ObjectAttributes, &ti, "%s: ObjectAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_EventNotifier); proto_item_set_end(ti, tvb, *pOffset); } void parseVariableAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_VariableAttributes, &ti, "%s: VariableAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseVariant(subtree, tvb, pinfo, pOffset, "Value"); parseNodeId(subtree, tvb, pinfo, pOffset, "DataType"); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ValueRank); /* Array length field ignored: NoOfArrayDimensions */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ArrayDimensions", "UInt32", hf_opcua_ArrayDimensions, parseUInt32, ett_opcua_array_UInt32); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_AccessLevel); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_UserAccessLevel); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_MinimumSamplingInterval); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Historizing); proto_item_set_end(ti, tvb, *pOffset); } void parseMethodAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MethodAttributes, &ti, "%s: MethodAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Executable); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UserExecutable); proto_item_set_end(ti, tvb, *pOffset); } void parseObjectTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ObjectTypeAttributes, &ti, "%s: ObjectTypeAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseVariableTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_VariableTypeAttributes, &ti, "%s: VariableTypeAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseVariant(subtree, tvb, pinfo, pOffset, "Value"); parseNodeId(subtree, tvb, pinfo, pOffset, "DataType"); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ValueRank); /* Array length field ignored: NoOfArrayDimensions */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ArrayDimensions", "UInt32", hf_opcua_ArrayDimensions, parseUInt32, ett_opcua_array_UInt32); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseReferenceTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReferenceTypeAttributes, &ti, "%s: ReferenceTypeAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Symmetric); parseLocalizedText(subtree, tvb, pinfo, pOffset, "InverseName"); proto_item_set_end(ti, tvb, *pOffset); } void parseDataTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DataTypeAttributes, &ti, "%s: DataTypeAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsAbstract); proto_item_set_end(ti, tvb, *pOffset); } void parseViewAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ViewAttributes, &ti, "%s: ViewAttributes", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SpecifiedAttributes); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_WriteMask); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UserWriteMask); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ContainsNoLoops); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_EventNotifier); proto_item_set_end(ti, tvb, *pOffset); } void parseAddNodesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AddNodesItem, &ti, "%s: AddNodesItem", szFieldName); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "ParentNodeId"); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "RequestedNewNodeId"); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseExtensionObject(subtree, tvb, pinfo, pOffset, "NodeAttributes"); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinition"); proto_item_set_end(ti, tvb, *pOffset); } void parseAddNodesResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AddNodesResult, &ti, "%s: AddNodesResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseNodeId(subtree, tvb, pinfo, pOffset, "AddedNodeId"); proto_item_set_end(ti, tvb, *pOffset); } void parseAddReferencesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AddReferencesItem, &ti, "%s: AddReferencesItem", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "SourceNodeId"); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsForward); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_TargetServerUri); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TargetNodeId"); parseNodeClass(subtree, tvb, pinfo, pOffset); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteNodesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DeleteNodesItem, &ti, "%s: DeleteNodesItem", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_DeleteTargetReferences); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteReferencesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DeleteReferencesItem, &ti, "%s: DeleteReferencesItem", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "SourceNodeId"); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsForward); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TargetNodeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_DeleteBidirectional); proto_item_set_end(ti, tvb, *pOffset); } void parseViewDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ViewDescription, &ti, "%s: ViewDescription", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "ViewId"); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_Timestamp); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ViewVersion); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BrowseDescription, &ti, "%s: BrowseDescription", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseBrowseDirection(subtree, tvb, pinfo, pOffset); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IncludeSubtypes); parseNodeClassMask(subtree, tvb, pinfo, pOffset); parseResultMask(subtree, tvb, pinfo, pOffset); proto_item_set_end(ti, tvb, *pOffset); } void parseReferenceDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReferenceDescription, &ti, "%s: ReferenceDescription", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsForward); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseQualifiedName(subtree, tvb, pinfo, pOffset, "BrowseName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseNodeClass(subtree, tvb, pinfo, pOffset); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinition"); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BrowseResult, &ti, "%s: BrowseResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ContinuationPoint); /* Array length field ignored: NoOfReferences */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "References", "ReferenceDescription", parseReferenceDescription, ett_opcua_array_ReferenceDescription); proto_item_set_end(ti, tvb, *pOffset); } void parseRelativePathElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_RelativePathElement, &ti, "%s: RelativePathElement", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsInverse); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IncludeSubtypes); parseQualifiedName(subtree, tvb, pinfo, pOffset, "TargetName"); proto_item_set_end(ti, tvb, *pOffset); } void parseRelativePath(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_RelativePath, &ti, "%s: RelativePath", szFieldName); /* Array length field ignored: NoOfElements */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Elements", "RelativePathElement", parseRelativePathElement, ett_opcua_array_RelativePathElement); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowsePath(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BrowsePath, &ti, "%s: BrowsePath", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "StartingNode"); parseRelativePath(subtree, tvb, pinfo, pOffset, "RelativePath"); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowsePathTarget(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BrowsePathTarget, &ti, "%s: BrowsePathTarget", szFieldName); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TargetId"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RemainingPathIndex); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowsePathResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BrowsePathResult, &ti, "%s: BrowsePathResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfTargets */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Targets", "BrowsePathTarget", parseBrowsePathTarget, ett_opcua_array_BrowsePathTarget); proto_item_set_end(ti, tvb, *pOffset); } void parseEndpointConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EndpointConfiguration, &ti, "%s: EndpointConfiguration", szFieldName); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_OperationTimeout); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UseBinaryEncoding); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxStringLength); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxByteStringLength); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxArrayLength); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxMessageSize); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxBufferSize); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ChannelLifetime); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityTokenLifetime); proto_item_set_end(ti, tvb, *pOffset); } void parseSupportedProfile(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SupportedProfile, &ti, "%s: SupportedProfile", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_OrganizationUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProfileId); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ComplianceTool); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_ComplianceDate); parseComplianceLevel(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfUnsupportedUnitIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "UnsupportedUnitIds", "String", hf_opcua_UnsupportedUnitIds, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseSoftwareCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SoftwareCertificate, &ti, "%s: SoftwareCertificate", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_VendorName); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_VendorProductCertificate); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SoftwareVersion); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_BuildNumber); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_BuildDate); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IssuedBy); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_IssueDate); /* Array length field ignored: NoOfSupportedProfiles */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "SupportedProfiles", "SupportedProfile", parseSupportedProfile, ett_opcua_array_SupportedProfile); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryDataDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_QueryDataDescription, &ti, "%s: QueryDataDescription", szFieldName); parseRelativePath(subtree, tvb, pinfo, pOffset, "RelativePath"); parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } void parseNodeTypeDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_NodeTypeDescription, &ti, "%s: NodeTypeDescription", szFieldName); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinitionNode"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IncludeSubTypes); /* Array length field ignored: NoOfDataToReturn */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DataToReturn", "QueryDataDescription", parseQueryDataDescription, ett_opcua_array_QueryDataDescription); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryDataSet(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_QueryDataSet, &ti, "%s: QueryDataSet", szFieldName); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinitionNode"); /* Array length field ignored: NoOfValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Values", "Variant", parseVariant, ett_opcua_array_Variant); proto_item_set_end(ti, tvb, *pOffset); } void parseNodeReference(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_NodeReference, &ti, "%s: NodeReference", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseNodeId(subtree, tvb, pinfo, pOffset, "ReferenceTypeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsForward); /* Array length field ignored: NoOfReferencedNodeIds */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ReferencedNodeIds", "NodeId", parseNodeId, ett_opcua_array_NodeId); proto_item_set_end(ti, tvb, *pOffset); } void parseContentFilterElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ContentFilterElement, &ti, "%s: ContentFilterElement", szFieldName); parseFilterOperator(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfFilterOperands */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "FilterOperands", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); proto_item_set_end(ti, tvb, *pOffset); } void parseContentFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ContentFilter, &ti, "%s: ContentFilter", szFieldName); /* Array length field ignored: NoOfElements */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Elements", "ContentFilterElement", parseContentFilterElement, ett_opcua_array_ContentFilterElement); proto_item_set_end(ti, tvb, *pOffset); } void parseElementOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ElementOperand, &ti, "%s: ElementOperand", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_Index); proto_item_set_end(ti, tvb, *pOffset); } void parseLiteralOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_LiteralOperand, &ti, "%s: LiteralOperand", szFieldName); parseVariant(subtree, tvb, pinfo, pOffset, "Value"); proto_item_set_end(ti, tvb, *pOffset); } void parseAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AttributeOperand, &ti, "%s: AttributeOperand", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Alias); parseRelativePath(subtree, tvb, pinfo, pOffset, "BrowsePath"); parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } void parseSimpleAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SimpleAttributeOperand, &ti, "%s: SimpleAttributeOperand", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinitionId"); /* Array length field ignored: NoOfBrowsePath */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "BrowsePath", "QualifiedName", parseQualifiedName, ett_opcua_array_QualifiedName); parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } void parseContentFilterElementResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ContentFilterElementResult, &ti, "%s: ContentFilterElementResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfOperandStatusCodes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "OperandStatusCodes", "StatusCode", hf_opcua_OperandStatusCodes, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfOperandDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "OperandDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseContentFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ContentFilterResult, &ti, "%s: ContentFilterResult", szFieldName); /* Array length field ignored: NoOfElementResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ElementResults", "ContentFilterElementResult", parseContentFilterElementResult, ett_opcua_array_ContentFilterElementResult); /* Array length field ignored: NoOfElementDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ElementDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseParsingResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ParsingResult, &ti, "%s: ParsingResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfDataStatusCodes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "DataStatusCodes", "StatusCode", hf_opcua_DataStatusCodes, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDataDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DataDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseReadValueId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadValueId, &ti, "%s: ReadValueId", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); parseQualifiedName(subtree, tvb, pinfo, pOffset, "DataEncoding"); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryReadValueId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryReadValueId, &ti, "%s: HistoryReadValueId", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); parseQualifiedName(subtree, tvb, pinfo, pOffset, "DataEncoding"); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ContinuationPoint); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryReadResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryReadResult, &ti, "%s: HistoryReadResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ContinuationPoint); parseExtensionObject(subtree, tvb, pinfo, pOffset, "HistoryData"); proto_item_set_end(ti, tvb, *pOffset); } void parseReadEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadEventDetails, &ti, "%s: ReadEventDetails", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_NumValuesPerNode); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_EndTime); parseEventFilter(subtree, tvb, pinfo, pOffset, "Filter"); proto_item_set_end(ti, tvb, *pOffset); } void parseReadRawModifiedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadRawModifiedDetails, &ti, "%s: ReadRawModifiedDetails", szFieldName); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsReadModified); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_EndTime); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_NumValuesPerNode); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ReturnBounds); proto_item_set_end(ti, tvb, *pOffset); } void parseReadProcessedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadProcessedDetails, &ti, "%s: ReadProcessedDetails", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_EndTime); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_ProcessingInterval); /* Array length field ignored: NoOfAggregateType */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "AggregateType", "NodeId", parseNodeId, ett_opcua_array_NodeId); parseAggregateConfiguration(subtree, tvb, pinfo, pOffset, "AggregateConfiguration"); proto_item_set_end(ti, tvb, *pOffset); } void parseReadAtTimeDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadAtTimeDetails, &ti, "%s: ReadAtTimeDetails", szFieldName); /* Array length field ignored: NoOfReqTimes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ReqTimes", "DateTime", hf_opcua_ReqTimes, parseDateTime, ett_opcua_array_DateTime); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UseSimpleBounds); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryData, &ti, "%s: HistoryData", szFieldName); /* Array length field ignored: NoOfDataValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DataValues", "DataValue", parseDataValue, ett_opcua_array_DataValue); proto_item_set_end(ti, tvb, *pOffset); } void parseModificationInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ModificationInfo, &ti, "%s: ModificationInfo", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_ModificationTime); parseHistoryUpdateType(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_UserName); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryModifiedData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryModifiedData, &ti, "%s: HistoryModifiedData", szFieldName); /* Array length field ignored: NoOfDataValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DataValues", "DataValue", parseDataValue, ett_opcua_array_DataValue); /* Array length field ignored: NoOfModificationInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ModificationInfos", "ModificationInfo", parseModificationInfo, ett_opcua_array_ModificationInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryEvent(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryEvent, &ti, "%s: HistoryEvent", szFieldName); /* Array length field ignored: NoOfEvents */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Events", "HistoryEventFieldList", parseHistoryEventFieldList, ett_opcua_array_HistoryEventFieldList); proto_item_set_end(ti, tvb, *pOffset); } void parseWriteValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_WriteValue, &ti, "%s: WriteValue", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); parseDataValue(subtree, tvb, pinfo, pOffset, "Value"); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryUpdateDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryUpdateDetails, &ti, "%s: HistoryUpdateDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); proto_item_set_end(ti, tvb, *pOffset); } void parseUpdateDataDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UpdateDataDetails, &ti, "%s: UpdateDataDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parsePerformUpdateType(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfUpdateValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "UpdateValues", "DataValue", parseDataValue, ett_opcua_array_DataValue); proto_item_set_end(ti, tvb, *pOffset); } void parseUpdateStructureDataDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UpdateStructureDataDetails, &ti, "%s: UpdateStructureDataDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parsePerformUpdateType(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfUpdateValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "UpdateValues", "DataValue", parseDataValue, ett_opcua_array_DataValue); proto_item_set_end(ti, tvb, *pOffset); } void parseUpdateEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_UpdateEventDetails, &ti, "%s: UpdateEventDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parsePerformUpdateType(subtree, tvb, pinfo, pOffset); parseEventFilter(subtree, tvb, pinfo, pOffset, "Filter"); /* Array length field ignored: NoOfEventData */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "EventData", "HistoryEventFieldList", parseHistoryEventFieldList, ett_opcua_array_HistoryEventFieldList); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteRawModifiedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DeleteRawModifiedDetails, &ti, "%s: DeleteRawModifiedDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_IsDeleteModified); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_EndTime); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteAtTimeDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DeleteAtTimeDetails, &ti, "%s: DeleteAtTimeDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); /* Array length field ignored: NoOfReqTimes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ReqTimes", "DateTime", hf_opcua_ReqTimes, parseDateTime, ett_opcua_array_DateTime); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DeleteEventDetails, &ti, "%s: DeleteEventDetails", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); /* Array length field ignored: NoOfEventIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "EventIds", "ByteString", hf_opcua_EventIds, parseByteString, ett_opcua_array_ByteString); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryUpdateResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryUpdateResult, &ti, "%s: HistoryUpdateResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfOperationResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "OperationResults", "StatusCode", hf_opcua_OperationResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseCallMethodRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_CallMethodRequest, &ti, "%s: CallMethodRequest", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "ObjectId"); parseNodeId(subtree, tvb, pinfo, pOffset, "MethodId"); /* Array length field ignored: NoOfInputArguments */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "InputArguments", "Variant", parseVariant, ett_opcua_array_Variant); proto_item_set_end(ti, tvb, *pOffset); } void parseCallMethodResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_CallMethodResult, &ti, "%s: CallMethodResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfInputArgumentResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "InputArgumentResults", "StatusCode", hf_opcua_InputArgumentResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfInputArgumentDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "InputArgumentDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); /* Array length field ignored: NoOfOutputArguments */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "OutputArguments", "Variant", parseVariant, ett_opcua_array_Variant); proto_item_set_end(ti, tvb, *pOffset); } void parseDataChangeFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DataChangeFilter, &ti, "%s: DataChangeFilter", szFieldName); parseDataChangeTrigger(subtree, tvb, pinfo, pOffset); parseDeadbandType(subtree, tvb, pinfo, pOffset); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_DeadbandValue); proto_item_set_end(ti, tvb, *pOffset); } void parseEventFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EventFilter, &ti, "%s: EventFilter", szFieldName); /* Array length field ignored: NoOfSelectClauses */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "SelectClauses", "SimpleAttributeOperand", parseSimpleAttributeOperand, ett_opcua_array_SimpleAttributeOperand); parseContentFilter(subtree, tvb, pinfo, pOffset, "WhereClause"); proto_item_set_end(ti, tvb, *pOffset); } void parseAggregateConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AggregateConfiguration, &ti, "%s: AggregateConfiguration", szFieldName); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UseServerCapabilitiesDefaults); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_TreatUncertainAsBad); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_PercentDataBad); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_PercentDataGood); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_UseSlopedExtrapolation); proto_item_set_end(ti, tvb, *pOffset); } void parseAggregateFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AggregateFilter, &ti, "%s: AggregateFilter", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseNodeId(subtree, tvb, pinfo, pOffset, "AggregateType"); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_ProcessingInterval); parseAggregateConfiguration(subtree, tvb, pinfo, pOffset, "AggregateConfiguration"); proto_item_set_end(ti, tvb, *pOffset); } void parseEventFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EventFilterResult, &ti, "%s: EventFilterResult", szFieldName); /* Array length field ignored: NoOfSelectClauseResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "SelectClauseResults", "StatusCode", hf_opcua_SelectClauseResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfSelectClauseDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "SelectClauseDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); parseContentFilterResult(subtree, tvb, pinfo, pOffset, "WhereClauseResult"); proto_item_set_end(ti, tvb, *pOffset); } void parseAggregateFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AggregateFilterResult, &ti, "%s: AggregateFilterResult", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedStartTime); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedProcessingInterval); parseAggregateConfiguration(subtree, tvb, pinfo, pOffset, "RevisedAggregateConfiguration"); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoringParameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoringParameters, &ti, "%s: MonitoringParameters", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ClientHandle); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_SamplingInterval); parseExtensionObject(subtree, tvb, pinfo, pOffset, "Filter"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_QueueSize); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_DiscardOldest); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoredItemCreateRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoredItemCreateRequest, &ti, "%s: MonitoredItemCreateRequest", szFieldName); parseReadValueId(subtree, tvb, pinfo, pOffset, "ItemToMonitor"); parseMonitoringMode(subtree, tvb, pinfo, pOffset); parseMonitoringParameters(subtree, tvb, pinfo, pOffset, "RequestedParameters"); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoredItemCreateResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoredItemCreateResult, &ti, "%s: MonitoredItemCreateResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MonitoredItemId); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedSamplingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedQueueSize); parseExtensionObject(subtree, tvb, pinfo, pOffset, "FilterResult"); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoredItemModifyRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoredItemModifyRequest, &ti, "%s: MonitoredItemModifyRequest", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MonitoredItemId); parseMonitoringParameters(subtree, tvb, pinfo, pOffset, "RequestedParameters"); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoredItemModifyResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoredItemModifyResult, &ti, "%s: MonitoredItemModifyResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedSamplingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedQueueSize); parseExtensionObject(subtree, tvb, pinfo, pOffset, "FilterResult"); proto_item_set_end(ti, tvb, *pOffset); } void parseNotificationMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_NotificationMessage, &ti, "%s: NotificationMessage", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SequenceNumber); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_PublishTime); /* Array length field ignored: NoOfNotificationData */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NotificationData", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); proto_item_set_end(ti, tvb, *pOffset); } void parseDataChangeNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DataChangeNotification, &ti, "%s: DataChangeNotification", szFieldName); /* Array length field ignored: NoOfMonitoredItems */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "MonitoredItems", "MonitoredItemNotification", parseMonitoredItemNotification, ett_opcua_array_MonitoredItemNotification); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseMonitoredItemNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_MonitoredItemNotification, &ti, "%s: MonitoredItemNotification", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ClientHandle); parseDataValue(subtree, tvb, pinfo, pOffset, "Value"); proto_item_set_end(ti, tvb, *pOffset); } void parseEventNotificationList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EventNotificationList, &ti, "%s: EventNotificationList", szFieldName); /* Array length field ignored: NoOfEvents */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Events", "EventFieldList", parseEventFieldList, ett_opcua_array_EventFieldList); proto_item_set_end(ti, tvb, *pOffset); } void parseEventFieldList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EventFieldList, &ti, "%s: EventFieldList", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ClientHandle); /* Array length field ignored: NoOfEventFields */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "EventFields", "Variant", parseVariant, ett_opcua_array_Variant); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryEventFieldList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_HistoryEventFieldList, &ti, "%s: HistoryEventFieldList", szFieldName); /* Array length field ignored: NoOfEventFields */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "EventFields", "Variant", parseVariant, ett_opcua_array_Variant); proto_item_set_end(ti, tvb, *pOffset); } void parseStatusChangeNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_StatusChangeNotification, &ti, "%s: StatusChangeNotification", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_Status); parseDiagnosticInfo(subtree, tvb, pinfo, pOffset, "DiagnosticInfo"); proto_item_set_end(ti, tvb, *pOffset); } void parseSubscriptionAcknowledgement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SubscriptionAcknowledgement, &ti, "%s: SubscriptionAcknowledgement", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SequenceNumber); proto_item_set_end(ti, tvb, *pOffset); } void parseTransferResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_TransferResult, &ti, "%s: TransferResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); /* Array length field ignored: NoOfAvailableSequenceNumbers */ parseArraySimple(subtree, tvb, pinfo, pOffset, "AvailableSequenceNumbers", "UInt32", hf_opcua_AvailableSequenceNumbers, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseScalarTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ScalarTestType, &ti, "%s: ScalarTestType", szFieldName); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_Boolean); parseSByte(subtree, tvb, pinfo, pOffset, hf_opcua_SByte); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_Byte); parseInt16(subtree, tvb, pinfo, pOffset, hf_opcua_Int16); parseUInt16(subtree, tvb, pinfo, pOffset, hf_opcua_UInt16); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_Int32); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UInt32); parseInt64(subtree, tvb, pinfo, pOffset, hf_opcua_Int64); parseUInt64(subtree, tvb, pinfo, pOffset, hf_opcua_UInt64); parseFloat(subtree, tvb, pinfo, pOffset, hf_opcua_Float); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_Double); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_String); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_DateTime); parseGuid(subtree, tvb, pinfo, pOffset, hf_opcua_Guid); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ByteString); parseXmlElement(subtree, tvb, pinfo, pOffset, hf_opcua_XmlElement); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseExpandedNodeId(subtree, tvb, pinfo, pOffset, "ExpandedNodeId"); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseDiagnosticInfo(subtree, tvb, pinfo, pOffset, "DiagnosticInfo"); parseQualifiedName(subtree, tvb, pinfo, pOffset, "QualifiedName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "LocalizedText"); parseExtensionObject(subtree, tvb, pinfo, pOffset, "ExtensionObject"); parseDataValue(subtree, tvb, pinfo, pOffset, "DataValue"); parseEnumeratedTestType(subtree, tvb, pinfo, pOffset); proto_item_set_end(ti, tvb, *pOffset); } void parseArrayTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ArrayTestType, &ti, "%s: ArrayTestType", szFieldName); /* Array length field ignored: NoOfBooleans */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Booleans", "Boolean", hf_opcua_Booleans, parseBoolean, ett_opcua_array_Boolean); /* Array length field ignored: NoOfSBytes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "SBytes", "SByte", hf_opcua_SBytes, parseSByte, ett_opcua_array_SByte); /* Array length field ignored: NoOfInt16s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Int16s", "Int16", hf_opcua_Int16s, parseInt16, ett_opcua_array_Int16); /* Array length field ignored: NoOfUInt16s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "UInt16s", "UInt16", hf_opcua_UInt16s, parseUInt16, ett_opcua_array_UInt16); /* Array length field ignored: NoOfInt32s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Int32s", "Int32", hf_opcua_Int32s, parseInt32, ett_opcua_array_Int32); /* Array length field ignored: NoOfUInt32s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "UInt32s", "UInt32", hf_opcua_UInt32s, parseUInt32, ett_opcua_array_UInt32); /* Array length field ignored: NoOfInt64s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Int64s", "Int64", hf_opcua_Int64s, parseInt64, ett_opcua_array_Int64); /* Array length field ignored: NoOfUInt64s */ parseArraySimple(subtree, tvb, pinfo, pOffset, "UInt64s", "UInt64", hf_opcua_UInt64s, parseUInt64, ett_opcua_array_UInt64); /* Array length field ignored: NoOfFloats */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Floats", "Float", hf_opcua_Floats, parseFloat, ett_opcua_array_Float); /* Array length field ignored: NoOfDoubles */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Doubles", "Double", hf_opcua_Doubles, parseDouble, ett_opcua_array_Double); /* Array length field ignored: NoOfStrings */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Strings", "String", hf_opcua_Strings, parseString, ett_opcua_array_String); /* Array length field ignored: NoOfDateTimes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "DateTimes", "DateTime", hf_opcua_DateTimes, parseDateTime, ett_opcua_array_DateTime); /* Array length field ignored: NoOfGuids */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Guids", "Guid", hf_opcua_Guids, parseGuid, ett_opcua_array_Guid); /* Array length field ignored: NoOfByteStrings */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ByteStrings", "ByteString", hf_opcua_ByteStrings, parseByteString, ett_opcua_array_ByteString); /* Array length field ignored: NoOfXmlElements */ parseArraySimple(subtree, tvb, pinfo, pOffset, "XmlElements", "XmlElement", hf_opcua_XmlElements, parseXmlElement, ett_opcua_array_XmlElement); /* Array length field ignored: NoOfNodeIds */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodeIds", "NodeId", parseNodeId, ett_opcua_array_NodeId); /* Array length field ignored: NoOfExpandedNodeIds */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ExpandedNodeIds", "ExpandedNodeId", parseExpandedNodeId, ett_opcua_array_ExpandedNodeId); /* Array length field ignored: NoOfStatusCodes */ parseArraySimple(subtree, tvb, pinfo, pOffset, "StatusCodes", "StatusCode", hf_opcua_StatusCodes, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); /* Array length field ignored: NoOfQualifiedNames */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "QualifiedNames", "QualifiedName", parseQualifiedName, ett_opcua_array_QualifiedName); /* Array length field ignored: NoOfLocalizedTexts */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "LocalizedTexts", "LocalizedText", parseLocalizedText, ett_opcua_array_LocalizedText); /* Array length field ignored: NoOfExtensionObjects */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ExtensionObjects", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); /* Array length field ignored: NoOfDataValues */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DataValues", "DataValue", parseDataValue, ett_opcua_array_DataValue); /* Array length field ignored: NoOfVariants */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Variants", "Variant", parseVariant, ett_opcua_array_Variant); /* Array length field ignored: NoOfEnumeratedValues */ parseArrayEnum(subtree, tvb, pinfo, pOffset, "EnumeratedValues", "EnumeratedTestType", parseEnumeratedTestType, ett_opcua_array_EnumeratedTestType); proto_item_set_end(ti, tvb, *pOffset); } void parseCompositeTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_CompositeTestType, &ti, "%s: CompositeTestType", szFieldName); parseScalarTestType(subtree, tvb, pinfo, pOffset, "Field1"); parseArrayTestType(subtree, tvb, pinfo, pOffset, "Field2"); proto_item_set_end(ti, tvb, *pOffset); } void parseBuildInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_BuildInfo, &ti, "%s: BuildInfo", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ManufacturerName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ProductName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SoftwareVersion); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_BuildNumber); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_BuildDate); proto_item_set_end(ti, tvb, *pOffset); } void parseRedundantServerDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_RedundantServerDataType, &ti, "%s: RedundantServerDataType", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerId); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_ServiceLevel); parseServerState(subtree, tvb, pinfo, pOffset); proto_item_set_end(ti, tvb, *pOffset); } void parseEndpointUrlListDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EndpointUrlListDataType, &ti, "%s: EndpointUrlListDataType", szFieldName); /* Array length field ignored: NoOfEndpointUrlList */ parseArraySimple(subtree, tvb, pinfo, pOffset, "EndpointUrlList", "String", hf_opcua_EndpointUrlList, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseNetworkGroupDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_NetworkGroupDataType, &ti, "%s: NetworkGroupDataType", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerUri); /* Array length field ignored: NoOfNetworkPaths */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NetworkPaths", "EndpointUrlListDataType", parseEndpointUrlListDataType, ett_opcua_array_EndpointUrlListDataType); proto_item_set_end(ti, tvb, *pOffset); } void parseSamplingIntervalDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SamplingIntervalDiagnosticsDataType, &ti, "%s: SamplingIntervalDiagnosticsDataType", szFieldName); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_SamplingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MonitoredItemCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxMonitoredItemCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DisabledMonitoredItemCount); proto_item_set_end(ti, tvb, *pOffset); } void parseServerDiagnosticsSummaryDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ServerDiagnosticsSummaryDataType, &ti, "%s: ServerDiagnosticsSummaryDataType", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ServerViewCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentSessionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CumulatedSessionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityRejectedSessionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RejectedSessionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SessionTimeoutCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SessionAbortCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentSubscriptionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CumulatedSubscriptionCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_PublishingIntervalCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityRejectedRequestsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RejectedRequestsCount); proto_item_set_end(ti, tvb, *pOffset); } void parseServerStatusDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ServerStatusDataType, &ti, "%s: ServerStatusDataType", szFieldName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_StartTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentTime); parseServerState(subtree, tvb, pinfo, pOffset); parseBuildInfo(subtree, tvb, pinfo, pOffset, "BuildInfo"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SecondsTillShutdown); parseLocalizedText(subtree, tvb, pinfo, pOffset, "ShutdownReason"); proto_item_set_end(ti, tvb, *pOffset); } void parseSessionDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SessionDiagnosticsDataType, &ti, "%s: SessionDiagnosticsDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "SessionId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SessionName); parseApplicationDescription(subtree, tvb, pinfo, pOffset, "ClientDescription"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EndpointUrl); /* Array length field ignored: NoOfLocaleIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LocaleIds", "String", hf_opcua_LocaleIds, parseString, ett_opcua_array_String); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_ActualSessionTimeout); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxResponseMessageSize); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_ClientConnectionTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_ClientLastContactTime); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentSubscriptionsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentMonitoredItemsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentPublishRequestsInQueue); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "TotalRequestCount"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UnauthorizedRequestCount); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "ReadCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "HistoryReadCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "WriteCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "HistoryUpdateCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "CallCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "CreateMonitoredItemsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "ModifyMonitoredItemsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "SetMonitoringModeCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "SetTriggeringCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "DeleteMonitoredItemsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "CreateSubscriptionCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "ModifySubscriptionCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "SetPublishingModeCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "PublishCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "RepublishCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "TransferSubscriptionsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "DeleteSubscriptionsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "AddNodesCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "AddReferencesCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "DeleteNodesCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "DeleteReferencesCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "BrowseCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "BrowseNextCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "TranslateBrowsePathsToNodeIdsCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "QueryFirstCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "QueryNextCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "RegisterNodesCount"); parseServiceCounterDataType(subtree, tvb, pinfo, pOffset, "UnregisterNodesCount"); proto_item_set_end(ti, tvb, *pOffset); } void parseSessionSecurityDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SessionSecurityDiagnosticsDataType, &ti, "%s: SessionSecurityDiagnosticsDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "SessionId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ClientUserIdOfSession); /* Array length field ignored: NoOfClientUserIdHistory */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ClientUserIdHistory", "String", hf_opcua_ClientUserIdHistory, parseString, ett_opcua_array_String); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_AuthenticationMechanism); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Encoding); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_TransportProtocol); parseMessageSecurityMode(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SecurityPolicyUri); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ClientCertificate); proto_item_set_end(ti, tvb, *pOffset); } void parseServiceCounterDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ServiceCounterDataType, &ti, "%s: ServiceCounterDataType", szFieldName); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TotalCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ErrorCount); proto_item_set_end(ti, tvb, *pOffset); } void parseStatusResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_StatusResult, &ti, "%s: StatusResult", szFieldName); parseStatusCode(subtree, tvb, pinfo, pOffset, hf_opcua_StatusCode); parseDiagnosticInfo(subtree, tvb, pinfo, pOffset, "DiagnosticInfo"); proto_item_set_end(ti, tvb, *pOffset); } void parseSubscriptionDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SubscriptionDiagnosticsDataType, &ti, "%s: SubscriptionDiagnosticsDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "SessionId"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_Priority); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_PublishingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxKeepAliveCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxNotificationsPerPublish); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_PublishingEnabled); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ModifyCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_EnableCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DisableCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RepublishRequestCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RepublishMessageRequestCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RepublishMessageCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TransferRequestCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TransferredToAltClientCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TransferredToSameClientCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_PublishRequestCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DataChangeNotificationsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_EventNotificationsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_NotificationsCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_LatePublishRequestCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentKeepAliveCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CurrentLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UnacknowledgedMessageCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DiscardedMessageCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MonitoredItemCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DisabledMonitoredItemCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MonitoringQueueOverflowCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_NextSequenceNumber); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_EventQueueOverFlowCount); proto_item_set_end(ti, tvb, *pOffset); } void parseModelChangeStructureDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ModelChangeStructureDataType, &ti, "%s: ModelChangeStructureDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "Affected"); parseNodeId(subtree, tvb, pinfo, pOffset, "AffectedType"); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_Verb); proto_item_set_end(ti, tvb, *pOffset); } void parseSemanticChangeStructureDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_SemanticChangeStructureDataType, &ti, "%s: SemanticChangeStructureDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "Affected"); parseNodeId(subtree, tvb, pinfo, pOffset, "AffectedType"); proto_item_set_end(ti, tvb, *pOffset); } void parseRange(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_Range, &ti, "%s: Range", szFieldName); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_Low); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_High); proto_item_set_end(ti, tvb, *pOffset); } void parseEUInformation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_EUInformation, &ti, "%s: EUInformation", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_NamespaceUri); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_UnitId); parseLocalizedText(subtree, tvb, pinfo, pOffset, "DisplayName"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Description"); proto_item_set_end(ti, tvb, *pOffset); } void parseComplexNumberType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ComplexNumberType, &ti, "%s: ComplexNumberType", szFieldName); parseFloat(subtree, tvb, pinfo, pOffset, hf_opcua_Real); parseFloat(subtree, tvb, pinfo, pOffset, hf_opcua_Imaginary); proto_item_set_end(ti, tvb, *pOffset); } void parseDoubleComplexNumberType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DoubleComplexNumberType, &ti, "%s: DoubleComplexNumberType", szFieldName); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_Real); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_Imaginary); proto_item_set_end(ti, tvb, *pOffset); } void parseAxisInformation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_AxisInformation, &ti, "%s: AxisInformation", szFieldName); parseEUInformation(subtree, tvb, pinfo, pOffset, "EngineeringUnits"); parseRange(subtree, tvb, pinfo, pOffset, "EURange"); parseLocalizedText(subtree, tvb, pinfo, pOffset, "Title"); parseAxisScaleEnumeration(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfAxisSteps */ parseArraySimple(subtree, tvb, pinfo, pOffset, "AxisSteps", "Double", hf_opcua_AxisSteps, parseDouble, ett_opcua_array_Double); proto_item_set_end(ti, tvb, *pOffset); } void parseXVType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_XVType, &ti, "%s: XVType", szFieldName); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_X); parseFloat(subtree, tvb, pinfo, pOffset, hf_opcua_Value); proto_item_set_end(ti, tvb, *pOffset); } void parseProgramDiagnosticDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ProgramDiagnosticDataType, &ti, "%s: ProgramDiagnosticDataType", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "CreateSessionId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_CreateClientName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_InvocationCreationTime); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_LastTransitionTime); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_LastMethodCall); parseNodeId(subtree, tvb, pinfo, pOffset, "LastMethodSessionId"); /* Array length field ignored: NoOfLastMethodInputArguments */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "LastMethodInputArguments", "Argument", parseArgument, ett_opcua_array_Argument); /* Array length field ignored: NoOfLastMethodOutputArguments */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "LastMethodOutputArguments", "Argument", parseArgument, ett_opcua_array_Argument); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_LastMethodCallTime); parseStatusResult(subtree, tvb, pinfo, pOffset, "LastMethodReturnStatus"); proto_item_set_end(ti, tvb, *pOffset); } void parseAnnotation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_Annotation, &ti, "%s: Annotation", szFieldName); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Message); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_UserName); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_AnnotationTime); proto_item_set_end(ti, tvb, *pOffset); } /** Setup protocol subtree array */ static gint *ett[] = { &ett_opcua_TrustListDataType, &ett_opcua_array_TrustListDataType, &ett_opcua_Node, &ett_opcua_array_Node, &ett_opcua_InstanceNode, &ett_opcua_array_InstanceNode, &ett_opcua_TypeNode, &ett_opcua_array_TypeNode, &ett_opcua_ObjectNode, &ett_opcua_array_ObjectNode, &ett_opcua_ObjectTypeNode, &ett_opcua_array_ObjectTypeNode, &ett_opcua_VariableNode, &ett_opcua_array_VariableNode, &ett_opcua_VariableTypeNode, &ett_opcua_array_VariableTypeNode, &ett_opcua_ReferenceTypeNode, &ett_opcua_array_ReferenceTypeNode, &ett_opcua_MethodNode, &ett_opcua_array_MethodNode, &ett_opcua_ViewNode, &ett_opcua_array_ViewNode, &ett_opcua_DataTypeNode, &ett_opcua_array_DataTypeNode, &ett_opcua_ReferenceNode, &ett_opcua_array_ReferenceNode, &ett_opcua_Argument, &ett_opcua_array_Argument, &ett_opcua_EnumValueType, &ett_opcua_array_EnumValueType, &ett_opcua_OptionSet, &ett_opcua_array_OptionSet, &ett_opcua_TimeZoneDataType, &ett_opcua_array_TimeZoneDataType, &ett_opcua_ApplicationDescription, &ett_opcua_array_ApplicationDescription, &ett_opcua_RequestHeader, &ett_opcua_array_RequestHeader, &ett_opcua_ResponseHeader, &ett_opcua_array_ResponseHeader, &ett_opcua_ServerOnNetwork, &ett_opcua_array_ServerOnNetwork, &ett_opcua_UserTokenPolicy, &ett_opcua_array_UserTokenPolicy, &ett_opcua_EndpointDescription, &ett_opcua_array_EndpointDescription, &ett_opcua_RegisteredServer, &ett_opcua_array_RegisteredServer, &ett_opcua_MdnsDiscoveryConfiguration, &ett_opcua_array_MdnsDiscoveryConfiguration, &ett_opcua_ChannelSecurityToken, &ett_opcua_array_ChannelSecurityToken, &ett_opcua_SignedSoftwareCertificate, &ett_opcua_array_SignedSoftwareCertificate, &ett_opcua_SignatureData, &ett_opcua_array_SignatureData, &ett_opcua_UserIdentityToken, &ett_opcua_array_UserIdentityToken, &ett_opcua_AnonymousIdentityToken, &ett_opcua_array_AnonymousIdentityToken, &ett_opcua_UserNameIdentityToken, &ett_opcua_array_UserNameIdentityToken, &ett_opcua_X509IdentityToken, &ett_opcua_array_X509IdentityToken, &ett_opcua_KerberosIdentityToken, &ett_opcua_array_KerberosIdentityToken, &ett_opcua_IssuedIdentityToken, &ett_opcua_array_IssuedIdentityToken, &ett_opcua_NodeAttributes, &ett_opcua_array_NodeAttributes, &ett_opcua_ObjectAttributes, &ett_opcua_array_ObjectAttributes, &ett_opcua_VariableAttributes, &ett_opcua_array_VariableAttributes, &ett_opcua_MethodAttributes, &ett_opcua_array_MethodAttributes, &ett_opcua_ObjectTypeAttributes, &ett_opcua_array_ObjectTypeAttributes, &ett_opcua_VariableTypeAttributes, &ett_opcua_array_VariableTypeAttributes, &ett_opcua_ReferenceTypeAttributes, &ett_opcua_array_ReferenceTypeAttributes, &ett_opcua_DataTypeAttributes, &ett_opcua_array_DataTypeAttributes, &ett_opcua_ViewAttributes, &ett_opcua_array_ViewAttributes, &ett_opcua_AddNodesItem, &ett_opcua_array_AddNodesItem, &ett_opcua_AddNodesResult, &ett_opcua_array_AddNodesResult, &ett_opcua_AddReferencesItem, &ett_opcua_array_AddReferencesItem, &ett_opcua_DeleteNodesItem, &ett_opcua_array_DeleteNodesItem, &ett_opcua_DeleteReferencesItem, &ett_opcua_array_DeleteReferencesItem, &ett_opcua_ViewDescription, &ett_opcua_array_ViewDescription, &ett_opcua_BrowseDescription, &ett_opcua_array_BrowseDescription, &ett_opcua_ReferenceDescription, &ett_opcua_array_ReferenceDescription, &ett_opcua_BrowseResult, &ett_opcua_array_BrowseResult, &ett_opcua_RelativePathElement, &ett_opcua_array_RelativePathElement, &ett_opcua_RelativePath, &ett_opcua_array_RelativePath, &ett_opcua_BrowsePath, &ett_opcua_array_BrowsePath, &ett_opcua_BrowsePathTarget, &ett_opcua_array_BrowsePathTarget, &ett_opcua_BrowsePathResult, &ett_opcua_array_BrowsePathResult, &ett_opcua_EndpointConfiguration, &ett_opcua_array_EndpointConfiguration, &ett_opcua_SupportedProfile, &ett_opcua_array_SupportedProfile, &ett_opcua_SoftwareCertificate, &ett_opcua_array_SoftwareCertificate, &ett_opcua_QueryDataDescription, &ett_opcua_array_QueryDataDescription, &ett_opcua_NodeTypeDescription, &ett_opcua_array_NodeTypeDescription, &ett_opcua_QueryDataSet, &ett_opcua_array_QueryDataSet, &ett_opcua_NodeReference, &ett_opcua_array_NodeReference, &ett_opcua_ContentFilterElement, &ett_opcua_array_ContentFilterElement, &ett_opcua_ContentFilter, &ett_opcua_array_ContentFilter, &ett_opcua_ElementOperand, &ett_opcua_array_ElementOperand, &ett_opcua_LiteralOperand, &ett_opcua_array_LiteralOperand, &ett_opcua_AttributeOperand, &ett_opcua_array_AttributeOperand, &ett_opcua_SimpleAttributeOperand, &ett_opcua_array_SimpleAttributeOperand, &ett_opcua_ContentFilterElementResult, &ett_opcua_array_ContentFilterElementResult, &ett_opcua_ContentFilterResult, &ett_opcua_array_ContentFilterResult, &ett_opcua_ParsingResult, &ett_opcua_array_ParsingResult, &ett_opcua_ReadValueId, &ett_opcua_array_ReadValueId, &ett_opcua_HistoryReadValueId, &ett_opcua_array_HistoryReadValueId, &ett_opcua_HistoryReadResult, &ett_opcua_array_HistoryReadResult, &ett_opcua_ReadEventDetails, &ett_opcua_array_ReadEventDetails, &ett_opcua_ReadRawModifiedDetails, &ett_opcua_array_ReadRawModifiedDetails, &ett_opcua_ReadProcessedDetails, &ett_opcua_array_ReadProcessedDetails, &ett_opcua_ReadAtTimeDetails, &ett_opcua_array_ReadAtTimeDetails, &ett_opcua_HistoryData, &ett_opcua_array_HistoryData, &ett_opcua_ModificationInfo, &ett_opcua_array_ModificationInfo, &ett_opcua_HistoryModifiedData, &ett_opcua_array_HistoryModifiedData, &ett_opcua_HistoryEvent, &ett_opcua_array_HistoryEvent, &ett_opcua_WriteValue, &ett_opcua_array_WriteValue, &ett_opcua_HistoryUpdateDetails, &ett_opcua_array_HistoryUpdateDetails, &ett_opcua_UpdateDataDetails, &ett_opcua_array_UpdateDataDetails, &ett_opcua_UpdateStructureDataDetails, &ett_opcua_array_UpdateStructureDataDetails, &ett_opcua_UpdateEventDetails, &ett_opcua_array_UpdateEventDetails, &ett_opcua_DeleteRawModifiedDetails, &ett_opcua_array_DeleteRawModifiedDetails, &ett_opcua_DeleteAtTimeDetails, &ett_opcua_array_DeleteAtTimeDetails, &ett_opcua_DeleteEventDetails, &ett_opcua_array_DeleteEventDetails, &ett_opcua_HistoryUpdateResult, &ett_opcua_array_HistoryUpdateResult, &ett_opcua_CallMethodRequest, &ett_opcua_array_CallMethodRequest, &ett_opcua_CallMethodResult, &ett_opcua_array_CallMethodResult, &ett_opcua_DataChangeFilter, &ett_opcua_array_DataChangeFilter, &ett_opcua_EventFilter, &ett_opcua_array_EventFilter, &ett_opcua_AggregateConfiguration, &ett_opcua_array_AggregateConfiguration, &ett_opcua_AggregateFilter, &ett_opcua_array_AggregateFilter, &ett_opcua_EventFilterResult, &ett_opcua_array_EventFilterResult, &ett_opcua_AggregateFilterResult, &ett_opcua_array_AggregateFilterResult, &ett_opcua_MonitoringParameters, &ett_opcua_array_MonitoringParameters, &ett_opcua_MonitoredItemCreateRequest, &ett_opcua_array_MonitoredItemCreateRequest, &ett_opcua_MonitoredItemCreateResult, &ett_opcua_array_MonitoredItemCreateResult, &ett_opcua_MonitoredItemModifyRequest, &ett_opcua_array_MonitoredItemModifyRequest, &ett_opcua_MonitoredItemModifyResult, &ett_opcua_array_MonitoredItemModifyResult, &ett_opcua_NotificationMessage, &ett_opcua_array_NotificationMessage, &ett_opcua_DataChangeNotification, &ett_opcua_array_DataChangeNotification, &ett_opcua_MonitoredItemNotification, &ett_opcua_array_MonitoredItemNotification, &ett_opcua_EventNotificationList, &ett_opcua_array_EventNotificationList, &ett_opcua_EventFieldList, &ett_opcua_array_EventFieldList, &ett_opcua_HistoryEventFieldList, &ett_opcua_array_HistoryEventFieldList, &ett_opcua_StatusChangeNotification, &ett_opcua_array_StatusChangeNotification, &ett_opcua_SubscriptionAcknowledgement, &ett_opcua_array_SubscriptionAcknowledgement, &ett_opcua_TransferResult, &ett_opcua_array_TransferResult, &ett_opcua_ScalarTestType, &ett_opcua_array_ScalarTestType, &ett_opcua_ArrayTestType, &ett_opcua_array_ArrayTestType, &ett_opcua_CompositeTestType, &ett_opcua_array_CompositeTestType, &ett_opcua_BuildInfo, &ett_opcua_array_BuildInfo, &ett_opcua_RedundantServerDataType, &ett_opcua_array_RedundantServerDataType, &ett_opcua_EndpointUrlListDataType, &ett_opcua_array_EndpointUrlListDataType, &ett_opcua_NetworkGroupDataType, &ett_opcua_array_NetworkGroupDataType, &ett_opcua_SamplingIntervalDiagnosticsDataType, &ett_opcua_array_SamplingIntervalDiagnosticsDataType, &ett_opcua_ServerDiagnosticsSummaryDataType, &ett_opcua_array_ServerDiagnosticsSummaryDataType, &ett_opcua_ServerStatusDataType, &ett_opcua_array_ServerStatusDataType, &ett_opcua_SessionDiagnosticsDataType, &ett_opcua_array_SessionDiagnosticsDataType, &ett_opcua_SessionSecurityDiagnosticsDataType, &ett_opcua_array_SessionSecurityDiagnosticsDataType, &ett_opcua_ServiceCounterDataType, &ett_opcua_array_ServiceCounterDataType, &ett_opcua_StatusResult, &ett_opcua_array_StatusResult, &ett_opcua_SubscriptionDiagnosticsDataType, &ett_opcua_array_SubscriptionDiagnosticsDataType, &ett_opcua_ModelChangeStructureDataType, &ett_opcua_array_ModelChangeStructureDataType, &ett_opcua_SemanticChangeStructureDataType, &ett_opcua_array_SemanticChangeStructureDataType, &ett_opcua_Range, &ett_opcua_array_Range, &ett_opcua_EUInformation, &ett_opcua_array_EUInformation, &ett_opcua_ComplexNumberType, &ett_opcua_array_ComplexNumberType, &ett_opcua_DoubleComplexNumberType, &ett_opcua_array_DoubleComplexNumberType, &ett_opcua_AxisInformation, &ett_opcua_array_AxisInformation, &ett_opcua_XVType, &ett_opcua_array_XVType, &ett_opcua_ProgramDiagnosticDataType, &ett_opcua_array_ProgramDiagnosticDataType, &ett_opcua_Annotation, &ett_opcua_array_Annotation, }; void registerComplexTypes(void) { proto_register_subtree_array(ett, array_length(ett)); }
C/C++
wireshark/plugins/epan/opcua/opcua_complextypeparser.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Complex Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include <glib.h> #include <epan/packet.h> extern gint ett_opcua_TrustListDataType; extern gint ett_opcua_array_TrustListDataType; extern gint ett_opcua_Node; extern gint ett_opcua_array_Node; extern gint ett_opcua_InstanceNode; extern gint ett_opcua_array_InstanceNode; extern gint ett_opcua_TypeNode; extern gint ett_opcua_array_TypeNode; extern gint ett_opcua_ObjectNode; extern gint ett_opcua_array_ObjectNode; extern gint ett_opcua_ObjectTypeNode; extern gint ett_opcua_array_ObjectTypeNode; extern gint ett_opcua_VariableNode; extern gint ett_opcua_array_VariableNode; extern gint ett_opcua_VariableTypeNode; extern gint ett_opcua_array_VariableTypeNode; extern gint ett_opcua_ReferenceTypeNode; extern gint ett_opcua_array_ReferenceTypeNode; extern gint ett_opcua_MethodNode; extern gint ett_opcua_array_MethodNode; extern gint ett_opcua_ViewNode; extern gint ett_opcua_array_ViewNode; extern gint ett_opcua_DataTypeNode; extern gint ett_opcua_array_DataTypeNode; extern gint ett_opcua_ReferenceNode; extern gint ett_opcua_array_ReferenceNode; extern gint ett_opcua_Argument; extern gint ett_opcua_array_Argument; extern gint ett_opcua_EnumValueType; extern gint ett_opcua_array_EnumValueType; extern gint ett_opcua_OptionSet; extern gint ett_opcua_array_OptionSet; extern gint ett_opcua_TimeZoneDataType; extern gint ett_opcua_array_TimeZoneDataType; extern gint ett_opcua_ApplicationDescription; extern gint ett_opcua_array_ApplicationDescription; extern gint ett_opcua_RequestHeader; extern gint ett_opcua_array_RequestHeader; extern gint ett_opcua_ResponseHeader; extern gint ett_opcua_array_ResponseHeader; extern gint ett_opcua_ServerOnNetwork; extern gint ett_opcua_array_ServerOnNetwork; extern gint ett_opcua_UserTokenPolicy; extern gint ett_opcua_array_UserTokenPolicy; extern gint ett_opcua_EndpointDescription; extern gint ett_opcua_array_EndpointDescription; extern gint ett_opcua_RegisteredServer; extern gint ett_opcua_array_RegisteredServer; extern gint ett_opcua_MdnsDiscoveryConfiguration; extern gint ett_opcua_array_MdnsDiscoveryConfiguration; extern gint ett_opcua_ChannelSecurityToken; extern gint ett_opcua_array_ChannelSecurityToken; extern gint ett_opcua_SignedSoftwareCertificate; extern gint ett_opcua_array_SignedSoftwareCertificate; extern gint ett_opcua_SignatureData; extern gint ett_opcua_array_SignatureData; extern gint ett_opcua_UserIdentityToken; extern gint ett_opcua_array_UserIdentityToken; extern gint ett_opcua_AnonymousIdentityToken; extern gint ett_opcua_array_AnonymousIdentityToken; extern gint ett_opcua_UserNameIdentityToken; extern gint ett_opcua_array_UserNameIdentityToken; extern gint ett_opcua_X509IdentityToken; extern gint ett_opcua_array_X509IdentityToken; extern gint ett_opcua_KerberosIdentityToken; extern gint ett_opcua_array_KerberosIdentityToken; extern gint ett_opcua_IssuedIdentityToken; extern gint ett_opcua_array_IssuedIdentityToken; extern gint ett_opcua_NodeAttributes; extern gint ett_opcua_array_NodeAttributes; extern gint ett_opcua_ObjectAttributes; extern gint ett_opcua_array_ObjectAttributes; extern gint ett_opcua_VariableAttributes; extern gint ett_opcua_array_VariableAttributes; extern gint ett_opcua_MethodAttributes; extern gint ett_opcua_array_MethodAttributes; extern gint ett_opcua_ObjectTypeAttributes; extern gint ett_opcua_array_ObjectTypeAttributes; extern gint ett_opcua_VariableTypeAttributes; extern gint ett_opcua_array_VariableTypeAttributes; extern gint ett_opcua_ReferenceTypeAttributes; extern gint ett_opcua_array_ReferenceTypeAttributes; extern gint ett_opcua_DataTypeAttributes; extern gint ett_opcua_array_DataTypeAttributes; extern gint ett_opcua_ViewAttributes; extern gint ett_opcua_array_ViewAttributes; extern gint ett_opcua_AddNodesItem; extern gint ett_opcua_array_AddNodesItem; extern gint ett_opcua_AddNodesResult; extern gint ett_opcua_array_AddNodesResult; extern gint ett_opcua_AddReferencesItem; extern gint ett_opcua_array_AddReferencesItem; extern gint ett_opcua_DeleteNodesItem; extern gint ett_opcua_array_DeleteNodesItem; extern gint ett_opcua_DeleteReferencesItem; extern gint ett_opcua_array_DeleteReferencesItem; extern gint ett_opcua_ViewDescription; extern gint ett_opcua_array_ViewDescription; extern gint ett_opcua_BrowseDescription; extern gint ett_opcua_array_BrowseDescription; extern gint ett_opcua_ReferenceDescription; extern gint ett_opcua_array_ReferenceDescription; extern gint ett_opcua_BrowseResult; extern gint ett_opcua_array_BrowseResult; extern gint ett_opcua_RelativePathElement; extern gint ett_opcua_array_RelativePathElement; extern gint ett_opcua_RelativePath; extern gint ett_opcua_array_RelativePath; extern gint ett_opcua_BrowsePath; extern gint ett_opcua_array_BrowsePath; extern gint ett_opcua_BrowsePathTarget; extern gint ett_opcua_array_BrowsePathTarget; extern gint ett_opcua_BrowsePathResult; extern gint ett_opcua_array_BrowsePathResult; extern gint ett_opcua_EndpointConfiguration; extern gint ett_opcua_array_EndpointConfiguration; extern gint ett_opcua_SupportedProfile; extern gint ett_opcua_array_SupportedProfile; extern gint ett_opcua_SoftwareCertificate; extern gint ett_opcua_array_SoftwareCertificate; extern gint ett_opcua_QueryDataDescription; extern gint ett_opcua_array_QueryDataDescription; extern gint ett_opcua_NodeTypeDescription; extern gint ett_opcua_array_NodeTypeDescription; extern gint ett_opcua_QueryDataSet; extern gint ett_opcua_array_QueryDataSet; extern gint ett_opcua_NodeReference; extern gint ett_opcua_array_NodeReference; extern gint ett_opcua_ContentFilterElement; extern gint ett_opcua_array_ContentFilterElement; extern gint ett_opcua_ContentFilter; extern gint ett_opcua_array_ContentFilter; extern gint ett_opcua_ElementOperand; extern gint ett_opcua_array_ElementOperand; extern gint ett_opcua_LiteralOperand; extern gint ett_opcua_array_LiteralOperand; extern gint ett_opcua_AttributeOperand; extern gint ett_opcua_array_AttributeOperand; extern gint ett_opcua_SimpleAttributeOperand; extern gint ett_opcua_array_SimpleAttributeOperand; extern gint ett_opcua_ContentFilterElementResult; extern gint ett_opcua_array_ContentFilterElementResult; extern gint ett_opcua_ContentFilterResult; extern gint ett_opcua_array_ContentFilterResult; extern gint ett_opcua_ParsingResult; extern gint ett_opcua_array_ParsingResult; extern gint ett_opcua_ReadValueId; extern gint ett_opcua_array_ReadValueId; extern gint ett_opcua_HistoryReadValueId; extern gint ett_opcua_array_HistoryReadValueId; extern gint ett_opcua_HistoryReadResult; extern gint ett_opcua_array_HistoryReadResult; extern gint ett_opcua_ReadEventDetails; extern gint ett_opcua_array_ReadEventDetails; extern gint ett_opcua_ReadRawModifiedDetails; extern gint ett_opcua_array_ReadRawModifiedDetails; extern gint ett_opcua_ReadProcessedDetails; extern gint ett_opcua_array_ReadProcessedDetails; extern gint ett_opcua_ReadAtTimeDetails; extern gint ett_opcua_array_ReadAtTimeDetails; extern gint ett_opcua_HistoryData; extern gint ett_opcua_array_HistoryData; extern gint ett_opcua_ModificationInfo; extern gint ett_opcua_array_ModificationInfo; extern gint ett_opcua_HistoryModifiedData; extern gint ett_opcua_array_HistoryModifiedData; extern gint ett_opcua_HistoryEvent; extern gint ett_opcua_array_HistoryEvent; extern gint ett_opcua_WriteValue; extern gint ett_opcua_array_WriteValue; extern gint ett_opcua_HistoryUpdateDetails; extern gint ett_opcua_array_HistoryUpdateDetails; extern gint ett_opcua_UpdateDataDetails; extern gint ett_opcua_array_UpdateDataDetails; extern gint ett_opcua_UpdateStructureDataDetails; extern gint ett_opcua_array_UpdateStructureDataDetails; extern gint ett_opcua_UpdateEventDetails; extern gint ett_opcua_array_UpdateEventDetails; extern gint ett_opcua_DeleteRawModifiedDetails; extern gint ett_opcua_array_DeleteRawModifiedDetails; extern gint ett_opcua_DeleteAtTimeDetails; extern gint ett_opcua_array_DeleteAtTimeDetails; extern gint ett_opcua_DeleteEventDetails; extern gint ett_opcua_array_DeleteEventDetails; extern gint ett_opcua_HistoryUpdateResult; extern gint ett_opcua_array_HistoryUpdateResult; extern gint ett_opcua_CallMethodRequest; extern gint ett_opcua_array_CallMethodRequest; extern gint ett_opcua_CallMethodResult; extern gint ett_opcua_array_CallMethodResult; extern gint ett_opcua_DataChangeFilter; extern gint ett_opcua_array_DataChangeFilter; extern gint ett_opcua_EventFilter; extern gint ett_opcua_array_EventFilter; extern gint ett_opcua_AggregateConfiguration; extern gint ett_opcua_array_AggregateConfiguration; extern gint ett_opcua_AggregateFilter; extern gint ett_opcua_array_AggregateFilter; extern gint ett_opcua_EventFilterResult; extern gint ett_opcua_array_EventFilterResult; extern gint ett_opcua_AggregateFilterResult; extern gint ett_opcua_array_AggregateFilterResult; extern gint ett_opcua_MonitoringParameters; extern gint ett_opcua_array_MonitoringParameters; extern gint ett_opcua_MonitoredItemCreateRequest; extern gint ett_opcua_array_MonitoredItemCreateRequest; extern gint ett_opcua_MonitoredItemCreateResult; extern gint ett_opcua_array_MonitoredItemCreateResult; extern gint ett_opcua_MonitoredItemModifyRequest; extern gint ett_opcua_array_MonitoredItemModifyRequest; extern gint ett_opcua_MonitoredItemModifyResult; extern gint ett_opcua_array_MonitoredItemModifyResult; extern gint ett_opcua_NotificationMessage; extern gint ett_opcua_array_NotificationMessage; extern gint ett_opcua_DataChangeNotification; extern gint ett_opcua_array_DataChangeNotification; extern gint ett_opcua_MonitoredItemNotification; extern gint ett_opcua_array_MonitoredItemNotification; extern gint ett_opcua_EventNotificationList; extern gint ett_opcua_array_EventNotificationList; extern gint ett_opcua_EventFieldList; extern gint ett_opcua_array_EventFieldList; extern gint ett_opcua_HistoryEventFieldList; extern gint ett_opcua_array_HistoryEventFieldList; extern gint ett_opcua_StatusChangeNotification; extern gint ett_opcua_array_StatusChangeNotification; extern gint ett_opcua_SubscriptionAcknowledgement; extern gint ett_opcua_array_SubscriptionAcknowledgement; extern gint ett_opcua_TransferResult; extern gint ett_opcua_array_TransferResult; extern gint ett_opcua_ScalarTestType; extern gint ett_opcua_array_ScalarTestType; extern gint ett_opcua_ArrayTestType; extern gint ett_opcua_array_ArrayTestType; extern gint ett_opcua_CompositeTestType; extern gint ett_opcua_array_CompositeTestType; extern gint ett_opcua_BuildInfo; extern gint ett_opcua_array_BuildInfo; extern gint ett_opcua_RedundantServerDataType; extern gint ett_opcua_array_RedundantServerDataType; extern gint ett_opcua_EndpointUrlListDataType; extern gint ett_opcua_array_EndpointUrlListDataType; extern gint ett_opcua_NetworkGroupDataType; extern gint ett_opcua_array_NetworkGroupDataType; extern gint ett_opcua_SamplingIntervalDiagnosticsDataType; extern gint ett_opcua_array_SamplingIntervalDiagnosticsDataType; extern gint ett_opcua_ServerDiagnosticsSummaryDataType; extern gint ett_opcua_array_ServerDiagnosticsSummaryDataType; extern gint ett_opcua_ServerStatusDataType; extern gint ett_opcua_array_ServerStatusDataType; extern gint ett_opcua_SessionDiagnosticsDataType; extern gint ett_opcua_array_SessionDiagnosticsDataType; extern gint ett_opcua_SessionSecurityDiagnosticsDataType; extern gint ett_opcua_array_SessionSecurityDiagnosticsDataType; extern gint ett_opcua_ServiceCounterDataType; extern gint ett_opcua_array_ServiceCounterDataType; extern gint ett_opcua_StatusResult; extern gint ett_opcua_array_StatusResult; extern gint ett_opcua_SubscriptionDiagnosticsDataType; extern gint ett_opcua_array_SubscriptionDiagnosticsDataType; extern gint ett_opcua_ModelChangeStructureDataType; extern gint ett_opcua_array_ModelChangeStructureDataType; extern gint ett_opcua_SemanticChangeStructureDataType; extern gint ett_opcua_array_SemanticChangeStructureDataType; extern gint ett_opcua_Range; extern gint ett_opcua_array_Range; extern gint ett_opcua_EUInformation; extern gint ett_opcua_array_EUInformation; extern gint ett_opcua_ComplexNumberType; extern gint ett_opcua_array_ComplexNumberType; extern gint ett_opcua_DoubleComplexNumberType; extern gint ett_opcua_array_DoubleComplexNumberType; extern gint ett_opcua_AxisInformation; extern gint ett_opcua_array_AxisInformation; extern gint ett_opcua_XVType; extern gint ett_opcua_array_XVType; extern gint ett_opcua_ProgramDiagnosticDataType; extern gint ett_opcua_array_ProgramDiagnosticDataType; extern gint ett_opcua_Annotation; extern gint ett_opcua_array_Annotation; void parseTrustListDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseInstanceNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseObjectNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseObjectTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseVariableNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseVariableTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReferenceTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMethodNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseViewNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDataTypeNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReferenceNode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseArgument(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEnumValueType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseOptionSet(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseTimeZoneDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseApplicationDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRequestHeader(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseResponseHeader(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseServerOnNetwork(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUserTokenPolicy(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEndpointDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRegisteredServer(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMdnsDiscoveryConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseChannelSecurityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSignedSoftwareCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSignatureData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUserIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAnonymousIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUserNameIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseX509IdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseKerberosIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseIssuedIdentityToken(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNodeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseObjectAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseVariableAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMethodAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseObjectTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseVariableTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReferenceTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDataTypeAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseViewAttributes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAddNodesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAddNodesResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAddReferencesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDeleteNodesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDeleteReferencesItem(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseViewDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBrowseDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReferenceDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBrowseResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRelativePathElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRelativePath(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBrowsePath(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBrowsePathTarget(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBrowsePathResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEndpointConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSupportedProfile(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSoftwareCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseQueryDataDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNodeTypeDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseQueryDataSet(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNodeReference(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseContentFilterElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseContentFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseElementOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseLiteralOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSimpleAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseContentFilterElementResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseContentFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseParsingResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReadValueId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryReadValueId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryReadResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReadEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReadRawModifiedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReadProcessedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseReadAtTimeDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseModificationInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryModifiedData(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryEvent(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseWriteValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryUpdateDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUpdateDataDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUpdateStructureDataDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseUpdateEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDeleteRawModifiedDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDeleteAtTimeDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDeleteEventDetails(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryUpdateResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseCallMethodRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseCallMethodResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDataChangeFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEventFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAggregateConfiguration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAggregateFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEventFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAggregateFilterResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoringParameters(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoredItemCreateRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoredItemCreateResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoredItemModifyRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoredItemModifyResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNotificationMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDataChangeNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseMonitoredItemNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEventNotificationList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEventFieldList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseHistoryEventFieldList(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseStatusChangeNotification(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSubscriptionAcknowledgement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseTransferResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseScalarTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseArrayTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseCompositeTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseBuildInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRedundantServerDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEndpointUrlListDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNetworkGroupDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSamplingIntervalDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseServerDiagnosticsSummaryDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseServerStatusDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSessionDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSessionSecurityDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseServiceCounterDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseStatusResult(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSubscriptionDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseModelChangeStructureDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseSemanticChangeStructureDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseRange(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseEUInformation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseComplexNumberType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDoubleComplexNumberType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAxisInformation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseXVType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseProgramDiagnosticDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseAnnotation(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void registerComplexTypes(void);
C
wireshark/plugins/epan/opcua/opcua_enumparser.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Enum Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_enumparser.h" gint ett_opcua_array_NodeIdType = -1; gint ett_opcua_array_NamingRuleType = -1; gint ett_opcua_array_OpenFileMode = -1; gint ett_opcua_array_TrustListMasks = -1; gint ett_opcua_array_IdType = -1; gint ett_opcua_array_NodeClass = -1; gint ett_opcua_array_ApplicationType = -1; gint ett_opcua_array_MessageSecurityMode = -1; gint ett_opcua_array_UserTokenType = -1; gint ett_opcua_array_SecurityTokenRequestType = -1; gint ett_opcua_array_NodeAttributesMask = -1; gint ett_opcua_array_AttributeWriteMask = -1; gint ett_opcua_array_BrowseDirection = -1; gint ett_opcua_array_BrowseResultMask = -1; gint ett_opcua_array_ComplianceLevel = -1; gint ett_opcua_array_FilterOperator = -1; gint ett_opcua_array_TimestampsToReturn = -1; gint ett_opcua_array_HistoryUpdateType = -1; gint ett_opcua_array_PerformUpdateType = -1; gint ett_opcua_array_MonitoringMode = -1; gint ett_opcua_array_DataChangeTrigger = -1; gint ett_opcua_array_DeadbandType = -1; gint ett_opcua_array_EnumeratedTestType = -1; gint ett_opcua_array_RedundancySupport = -1; gint ett_opcua_array_ServerState = -1; gint ett_opcua_array_ModelChangeStructureVerbMask = -1; gint ett_opcua_array_AxisScaleEnumeration = -1; gint ett_opcua_array_ExceptionDeviationFormat = -1; /** NodeIdType enum table */ static const value_string g_NodeIdTypeTable[] = { { 0, "TwoByte" }, { 1, "FourByte" }, { 2, "Numeric" }, { 3, "String" }, { 4, "Guid" }, { 5, "ByteString" }, { 0, NULL } }; static int hf_opcua_NodeIdType = -1; void parseNodeIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_NodeIdType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** NamingRuleType enum table */ static const value_string g_NamingRuleTypeTable[] = { { 1, "Mandatory" }, { 2, "Optional" }, { 3, "Constraint" }, { 0, NULL } }; static int hf_opcua_NamingRuleType = -1; void parseNamingRuleType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_NamingRuleType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** OpenFileMode enum table */ static const value_string g_OpenFileModeTable[] = { { 1, "Read" }, { 2, "Write" }, { 4, "EraseExisting" }, { 8, "Append" }, { 0, NULL } }; static int hf_opcua_OpenFileMode = -1; void parseOpenFileMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_OpenFileMode, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** TrustListMasks enum table */ static const value_string g_TrustListMasksTable[] = { { 0, "None" }, { 1, "TrustedCertificates" }, { 2, "TrustedCrls" }, { 4, "IssuerCertificates" }, { 8, "IssuerCrls" }, { 15, "All" }, { 0, NULL } }; static int hf_opcua_TrustListMasks = -1; void parseTrustListMasks(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_TrustListMasks, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** IdType enum table */ static const value_string g_IdTypeTable[] = { { 0, "Numeric" }, { 1, "String" }, { 2, "Guid" }, { 3, "Opaque" }, { 0, NULL } }; static int hf_opcua_IdType = -1; void parseIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_IdType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** NodeClass enum table */ static const value_string g_NodeClassTable[] = { { 0, "Unspecified" }, { 1, "Object" }, { 2, "Variable" }, { 4, "Method" }, { 8, "ObjectType" }, { 16, "VariableType" }, { 32, "ReferenceType" }, { 64, "DataType" }, { 128, "View" }, { 0, NULL } }; static int hf_opcua_NodeClass = -1; void parseNodeClass(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_NodeClass, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** ApplicationType enum table */ static const value_string g_ApplicationTypeTable[] = { { 0, "Server" }, { 1, "Client" }, { 2, "ClientAndServer" }, { 3, "DiscoveryServer" }, { 0, NULL } }; static int hf_opcua_ApplicationType = -1; void parseApplicationType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_ApplicationType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** MessageSecurityMode enum table */ static const value_string g_MessageSecurityModeTable[] = { { 0, "Invalid" }, { 1, "None" }, { 2, "Sign" }, { 3, "SignAndEncrypt" }, { 0, NULL } }; static int hf_opcua_MessageSecurityMode = -1; void parseMessageSecurityMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_MessageSecurityMode, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** UserTokenType enum table */ static const value_string g_UserTokenTypeTable[] = { { 0, "Anonymous" }, { 1, "UserName" }, { 2, "Certificate" }, { 3, "IssuedToken" }, { 4, "Kerberos" }, { 0, NULL } }; static int hf_opcua_UserTokenType = -1; void parseUserTokenType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_UserTokenType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** SecurityTokenRequestType enum table */ static const value_string g_SecurityTokenRequestTypeTable[] = { { 0, "Issue" }, { 1, "Renew" }, { 0, NULL } }; static int hf_opcua_SecurityTokenRequestType = -1; void parseSecurityTokenRequestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_SecurityTokenRequestType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** NodeAttributesMask enum table */ static const value_string g_NodeAttributesMaskTable[] = { { 0, "None" }, { 1, "AccessLevel" }, { 2, "ArrayDimensions" }, { 4, "BrowseName" }, { 8, "ContainsNoLoops" }, { 16, "DataType" }, { 32, "Description" }, { 64, "DisplayName" }, { 128, "EventNotifier" }, { 256, "Executable" }, { 512, "Historizing" }, { 1024, "InverseName" }, { 2048, "IsAbstract" }, { 4096, "MinimumSamplingInterval" }, { 8192, "NodeClass" }, { 16384, "NodeId" }, { 32768, "Symmetric" }, { 65536, "UserAccessLevel" }, { 131072, "UserExecutable" }, { 262144, "UserWriteMask" }, { 524288, "ValueRank" }, { 1048576, "WriteMask" }, { 2097152, "Value" }, { 4194303, "All" }, { 1335396, "BaseNode" }, { 1335524, "Object" }, { 1337444, "ObjectTypeOrDataType" }, { 4026999, "Variable" }, { 3958902, "VariableType" }, { 1466724, "Method" }, { 1371236, "ReferenceType" }, { 1335532, "View" }, { 0, NULL } }; static int hf_opcua_NodeAttributesMask = -1; void parseNodeAttributesMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_NodeAttributesMask, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** AttributeWriteMask enum table */ static const value_string g_AttributeWriteMaskTable[] = { { 0, "None" }, { 1, "AccessLevel" }, { 2, "ArrayDimensions" }, { 4, "BrowseName" }, { 8, "ContainsNoLoops" }, { 16, "DataType" }, { 32, "Description" }, { 64, "DisplayName" }, { 128, "EventNotifier" }, { 256, "Executable" }, { 512, "Historizing" }, { 1024, "InverseName" }, { 2048, "IsAbstract" }, { 4096, "MinimumSamplingInterval" }, { 8192, "NodeClass" }, { 16384, "NodeId" }, { 32768, "Symmetric" }, { 65536, "UserAccessLevel" }, { 131072, "UserExecutable" }, { 262144, "UserWriteMask" }, { 524288, "ValueRank" }, { 1048576, "WriteMask" }, { 2097152, "ValueForVariableType" }, { 4194304, "DataTypeDefinition" }, { 8388608, "RolePermissions" }, { 16777216, "AccessRestrictions" }, { 33554432, "AccessLevelEx" }, { 0, NULL } }; static int hf_opcua_AttributeWriteMask = -1; void parseAttributeWriteMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_AttributeWriteMask, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** BrowseDirection enum table */ static const value_string g_BrowseDirectionTable[] = { { 0, "Forward" }, { 1, "Inverse" }, { 2, "Both" }, { 3, "Invalid" }, { 0, NULL } }; static int hf_opcua_BrowseDirection = -1; void parseBrowseDirection(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_BrowseDirection, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** ComplianceLevel enum table */ static const value_string g_ComplianceLevelTable[] = { { 0, "Untested" }, { 1, "Partial" }, { 2, "SelfTested" }, { 3, "Certified" }, { 0, NULL } }; static int hf_opcua_ComplianceLevel = -1; void parseComplianceLevel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_ComplianceLevel, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** FilterOperator enum table */ static const value_string g_FilterOperatorTable[] = { { 0, "Equals" }, { 1, "IsNull" }, { 2, "GreaterThan" }, { 3, "LessThan" }, { 4, "GreaterThanOrEqual" }, { 5, "LessThanOrEqual" }, { 6, "Like" }, { 7, "Not" }, { 8, "Between" }, { 9, "InList" }, { 10, "And" }, { 11, "Or" }, { 12, "Cast" }, { 13, "InView" }, { 14, "OfType" }, { 15, "RelatedTo" }, { 16, "BitwiseAnd" }, { 17, "BitwiseOr" }, { 0, NULL } }; static int hf_opcua_FilterOperator = -1; void parseFilterOperator(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_FilterOperator, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** TimestampsToReturn enum table */ static const value_string g_TimestampsToReturnTable[] = { { 0, "Source" }, { 1, "Server" }, { 2, "Both" }, { 3, "Neither" }, { 4, "Invalid" }, { 0, NULL } }; static int hf_opcua_TimestampsToReturn = -1; void parseTimestampsToReturn(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_TimestampsToReturn, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** HistoryUpdateType enum table */ static const value_string g_HistoryUpdateTypeTable[] = { { 1, "Insert" }, { 2, "Replace" }, { 3, "Update" }, { 4, "Delete" }, { 0, NULL } }; static int hf_opcua_HistoryUpdateType = -1; void parseHistoryUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_HistoryUpdateType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** PerformUpdateType enum table */ static const value_string g_PerformUpdateTypeTable[] = { { 1, "Insert" }, { 2, "Replace" }, { 3, "Update" }, { 4, "Remove" }, { 0, NULL } }; static int hf_opcua_PerformUpdateType = -1; void parsePerformUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_PerformUpdateType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** MonitoringMode enum table */ static const value_string g_MonitoringModeTable[] = { { 0, "Disabled" }, { 1, "Sampling" }, { 2, "Reporting" }, { 0, NULL } }; static int hf_opcua_MonitoringMode = -1; void parseMonitoringMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_MonitoringMode, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** DataChangeTrigger enum table */ static const value_string g_DataChangeTriggerTable[] = { { 0, "Status" }, { 1, "StatusValue" }, { 2, "StatusValueTimestamp" }, { 0, NULL } }; static int hf_opcua_DataChangeTrigger = -1; void parseDataChangeTrigger(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_DataChangeTrigger, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** DeadbandType enum table */ static const value_string g_DeadbandTypeTable[] = { { 0, "None" }, { 1, "Absolute" }, { 2, "Percent" }, { 0, NULL } }; static int hf_opcua_DeadbandType = -1; void parseDeadbandType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_DeadbandType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** EnumeratedTestType enum table */ static const value_string g_EnumeratedTestTypeTable[] = { { 1, "Red" }, { 4, "Yellow" }, { 5, "Green" }, { 0, NULL } }; static int hf_opcua_EnumeratedTestType = -1; void parseEnumeratedTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_EnumeratedTestType, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** RedundancySupport enum table */ static const value_string g_RedundancySupportTable[] = { { 0, "None" }, { 1, "Cold" }, { 2, "Warm" }, { 3, "Hot" }, { 4, "Transparent" }, { 5, "HotAndMirrored" }, { 0, NULL } }; static int hf_opcua_RedundancySupport = -1; void parseRedundancySupport(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_RedundancySupport, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** ServerState enum table */ static const value_string g_ServerStateTable[] = { { 0, "Running" }, { 1, "Failed" }, { 2, "NoConfiguration" }, { 3, "Suspended" }, { 4, "Shutdown" }, { 5, "Test" }, { 6, "CommunicationFault" }, { 7, "Unknown" }, { 0, NULL } }; static int hf_opcua_ServerState = -1; void parseServerState(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_ServerState, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** ModelChangeStructureVerbMask enum table */ static const value_string g_ModelChangeStructureVerbMaskTable[] = { { 1, "NodeAdded" }, { 2, "NodeDeleted" }, { 4, "ReferenceAdded" }, { 8, "ReferenceDeleted" }, { 16, "DataTypeChanged" }, { 0, NULL } }; static int hf_opcua_ModelChangeStructureVerbMask = -1; void parseModelChangeStructureVerbMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_ModelChangeStructureVerbMask, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** AxisScaleEnumeration enum table */ static const value_string g_AxisScaleEnumerationTable[] = { { 0, "Linear" }, { 1, "Log" }, { 2, "Ln" }, { 0, NULL } }; static int hf_opcua_AxisScaleEnumeration = -1; void parseAxisScaleEnumeration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_AxisScaleEnumeration, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** ExceptionDeviationFormat enum table */ static const value_string g_ExceptionDeviationFormatTable[] = { { 0, "AbsoluteValue" }, { 1, "PercentOfValue" }, { 2, "PercentOfRange" }, { 3, "PercentOfEURange" }, { 4, "Unknown" }, { 0, NULL } }; static int hf_opcua_ExceptionDeviationFormat = -1; void parseExceptionDeviationFormat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_ExceptionDeviationFormat, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /** AttributeId enum table */ static const value_string g_AttributeIdTable[] = { {1, "NodeId"}, {2, "NodeClass"}, {3, "BrowseName"}, {4, "DisplayName"}, {5, "Description"}, {6, "WriteMask"}, {7, "UserWriteMask"}, {8, "IsAbstract"}, {9, "Symmetric"}, {10, "InverseName"}, {11, "ContainsNoLoops"}, {12, "EventNotifier"}, {13, "Value"}, {14, "DataType"}, {15, "ValueRank"}, {16, "ArrayDimensions"}, {17, "AccessLevel"}, {18, "UserAccessLevel"}, {19, "MinimumSamplingInterval"}, {20, "Historizing"}, {21, "Executable"}, {22, "UserExecutable"}, {23, "DataTypeDefinition"}, {24, "RolePermissions"}, {25, "UserRolePermissions"}, {26, "AccessRestrictions"}, {27, "AccessLevelEx"}, {0, NULL} }; static int hf_opcua_AttributeId = -1; void parseAttributeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_AttributeId, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset += 4; } /** Setup enum subtree array */ static gint *ett[] = { &ett_opcua_array_NodeIdType, &ett_opcua_array_NamingRuleType, &ett_opcua_array_OpenFileMode, &ett_opcua_array_TrustListMasks, &ett_opcua_array_IdType, &ett_opcua_array_NodeClass, &ett_opcua_array_ApplicationType, &ett_opcua_array_MessageSecurityMode, &ett_opcua_array_UserTokenType, &ett_opcua_array_SecurityTokenRequestType, &ett_opcua_array_NodeAttributesMask, &ett_opcua_array_AttributeWriteMask, &ett_opcua_array_BrowseDirection, &ett_opcua_array_BrowseResultMask, &ett_opcua_array_ComplianceLevel, &ett_opcua_array_FilterOperator, &ett_opcua_array_TimestampsToReturn, &ett_opcua_array_HistoryUpdateType, &ett_opcua_array_PerformUpdateType, &ett_opcua_array_MonitoringMode, &ett_opcua_array_DataChangeTrigger, &ett_opcua_array_DeadbandType, &ett_opcua_array_EnumeratedTestType, &ett_opcua_array_RedundancySupport, &ett_opcua_array_ServerState, &ett_opcua_array_ModelChangeStructureVerbMask, &ett_opcua_array_AxisScaleEnumeration, &ett_opcua_array_ExceptionDeviationFormat, }; /** Register enum types. */ void registerEnumTypes(int proto) { /** header field definitions */ static hf_register_info hf[] = { { &hf_opcua_NodeIdType, { "NodeIdType", "opcua.NodeIdType", FT_UINT32, BASE_HEX, VALS(g_NodeIdTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_NamingRuleType, { "NamingRuleType", "opcua.NamingRuleType", FT_UINT32, BASE_HEX, VALS(g_NamingRuleTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_OpenFileMode, { "OpenFileMode", "opcua.OpenFileMode", FT_UINT32, BASE_HEX, VALS(g_OpenFileModeTable), 0x0, NULL, HFILL } }, { &hf_opcua_TrustListMasks, { "TrustListMasks", "opcua.TrustListMasks", FT_UINT32, BASE_HEX, VALS(g_TrustListMasksTable), 0x0, NULL, HFILL } }, { &hf_opcua_IdType, { "IdType", "opcua.IdType", FT_UINT32, BASE_HEX, VALS(g_IdTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_NodeClass, { "NodeClass", "opcua.NodeClass", FT_UINT32, BASE_HEX, VALS(g_NodeClassTable), 0x0, NULL, HFILL } }, { &hf_opcua_ApplicationType, { "ApplicationType", "opcua.ApplicationType", FT_UINT32, BASE_HEX, VALS(g_ApplicationTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_MessageSecurityMode, { "MessageSecurityMode", "opcua.MessageSecurityMode", FT_UINT32, BASE_HEX, VALS(g_MessageSecurityModeTable), 0x0, NULL, HFILL } }, { &hf_opcua_UserTokenType, { "UserTokenType", "opcua.UserTokenType", FT_UINT32, BASE_HEX, VALS(g_UserTokenTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_SecurityTokenRequestType, { "SecurityTokenRequestType", "opcua.SecurityTokenRequestType", FT_UINT32, BASE_HEX, VALS(g_SecurityTokenRequestTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_NodeAttributesMask, { "NodeAttributesMask", "opcua.NodeAttributesMask", FT_UINT32, BASE_HEX, VALS(g_NodeAttributesMaskTable), 0x0, NULL, HFILL } }, { &hf_opcua_AttributeWriteMask, { "AttributeWriteMask", "opcua.AttributeWriteMask", FT_UINT32, BASE_HEX, VALS(g_AttributeWriteMaskTable), 0x0, NULL, HFILL } }, { &hf_opcua_BrowseDirection, { "BrowseDirection", "opcua.BrowseDirection", FT_UINT32, BASE_HEX, VALS(g_BrowseDirectionTable), 0x0, NULL, HFILL } }, { &hf_opcua_ComplianceLevel, { "ComplianceLevel", "opcua.ComplianceLevel", FT_UINT32, BASE_HEX, VALS(g_ComplianceLevelTable), 0x0, NULL, HFILL } }, { &hf_opcua_FilterOperator, { "FilterOperator", "opcua.FilterOperator", FT_UINT32, BASE_HEX, VALS(g_FilterOperatorTable), 0x0, NULL, HFILL } }, { &hf_opcua_TimestampsToReturn, { "TimestampsToReturn", "opcua.TimestampsToReturn", FT_UINT32, BASE_HEX, VALS(g_TimestampsToReturnTable), 0x0, NULL, HFILL } }, { &hf_opcua_HistoryUpdateType, { "HistoryUpdateType", "opcua.HistoryUpdateType", FT_UINT32, BASE_HEX, VALS(g_HistoryUpdateTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_PerformUpdateType, { "PerformUpdateType", "opcua.PerformUpdateType", FT_UINT32, BASE_HEX, VALS(g_PerformUpdateTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_MonitoringMode, { "MonitoringMode", "opcua.MonitoringMode", FT_UINT32, BASE_HEX, VALS(g_MonitoringModeTable), 0x0, NULL, HFILL } }, { &hf_opcua_DataChangeTrigger, { "DataChangeTrigger", "opcua.DataChangeTrigger", FT_UINT32, BASE_HEX, VALS(g_DataChangeTriggerTable), 0x0, NULL, HFILL } }, { &hf_opcua_DeadbandType, { "DeadbandType", "opcua.DeadbandType", FT_UINT32, BASE_HEX, VALS(g_DeadbandTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_EnumeratedTestType, { "EnumeratedTestType", "opcua.EnumeratedTestType", FT_UINT32, BASE_HEX, VALS(g_EnumeratedTestTypeTable), 0x0, NULL, HFILL } }, { &hf_opcua_RedundancySupport, { "RedundancySupport", "opcua.RedundancySupport", FT_UINT32, BASE_HEX, VALS(g_RedundancySupportTable), 0x0, NULL, HFILL } }, { &hf_opcua_ServerState, { "ServerState", "opcua.ServerState", FT_UINT32, BASE_HEX, VALS(g_ServerStateTable), 0x0, NULL, HFILL } }, { &hf_opcua_ModelChangeStructureVerbMask, { "ModelChangeStructureVerbMask", "opcua.ModelChangeStructureVerbMask", FT_UINT32, BASE_HEX, VALS(g_ModelChangeStructureVerbMaskTable), 0x0, NULL, HFILL } }, { &hf_opcua_AxisScaleEnumeration, { "AxisScaleEnumeration", "opcua.AxisScaleEnumeration", FT_UINT32, BASE_HEX, VALS(g_AxisScaleEnumerationTable), 0x0, NULL, HFILL } }, { &hf_opcua_ExceptionDeviationFormat, { "ExceptionDeviationFormat", "opcua.ExceptionDeviationFormat", FT_UINT32, BASE_HEX, VALS(g_ExceptionDeviationFormatTable), 0x0, NULL, HFILL } }, { &hf_opcua_AttributeId, { "AttributeId", "opcua.AttributeId", FT_UINT32, BASE_HEX, VALS(g_AttributeIdTable), 0x0, NULL, HFILL } }, }; proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); }
C/C++
wireshark/plugins/epan/opcua/opcua_enumparser.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Enum Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include <glib.h> #include <epan/packet.h> extern gint ett_opcua_array_NodeIdType; extern gint ett_opcua_array_NamingRuleType; extern gint ett_opcua_array_OpenFileMode; extern gint ett_opcua_array_TrustListMasks; extern gint ett_opcua_array_IdType; extern gint ett_opcua_array_NodeClass; extern gint ett_opcua_array_ApplicationType; extern gint ett_opcua_array_MessageSecurityMode; extern gint ett_opcua_array_UserTokenType; extern gint ett_opcua_array_SecurityTokenRequestType; extern gint ett_opcua_array_NodeAttributesMask; extern gint ett_opcua_array_AttributeWriteMask; extern gint ett_opcua_array_BrowseDirection; extern gint ett_opcua_array_BrowseResultMask; extern gint ett_opcua_array_ComplianceLevel; extern gint ett_opcua_array_FilterOperator; extern gint ett_opcua_array_TimestampsToReturn; extern gint ett_opcua_array_HistoryUpdateType; extern gint ett_opcua_array_PerformUpdateType; extern gint ett_opcua_array_MonitoringMode; extern gint ett_opcua_array_DataChangeTrigger; extern gint ett_opcua_array_DeadbandType; extern gint ett_opcua_array_EnumeratedTestType; extern gint ett_opcua_array_RedundancySupport; extern gint ett_opcua_array_ServerState; extern gint ett_opcua_array_ModelChangeStructureVerbMask; extern gint ett_opcua_array_AxisScaleEnumeration; extern gint ett_opcua_array_ExceptionDeviationFormat; extern gint ett_opcua_array_AttributeId; void parseNodeIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseNamingRuleType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseOpenFileMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTrustListMasks(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseNodeClass(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseApplicationType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseMessageSecurityMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseUserTokenType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSecurityTokenRequestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseNodeAttributesMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAttributeWriteMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseBrowseDirection(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseComplianceLevel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseFilterOperator(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTimestampsToReturn(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseHistoryUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parsePerformUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseMonitoringMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDataChangeTrigger(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeadbandType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseEnumeratedTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRedundancySupport(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseServerState(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseModelChangeStructureVerbMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAxisScaleEnumeration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseExceptionDeviationFormat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAttributeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void registerEnumTypes(int proto);
C/C++
wireshark/plugins/epan/opcua/opcua_extensionobjectids.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Extension Object IDs ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #define OpcUaId_TrustListDataType_Encoding_DefaultBinary 12680 #define OpcUaId_Node_Encoding_DefaultBinary 260 #define OpcUaId_InstanceNode_Encoding_DefaultBinary 11889 #define OpcUaId_TypeNode_Encoding_DefaultBinary 11890 #define OpcUaId_ObjectNode_Encoding_DefaultBinary 263 #define OpcUaId_ObjectTypeNode_Encoding_DefaultBinary 266 #define OpcUaId_VariableNode_Encoding_DefaultBinary 269 #define OpcUaId_VariableTypeNode_Encoding_DefaultBinary 272 #define OpcUaId_ReferenceTypeNode_Encoding_DefaultBinary 275 #define OpcUaId_MethodNode_Encoding_DefaultBinary 278 #define OpcUaId_ViewNode_Encoding_DefaultBinary 281 #define OpcUaId_DataTypeNode_Encoding_DefaultBinary 284 #define OpcUaId_ReferenceNode_Encoding_DefaultBinary 287 #define OpcUaId_Argument_Encoding_DefaultBinary 298 #define OpcUaId_EnumValueType_Encoding_DefaultBinary 8251 #define OpcUaId_OptionSet_Encoding_DefaultBinary 12765 #define OpcUaId_TimeZoneDataType_Encoding_DefaultBinary 8917 #define OpcUaId_ApplicationDescription_Encoding_DefaultBinary 310 #define OpcUaId_RequestHeader_Encoding_DefaultBinary 391 #define OpcUaId_ResponseHeader_Encoding_DefaultBinary 394 #define OpcUaId_ServerOnNetwork_Encoding_DefaultBinary 12207 #define OpcUaId_UserTokenPolicy_Encoding_DefaultBinary 306 #define OpcUaId_EndpointDescription_Encoding_DefaultBinary 314 #define OpcUaId_RegisteredServer_Encoding_DefaultBinary 434 #define OpcUaId_MdnsDiscoveryConfiguration_Encoding_DefaultBinary 12901 #define OpcUaId_ChannelSecurityToken_Encoding_DefaultBinary 443 #define OpcUaId_SignedSoftwareCertificate_Encoding_DefaultBinary 346 #define OpcUaId_SignatureData_Encoding_DefaultBinary 458 #define OpcUaId_UserIdentityToken_Encoding_DefaultBinary 318 #define OpcUaId_AnonymousIdentityToken_Encoding_DefaultBinary 321 #define OpcUaId_UserNameIdentityToken_Encoding_DefaultBinary 324 #define OpcUaId_X509IdentityToken_Encoding_DefaultBinary 327 #define OpcUaId_KerberosIdentityToken_Encoding_DefaultBinary 12509 #define OpcUaId_IssuedIdentityToken_Encoding_DefaultBinary 940 #define OpcUaId_NodeAttributes_Encoding_DefaultBinary 351 #define OpcUaId_ObjectAttributes_Encoding_DefaultBinary 354 #define OpcUaId_VariableAttributes_Encoding_DefaultBinary 357 #define OpcUaId_MethodAttributes_Encoding_DefaultBinary 360 #define OpcUaId_ObjectTypeAttributes_Encoding_DefaultBinary 363 #define OpcUaId_VariableTypeAttributes_Encoding_DefaultBinary 366 #define OpcUaId_ReferenceTypeAttributes_Encoding_DefaultBinary 369 #define OpcUaId_DataTypeAttributes_Encoding_DefaultBinary 372 #define OpcUaId_ViewAttributes_Encoding_DefaultBinary 375 #define OpcUaId_AddNodesItem_Encoding_DefaultBinary 378 #define OpcUaId_AddNodesResult_Encoding_DefaultBinary 485 #define OpcUaId_AddReferencesItem_Encoding_DefaultBinary 381 #define OpcUaId_DeleteNodesItem_Encoding_DefaultBinary 384 #define OpcUaId_DeleteReferencesItem_Encoding_DefaultBinary 387 #define OpcUaId_ViewDescription_Encoding_DefaultBinary 513 #define OpcUaId_BrowseDescription_Encoding_DefaultBinary 516 #define OpcUaId_ReferenceDescription_Encoding_DefaultBinary 520 #define OpcUaId_BrowseResult_Encoding_DefaultBinary 524 #define OpcUaId_RelativePathElement_Encoding_DefaultBinary 539 #define OpcUaId_RelativePath_Encoding_DefaultBinary 542 #define OpcUaId_BrowsePath_Encoding_DefaultBinary 545 #define OpcUaId_BrowsePathTarget_Encoding_DefaultBinary 548 #define OpcUaId_BrowsePathResult_Encoding_DefaultBinary 551 #define OpcUaId_EndpointConfiguration_Encoding_DefaultBinary 333 #define OpcUaId_SupportedProfile_Encoding_DefaultBinary 337 #define OpcUaId_SoftwareCertificate_Encoding_DefaultBinary 343 #define OpcUaId_QueryDataDescription_Encoding_DefaultBinary 572 #define OpcUaId_NodeTypeDescription_Encoding_DefaultBinary 575 #define OpcUaId_QueryDataSet_Encoding_DefaultBinary 579 #define OpcUaId_NodeReference_Encoding_DefaultBinary 582 #define OpcUaId_ContentFilterElement_Encoding_DefaultBinary 585 #define OpcUaId_ContentFilter_Encoding_DefaultBinary 588 #define OpcUaId_ElementOperand_Encoding_DefaultBinary 594 #define OpcUaId_LiteralOperand_Encoding_DefaultBinary 597 #define OpcUaId_AttributeOperand_Encoding_DefaultBinary 600 #define OpcUaId_SimpleAttributeOperand_Encoding_DefaultBinary 603 #define OpcUaId_ContentFilterElementResult_Encoding_DefaultBinary 606 #define OpcUaId_ContentFilterResult_Encoding_DefaultBinary 609 #define OpcUaId_ParsingResult_Encoding_DefaultBinary 612 #define OpcUaId_ReadValueId_Encoding_DefaultBinary 628 #define OpcUaId_HistoryReadValueId_Encoding_DefaultBinary 637 #define OpcUaId_HistoryReadResult_Encoding_DefaultBinary 640 #define OpcUaId_ReadEventDetails_Encoding_DefaultBinary 646 #define OpcUaId_ReadRawModifiedDetails_Encoding_DefaultBinary 649 #define OpcUaId_ReadProcessedDetails_Encoding_DefaultBinary 652 #define OpcUaId_ReadAtTimeDetails_Encoding_DefaultBinary 655 #define OpcUaId_HistoryData_Encoding_DefaultBinary 658 #define OpcUaId_ModificationInfo_Encoding_DefaultBinary 11226 #define OpcUaId_HistoryModifiedData_Encoding_DefaultBinary 11227 #define OpcUaId_HistoryEvent_Encoding_DefaultBinary 661 #define OpcUaId_WriteValue_Encoding_DefaultBinary 670 #define OpcUaId_HistoryUpdateDetails_Encoding_DefaultBinary 679 #define OpcUaId_UpdateDataDetails_Encoding_DefaultBinary 682 #define OpcUaId_UpdateStructureDataDetails_Encoding_DefaultBinary 11300 #define OpcUaId_UpdateEventDetails_Encoding_DefaultBinary 685 #define OpcUaId_DeleteRawModifiedDetails_Encoding_DefaultBinary 688 #define OpcUaId_DeleteAtTimeDetails_Encoding_DefaultBinary 691 #define OpcUaId_DeleteEventDetails_Encoding_DefaultBinary 694 #define OpcUaId_HistoryUpdateResult_Encoding_DefaultBinary 697 #define OpcUaId_CallMethodRequest_Encoding_DefaultBinary 706 #define OpcUaId_CallMethodResult_Encoding_DefaultBinary 709 #define OpcUaId_DataChangeFilter_Encoding_DefaultBinary 724 #define OpcUaId_EventFilter_Encoding_DefaultBinary 727 #define OpcUaId_AggregateConfiguration_Encoding_DefaultBinary 950 #define OpcUaId_AggregateFilter_Encoding_DefaultBinary 730 #define OpcUaId_EventFilterResult_Encoding_DefaultBinary 736 #define OpcUaId_AggregateFilterResult_Encoding_DefaultBinary 739 #define OpcUaId_MonitoringParameters_Encoding_DefaultBinary 742 #define OpcUaId_MonitoredItemCreateRequest_Encoding_DefaultBinary 745 #define OpcUaId_MonitoredItemCreateResult_Encoding_DefaultBinary 748 #define OpcUaId_MonitoredItemModifyRequest_Encoding_DefaultBinary 757 #define OpcUaId_MonitoredItemModifyResult_Encoding_DefaultBinary 760 #define OpcUaId_NotificationMessage_Encoding_DefaultBinary 805 #define OpcUaId_DataChangeNotification_Encoding_DefaultBinary 811 #define OpcUaId_MonitoredItemNotification_Encoding_DefaultBinary 808 #define OpcUaId_EventNotificationList_Encoding_DefaultBinary 916 #define OpcUaId_EventFieldList_Encoding_DefaultBinary 919 #define OpcUaId_HistoryEventFieldList_Encoding_DefaultBinary 922 #define OpcUaId_StatusChangeNotification_Encoding_DefaultBinary 820 #define OpcUaId_SubscriptionAcknowledgement_Encoding_DefaultBinary 823 #define OpcUaId_TransferResult_Encoding_DefaultBinary 838 #define OpcUaId_ScalarTestType_Encoding_DefaultBinary 401 #define OpcUaId_ArrayTestType_Encoding_DefaultBinary 404 #define OpcUaId_CompositeTestType_Encoding_DefaultBinary 407 #define OpcUaId_BuildInfo_Encoding_DefaultBinary 340 #define OpcUaId_RedundantServerDataType_Encoding_DefaultBinary 855 #define OpcUaId_EndpointUrlListDataType_Encoding_DefaultBinary 11957 #define OpcUaId_NetworkGroupDataType_Encoding_DefaultBinary 11958 #define OpcUaId_SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary 858 #define OpcUaId_ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary 861 #define OpcUaId_ServerStatusDataType_Encoding_DefaultBinary 864 #define OpcUaId_SessionDiagnosticsDataType_Encoding_DefaultBinary 867 #define OpcUaId_SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary 870 #define OpcUaId_ServiceCounterDataType_Encoding_DefaultBinary 873 #define OpcUaId_StatusResult_Encoding_DefaultBinary 301 #define OpcUaId_SubscriptionDiagnosticsDataType_Encoding_DefaultBinary 876 #define OpcUaId_ModelChangeStructureDataType_Encoding_DefaultBinary 879 #define OpcUaId_SemanticChangeStructureDataType_Encoding_DefaultBinary 899 #define OpcUaId_Range_Encoding_DefaultBinary 886 #define OpcUaId_EUInformation_Encoding_DefaultBinary 889 #define OpcUaId_ComplexNumberType_Encoding_DefaultBinary 12181 #define OpcUaId_DoubleComplexNumberType_Encoding_DefaultBinary 12182 #define OpcUaId_AxisInformation_Encoding_DefaultBinary 12089 #define OpcUaId_XVType_Encoding_DefaultBinary 12090 #define OpcUaId_ProgramDiagnosticDataType_Encoding_DefaultBinary 896 #define OpcUaId_Annotation_Encoding_DefaultBinary 893
C
wireshark/plugins/epan/opcua/opcua_extensionobjecttable.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Service table and service dispatcher. ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_simpletypes.h" #include "opcua_complextypeparser.h" #include "opcua_extensionobjectids.h" #include "opcua_hfindeces.h" ExtensionObjectParserEntry g_arExtensionObjectParserTable[] = { { OpcUaId_TrustListDataType_Encoding_DefaultBinary, parseTrustListDataType, "TrustListDataType" }, { OpcUaId_Node_Encoding_DefaultBinary, parseNode, "Node" }, { OpcUaId_InstanceNode_Encoding_DefaultBinary, parseInstanceNode, "InstanceNode" }, { OpcUaId_TypeNode_Encoding_DefaultBinary, parseTypeNode, "TypeNode" }, { OpcUaId_ObjectNode_Encoding_DefaultBinary, parseObjectNode, "ObjectNode" }, { OpcUaId_ObjectTypeNode_Encoding_DefaultBinary, parseObjectTypeNode, "ObjectTypeNode" }, { OpcUaId_VariableNode_Encoding_DefaultBinary, parseVariableNode, "VariableNode" }, { OpcUaId_VariableTypeNode_Encoding_DefaultBinary, parseVariableTypeNode, "VariableTypeNode" }, { OpcUaId_ReferenceTypeNode_Encoding_DefaultBinary, parseReferenceTypeNode, "ReferenceTypeNode" }, { OpcUaId_MethodNode_Encoding_DefaultBinary, parseMethodNode, "MethodNode" }, { OpcUaId_ViewNode_Encoding_DefaultBinary, parseViewNode, "ViewNode" }, { OpcUaId_DataTypeNode_Encoding_DefaultBinary, parseDataTypeNode, "DataTypeNode" }, { OpcUaId_ReferenceNode_Encoding_DefaultBinary, parseReferenceNode, "ReferenceNode" }, { OpcUaId_Argument_Encoding_DefaultBinary, parseArgument, "Argument" }, { OpcUaId_EnumValueType_Encoding_DefaultBinary, parseEnumValueType, "EnumValueType" }, { OpcUaId_OptionSet_Encoding_DefaultBinary, parseOptionSet, "OptionSet" }, { OpcUaId_TimeZoneDataType_Encoding_DefaultBinary, parseTimeZoneDataType, "TimeZoneDataType" }, { OpcUaId_ApplicationDescription_Encoding_DefaultBinary, parseApplicationDescription, "ApplicationDescription" }, { OpcUaId_RequestHeader_Encoding_DefaultBinary, parseRequestHeader, "RequestHeader" }, { OpcUaId_ResponseHeader_Encoding_DefaultBinary, parseResponseHeader, "ResponseHeader" }, { OpcUaId_ServerOnNetwork_Encoding_DefaultBinary, parseServerOnNetwork, "ServerOnNetwork" }, { OpcUaId_UserTokenPolicy_Encoding_DefaultBinary, parseUserTokenPolicy, "UserTokenPolicy" }, { OpcUaId_EndpointDescription_Encoding_DefaultBinary, parseEndpointDescription, "EndpointDescription" }, { OpcUaId_RegisteredServer_Encoding_DefaultBinary, parseRegisteredServer, "RegisteredServer" }, { OpcUaId_MdnsDiscoveryConfiguration_Encoding_DefaultBinary, parseMdnsDiscoveryConfiguration, "MdnsDiscoveryConfiguration" }, { OpcUaId_ChannelSecurityToken_Encoding_DefaultBinary, parseChannelSecurityToken, "ChannelSecurityToken" }, { OpcUaId_SignedSoftwareCertificate_Encoding_DefaultBinary, parseSignedSoftwareCertificate, "SignedSoftwareCertificate" }, { OpcUaId_SignatureData_Encoding_DefaultBinary, parseSignatureData, "SignatureData" }, { OpcUaId_UserIdentityToken_Encoding_DefaultBinary, parseUserIdentityToken, "UserIdentityToken" }, { OpcUaId_AnonymousIdentityToken_Encoding_DefaultBinary, parseAnonymousIdentityToken, "AnonymousIdentityToken" }, { OpcUaId_UserNameIdentityToken_Encoding_DefaultBinary, parseUserNameIdentityToken, "UserNameIdentityToken" }, { OpcUaId_X509IdentityToken_Encoding_DefaultBinary, parseX509IdentityToken, "X509IdentityToken" }, { OpcUaId_KerberosIdentityToken_Encoding_DefaultBinary, parseKerberosIdentityToken, "KerberosIdentityToken" }, { OpcUaId_IssuedIdentityToken_Encoding_DefaultBinary, parseIssuedIdentityToken, "IssuedIdentityToken" }, { OpcUaId_NodeAttributes_Encoding_DefaultBinary, parseNodeAttributes, "NodeAttributes" }, { OpcUaId_ObjectAttributes_Encoding_DefaultBinary, parseObjectAttributes, "ObjectAttributes" }, { OpcUaId_VariableAttributes_Encoding_DefaultBinary, parseVariableAttributes, "VariableAttributes" }, { OpcUaId_MethodAttributes_Encoding_DefaultBinary, parseMethodAttributes, "MethodAttributes" }, { OpcUaId_ObjectTypeAttributes_Encoding_DefaultBinary, parseObjectTypeAttributes, "ObjectTypeAttributes" }, { OpcUaId_VariableTypeAttributes_Encoding_DefaultBinary, parseVariableTypeAttributes, "VariableTypeAttributes" }, { OpcUaId_ReferenceTypeAttributes_Encoding_DefaultBinary, parseReferenceTypeAttributes, "ReferenceTypeAttributes" }, { OpcUaId_DataTypeAttributes_Encoding_DefaultBinary, parseDataTypeAttributes, "DataTypeAttributes" }, { OpcUaId_ViewAttributes_Encoding_DefaultBinary, parseViewAttributes, "ViewAttributes" }, { OpcUaId_AddNodesItem_Encoding_DefaultBinary, parseAddNodesItem, "AddNodesItem" }, { OpcUaId_AddNodesResult_Encoding_DefaultBinary, parseAddNodesResult, "AddNodesResult" }, { OpcUaId_AddReferencesItem_Encoding_DefaultBinary, parseAddReferencesItem, "AddReferencesItem" }, { OpcUaId_DeleteNodesItem_Encoding_DefaultBinary, parseDeleteNodesItem, "DeleteNodesItem" }, { OpcUaId_DeleteReferencesItem_Encoding_DefaultBinary, parseDeleteReferencesItem, "DeleteReferencesItem" }, { OpcUaId_ViewDescription_Encoding_DefaultBinary, parseViewDescription, "ViewDescription" }, { OpcUaId_BrowseDescription_Encoding_DefaultBinary, parseBrowseDescription, "BrowseDescription" }, { OpcUaId_ReferenceDescription_Encoding_DefaultBinary, parseReferenceDescription, "ReferenceDescription" }, { OpcUaId_BrowseResult_Encoding_DefaultBinary, parseBrowseResult, "BrowseResult" }, { OpcUaId_RelativePathElement_Encoding_DefaultBinary, parseRelativePathElement, "RelativePathElement" }, { OpcUaId_RelativePath_Encoding_DefaultBinary, parseRelativePath, "RelativePath" }, { OpcUaId_BrowsePath_Encoding_DefaultBinary, parseBrowsePath, "BrowsePath" }, { OpcUaId_BrowsePathTarget_Encoding_DefaultBinary, parseBrowsePathTarget, "BrowsePathTarget" }, { OpcUaId_BrowsePathResult_Encoding_DefaultBinary, parseBrowsePathResult, "BrowsePathResult" }, { OpcUaId_EndpointConfiguration_Encoding_DefaultBinary, parseEndpointConfiguration, "EndpointConfiguration" }, { OpcUaId_SupportedProfile_Encoding_DefaultBinary, parseSupportedProfile, "SupportedProfile" }, { OpcUaId_SoftwareCertificate_Encoding_DefaultBinary, parseSoftwareCertificate, "SoftwareCertificate" }, { OpcUaId_QueryDataDescription_Encoding_DefaultBinary, parseQueryDataDescription, "QueryDataDescription" }, { OpcUaId_NodeTypeDescription_Encoding_DefaultBinary, parseNodeTypeDescription, "NodeTypeDescription" }, { OpcUaId_QueryDataSet_Encoding_DefaultBinary, parseQueryDataSet, "QueryDataSet" }, { OpcUaId_NodeReference_Encoding_DefaultBinary, parseNodeReference, "NodeReference" }, { OpcUaId_ContentFilterElement_Encoding_DefaultBinary, parseContentFilterElement, "ContentFilterElement" }, { OpcUaId_ContentFilter_Encoding_DefaultBinary, parseContentFilter, "ContentFilter" }, { OpcUaId_ElementOperand_Encoding_DefaultBinary, parseElementOperand, "ElementOperand" }, { OpcUaId_LiteralOperand_Encoding_DefaultBinary, parseLiteralOperand, "LiteralOperand" }, { OpcUaId_AttributeOperand_Encoding_DefaultBinary, parseAttributeOperand, "AttributeOperand" }, { OpcUaId_SimpleAttributeOperand_Encoding_DefaultBinary, parseSimpleAttributeOperand, "SimpleAttributeOperand" }, { OpcUaId_ContentFilterElementResult_Encoding_DefaultBinary, parseContentFilterElementResult, "ContentFilterElementResult" }, { OpcUaId_ContentFilterResult_Encoding_DefaultBinary, parseContentFilterResult, "ContentFilterResult" }, { OpcUaId_ParsingResult_Encoding_DefaultBinary, parseParsingResult, "ParsingResult" }, { OpcUaId_ReadValueId_Encoding_DefaultBinary, parseReadValueId, "ReadValueId" }, { OpcUaId_HistoryReadValueId_Encoding_DefaultBinary, parseHistoryReadValueId, "HistoryReadValueId" }, { OpcUaId_HistoryReadResult_Encoding_DefaultBinary, parseHistoryReadResult, "HistoryReadResult" }, { OpcUaId_ReadEventDetails_Encoding_DefaultBinary, parseReadEventDetails, "ReadEventDetails" }, { OpcUaId_ReadRawModifiedDetails_Encoding_DefaultBinary, parseReadRawModifiedDetails, "ReadRawModifiedDetails" }, { OpcUaId_ReadProcessedDetails_Encoding_DefaultBinary, parseReadProcessedDetails, "ReadProcessedDetails" }, { OpcUaId_ReadAtTimeDetails_Encoding_DefaultBinary, parseReadAtTimeDetails, "ReadAtTimeDetails" }, { OpcUaId_HistoryData_Encoding_DefaultBinary, parseHistoryData, "HistoryData" }, { OpcUaId_ModificationInfo_Encoding_DefaultBinary, parseModificationInfo, "ModificationInfo" }, { OpcUaId_HistoryModifiedData_Encoding_DefaultBinary, parseHistoryModifiedData, "HistoryModifiedData" }, { OpcUaId_HistoryEvent_Encoding_DefaultBinary, parseHistoryEvent, "HistoryEvent" }, { OpcUaId_WriteValue_Encoding_DefaultBinary, parseWriteValue, "WriteValue" }, { OpcUaId_HistoryUpdateDetails_Encoding_DefaultBinary, parseHistoryUpdateDetails, "HistoryUpdateDetails" }, { OpcUaId_UpdateDataDetails_Encoding_DefaultBinary, parseUpdateDataDetails, "UpdateDataDetails" }, { OpcUaId_UpdateStructureDataDetails_Encoding_DefaultBinary, parseUpdateStructureDataDetails, "UpdateStructureDataDetails" }, { OpcUaId_UpdateEventDetails_Encoding_DefaultBinary, parseUpdateEventDetails, "UpdateEventDetails" }, { OpcUaId_DeleteRawModifiedDetails_Encoding_DefaultBinary, parseDeleteRawModifiedDetails, "DeleteRawModifiedDetails" }, { OpcUaId_DeleteAtTimeDetails_Encoding_DefaultBinary, parseDeleteAtTimeDetails, "DeleteAtTimeDetails" }, { OpcUaId_DeleteEventDetails_Encoding_DefaultBinary, parseDeleteEventDetails, "DeleteEventDetails" }, { OpcUaId_HistoryUpdateResult_Encoding_DefaultBinary, parseHistoryUpdateResult, "HistoryUpdateResult" }, { OpcUaId_CallMethodRequest_Encoding_DefaultBinary, parseCallMethodRequest, "CallMethodRequest" }, { OpcUaId_CallMethodResult_Encoding_DefaultBinary, parseCallMethodResult, "CallMethodResult" }, { OpcUaId_DataChangeFilter_Encoding_DefaultBinary, parseDataChangeFilter, "DataChangeFilter" }, { OpcUaId_EventFilter_Encoding_DefaultBinary, parseEventFilter, "EventFilter" }, { OpcUaId_AggregateConfiguration_Encoding_DefaultBinary, parseAggregateConfiguration, "AggregateConfiguration" }, { OpcUaId_AggregateFilter_Encoding_DefaultBinary, parseAggregateFilter, "AggregateFilter" }, { OpcUaId_EventFilterResult_Encoding_DefaultBinary, parseEventFilterResult, "EventFilterResult" }, { OpcUaId_AggregateFilterResult_Encoding_DefaultBinary, parseAggregateFilterResult, "AggregateFilterResult" }, { OpcUaId_MonitoringParameters_Encoding_DefaultBinary, parseMonitoringParameters, "MonitoringParameters" }, { OpcUaId_MonitoredItemCreateRequest_Encoding_DefaultBinary, parseMonitoredItemCreateRequest, "MonitoredItemCreateRequest" }, { OpcUaId_MonitoredItemCreateResult_Encoding_DefaultBinary, parseMonitoredItemCreateResult, "MonitoredItemCreateResult" }, { OpcUaId_MonitoredItemModifyRequest_Encoding_DefaultBinary, parseMonitoredItemModifyRequest, "MonitoredItemModifyRequest" }, { OpcUaId_MonitoredItemModifyResult_Encoding_DefaultBinary, parseMonitoredItemModifyResult, "MonitoredItemModifyResult" }, { OpcUaId_NotificationMessage_Encoding_DefaultBinary, parseNotificationMessage, "NotificationMessage" }, { OpcUaId_DataChangeNotification_Encoding_DefaultBinary, parseDataChangeNotification, "DataChangeNotification" }, { OpcUaId_MonitoredItemNotification_Encoding_DefaultBinary, parseMonitoredItemNotification, "MonitoredItemNotification" }, { OpcUaId_EventNotificationList_Encoding_DefaultBinary, parseEventNotificationList, "EventNotificationList" }, { OpcUaId_EventFieldList_Encoding_DefaultBinary, parseEventFieldList, "EventFieldList" }, { OpcUaId_HistoryEventFieldList_Encoding_DefaultBinary, parseHistoryEventFieldList, "HistoryEventFieldList" }, { OpcUaId_StatusChangeNotification_Encoding_DefaultBinary, parseStatusChangeNotification, "StatusChangeNotification" }, { OpcUaId_SubscriptionAcknowledgement_Encoding_DefaultBinary, parseSubscriptionAcknowledgement, "SubscriptionAcknowledgement" }, { OpcUaId_TransferResult_Encoding_DefaultBinary, parseTransferResult, "TransferResult" }, { OpcUaId_ScalarTestType_Encoding_DefaultBinary, parseScalarTestType, "ScalarTestType" }, { OpcUaId_ArrayTestType_Encoding_DefaultBinary, parseArrayTestType, "ArrayTestType" }, { OpcUaId_CompositeTestType_Encoding_DefaultBinary, parseCompositeTestType, "CompositeTestType" }, { OpcUaId_BuildInfo_Encoding_DefaultBinary, parseBuildInfo, "BuildInfo" }, { OpcUaId_RedundantServerDataType_Encoding_DefaultBinary, parseRedundantServerDataType, "RedundantServerDataType" }, { OpcUaId_EndpointUrlListDataType_Encoding_DefaultBinary, parseEndpointUrlListDataType, "EndpointUrlListDataType" }, { OpcUaId_NetworkGroupDataType_Encoding_DefaultBinary, parseNetworkGroupDataType, "NetworkGroupDataType" }, { OpcUaId_SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary, parseSamplingIntervalDiagnosticsDataType, "SamplingIntervalDiagnosticsDataType" }, { OpcUaId_ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary, parseServerDiagnosticsSummaryDataType, "ServerDiagnosticsSummaryDataType" }, { OpcUaId_ServerStatusDataType_Encoding_DefaultBinary, parseServerStatusDataType, "ServerStatusDataType" }, { OpcUaId_SessionDiagnosticsDataType_Encoding_DefaultBinary, parseSessionDiagnosticsDataType, "SessionDiagnosticsDataType" }, { OpcUaId_SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary, parseSessionSecurityDiagnosticsDataType, "SessionSecurityDiagnosticsDataType" }, { OpcUaId_ServiceCounterDataType_Encoding_DefaultBinary, parseServiceCounterDataType, "ServiceCounterDataType" }, { OpcUaId_StatusResult_Encoding_DefaultBinary, parseStatusResult, "StatusResult" }, { OpcUaId_SubscriptionDiagnosticsDataType_Encoding_DefaultBinary, parseSubscriptionDiagnosticsDataType, "SubscriptionDiagnosticsDataType" }, { OpcUaId_ModelChangeStructureDataType_Encoding_DefaultBinary, parseModelChangeStructureDataType, "ModelChangeStructureDataType" }, { OpcUaId_SemanticChangeStructureDataType_Encoding_DefaultBinary, parseSemanticChangeStructureDataType, "SemanticChangeStructureDataType" }, { OpcUaId_Range_Encoding_DefaultBinary, parseRange, "Range" }, { OpcUaId_EUInformation_Encoding_DefaultBinary, parseEUInformation, "EUInformation" }, { OpcUaId_ComplexNumberType_Encoding_DefaultBinary, parseComplexNumberType, "ComplexNumberType" }, { OpcUaId_DoubleComplexNumberType_Encoding_DefaultBinary, parseDoubleComplexNumberType, "DoubleComplexNumberType" }, { OpcUaId_AxisInformation_Encoding_DefaultBinary, parseAxisInformation, "AxisInformation" }, { OpcUaId_XVType_Encoding_DefaultBinary, parseXVType, "XVType" }, { OpcUaId_ProgramDiagnosticDataType_Encoding_DefaultBinary, parseProgramDiagnosticDataType, "ProgramDiagnosticDataType" }, { OpcUaId_Annotation_Encoding_DefaultBinary, parseAnnotation, "Annotation" }, }; const int g_NumTypes = sizeof(g_arExtensionObjectParserTable) / sizeof(ExtensionObjectParserEntry); /** Dispatch all extension objects to a special parser function. */ void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int TypeId) { gint iOffset = *pOffset; int indx = 0; int bFound = 0; gint32 iLen = 0; /* get the length of the body */ iLen = tvb_get_letohl(tvb, iOffset); iOffset += 4; while (indx < g_NumTypes) { if (g_arExtensionObjectParserTable[indx].iRequestId == TypeId) { bFound = 1; (*g_arExtensionObjectParserTable[indx].pParser)(tree, tvb, pinfo, &iOffset, g_arExtensionObjectParserTable[indx].typeName); break; } indx++; } /* display contained object as ByteString if unknown type */ if (bFound == 0) { if (iLen == -1) { proto_tree_add_bytes_format_value(tree, hf_opcua_ByteString, tvb, *pOffset, 4, NULL, "[OpcUa Null ByteString]"); } else if (iLen >= 0) { proto_tree_add_item(tree, hf_opcua_ByteString, tvb, iOffset, iLen, ENC_NA); iOffset += iLen; /* eat the whole bytestring */ } else { proto_tree_add_bytes_format_value(tree, hf_opcua_ByteString, tvb, *pOffset, 4, NULL, "[Invalid ByteString] Invalid length: %d", iLen); } } *pOffset = iOffset; }
C
wireshark/plugins/epan/opcua/opcua_hfindeces.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: This file contains protocol field handles. ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_hfindeces.h" int hf_opcua_AccessLevel = -1; int hf_opcua_ActualSessionTimeout = -1; int hf_opcua_AddResults = -1; int hf_opcua_Algorithm = -1; int hf_opcua_Alias = -1; int hf_opcua_AnnotationTime = -1; int hf_opcua_ApplicationUri = -1; int hf_opcua_ArrayDimensions = -1; int hf_opcua_AuditEntryId = -1; int hf_opcua_AuthenticationMechanism = -1; int hf_opcua_AvailableSequenceNumbers = -1; int hf_opcua_AxisSteps = -1; int hf_opcua_Boolean = -1; int hf_opcua_Booleans = -1; int hf_opcua_BuildDate = -1; int hf_opcua_BuildNumber = -1; int hf_opcua_Byte = -1; int hf_opcua_ByteString = -1; int hf_opcua_ByteStrings = -1; int hf_opcua_CancelCount = -1; int hf_opcua_CertificateData = -1; int hf_opcua_ChannelId = -1; int hf_opcua_ChannelLifetime = -1; int hf_opcua_ClientCertificate = -1; int hf_opcua_ClientConnectionTime = -1; int hf_opcua_ClientHandle = -1; int hf_opcua_ClientLastContactTime = -1; int hf_opcua_ClientNonce = -1; int hf_opcua_ClientProtocolVersion = -1; int hf_opcua_ClientUserIdHistory = -1; int hf_opcua_ClientUserIdOfSession = -1; int hf_opcua_ComplianceDate = -1; int hf_opcua_ComplianceTool = -1; int hf_opcua_ConfigurationResults = -1; int hf_opcua_ContainsNoLoops = -1; int hf_opcua_ContinuationPoint = -1; int hf_opcua_ContinuationPoints = -1; int hf_opcua_CreateClientName = -1; int hf_opcua_CreatedAt = -1; int hf_opcua_CumulatedSessionCount = -1; int hf_opcua_CumulatedSubscriptionCount = -1; int hf_opcua_CurrentKeepAliveCount = -1; int hf_opcua_CurrentLifetimeCount = -1; int hf_opcua_CurrentMonitoredItemsCount = -1; int hf_opcua_CurrentPublishRequestsInQueue = -1; int hf_opcua_CurrentSessionCount = -1; int hf_opcua_CurrentSubscriptionCount = -1; int hf_opcua_CurrentSubscriptionsCount = -1; int hf_opcua_CurrentTime = -1; int hf_opcua_DataChangeNotificationsCount = -1; int hf_opcua_DataStatusCodes = -1; int hf_opcua_DateTime = -1; int hf_opcua_DateTimes = -1; int hf_opcua_DaylightSavingInOffset = -1; int hf_opcua_DeadbandType = -1; int hf_opcua_DeadbandValue = -1; int hf_opcua_DeleteBidirectional = -1; int hf_opcua_DeleteSubscriptions = -1; int hf_opcua_DeleteTargetReferences = -1; int hf_opcua_DisableCount = -1; int hf_opcua_DisabledMonitoredItemCount = -1; int hf_opcua_DiscardOldest = -1; int hf_opcua_DiscardedMessageCount = -1; int hf_opcua_DiscoveryProfileUri = -1; int hf_opcua_DiscoveryUrl = -1; int hf_opcua_DiscoveryUrls = -1; int hf_opcua_Double = -1; int hf_opcua_Doubles = -1; int hf_opcua_EnableCount = -1; int hf_opcua_Encoding = -1; int hf_opcua_EncryptionAlgorithm = -1; int hf_opcua_EndTime = -1; int hf_opcua_EndpointUrl = -1; int hf_opcua_EndpointUrlList = -1; int hf_opcua_ErrorCount = -1; int hf_opcua_EventIds = -1; int hf_opcua_EventNotificationsCount = -1; int hf_opcua_EventNotifier = -1; int hf_opcua_EventQueueOverFlowCount = -1; int hf_opcua_Executable = -1; int hf_opcua_Float = -1; int hf_opcua_Floats = -1; int hf_opcua_GatewayServerUri = -1; int hf_opcua_Guid = -1; int hf_opcua_Guids = -1; int hf_opcua_High = -1; int hf_opcua_Historizing = -1; int hf_opcua_Imaginary = -1; int hf_opcua_IncludeSubTypes = -1; int hf_opcua_IncludeSubtypes = -1; int hf_opcua_Index = -1; int hf_opcua_IndexRange = -1; int hf_opcua_InputArgumentResults = -1; int hf_opcua_Int16 = -1; int hf_opcua_Int16s = -1; int hf_opcua_Int32 = -1; int hf_opcua_Int32s = -1; int hf_opcua_Int64 = -1; int hf_opcua_Int64s = -1; int hf_opcua_InvocationCreationTime = -1; int hf_opcua_IsAbstract = -1; int hf_opcua_IsDeleteModified = -1; int hf_opcua_IsForward = -1; int hf_opcua_IsInverse = -1; int hf_opcua_IsOnline = -1; int hf_opcua_IsReadModified = -1; int hf_opcua_IssueDate = -1; int hf_opcua_IssuedBy = -1; int hf_opcua_IssuedTokenType = -1; int hf_opcua_IssuerCertificates = -1; int hf_opcua_IssuerCrls = -1; int hf_opcua_IssuerEndpointUrl = -1; int hf_opcua_Iteration = -1; int hf_opcua_LastCounterResetTime = -1; int hf_opcua_LastMethodCall = -1; int hf_opcua_LastMethodCallTime = -1; int hf_opcua_LastTransitionTime = -1; int hf_opcua_LatePublishRequestCount = -1; int hf_opcua_LinksToAdd = -1; int hf_opcua_LinksToRemove = -1; int hf_opcua_LocaleIds = -1; int hf_opcua_Low = -1; int hf_opcua_ManufacturerName = -1; int hf_opcua_MaxAge = -1; int hf_opcua_MaxArrayLength = -1; int hf_opcua_MaxBufferSize = -1; int hf_opcua_MaxByteStringLength = -1; int hf_opcua_MaxDataSetsToReturn = -1; int hf_opcua_MaxKeepAliveCount = -1; int hf_opcua_MaxLifetimeCount = -1; int hf_opcua_MaxMessageSize = -1; int hf_opcua_MaxMonitoredItemCount = -1; int hf_opcua_MaxNotificationsPerPublish = -1; int hf_opcua_MaxRecordsToReturn = -1; int hf_opcua_MaxReferencesToReturn = -1; int hf_opcua_MaxRequestMessageSize = -1; int hf_opcua_MaxResponseMessageSize = -1; int hf_opcua_MaxStringLength = -1; int hf_opcua_MdnsServerName = -1; int hf_opcua_Message = -1; int hf_opcua_MinimumSamplingInterval = -1; int hf_opcua_ModificationTime = -1; int hf_opcua_ModifyCount = -1; int hf_opcua_MonitoredItemCount = -1; int hf_opcua_MonitoredItemId = -1; int hf_opcua_MonitoredItemIds = -1; int hf_opcua_MonitoringQueueOverflowCount = -1; int hf_opcua_MoreNotifications = -1; int hf_opcua_Name = -1; int hf_opcua_NamespaceUri = -1; int hf_opcua_NextSequenceNumber = -1; int hf_opcua_NotificationsCount = -1; int hf_opcua_NumValuesPerNode = -1; int hf_opcua_Offset = -1; int hf_opcua_OperandStatusCodes = -1; int hf_opcua_OperationResults = -1; int hf_opcua_OperationTimeout = -1; int hf_opcua_OrganizationUri = -1; int hf_opcua_Password = -1; int hf_opcua_PercentDataBad = -1; int hf_opcua_PercentDataGood = -1; int hf_opcua_PolicyId = -1; int hf_opcua_Priority = -1; int hf_opcua_ProcessingInterval = -1; int hf_opcua_ProductName = -1; int hf_opcua_ProductUri = -1; int hf_opcua_ProfileId = -1; int hf_opcua_ProfileUris = -1; int hf_opcua_PublishRequestCount = -1; int hf_opcua_PublishTime = -1; int hf_opcua_PublishingEnabled = -1; int hf_opcua_PublishingInterval = -1; int hf_opcua_PublishingIntervalCount = -1; int hf_opcua_QueueSize = -1; int hf_opcua_Real = -1; int hf_opcua_RecordId = -1; int hf_opcua_RejectedRequestsCount = -1; int hf_opcua_RejectedSessionCount = -1; int hf_opcua_ReleaseContinuationPoint = -1; int hf_opcua_ReleaseContinuationPoints = -1; int hf_opcua_RemainingPathIndex = -1; int hf_opcua_RemoveResults = -1; int hf_opcua_RepublishMessageCount = -1; int hf_opcua_RepublishMessageRequestCount = -1; int hf_opcua_RepublishRequestCount = -1; int hf_opcua_ReqTimes = -1; int hf_opcua_RequestHandle = -1; int hf_opcua_RequestedLifetime = -1; int hf_opcua_RequestedLifetimeCount = -1; int hf_opcua_RequestedMaxKeepAliveCount = -1; int hf_opcua_RequestedMaxReferencesPerNode = -1; int hf_opcua_RequestedPublishingInterval = -1; int hf_opcua_RequestedSessionTimeout = -1; int hf_opcua_Results = -1; int hf_opcua_RetransmitSequenceNumber = -1; int hf_opcua_ReturnBounds = -1; int hf_opcua_ReturnDiagnostics = -1; int hf_opcua_RevisedContinuationPoint = -1; int hf_opcua_RevisedLifetime = -1; int hf_opcua_RevisedLifetimeCount = -1; int hf_opcua_RevisedMaxKeepAliveCount = -1; int hf_opcua_RevisedProcessingInterval = -1; int hf_opcua_RevisedPublishingInterval = -1; int hf_opcua_RevisedQueueSize = -1; int hf_opcua_RevisedSamplingInterval = -1; int hf_opcua_RevisedSessionTimeout = -1; int hf_opcua_RevisedStartTime = -1; int hf_opcua_SByte = -1; int hf_opcua_SBytes = -1; int hf_opcua_SamplingInterval = -1; int hf_opcua_SecondsTillShutdown = -1; int hf_opcua_SecurityLevel = -1; int hf_opcua_SecurityPolicyUri = -1; int hf_opcua_SecurityRejectedRequestsCount = -1; int hf_opcua_SecurityRejectedSessionCount = -1; int hf_opcua_SecurityTokenLifetime = -1; int hf_opcua_SelectClauseResults = -1; int hf_opcua_SemaphoreFilePath = -1; int hf_opcua_SendInitialValues = -1; int hf_opcua_SequenceNumber = -1; int hf_opcua_ServerCapabilities = -1; int hf_opcua_ServerCapabilityFilter = -1; int hf_opcua_ServerCertificate = -1; int hf_opcua_ServerId = -1; int hf_opcua_ServerName = -1; int hf_opcua_ServerNonce = -1; int hf_opcua_ServerProtocolVersion = -1; int hf_opcua_ServerUri = -1; int hf_opcua_ServerUris = -1; int hf_opcua_ServerViewCount = -1; int hf_opcua_ServiceLevel = -1; int hf_opcua_ServiceResult = -1; int hf_opcua_SessionAbortCount = -1; int hf_opcua_SessionName = -1; int hf_opcua_SessionTimeoutCount = -1; int hf_opcua_Signature = -1; int hf_opcua_SoftwareVersion = -1; int hf_opcua_SpecifiedAttributes = -1; int hf_opcua_SpecifiedLists = -1; int hf_opcua_StartTime = -1; int hf_opcua_StartingRecordId = -1; int hf_opcua_Status = -1; int hf_opcua_StatusCode = -1; int hf_opcua_StatusCodes = -1; int hf_opcua_String = -1; int hf_opcua_StringTable = -1; int hf_opcua_Strings = -1; int hf_opcua_SubscriptionId = -1; int hf_opcua_SubscriptionIds = -1; int hf_opcua_Symmetric = -1; int hf_opcua_TargetServerUri = -1; int hf_opcua_TestId = -1; int hf_opcua_TicketData = -1; int hf_opcua_TimeoutHint = -1; int hf_opcua_Timestamp = -1; int hf_opcua_TokenData = -1; int hf_opcua_TokenId = -1; int hf_opcua_TotalCount = -1; int hf_opcua_TransferRequestCount = -1; int hf_opcua_TransferredToAltClientCount = -1; int hf_opcua_TransferredToSameClientCount = -1; int hf_opcua_TransportProfileUri = -1; int hf_opcua_TransportProtocol = -1; int hf_opcua_TreatUncertainAsBad = -1; int hf_opcua_TriggeringItemId = -1; int hf_opcua_TrustedCertificates = -1; int hf_opcua_TrustedCrls = -1; int hf_opcua_UInt16 = -1; int hf_opcua_UInt16s = -1; int hf_opcua_UInt32 = -1; int hf_opcua_UInt32s = -1; int hf_opcua_UInt64 = -1; int hf_opcua_UInt64s = -1; int hf_opcua_UnacknowledgedMessageCount = -1; int hf_opcua_UnauthorizedRequestCount = -1; int hf_opcua_UnitId = -1; int hf_opcua_UnsupportedUnitIds = -1; int hf_opcua_UseBinaryEncoding = -1; int hf_opcua_UseServerCapabilitiesDefaults = -1; int hf_opcua_UseSimpleBounds = -1; int hf_opcua_UseSlopedExtrapolation = -1; int hf_opcua_UserAccessLevel = -1; int hf_opcua_UserExecutable = -1; int hf_opcua_UserName = -1; int hf_opcua_UserWriteMask = -1; int hf_opcua_ValidBits = -1; int hf_opcua_Value = -1; int hf_opcua_ValueRank = -1; int hf_opcua_VendorName = -1; int hf_opcua_VendorProductCertificate = -1; int hf_opcua_Verb = -1; int hf_opcua_ViewVersion = -1; int hf_opcua_WriteMask = -1; int hf_opcua_X = -1; int hf_opcua_XmlElement = -1; int hf_opcua_XmlElements = -1; /** Register field types. */ void registerFieldTypes(int proto) { /** header field definitions */ static hf_register_info hf[] = { { &hf_opcua_AccessLevel, { "AccessLevel", "opcua.AccessLevel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ActualSessionTimeout, { "ActualSessionTimeout", "opcua.ActualSessionTimeout", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AddResults, { "AddResults", "opcua.AddResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Algorithm, { "Algorithm", "opcua.Algorithm", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Alias, { "Alias", "opcua.Alias", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AnnotationTime, { "AnnotationTime", "opcua.AnnotationTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ApplicationUri, { "ApplicationUri", "opcua.ApplicationUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ArrayDimensions, { "ArrayDimensions", "opcua.ArrayDimensions", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AuditEntryId, { "AuditEntryId", "opcua.AuditEntryId", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AuthenticationMechanism, { "AuthenticationMechanism", "opcua.AuthenticationMechanism", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AvailableSequenceNumbers, { "AvailableSequenceNumbers", "opcua.AvailableSequenceNumbers", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AxisSteps, { "AxisSteps", "opcua.AxisSteps", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Boolean, { "Boolean", "opcua.Boolean", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Booleans, { "Booleans", "opcua.Booleans", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_BuildDate, { "BuildDate", "opcua.BuildDate", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_BuildNumber, { "BuildNumber", "opcua.BuildNumber", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Byte, { "Byte", "opcua.Byte", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ByteString, { "ByteString", "opcua.ByteString", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ByteStrings, { "ByteStrings", "opcua.ByteStrings", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CancelCount, { "CancelCount", "opcua.CancelCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CertificateData, { "CertificateData", "opcua.CertificateData", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ChannelId, { "ChannelId", "opcua.ChannelId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ChannelLifetime, { "ChannelLifetime", "opcua.ChannelLifetime", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientCertificate, { "ClientCertificate", "opcua.ClientCertificate", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientConnectionTime, { "ClientConnectionTime", "opcua.ClientConnectionTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientHandle, { "ClientHandle", "opcua.ClientHandle", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientLastContactTime, { "ClientLastContactTime", "opcua.ClientLastContactTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientNonce, { "ClientNonce", "opcua.ClientNonce", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientProtocolVersion, { "ClientProtocolVersion", "opcua.ClientProtocolVersion", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientUserIdHistory, { "ClientUserIdHistory", "opcua.ClientUserIdHistory", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ClientUserIdOfSession, { "ClientUserIdOfSession", "opcua.ClientUserIdOfSession", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ComplianceDate, { "ComplianceDate", "opcua.ComplianceDate", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ComplianceTool, { "ComplianceTool", "opcua.ComplianceTool", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ConfigurationResults, { "ConfigurationResults", "opcua.ConfigurationResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ContainsNoLoops, { "ContainsNoLoops", "opcua.ContainsNoLoops", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ContinuationPoint, { "ContinuationPoint", "opcua.ContinuationPoint", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ContinuationPoints, { "ContinuationPoints", "opcua.ContinuationPoints", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CreateClientName, { "CreateClientName", "opcua.CreateClientName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CreatedAt, { "CreatedAt", "opcua.CreatedAt", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CumulatedSessionCount, { "CumulatedSessionCount", "opcua.CumulatedSessionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CumulatedSubscriptionCount, { "CumulatedSubscriptionCount", "opcua.CumulatedSubscriptionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentKeepAliveCount, { "CurrentKeepAliveCount", "opcua.CurrentKeepAliveCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentLifetimeCount, { "CurrentLifetimeCount", "opcua.CurrentLifetimeCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentMonitoredItemsCount, { "CurrentMonitoredItemsCount", "opcua.CurrentMonitoredItemsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentPublishRequestsInQueue, { "CurrentPublishRequestsInQueue", "opcua.CurrentPublishRequestsInQueue", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentSessionCount, { "CurrentSessionCount", "opcua.CurrentSessionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentSubscriptionCount, { "CurrentSubscriptionCount", "opcua.CurrentSubscriptionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentSubscriptionsCount, { "CurrentSubscriptionsCount", "opcua.CurrentSubscriptionsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_CurrentTime, { "CurrentTime", "opcua.CurrentTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DataChangeNotificationsCount, { "DataChangeNotificationsCount", "opcua.DataChangeNotificationsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DataStatusCodes, { "DataStatusCodes", "opcua.DataStatusCodes", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DateTime, { "DateTime", "opcua.DateTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DateTimes, { "DateTimes", "opcua.DateTimes", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DaylightSavingInOffset, { "DaylightSavingInOffset", "opcua.DaylightSavingInOffset", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DeadbandType, { "DeadbandType", "opcua.DeadbandType", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DeadbandValue, { "DeadbandValue", "opcua.DeadbandValue", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DeleteBidirectional, { "DeleteBidirectional", "opcua.DeleteBidirectional", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DeleteSubscriptions, { "DeleteSubscriptions", "opcua.DeleteSubscriptions", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DeleteTargetReferences, { "DeleteTargetReferences", "opcua.DeleteTargetReferences", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DisableCount, { "DisableCount", "opcua.DisableCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DisabledMonitoredItemCount, { "DisabledMonitoredItemCount", "opcua.DisabledMonitoredItemCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DiscardOldest, { "DiscardOldest", "opcua.DiscardOldest", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DiscardedMessageCount, { "DiscardedMessageCount", "opcua.DiscardedMessageCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DiscoveryProfileUri, { "DiscoveryProfileUri", "opcua.DiscoveryProfileUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DiscoveryUrl, { "DiscoveryUrl", "opcua.DiscoveryUrl", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_DiscoveryUrls, { "DiscoveryUrls", "opcua.DiscoveryUrls", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Double, { "Double", "opcua.Double", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Doubles, { "Doubles", "opcua.Doubles", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EnableCount, { "EnableCount", "opcua.EnableCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Encoding, { "Encoding", "opcua.Encoding", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EncryptionAlgorithm, { "EncryptionAlgorithm", "opcua.EncryptionAlgorithm", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EndTime, { "EndTime", "opcua.EndTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EndpointUrl, { "EndpointUrl", "opcua.EndpointUrl", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EndpointUrlList, { "EndpointUrlList", "opcua.EndpointUrlList", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ErrorCount, { "ErrorCount", "opcua.ErrorCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EventIds, { "EventIds", "opcua.EventIds", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EventNotificationsCount, { "EventNotificationsCount", "opcua.EventNotificationsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EventNotifier, { "EventNotifier", "opcua.EventNotifier", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_EventQueueOverFlowCount, { "EventQueueOverFlowCount", "opcua.EventQueueOverFlowCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Executable, { "Executable", "opcua.Executable", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Float, { "Float", "opcua.Float", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Floats, { "Floats", "opcua.Floats", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_GatewayServerUri, { "GatewayServerUri", "opcua.GatewayServerUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Guid, { "Guid", "opcua.Guid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Guids, { "Guids", "opcua.Guids", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_High, { "High", "opcua.High", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Historizing, { "Historizing", "opcua.Historizing", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Imaginary, { "Imaginary", "opcua.Imaginary", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IncludeSubTypes, { "IncludeSubTypes", "opcua.IncludeSubTypes", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IncludeSubtypes, { "IncludeSubtypes", "opcua.IncludeSubtypes", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Index, { "Index", "opcua.Index", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IndexRange, { "IndexRange", "opcua.IndexRange", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_InputArgumentResults, { "InputArgumentResults", "opcua.InputArgumentResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int16, { "Int16", "opcua.Int16", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int16s, { "Int16s", "opcua.Int16s", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int32, { "Int32", "opcua.Int32", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int32s, { "Int32s", "opcua.Int32s", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int64, { "Int64", "opcua.Int64", FT_INT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Int64s, { "Int64s", "opcua.Int64s", FT_INT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_InvocationCreationTime, { "InvocationCreationTime", "opcua.InvocationCreationTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsAbstract, { "IsAbstract", "opcua.IsAbstract", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsDeleteModified, { "IsDeleteModified", "opcua.IsDeleteModified", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsForward, { "IsForward", "opcua.IsForward", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsInverse, { "IsInverse", "opcua.IsInverse", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsOnline, { "IsOnline", "opcua.IsOnline", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IsReadModified, { "IsReadModified", "opcua.IsReadModified", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssueDate, { "IssueDate", "opcua.IssueDate", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssuedBy, { "IssuedBy", "opcua.IssuedBy", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssuedTokenType, { "IssuedTokenType", "opcua.IssuedTokenType", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssuerCertificates, { "IssuerCertificates", "opcua.IssuerCertificates", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssuerCrls, { "IssuerCrls", "opcua.IssuerCrls", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_IssuerEndpointUrl, { "IssuerEndpointUrl", "opcua.IssuerEndpointUrl", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Iteration, { "Iteration", "opcua.Iteration", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LastCounterResetTime, { "LastCounterResetTime", "opcua.LastCounterResetTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LastMethodCall, { "LastMethodCall", "opcua.LastMethodCall", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LastMethodCallTime, { "LastMethodCallTime", "opcua.LastMethodCallTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LastTransitionTime, { "LastTransitionTime", "opcua.LastTransitionTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LatePublishRequestCount, { "LatePublishRequestCount", "opcua.LatePublishRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LinksToAdd, { "LinksToAdd", "opcua.LinksToAdd", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LinksToRemove, { "LinksToRemove", "opcua.LinksToRemove", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_LocaleIds, { "LocaleIds", "opcua.LocaleIds", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Low, { "Low", "opcua.Low", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ManufacturerName, { "ManufacturerName", "opcua.ManufacturerName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxAge, { "MaxAge", "opcua.MaxAge", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxArrayLength, { "MaxArrayLength", "opcua.MaxArrayLength", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxBufferSize, { "MaxBufferSize", "opcua.MaxBufferSize", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxByteStringLength, { "MaxByteStringLength", "opcua.MaxByteStringLength", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxDataSetsToReturn, { "MaxDataSetsToReturn", "opcua.MaxDataSetsToReturn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxKeepAliveCount, { "MaxKeepAliveCount", "opcua.MaxKeepAliveCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxLifetimeCount, { "MaxLifetimeCount", "opcua.MaxLifetimeCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxMessageSize, { "MaxMessageSize", "opcua.MaxMessageSize", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxMonitoredItemCount, { "MaxMonitoredItemCount", "opcua.MaxMonitoredItemCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxNotificationsPerPublish, { "MaxNotificationsPerPublish", "opcua.MaxNotificationsPerPublish", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxRecordsToReturn, { "MaxRecordsToReturn", "opcua.MaxRecordsToReturn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxReferencesToReturn, { "MaxReferencesToReturn", "opcua.MaxReferencesToReturn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxRequestMessageSize, { "MaxRequestMessageSize", "opcua.MaxRequestMessageSize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxResponseMessageSize, { "MaxResponseMessageSize", "opcua.MaxResponseMessageSize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MaxStringLength, { "MaxStringLength", "opcua.MaxStringLength", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MdnsServerName, { "MdnsServerName", "opcua.MdnsServerName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Message, { "Message", "opcua.Message", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MinimumSamplingInterval, { "MinimumSamplingInterval", "opcua.MinimumSamplingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ModificationTime, { "ModificationTime", "opcua.ModificationTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ModifyCount, { "ModifyCount", "opcua.ModifyCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MonitoredItemCount, { "MonitoredItemCount", "opcua.MonitoredItemCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MonitoredItemId, { "MonitoredItemId", "opcua.MonitoredItemId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MonitoredItemIds, { "MonitoredItemIds", "opcua.MonitoredItemIds", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MonitoringQueueOverflowCount, { "MonitoringQueueOverflowCount", "opcua.MonitoringQueueOverflowCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_MoreNotifications, { "MoreNotifications", "opcua.MoreNotifications", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Name, { "Name", "opcua.Name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_NamespaceUri, { "NamespaceUri", "opcua.NamespaceUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_NextSequenceNumber, { "NextSequenceNumber", "opcua.NextSequenceNumber", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_NotificationsCount, { "NotificationsCount", "opcua.NotificationsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_NumValuesPerNode, { "NumValuesPerNode", "opcua.NumValuesPerNode", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Offset, { "Offset", "opcua.Offset", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_OperandStatusCodes, { "OperandStatusCodes", "opcua.OperandStatusCodes", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_OperationResults, { "OperationResults", "opcua.OperationResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_OperationTimeout, { "OperationTimeout", "opcua.OperationTimeout", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_OrganizationUri, { "OrganizationUri", "opcua.OrganizationUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Password, { "Password", "opcua.Password", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PercentDataBad, { "PercentDataBad", "opcua.PercentDataBad", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PercentDataGood, { "PercentDataGood", "opcua.PercentDataGood", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PolicyId, { "PolicyId", "opcua.PolicyId", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Priority, { "Priority", "opcua.Priority", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ProcessingInterval, { "ProcessingInterval", "opcua.ProcessingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ProductName, { "ProductName", "opcua.ProductName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ProductUri, { "ProductUri", "opcua.ProductUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ProfileId, { "ProfileId", "opcua.ProfileId", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ProfileUris, { "ProfileUris", "opcua.ProfileUris", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PublishRequestCount, { "PublishRequestCount", "opcua.PublishRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PublishTime, { "PublishTime", "opcua.PublishTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PublishingEnabled, { "PublishingEnabled", "opcua.PublishingEnabled", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PublishingInterval, { "PublishingInterval", "opcua.PublishingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_PublishingIntervalCount, { "PublishingIntervalCount", "opcua.PublishingIntervalCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_QueueSize, { "QueueSize", "opcua.QueueSize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Real, { "Real", "opcua.Real", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RecordId, { "RecordId", "opcua.RecordId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RejectedRequestsCount, { "RejectedRequestsCount", "opcua.RejectedRequestsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RejectedSessionCount, { "RejectedSessionCount", "opcua.RejectedSessionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ReleaseContinuationPoint, { "ReleaseContinuationPoint", "opcua.ReleaseContinuationPoint", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ReleaseContinuationPoints, { "ReleaseContinuationPoints", "opcua.ReleaseContinuationPoints", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RemainingPathIndex, { "RemainingPathIndex", "opcua.RemainingPathIndex", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RemoveResults, { "RemoveResults", "opcua.RemoveResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RepublishMessageCount, { "RepublishMessageCount", "opcua.RepublishMessageCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RepublishMessageRequestCount, { "RepublishMessageRequestCount", "opcua.RepublishMessageRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RepublishRequestCount, { "RepublishRequestCount", "opcua.RepublishRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ReqTimes, { "ReqTimes", "opcua.ReqTimes", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestHandle, { "RequestHandle", "opcua.RequestHandle", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedLifetime, { "RequestedLifetime", "opcua.RequestedLifetime", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedLifetimeCount, { "RequestedLifetimeCount", "opcua.RequestedLifetimeCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedMaxKeepAliveCount, { "RequestedMaxKeepAliveCount", "opcua.RequestedMaxKeepAliveCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedMaxReferencesPerNode, { "RequestedMaxReferencesPerNode", "opcua.RequestedMaxReferencesPerNode", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedPublishingInterval, { "RequestedPublishingInterval", "opcua.RequestedPublishingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RequestedSessionTimeout, { "RequestedSessionTimeout", "opcua.RequestedSessionTimeout", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Results, { "Results", "opcua.Results", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RetransmitSequenceNumber, { "RetransmitSequenceNumber", "opcua.RetransmitSequenceNumber", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ReturnBounds, { "ReturnBounds", "opcua.ReturnBounds", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ReturnDiagnostics, { "ReturnDiagnostics", "opcua.ReturnDiagnostics", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedContinuationPoint, { "RevisedContinuationPoint", "opcua.RevisedContinuationPoint", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedLifetime, { "RevisedLifetime", "opcua.RevisedLifetime", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedLifetimeCount, { "RevisedLifetimeCount", "opcua.RevisedLifetimeCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedMaxKeepAliveCount, { "RevisedMaxKeepAliveCount", "opcua.RevisedMaxKeepAliveCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedProcessingInterval, { "RevisedProcessingInterval", "opcua.RevisedProcessingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedPublishingInterval, { "RevisedPublishingInterval", "opcua.RevisedPublishingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedQueueSize, { "RevisedQueueSize", "opcua.RevisedQueueSize", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedSamplingInterval, { "RevisedSamplingInterval", "opcua.RevisedSamplingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedSessionTimeout, { "RevisedSessionTimeout", "opcua.RevisedSessionTimeout", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_RevisedStartTime, { "RevisedStartTime", "opcua.RevisedStartTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SByte, { "SByte", "opcua.SByte", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SBytes, { "SBytes", "opcua.SBytes", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SamplingInterval, { "SamplingInterval", "opcua.SamplingInterval", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecondsTillShutdown, { "SecondsTillShutdown", "opcua.SecondsTillShutdown", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecurityLevel, { "SecurityLevel", "opcua.SecurityLevel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecurityPolicyUri, { "SecurityPolicyUri", "opcua.SecurityPolicyUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecurityRejectedRequestsCount, { "SecurityRejectedRequestsCount", "opcua.SecurityRejectedRequestsCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecurityRejectedSessionCount, { "SecurityRejectedSessionCount", "opcua.SecurityRejectedSessionCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SecurityTokenLifetime, { "SecurityTokenLifetime", "opcua.SecurityTokenLifetime", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SelectClauseResults, { "SelectClauseResults", "opcua.SelectClauseResults", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SemaphoreFilePath, { "SemaphoreFilePath", "opcua.SemaphoreFilePath", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SendInitialValues, { "SendInitialValues", "opcua.SendInitialValues", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SequenceNumber, { "SequenceNumber", "opcua.SequenceNumber", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerCapabilities, { "ServerCapabilities", "opcua.ServerCapabilities", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerCapabilityFilter, { "ServerCapabilityFilter", "opcua.ServerCapabilityFilter", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerCertificate, { "ServerCertificate", "opcua.ServerCertificate", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerId, { "ServerId", "opcua.ServerId", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerName, { "ServerName", "opcua.ServerName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerNonce, { "ServerNonce", "opcua.ServerNonce", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerProtocolVersion, { "ServerProtocolVersion", "opcua.ServerProtocolVersion", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerUri, { "ServerUri", "opcua.ServerUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerUris, { "ServerUris", "opcua.ServerUris", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServerViewCount, { "ServerViewCount", "opcua.ServerViewCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServiceLevel, { "ServiceLevel", "opcua.ServiceLevel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ServiceResult, { "ServiceResult", "opcua.ServiceResult", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SessionAbortCount, { "SessionAbortCount", "opcua.SessionAbortCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SessionName, { "SessionName", "opcua.SessionName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SessionTimeoutCount, { "SessionTimeoutCount", "opcua.SessionTimeoutCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Signature, { "Signature", "opcua.Signature", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SoftwareVersion, { "SoftwareVersion", "opcua.SoftwareVersion", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SpecifiedAttributes, { "SpecifiedAttributes", "opcua.SpecifiedAttributes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SpecifiedLists, { "SpecifiedLists", "opcua.SpecifiedLists", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_StartTime, { "StartTime", "opcua.StartTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_StartingRecordId, { "StartingRecordId", "opcua.StartingRecordId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Status, { "Status", "opcua.Status", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_StatusCode, { "StatusCode", "opcua.StatusCode", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_StatusCodes, { "StatusCodes", "opcua.StatusCodes", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_String, { "String", "opcua.String", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_StringTable, { "StringTable", "opcua.StringTable", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Strings, { "Strings", "opcua.Strings", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SubscriptionId, { "SubscriptionId", "opcua.SubscriptionId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_SubscriptionIds, { "SubscriptionIds", "opcua.SubscriptionIds", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Symmetric, { "Symmetric", "opcua.Symmetric", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TargetServerUri, { "TargetServerUri", "opcua.TargetServerUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TestId, { "TestId", "opcua.TestId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TicketData, { "TicketData", "opcua.TicketData", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TimeoutHint, { "TimeoutHint", "opcua.TimeoutHint", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Timestamp, { "Timestamp", "opcua.Timestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TokenData, { "TokenData", "opcua.TokenData", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TokenId, { "TokenId", "opcua.TokenId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TotalCount, { "TotalCount", "opcua.TotalCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TransferRequestCount, { "TransferRequestCount", "opcua.TransferRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TransferredToAltClientCount, { "TransferredToAltClientCount", "opcua.TransferredToAltClientCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TransferredToSameClientCount, { "TransferredToSameClientCount", "opcua.TransferredToSameClientCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TransportProfileUri, { "TransportProfileUri", "opcua.TransportProfileUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TransportProtocol, { "TransportProtocol", "opcua.TransportProtocol", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TreatUncertainAsBad, { "TreatUncertainAsBad", "opcua.TreatUncertainAsBad", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TriggeringItemId, { "TriggeringItemId", "opcua.TriggeringItemId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TrustedCertificates, { "TrustedCertificates", "opcua.TrustedCertificates", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_TrustedCrls, { "TrustedCrls", "opcua.TrustedCrls", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt16, { "UInt16", "opcua.UInt16", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt16s, { "UInt16s", "opcua.UInt16s", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt32, { "UInt32", "opcua.UInt32", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt32s, { "UInt32s", "opcua.UInt32s", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt64, { "UInt64", "opcua.UInt64", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UInt64s, { "UInt64s", "opcua.UInt64s", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UnacknowledgedMessageCount, { "UnacknowledgedMessageCount", "opcua.UnacknowledgedMessageCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UnauthorizedRequestCount, { "UnauthorizedRequestCount", "opcua.UnauthorizedRequestCount", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UnitId, { "UnitId", "opcua.UnitId", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UnsupportedUnitIds, { "UnsupportedUnitIds", "opcua.UnsupportedUnitIds", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UseBinaryEncoding, { "UseBinaryEncoding", "opcua.UseBinaryEncoding", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UseServerCapabilitiesDefaults, { "UseServerCapabilitiesDefaults", "opcua.UseServerCapabilitiesDefaults", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UseSimpleBounds, { "UseSimpleBounds", "opcua.UseSimpleBounds", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UseSlopedExtrapolation, { "UseSlopedExtrapolation", "opcua.UseSlopedExtrapolation", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UserAccessLevel, { "UserAccessLevel", "opcua.UserAccessLevel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UserExecutable, { "UserExecutable", "opcua.UserExecutable", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UserName, { "UserName", "opcua.UserName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_UserWriteMask, { "UserWriteMask", "opcua.UserWriteMask", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ValidBits, { "ValidBits", "opcua.ValidBits", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Value, { "Value", "opcua.Value", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ValueRank, { "ValueRank", "opcua.ValueRank", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_VendorName, { "VendorName", "opcua.VendorName", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_VendorProductCertificate, { "VendorProductCertificate", "opcua.VendorProductCertificate", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_Verb, { "Verb", "opcua.Verb", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ViewVersion, { "ViewVersion", "opcua.ViewVersion", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_WriteMask, { "WriteMask", "opcua.WriteMask", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_X, { "X", "opcua.X", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_XmlElement, { "XmlElement", "opcua.XmlElement", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_XmlElements, { "XmlElements", "opcua.XmlElements", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; proto_register_field_array(proto, hf, array_length(hf)); }
C/C++
wireshark/plugins/epan/opcua/opcua_hfindeces.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: This file contains protocol field handles. ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include <glib.h> #include <epan/packet.h> extern int hf_opcua_AccessLevel; extern int hf_opcua_ActualSessionTimeout; extern int hf_opcua_AddResults; extern int hf_opcua_Algorithm; extern int hf_opcua_Alias; extern int hf_opcua_AnnotationTime; extern int hf_opcua_ApplicationUri; extern int hf_opcua_ArrayDimensions; extern int hf_opcua_AuditEntryId; extern int hf_opcua_AuthenticationMechanism; extern int hf_opcua_AvailableSequenceNumbers; extern int hf_opcua_AxisSteps; extern int hf_opcua_Boolean; extern int hf_opcua_Booleans; extern int hf_opcua_BuildDate; extern int hf_opcua_BuildNumber; extern int hf_opcua_Byte; extern int hf_opcua_ByteString; extern int hf_opcua_ByteStrings; extern int hf_opcua_CancelCount; extern int hf_opcua_CertificateData; extern int hf_opcua_ChannelId; extern int hf_opcua_ChannelLifetime; extern int hf_opcua_ClientCertificate; extern int hf_opcua_ClientConnectionTime; extern int hf_opcua_ClientHandle; extern int hf_opcua_ClientLastContactTime; extern int hf_opcua_ClientNonce; extern int hf_opcua_ClientProtocolVersion; extern int hf_opcua_ClientUserIdHistory; extern int hf_opcua_ClientUserIdOfSession; extern int hf_opcua_ComplianceDate; extern int hf_opcua_ComplianceTool; extern int hf_opcua_ConfigurationResults; extern int hf_opcua_ContainsNoLoops; extern int hf_opcua_ContinuationPoint; extern int hf_opcua_ContinuationPoints; extern int hf_opcua_CreateClientName; extern int hf_opcua_CreatedAt; extern int hf_opcua_CumulatedSessionCount; extern int hf_opcua_CumulatedSubscriptionCount; extern int hf_opcua_CurrentKeepAliveCount; extern int hf_opcua_CurrentLifetimeCount; extern int hf_opcua_CurrentMonitoredItemsCount; extern int hf_opcua_CurrentPublishRequestsInQueue; extern int hf_opcua_CurrentSessionCount; extern int hf_opcua_CurrentSubscriptionCount; extern int hf_opcua_CurrentSubscriptionsCount; extern int hf_opcua_CurrentTime; extern int hf_opcua_DataChangeNotificationsCount; extern int hf_opcua_DataStatusCodes; extern int hf_opcua_DateTime; extern int hf_opcua_DateTimes; extern int hf_opcua_DaylightSavingInOffset; extern int hf_opcua_DeadbandType; extern int hf_opcua_DeadbandValue; extern int hf_opcua_DeleteBidirectional; extern int hf_opcua_DeleteSubscriptions; extern int hf_opcua_DeleteTargetReferences; extern int hf_opcua_DisableCount; extern int hf_opcua_DisabledMonitoredItemCount; extern int hf_opcua_DiscardOldest; extern int hf_opcua_DiscardedMessageCount; extern int hf_opcua_DiscoveryProfileUri; extern int hf_opcua_DiscoveryUrl; extern int hf_opcua_DiscoveryUrls; extern int hf_opcua_Double; extern int hf_opcua_Doubles; extern int hf_opcua_EnableCount; extern int hf_opcua_Encoding; extern int hf_opcua_EncryptionAlgorithm; extern int hf_opcua_EndTime; extern int hf_opcua_EndpointUrl; extern int hf_opcua_EndpointUrlList; extern int hf_opcua_ErrorCount; extern int hf_opcua_EventIds; extern int hf_opcua_EventNotificationsCount; extern int hf_opcua_EventNotifier; extern int hf_opcua_EventQueueOverFlowCount; extern int hf_opcua_Executable; extern int hf_opcua_Float; extern int hf_opcua_Floats; extern int hf_opcua_GatewayServerUri; extern int hf_opcua_Guid; extern int hf_opcua_Guids; extern int hf_opcua_High; extern int hf_opcua_Historizing; extern int hf_opcua_Imaginary; extern int hf_opcua_IncludeSubTypes; extern int hf_opcua_IncludeSubtypes; extern int hf_opcua_Index; extern int hf_opcua_IndexRange; extern int hf_opcua_InputArgumentResults; extern int hf_opcua_Int16; extern int hf_opcua_Int16s; extern int hf_opcua_Int32; extern int hf_opcua_Int32s; extern int hf_opcua_Int64; extern int hf_opcua_Int64s; extern int hf_opcua_InvocationCreationTime; extern int hf_opcua_IsAbstract; extern int hf_opcua_IsDeleteModified; extern int hf_opcua_IsForward; extern int hf_opcua_IsInverse; extern int hf_opcua_IsOnline; extern int hf_opcua_IsReadModified; extern int hf_opcua_IssueDate; extern int hf_opcua_IssuedBy; extern int hf_opcua_IssuedTokenType; extern int hf_opcua_IssuerCertificates; extern int hf_opcua_IssuerCrls; extern int hf_opcua_IssuerEndpointUrl; extern int hf_opcua_Iteration; extern int hf_opcua_LastCounterResetTime; extern int hf_opcua_LastMethodCall; extern int hf_opcua_LastMethodCallTime; extern int hf_opcua_LastTransitionTime; extern int hf_opcua_LatePublishRequestCount; extern int hf_opcua_LinksToAdd; extern int hf_opcua_LinksToRemove; extern int hf_opcua_LocaleIds; extern int hf_opcua_Low; extern int hf_opcua_ManufacturerName; extern int hf_opcua_MaxAge; extern int hf_opcua_MaxArrayLength; extern int hf_opcua_MaxBufferSize; extern int hf_opcua_MaxByteStringLength; extern int hf_opcua_MaxDataSetsToReturn; extern int hf_opcua_MaxKeepAliveCount; extern int hf_opcua_MaxLifetimeCount; extern int hf_opcua_MaxMessageSize; extern int hf_opcua_MaxMonitoredItemCount; extern int hf_opcua_MaxNotificationsPerPublish; extern int hf_opcua_MaxRecordsToReturn; extern int hf_opcua_MaxReferencesToReturn; extern int hf_opcua_MaxRequestMessageSize; extern int hf_opcua_MaxResponseMessageSize; extern int hf_opcua_MaxStringLength; extern int hf_opcua_MdnsServerName; extern int hf_opcua_Message; extern int hf_opcua_MinimumSamplingInterval; extern int hf_opcua_ModificationTime; extern int hf_opcua_ModifyCount; extern int hf_opcua_MonitoredItemCount; extern int hf_opcua_MonitoredItemId; extern int hf_opcua_MonitoredItemIds; extern int hf_opcua_MonitoringQueueOverflowCount; extern int hf_opcua_MoreNotifications; extern int hf_opcua_Name; extern int hf_opcua_NamespaceUri; extern int hf_opcua_NextSequenceNumber; extern int hf_opcua_NotificationsCount; extern int hf_opcua_NumValuesPerNode; extern int hf_opcua_Offset; extern int hf_opcua_OperandStatusCodes; extern int hf_opcua_OperationResults; extern int hf_opcua_OperationTimeout; extern int hf_opcua_OrganizationUri; extern int hf_opcua_Password; extern int hf_opcua_PercentDataBad; extern int hf_opcua_PercentDataGood; extern int hf_opcua_PolicyId; extern int hf_opcua_Priority; extern int hf_opcua_ProcessingInterval; extern int hf_opcua_ProductName; extern int hf_opcua_ProductUri; extern int hf_opcua_ProfileId; extern int hf_opcua_ProfileUris; extern int hf_opcua_PublishRequestCount; extern int hf_opcua_PublishTime; extern int hf_opcua_PublishingEnabled; extern int hf_opcua_PublishingInterval; extern int hf_opcua_PublishingIntervalCount; extern int hf_opcua_QueueSize; extern int hf_opcua_Real; extern int hf_opcua_RecordId; extern int hf_opcua_RejectedRequestsCount; extern int hf_opcua_RejectedSessionCount; extern int hf_opcua_ReleaseContinuationPoint; extern int hf_opcua_ReleaseContinuationPoints; extern int hf_opcua_RemainingPathIndex; extern int hf_opcua_RemoveResults; extern int hf_opcua_RepublishMessageCount; extern int hf_opcua_RepublishMessageRequestCount; extern int hf_opcua_RepublishRequestCount; extern int hf_opcua_ReqTimes; extern int hf_opcua_RequestHandle; extern int hf_opcua_RequestedLifetime; extern int hf_opcua_RequestedLifetimeCount; extern int hf_opcua_RequestedMaxKeepAliveCount; extern int hf_opcua_RequestedMaxReferencesPerNode; extern int hf_opcua_RequestedPublishingInterval; extern int hf_opcua_RequestedSessionTimeout; extern int hf_opcua_Results; extern int hf_opcua_RetransmitSequenceNumber; extern int hf_opcua_ReturnBounds; extern int hf_opcua_ReturnDiagnostics; extern int hf_opcua_RevisedContinuationPoint; extern int hf_opcua_RevisedLifetime; extern int hf_opcua_RevisedLifetimeCount; extern int hf_opcua_RevisedMaxKeepAliveCount; extern int hf_opcua_RevisedProcessingInterval; extern int hf_opcua_RevisedPublishingInterval; extern int hf_opcua_RevisedQueueSize; extern int hf_opcua_RevisedSamplingInterval; extern int hf_opcua_RevisedSessionTimeout; extern int hf_opcua_RevisedStartTime; extern int hf_opcua_SByte; extern int hf_opcua_SBytes; extern int hf_opcua_SamplingInterval; extern int hf_opcua_SecondsTillShutdown; extern int hf_opcua_SecurityLevel; extern int hf_opcua_SecurityPolicyUri; extern int hf_opcua_SecurityRejectedRequestsCount; extern int hf_opcua_SecurityRejectedSessionCount; extern int hf_opcua_SecurityTokenLifetime; extern int hf_opcua_SelectClauseResults; extern int hf_opcua_SemaphoreFilePath; extern int hf_opcua_SendInitialValues; extern int hf_opcua_SequenceNumber; extern int hf_opcua_ServerCapabilities; extern int hf_opcua_ServerCapabilityFilter; extern int hf_opcua_ServerCertificate; extern int hf_opcua_ServerId; extern int hf_opcua_ServerName; extern int hf_opcua_ServerNonce; extern int hf_opcua_ServerProtocolVersion; extern int hf_opcua_ServerUri; extern int hf_opcua_ServerUris; extern int hf_opcua_ServerViewCount; extern int hf_opcua_ServiceLevel; extern int hf_opcua_ServiceResult; extern int hf_opcua_SessionAbortCount; extern int hf_opcua_SessionName; extern int hf_opcua_SessionTimeoutCount; extern int hf_opcua_Signature; extern int hf_opcua_SoftwareVersion; extern int hf_opcua_SpecifiedAttributes; extern int hf_opcua_SpecifiedLists; extern int hf_opcua_StartTime; extern int hf_opcua_StartingRecordId; extern int hf_opcua_Status; extern int hf_opcua_StatusCode; extern int hf_opcua_StatusCodes; extern int hf_opcua_String; extern int hf_opcua_StringTable; extern int hf_opcua_Strings; extern int hf_opcua_SubscriptionId; extern int hf_opcua_SubscriptionIds; extern int hf_opcua_Symmetric; extern int hf_opcua_TargetServerUri; extern int hf_opcua_TestId; extern int hf_opcua_TicketData; extern int hf_opcua_TimeoutHint; extern int hf_opcua_Timestamp; extern int hf_opcua_TokenData; extern int hf_opcua_TokenId; extern int hf_opcua_TotalCount; extern int hf_opcua_TransferRequestCount; extern int hf_opcua_TransferredToAltClientCount; extern int hf_opcua_TransferredToSameClientCount; extern int hf_opcua_TransportProfileUri; extern int hf_opcua_TransportProtocol; extern int hf_opcua_TreatUncertainAsBad; extern int hf_opcua_TriggeringItemId; extern int hf_opcua_TrustedCertificates; extern int hf_opcua_TrustedCrls; extern int hf_opcua_UInt16; extern int hf_opcua_UInt16s; extern int hf_opcua_UInt32; extern int hf_opcua_UInt32s; extern int hf_opcua_UInt64; extern int hf_opcua_UInt64s; extern int hf_opcua_UnacknowledgedMessageCount; extern int hf_opcua_UnauthorizedRequestCount; extern int hf_opcua_UnitId; extern int hf_opcua_UnsupportedUnitIds; extern int hf_opcua_UseBinaryEncoding; extern int hf_opcua_UseServerCapabilitiesDefaults; extern int hf_opcua_UseSimpleBounds; extern int hf_opcua_UseSlopedExtrapolation; extern int hf_opcua_UserAccessLevel; extern int hf_opcua_UserExecutable; extern int hf_opcua_UserName; extern int hf_opcua_UserWriteMask; extern int hf_opcua_ValidBits; extern int hf_opcua_Value; extern int hf_opcua_ValueRank; extern int hf_opcua_VendorName; extern int hf_opcua_VendorProductCertificate; extern int hf_opcua_Verb; extern int hf_opcua_ViewVersion; extern int hf_opcua_WriteMask; extern int hf_opcua_X; extern int hf_opcua_XmlElement; extern int hf_opcua_XmlElements; /** Register field types. */ void registerFieldTypes(int proto);
C/C++
wireshark/plugins/epan/opcua/opcua_identifiers.h
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Parser type definitions. ** ** This file was autogenerated on 6/10/2007 2:35:22 AM. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include <glib.h> #include <epan/packet.h> /* declare service parser function prototype */ typedef void (*fctServiceParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); /* declare enum parser function prototype */ typedef void (*fctEnumParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); /* declare type parser function prototype */ typedef void (*fctComplexTypeParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); /* declare type parser function prototype */ typedef proto_item* (*fctSimpleTypeParser)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); typedef struct _ParserEntry { int iRequestId; fctServiceParser pParser; } ParserEntry; typedef struct _ExtensionObjectParserEntry { int iRequestId; fctComplexTypeParser pParser; const gchar *typeName; } ExtensionObjectParserEntry;
C
wireshark/plugins/epan/opcua/opcua_security_layer.c
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Security Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_security_layer.h" static int hf_opcua_security_tokenid = -1; static int hf_opcua_security_seq = -1; static int hf_opcua_security_rqid = -1; /** Register security layer types. */ void registerSecurityLayerTypes(int proto) { static hf_register_info hf[] = { /* id full name abbreviation type display strings bitmask blurb HFILL */ {&hf_opcua_security_tokenid, {"Security Token Id", "opcua.security.tokenid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_security_seq, {"Security Sequence Number", "opcua.security.seq", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_security_rqid, {"Security RequestId", "opcua.security.rqid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}} }; proto_register_field_array(proto, hf, array_length(hf)); } /* Security Layer: message parsers * Only works for Security Policy "NoSecurity" at the moment. */ void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_security_tokenid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_security_seq, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_security_rqid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/opcua/opcua_security_layer.h
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Security Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ void registerSecurityLayerTypes(int proto); void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset);
C/C++
wireshark/plugins/epan/opcua/opcua_serviceids.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Service IDs ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #define OpcUaId_ServiceFault_Encoding_DefaultBinary 397 #define OpcUaId_FindServersRequest_Encoding_DefaultBinary 422 #define OpcUaId_FindServersResponse_Encoding_DefaultBinary 425 #define OpcUaId_FindServersOnNetworkRequest_Encoding_DefaultBinary 12208 #define OpcUaId_FindServersOnNetworkResponse_Encoding_DefaultBinary 12209 #define OpcUaId_GetEndpointsRequest_Encoding_DefaultBinary 428 #define OpcUaId_GetEndpointsResponse_Encoding_DefaultBinary 431 #define OpcUaId_RegisterServerRequest_Encoding_DefaultBinary 437 #define OpcUaId_RegisterServerResponse_Encoding_DefaultBinary 440 #define OpcUaId_RegisterServer2Request_Encoding_DefaultBinary 12211 #define OpcUaId_RegisterServer2Response_Encoding_DefaultBinary 12212 #define OpcUaId_OpenSecureChannelRequest_Encoding_DefaultBinary 446 #define OpcUaId_OpenSecureChannelResponse_Encoding_DefaultBinary 449 #define OpcUaId_CloseSecureChannelRequest_Encoding_DefaultBinary 452 #define OpcUaId_CloseSecureChannelResponse_Encoding_DefaultBinary 455 #define OpcUaId_CreateSessionRequest_Encoding_DefaultBinary 461 #define OpcUaId_CreateSessionResponse_Encoding_DefaultBinary 464 #define OpcUaId_ActivateSessionRequest_Encoding_DefaultBinary 467 #define OpcUaId_ActivateSessionResponse_Encoding_DefaultBinary 470 #define OpcUaId_CloseSessionRequest_Encoding_DefaultBinary 473 #define OpcUaId_CloseSessionResponse_Encoding_DefaultBinary 476 #define OpcUaId_CancelRequest_Encoding_DefaultBinary 479 #define OpcUaId_CancelResponse_Encoding_DefaultBinary 482 #define OpcUaId_AddNodesRequest_Encoding_DefaultBinary 488 #define OpcUaId_AddNodesResponse_Encoding_DefaultBinary 491 #define OpcUaId_AddReferencesRequest_Encoding_DefaultBinary 494 #define OpcUaId_AddReferencesResponse_Encoding_DefaultBinary 497 #define OpcUaId_DeleteNodesRequest_Encoding_DefaultBinary 500 #define OpcUaId_DeleteNodesResponse_Encoding_DefaultBinary 503 #define OpcUaId_DeleteReferencesRequest_Encoding_DefaultBinary 506 #define OpcUaId_DeleteReferencesResponse_Encoding_DefaultBinary 509 #define OpcUaId_BrowseRequest_Encoding_DefaultBinary 527 #define OpcUaId_BrowseResponse_Encoding_DefaultBinary 530 #define OpcUaId_BrowseNextRequest_Encoding_DefaultBinary 533 #define OpcUaId_BrowseNextResponse_Encoding_DefaultBinary 536 #define OpcUaId_TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary 554 #define OpcUaId_TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary 557 #define OpcUaId_RegisterNodesRequest_Encoding_DefaultBinary 560 #define OpcUaId_RegisterNodesResponse_Encoding_DefaultBinary 563 #define OpcUaId_UnregisterNodesRequest_Encoding_DefaultBinary 566 #define OpcUaId_UnregisterNodesResponse_Encoding_DefaultBinary 569 #define OpcUaId_QueryFirstRequest_Encoding_DefaultBinary 615 #define OpcUaId_QueryFirstResponse_Encoding_DefaultBinary 618 #define OpcUaId_QueryNextRequest_Encoding_DefaultBinary 621 #define OpcUaId_QueryNextResponse_Encoding_DefaultBinary 624 #define OpcUaId_ReadRequest_Encoding_DefaultBinary 631 #define OpcUaId_ReadResponse_Encoding_DefaultBinary 634 #define OpcUaId_HistoryReadRequest_Encoding_DefaultBinary 664 #define OpcUaId_HistoryReadResponse_Encoding_DefaultBinary 667 #define OpcUaId_WriteRequest_Encoding_DefaultBinary 673 #define OpcUaId_WriteResponse_Encoding_DefaultBinary 676 #define OpcUaId_HistoryUpdateRequest_Encoding_DefaultBinary 700 #define OpcUaId_HistoryUpdateResponse_Encoding_DefaultBinary 703 #define OpcUaId_CallRequest_Encoding_DefaultBinary 712 #define OpcUaId_CallResponse_Encoding_DefaultBinary 715 #define OpcUaId_CreateMonitoredItemsRequest_Encoding_DefaultBinary 751 #define OpcUaId_CreateMonitoredItemsResponse_Encoding_DefaultBinary 754 #define OpcUaId_ModifyMonitoredItemsRequest_Encoding_DefaultBinary 763 #define OpcUaId_ModifyMonitoredItemsResponse_Encoding_DefaultBinary 766 #define OpcUaId_SetMonitoringModeRequest_Encoding_DefaultBinary 769 #define OpcUaId_SetMonitoringModeResponse_Encoding_DefaultBinary 772 #define OpcUaId_SetTriggeringRequest_Encoding_DefaultBinary 775 #define OpcUaId_SetTriggeringResponse_Encoding_DefaultBinary 778 #define OpcUaId_DeleteMonitoredItemsRequest_Encoding_DefaultBinary 781 #define OpcUaId_DeleteMonitoredItemsResponse_Encoding_DefaultBinary 784 #define OpcUaId_CreateSubscriptionRequest_Encoding_DefaultBinary 787 #define OpcUaId_CreateSubscriptionResponse_Encoding_DefaultBinary 790 #define OpcUaId_ModifySubscriptionRequest_Encoding_DefaultBinary 793 #define OpcUaId_ModifySubscriptionResponse_Encoding_DefaultBinary 796 #define OpcUaId_SetPublishingModeRequest_Encoding_DefaultBinary 799 #define OpcUaId_SetPublishingModeResponse_Encoding_DefaultBinary 802 #define OpcUaId_PublishRequest_Encoding_DefaultBinary 826 #define OpcUaId_PublishResponse_Encoding_DefaultBinary 829 #define OpcUaId_RepublishRequest_Encoding_DefaultBinary 832 #define OpcUaId_RepublishResponse_Encoding_DefaultBinary 835 #define OpcUaId_TransferSubscriptionsRequest_Encoding_DefaultBinary 841 #define OpcUaId_TransferSubscriptionsResponse_Encoding_DefaultBinary 844 #define OpcUaId_DeleteSubscriptionsRequest_Encoding_DefaultBinary 847 #define OpcUaId_DeleteSubscriptionsResponse_Encoding_DefaultBinary 850 #define OpcUaId_TestStackRequest_Encoding_DefaultBinary 410 #define OpcUaId_TestStackResponse_Encoding_DefaultBinary 413 #define OpcUaId_TestStackExRequest_Encoding_DefaultBinary 416 #define OpcUaId_TestStackExResponse_Encoding_DefaultBinary 419 #define OpcUaId_ServiceFault_Encoding_DefaultXml 396 #define OpcUaId_FindServersRequest_Encoding_DefaultXml 421 #define OpcUaId_FindServersResponse_Encoding_DefaultXml 424 #define OpcUaId_FindServersOnNetworkRequest_Encoding_DefaultXml 12196 #define OpcUaId_FindServersOnNetworkResponse_Encoding_DefaultXml 12197 #define OpcUaId_GetEndpointsRequest_Encoding_DefaultXml 427 #define OpcUaId_GetEndpointsResponse_Encoding_DefaultXml 430 #define OpcUaId_RegisterServerRequest_Encoding_DefaultXml 436 #define OpcUaId_RegisterServerResponse_Encoding_DefaultXml 439 #define OpcUaId_RegisterServer2Request_Encoding_DefaultXml 12199 #define OpcUaId_RegisterServer2Response_Encoding_DefaultXml 12200 #define OpcUaId_OpenSecureChannelRequest_Encoding_DefaultXml 445 #define OpcUaId_OpenSecureChannelResponse_Encoding_DefaultXml 448 #define OpcUaId_CloseSecureChannelRequest_Encoding_DefaultXml 451 #define OpcUaId_CloseSecureChannelResponse_Encoding_DefaultXml 454 #define OpcUaId_CreateSessionRequest_Encoding_DefaultXml 460 #define OpcUaId_CreateSessionResponse_Encoding_DefaultXml 463 #define OpcUaId_ActivateSessionRequest_Encoding_DefaultXml 466 #define OpcUaId_ActivateSessionResponse_Encoding_DefaultXml 469 #define OpcUaId_CloseSessionRequest_Encoding_DefaultXml 472 #define OpcUaId_CloseSessionResponse_Encoding_DefaultXml 475 #define OpcUaId_CancelRequest_Encoding_DefaultXml 478 #define OpcUaId_CancelResponse_Encoding_DefaultXml 481 #define OpcUaId_AddNodesRequest_Encoding_DefaultXml 487 #define OpcUaId_AddNodesResponse_Encoding_DefaultXml 490 #define OpcUaId_AddReferencesRequest_Encoding_DefaultXml 493 #define OpcUaId_AddReferencesResponse_Encoding_DefaultXml 496 #define OpcUaId_DeleteNodesRequest_Encoding_DefaultXml 499 #define OpcUaId_DeleteNodesResponse_Encoding_DefaultXml 502 #define OpcUaId_DeleteReferencesRequest_Encoding_DefaultXml 505 #define OpcUaId_DeleteReferencesResponse_Encoding_DefaultXml 508 #define OpcUaId_BrowseRequest_Encoding_DefaultXml 526 #define OpcUaId_BrowseResponse_Encoding_DefaultXml 529 #define OpcUaId_BrowseNextRequest_Encoding_DefaultXml 532 #define OpcUaId_BrowseNextResponse_Encoding_DefaultXml 535 #define OpcUaId_TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultXml 553 #define OpcUaId_TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultXml 556 #define OpcUaId_RegisterNodesRequest_Encoding_DefaultXml 559 #define OpcUaId_RegisterNodesResponse_Encoding_DefaultXml 562 #define OpcUaId_UnregisterNodesRequest_Encoding_DefaultXml 565 #define OpcUaId_UnregisterNodesResponse_Encoding_DefaultXml 568 #define OpcUaId_QueryFirstRequest_Encoding_DefaultXml 614 #define OpcUaId_QueryFirstResponse_Encoding_DefaultXml 617 #define OpcUaId_QueryNextRequest_Encoding_DefaultXml 620 #define OpcUaId_QueryNextResponse_Encoding_DefaultXml 623 #define OpcUaId_ReadRequest_Encoding_DefaultXml 630 #define OpcUaId_ReadResponse_Encoding_DefaultXml 633 #define OpcUaId_HistoryReadRequest_Encoding_DefaultXml 663 #define OpcUaId_HistoryReadResponse_Encoding_DefaultXml 666 #define OpcUaId_WriteRequest_Encoding_DefaultXml 672 #define OpcUaId_WriteResponse_Encoding_DefaultXml 675 #define OpcUaId_HistoryUpdateRequest_Encoding_DefaultXml 699 #define OpcUaId_HistoryUpdateResponse_Encoding_DefaultXml 702 #define OpcUaId_CallRequest_Encoding_DefaultXml 711 #define OpcUaId_CallResponse_Encoding_DefaultXml 714 #define OpcUaId_CreateMonitoredItemsRequest_Encoding_DefaultXml 750 #define OpcUaId_CreateMonitoredItemsResponse_Encoding_DefaultXml 753 #define OpcUaId_ModifyMonitoredItemsRequest_Encoding_DefaultXml 762 #define OpcUaId_ModifyMonitoredItemsResponse_Encoding_DefaultXml 765 #define OpcUaId_SetMonitoringModeRequest_Encoding_DefaultXml 768 #define OpcUaId_SetMonitoringModeResponse_Encoding_DefaultXml 771 #define OpcUaId_SetTriggeringRequest_Encoding_DefaultXml 774 #define OpcUaId_SetTriggeringResponse_Encoding_DefaultXml 777 #define OpcUaId_DeleteMonitoredItemsRequest_Encoding_DefaultXml 780 #define OpcUaId_DeleteMonitoredItemsResponse_Encoding_DefaultXml 783 #define OpcUaId_CreateSubscriptionRequest_Encoding_DefaultXml 786 #define OpcUaId_CreateSubscriptionResponse_Encoding_DefaultXml 789 #define OpcUaId_ModifySubscriptionRequest_Encoding_DefaultXml 792 #define OpcUaId_ModifySubscriptionResponse_Encoding_DefaultXml 795 #define OpcUaId_SetPublishingModeRequest_Encoding_DefaultXml 798 #define OpcUaId_SetPublishingModeResponse_Encoding_DefaultXml 801 #define OpcUaId_PublishRequest_Encoding_DefaultXml 825 #define OpcUaId_PublishResponse_Encoding_DefaultXml 828 #define OpcUaId_RepublishRequest_Encoding_DefaultXml 831 #define OpcUaId_RepublishResponse_Encoding_DefaultXml 834 #define OpcUaId_TransferSubscriptionsRequest_Encoding_DefaultXml 840 #define OpcUaId_TransferSubscriptionsResponse_Encoding_DefaultXml 843 #define OpcUaId_DeleteSubscriptionsRequest_Encoding_DefaultXml 846 #define OpcUaId_DeleteSubscriptionsResponse_Encoding_DefaultXml 849 #define OpcUaId_TestStackRequest_Encoding_DefaultXml 409 #define OpcUaId_TestStackResponse_Encoding_DefaultXml 412 #define OpcUaId_TestStackExRequest_Encoding_DefaultXml 415 #define OpcUaId_TestStackExResponse_Encoding_DefaultXml 418
C
wireshark/plugins/epan/opcua/opcua_serviceparser.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Complex Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_complextypeparser.h" #include "opcua_enumparser.h" #include "opcua_simpletypes.h" #include "opcua_hfindeces.h" #include "opcua_serviceparser.h" gint ett_opcua_ServiceFault = -1; gint ett_opcua_array_ServiceFault = -1; gint ett_opcua_FindServersRequest = -1; gint ett_opcua_array_FindServersRequest = -1; gint ett_opcua_FindServersResponse = -1; gint ett_opcua_array_FindServersResponse = -1; gint ett_opcua_FindServersOnNetworkRequest = -1; gint ett_opcua_array_FindServersOnNetworkRequest = -1; gint ett_opcua_FindServersOnNetworkResponse = -1; gint ett_opcua_array_FindServersOnNetworkResponse = -1; gint ett_opcua_GetEndpointsRequest = -1; gint ett_opcua_array_GetEndpointsRequest = -1; gint ett_opcua_GetEndpointsResponse = -1; gint ett_opcua_array_GetEndpointsResponse = -1; gint ett_opcua_RegisterServerRequest = -1; gint ett_opcua_array_RegisterServerRequest = -1; gint ett_opcua_RegisterServerResponse = -1; gint ett_opcua_array_RegisterServerResponse = -1; gint ett_opcua_RegisterServer2Request = -1; gint ett_opcua_array_RegisterServer2Request = -1; gint ett_opcua_RegisterServer2Response = -1; gint ett_opcua_array_RegisterServer2Response = -1; gint ett_opcua_OpenSecureChannelRequest = -1; gint ett_opcua_array_OpenSecureChannelRequest = -1; gint ett_opcua_OpenSecureChannelResponse = -1; gint ett_opcua_array_OpenSecureChannelResponse = -1; gint ett_opcua_CloseSecureChannelRequest = -1; gint ett_opcua_array_CloseSecureChannelRequest = -1; gint ett_opcua_CloseSecureChannelResponse = -1; gint ett_opcua_array_CloseSecureChannelResponse = -1; gint ett_opcua_CreateSessionRequest = -1; gint ett_opcua_array_CreateSessionRequest = -1; gint ett_opcua_CreateSessionResponse = -1; gint ett_opcua_array_CreateSessionResponse = -1; gint ett_opcua_ActivateSessionRequest = -1; gint ett_opcua_array_ActivateSessionRequest = -1; gint ett_opcua_ActivateSessionResponse = -1; gint ett_opcua_array_ActivateSessionResponse = -1; gint ett_opcua_CloseSessionRequest = -1; gint ett_opcua_array_CloseSessionRequest = -1; gint ett_opcua_CloseSessionResponse = -1; gint ett_opcua_array_CloseSessionResponse = -1; gint ett_opcua_CancelRequest = -1; gint ett_opcua_array_CancelRequest = -1; gint ett_opcua_CancelResponse = -1; gint ett_opcua_array_CancelResponse = -1; gint ett_opcua_AddNodesRequest = -1; gint ett_opcua_array_AddNodesRequest = -1; gint ett_opcua_AddNodesResponse = -1; gint ett_opcua_array_AddNodesResponse = -1; gint ett_opcua_AddReferencesRequest = -1; gint ett_opcua_array_AddReferencesRequest = -1; gint ett_opcua_AddReferencesResponse = -1; gint ett_opcua_array_AddReferencesResponse = -1; gint ett_opcua_DeleteNodesRequest = -1; gint ett_opcua_array_DeleteNodesRequest = -1; gint ett_opcua_DeleteNodesResponse = -1; gint ett_opcua_array_DeleteNodesResponse = -1; gint ett_opcua_DeleteReferencesRequest = -1; gint ett_opcua_array_DeleteReferencesRequest = -1; gint ett_opcua_DeleteReferencesResponse = -1; gint ett_opcua_array_DeleteReferencesResponse = -1; gint ett_opcua_BrowseRequest = -1; gint ett_opcua_array_BrowseRequest = -1; gint ett_opcua_BrowseResponse = -1; gint ett_opcua_array_BrowseResponse = -1; gint ett_opcua_BrowseNextRequest = -1; gint ett_opcua_array_BrowseNextRequest = -1; gint ett_opcua_BrowseNextResponse = -1; gint ett_opcua_array_BrowseNextResponse = -1; gint ett_opcua_TranslateBrowsePathsToNodeIdsRequest = -1; gint ett_opcua_array_TranslateBrowsePathsToNodeIdsRequest = -1; gint ett_opcua_TranslateBrowsePathsToNodeIdsResponse = -1; gint ett_opcua_array_TranslateBrowsePathsToNodeIdsResponse = -1; gint ett_opcua_RegisterNodesRequest = -1; gint ett_opcua_array_RegisterNodesRequest = -1; gint ett_opcua_RegisterNodesResponse = -1; gint ett_opcua_array_RegisterNodesResponse = -1; gint ett_opcua_UnregisterNodesRequest = -1; gint ett_opcua_array_UnregisterNodesRequest = -1; gint ett_opcua_UnregisterNodesResponse = -1; gint ett_opcua_array_UnregisterNodesResponse = -1; gint ett_opcua_QueryFirstRequest = -1; gint ett_opcua_array_QueryFirstRequest = -1; gint ett_opcua_QueryFirstResponse = -1; gint ett_opcua_array_QueryFirstResponse = -1; gint ett_opcua_QueryNextRequest = -1; gint ett_opcua_array_QueryNextRequest = -1; gint ett_opcua_QueryNextResponse = -1; gint ett_opcua_array_QueryNextResponse = -1; gint ett_opcua_ReadRequest = -1; gint ett_opcua_array_ReadRequest = -1; gint ett_opcua_ReadResponse = -1; gint ett_opcua_array_ReadResponse = -1; gint ett_opcua_HistoryReadRequest = -1; gint ett_opcua_array_HistoryReadRequest = -1; gint ett_opcua_HistoryReadResponse = -1; gint ett_opcua_array_HistoryReadResponse = -1; gint ett_opcua_WriteRequest = -1; gint ett_opcua_array_WriteRequest = -1; gint ett_opcua_WriteResponse = -1; gint ett_opcua_array_WriteResponse = -1; gint ett_opcua_HistoryUpdateRequest = -1; gint ett_opcua_array_HistoryUpdateRequest = -1; gint ett_opcua_HistoryUpdateResponse = -1; gint ett_opcua_array_HistoryUpdateResponse = -1; gint ett_opcua_CallRequest = -1; gint ett_opcua_array_CallRequest = -1; gint ett_opcua_CallResponse = -1; gint ett_opcua_array_CallResponse = -1; gint ett_opcua_CreateMonitoredItemsRequest = -1; gint ett_opcua_array_CreateMonitoredItemsRequest = -1; gint ett_opcua_CreateMonitoredItemsResponse = -1; gint ett_opcua_array_CreateMonitoredItemsResponse = -1; gint ett_opcua_ModifyMonitoredItemsRequest = -1; gint ett_opcua_array_ModifyMonitoredItemsRequest = -1; gint ett_opcua_ModifyMonitoredItemsResponse = -1; gint ett_opcua_array_ModifyMonitoredItemsResponse = -1; gint ett_opcua_SetMonitoringModeRequest = -1; gint ett_opcua_array_SetMonitoringModeRequest = -1; gint ett_opcua_SetMonitoringModeResponse = -1; gint ett_opcua_array_SetMonitoringModeResponse = -1; gint ett_opcua_SetTriggeringRequest = -1; gint ett_opcua_array_SetTriggeringRequest = -1; gint ett_opcua_SetTriggeringResponse = -1; gint ett_opcua_array_SetTriggeringResponse = -1; gint ett_opcua_DeleteMonitoredItemsRequest = -1; gint ett_opcua_array_DeleteMonitoredItemsRequest = -1; gint ett_opcua_DeleteMonitoredItemsResponse = -1; gint ett_opcua_array_DeleteMonitoredItemsResponse = -1; gint ett_opcua_CreateSubscriptionRequest = -1; gint ett_opcua_array_CreateSubscriptionRequest = -1; gint ett_opcua_CreateSubscriptionResponse = -1; gint ett_opcua_array_CreateSubscriptionResponse = -1; gint ett_opcua_ModifySubscriptionRequest = -1; gint ett_opcua_array_ModifySubscriptionRequest = -1; gint ett_opcua_ModifySubscriptionResponse = -1; gint ett_opcua_array_ModifySubscriptionResponse = -1; gint ett_opcua_SetPublishingModeRequest = -1; gint ett_opcua_array_SetPublishingModeRequest = -1; gint ett_opcua_SetPublishingModeResponse = -1; gint ett_opcua_array_SetPublishingModeResponse = -1; gint ett_opcua_PublishRequest = -1; gint ett_opcua_array_PublishRequest = -1; gint ett_opcua_PublishResponse = -1; gint ett_opcua_array_PublishResponse = -1; gint ett_opcua_RepublishRequest = -1; gint ett_opcua_array_RepublishRequest = -1; gint ett_opcua_RepublishResponse = -1; gint ett_opcua_array_RepublishResponse = -1; gint ett_opcua_TransferSubscriptionsRequest = -1; gint ett_opcua_array_TransferSubscriptionsRequest = -1; gint ett_opcua_TransferSubscriptionsResponse = -1; gint ett_opcua_array_TransferSubscriptionsResponse = -1; gint ett_opcua_DeleteSubscriptionsRequest = -1; gint ett_opcua_array_DeleteSubscriptionsRequest = -1; gint ett_opcua_DeleteSubscriptionsResponse = -1; gint ett_opcua_array_DeleteSubscriptionsResponse = -1; gint ett_opcua_TestStackRequest = -1; gint ett_opcua_array_TestStackRequest = -1; gint ett_opcua_TestStackResponse = -1; gint ett_opcua_array_TestStackResponse = -1; gint ett_opcua_TestStackExRequest = -1; gint ett_opcua_array_TestStackExRequest = -1; gint ett_opcua_TestStackExResponse = -1; gint ett_opcua_array_TestStackExResponse = -1; void parseServiceFault(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ServiceFault, &ti, "ServiceFault"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseFindServersRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_FindServersRequest, &ti, "FindServersRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EndpointUrl); /* Array length field ignored: NoOfLocaleIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LocaleIds", "String", hf_opcua_LocaleIds, parseString, ett_opcua_array_String); /* Array length field ignored: NoOfServerUris */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ServerUris", "String", hf_opcua_ServerUris, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseFindServersResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_FindServersResponse, &ti, "FindServersResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfServers */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Servers", "ApplicationDescription", parseApplicationDescription, ett_opcua_array_ApplicationDescription); proto_item_set_end(ti, tvb, *pOffset); } void parseFindServersOnNetworkRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_FindServersOnNetworkRequest, &ti, "FindServersOnNetworkRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_StartingRecordId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxRecordsToReturn); /* Array length field ignored: NoOfServerCapabilityFilter */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ServerCapabilityFilter", "String", hf_opcua_ServerCapabilityFilter, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseFindServersOnNetworkResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_FindServersOnNetworkResponse, &ti, "FindServersOnNetworkResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseDateTime(subtree, tvb, pinfo, pOffset, hf_opcua_LastCounterResetTime); /* Array length field ignored: NoOfServers */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Servers", "ServerOnNetwork", parseServerOnNetwork, ett_opcua_array_ServerOnNetwork); proto_item_set_end(ti, tvb, *pOffset); } void parseGetEndpointsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_GetEndpointsRequest, &ti, "GetEndpointsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EndpointUrl); /* Array length field ignored: NoOfLocaleIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LocaleIds", "String", hf_opcua_LocaleIds, parseString, ett_opcua_array_String); /* Array length field ignored: NoOfProfileUris */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ProfileUris", "String", hf_opcua_ProfileUris, parseString, ett_opcua_array_String); proto_item_set_end(ti, tvb, *pOffset); } void parseGetEndpointsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_GetEndpointsResponse, &ti, "GetEndpointsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfEndpoints */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Endpoints", "EndpointDescription", parseEndpointDescription, ett_opcua_array_EndpointDescription); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterServerRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterServerRequest, &ti, "RegisterServerRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseRegisteredServer(subtree, tvb, pinfo, pOffset, "Server"); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterServerResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterServerResponse, &ti, "RegisterServerResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterServer2Request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterServer2Request, &ti, "RegisterServer2Request"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseRegisteredServer(subtree, tvb, pinfo, pOffset, "Server"); /* Array length field ignored: NoOfDiscoveryConfiguration */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiscoveryConfiguration", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterServer2Response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterServer2Response, &ti, "RegisterServer2Response"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfConfigurationResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ConfigurationResults", "StatusCode", hf_opcua_ConfigurationResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseOpenSecureChannelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_OpenSecureChannelRequest, &ti, "OpenSecureChannelRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ClientProtocolVersion); parseSecurityTokenRequestType(subtree, tvb, pinfo, pOffset); parseMessageSecurityMode(subtree, tvb, pinfo, pOffset); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ClientNonce); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedLifetime); proto_item_set_end(ti, tvb, *pOffset); } void parseOpenSecureChannelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_OpenSecureChannelResponse, &ti, "OpenSecureChannelResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_ServerProtocolVersion); parseChannelSecurityToken(subtree, tvb, pinfo, pOffset, "SecurityToken"); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerNonce); proto_item_set_end(ti, tvb, *pOffset); } void parseCloseSecureChannelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CloseSecureChannelRequest, &ti, "CloseSecureChannelRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseCloseSecureChannelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CloseSecureChannelResponse, &ti, "CloseSecureChannelResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateSessionRequest, &ti, "CreateSessionRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseApplicationDescription(subtree, tvb, pinfo, pOffset, "ClientDescription"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerUri); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_EndpointUrl); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_SessionName); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ClientNonce); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ClientCertificate); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedSessionTimeout); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxResponseMessageSize); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateSessionResponse, &ti, "CreateSessionResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseNodeId(subtree, tvb, pinfo, pOffset, "SessionId"); parseNodeId(subtree, tvb, pinfo, pOffset, "AuthenticationToken"); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedSessionTimeout); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerNonce); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerCertificate); /* Array length field ignored: NoOfServerEndpoints */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ServerEndpoints", "EndpointDescription", parseEndpointDescription, ett_opcua_array_EndpointDescription); /* Array length field ignored: NoOfServerSoftwareCertificates */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ServerSoftwareCertificates", "SignedSoftwareCertificate", parseSignedSoftwareCertificate, ett_opcua_array_SignedSoftwareCertificate); parseSignatureData(subtree, tvb, pinfo, pOffset, "ServerSignature"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxRequestMessageSize); proto_item_set_end(ti, tvb, *pOffset); } void parseActivateSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ActivateSessionRequest, &ti, "ActivateSessionRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseSignatureData(subtree, tvb, pinfo, pOffset, "ClientSignature"); /* Array length field ignored: NoOfClientSoftwareCertificates */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ClientSoftwareCertificates", "SignedSoftwareCertificate", parseSignedSoftwareCertificate, ett_opcua_array_SignedSoftwareCertificate); /* Array length field ignored: NoOfLocaleIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LocaleIds", "String", hf_opcua_LocaleIds, parseString, ett_opcua_array_String); parseExtensionObject(subtree, tvb, pinfo, pOffset, "UserIdentityToken"); parseSignatureData(subtree, tvb, pinfo, pOffset, "UserTokenSignature"); proto_item_set_end(ti, tvb, *pOffset); } void parseActivateSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ActivateSessionResponse, &ti, "ActivateSessionResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ServerNonce); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseCloseSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CloseSessionRequest, &ti, "CloseSessionRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_DeleteSubscriptions); proto_item_set_end(ti, tvb, *pOffset); } void parseCloseSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CloseSessionResponse, &ti, "CloseSessionResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseCancelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CancelRequest, &ti, "CancelRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestHandle); proto_item_set_end(ti, tvb, *pOffset); } void parseCancelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CancelResponse, &ti, "CancelResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_CancelCount); proto_item_set_end(ti, tvb, *pOffset); } void parseAddNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_AddNodesRequest, &ti, "AddNodesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfNodesToAdd */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToAdd", "AddNodesItem", parseAddNodesItem, ett_opcua_array_AddNodesItem); proto_item_set_end(ti, tvb, *pOffset); } void parseAddNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_AddNodesResponse, &ti, "AddNodesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "AddNodesResult", parseAddNodesResult, ett_opcua_array_AddNodesResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseAddReferencesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_AddReferencesRequest, &ti, "AddReferencesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfReferencesToAdd */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ReferencesToAdd", "AddReferencesItem", parseAddReferencesItem, ett_opcua_array_AddReferencesItem); proto_item_set_end(ti, tvb, *pOffset); } void parseAddReferencesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_AddReferencesResponse, &ti, "AddReferencesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteNodesRequest, &ti, "DeleteNodesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfNodesToDelete */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToDelete", "DeleteNodesItem", parseDeleteNodesItem, ett_opcua_array_DeleteNodesItem); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteNodesResponse, &ti, "DeleteNodesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteReferencesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteReferencesRequest, &ti, "DeleteReferencesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfReferencesToDelete */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ReferencesToDelete", "DeleteReferencesItem", parseDeleteReferencesItem, ett_opcua_array_DeleteReferencesItem); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteReferencesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteReferencesResponse, &ti, "DeleteReferencesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_BrowseRequest, &ti, "BrowseRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseViewDescription(subtree, tvb, pinfo, pOffset, "View"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedMaxReferencesPerNode); /* Array length field ignored: NoOfNodesToBrowse */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToBrowse", "BrowseDescription", parseBrowseDescription, ett_opcua_array_BrowseDescription); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_BrowseResponse, &ti, "BrowseResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "BrowseResult", parseBrowseResult, ett_opcua_array_BrowseResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseNextRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_BrowseNextRequest, &ti, "BrowseNextRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ReleaseContinuationPoints); /* Array length field ignored: NoOfContinuationPoints */ parseArraySimple(subtree, tvb, pinfo, pOffset, "ContinuationPoints", "ByteString", hf_opcua_ContinuationPoints, parseByteString, ett_opcua_array_ByteString); proto_item_set_end(ti, tvb, *pOffset); } void parseBrowseNextResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_BrowseNextResponse, &ti, "BrowseNextResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "BrowseResult", parseBrowseResult, ett_opcua_array_BrowseResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseTranslateBrowsePathsToNodeIdsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TranslateBrowsePathsToNodeIdsRequest, &ti, "TranslateBrowsePathsToNodeIdsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfBrowsePaths */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "BrowsePaths", "BrowsePath", parseBrowsePath, ett_opcua_array_BrowsePath); proto_item_set_end(ti, tvb, *pOffset); } void parseTranslateBrowsePathsToNodeIdsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TranslateBrowsePathsToNodeIdsResponse, &ti, "TranslateBrowsePathsToNodeIdsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "BrowsePathResult", parseBrowsePathResult, ett_opcua_array_BrowsePathResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterNodesRequest, &ti, "RegisterNodesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfNodesToRegister */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToRegister", "NodeId", parseNodeId, ett_opcua_array_NodeId); proto_item_set_end(ti, tvb, *pOffset); } void parseRegisterNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RegisterNodesResponse, &ti, "RegisterNodesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfRegisteredNodeIds */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "RegisteredNodeIds", "NodeId", parseNodeId, ett_opcua_array_NodeId); proto_item_set_end(ti, tvb, *pOffset); } void parseUnregisterNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_UnregisterNodesRequest, &ti, "UnregisterNodesRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfNodesToUnregister */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToUnregister", "NodeId", parseNodeId, ett_opcua_array_NodeId); proto_item_set_end(ti, tvb, *pOffset); } void parseUnregisterNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_UnregisterNodesResponse, &ti, "UnregisterNodesResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryFirstRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_QueryFirstRequest, &ti, "QueryFirstRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseViewDescription(subtree, tvb, pinfo, pOffset, "View"); /* Array length field ignored: NoOfNodeTypes */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodeTypes", "NodeTypeDescription", parseNodeTypeDescription, ett_opcua_array_NodeTypeDescription); parseContentFilter(subtree, tvb, pinfo, pOffset, "Filter"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxDataSetsToReturn); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxReferencesToReturn); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryFirstResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_QueryFirstResponse, &ti, "QueryFirstResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfQueryDataSets */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "QueryDataSets", "QueryDataSet", parseQueryDataSet, ett_opcua_array_QueryDataSet); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ContinuationPoint); /* Array length field ignored: NoOfParsingResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ParsingResults", "ParsingResult", parseParsingResult, ett_opcua_array_ParsingResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); parseContentFilterResult(subtree, tvb, pinfo, pOffset, "FilterResult"); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryNextRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_QueryNextRequest, &ti, "QueryNextRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ReleaseContinuationPoint); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_ContinuationPoint); proto_item_set_end(ti, tvb, *pOffset); } void parseQueryNextResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_QueryNextResponse, &ti, "QueryNextResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfQueryDataSets */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "QueryDataSets", "QueryDataSet", parseQueryDataSet, ett_opcua_array_QueryDataSet); parseByteString(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedContinuationPoint); proto_item_set_end(ti, tvb, *pOffset); } void parseReadRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ReadRequest, &ti, "ReadRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_MaxAge); parseTimestampsToReturn(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfNodesToRead */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToRead", "ReadValueId", parseReadValueId, ett_opcua_array_ReadValueId); proto_item_set_end(ti, tvb, *pOffset); } void parseReadResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ReadResponse, &ti, "ReadResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "DataValue", parseDataValue, ett_opcua_array_DataValue); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryReadRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_HistoryReadRequest, &ti, "HistoryReadRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseExtensionObject(subtree, tvb, pinfo, pOffset, "HistoryReadDetails"); parseTimestampsToReturn(subtree, tvb, pinfo, pOffset); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_ReleaseContinuationPoints); /* Array length field ignored: NoOfNodesToRead */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToRead", "HistoryReadValueId", parseHistoryReadValueId, ett_opcua_array_HistoryReadValueId); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryReadResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_HistoryReadResponse, &ti, "HistoryReadResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "HistoryReadResult", parseHistoryReadResult, ett_opcua_array_HistoryReadResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseWriteRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_WriteRequest, &ti, "WriteRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfNodesToWrite */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "NodesToWrite", "WriteValue", parseWriteValue, ett_opcua_array_WriteValue); proto_item_set_end(ti, tvb, *pOffset); } void parseWriteResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_WriteResponse, &ti, "WriteResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryUpdateRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_HistoryUpdateRequest, &ti, "HistoryUpdateRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfHistoryUpdateDetails */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "HistoryUpdateDetails", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); proto_item_set_end(ti, tvb, *pOffset); } void parseHistoryUpdateResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_HistoryUpdateResponse, &ti, "HistoryUpdateResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "HistoryUpdateResult", parseHistoryUpdateResult, ett_opcua_array_HistoryUpdateResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseCallRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CallRequest, &ti, "CallRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfMethodsToCall */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "MethodsToCall", "CallMethodRequest", parseCallMethodRequest, ett_opcua_array_CallMethodRequest); proto_item_set_end(ti, tvb, *pOffset); } void parseCallResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CallResponse, &ti, "CallResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "CallMethodResult", parseCallMethodResult, ett_opcua_array_CallMethodResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateMonitoredItemsRequest, &ti, "CreateMonitoredItemsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseTimestampsToReturn(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfItemsToCreate */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ItemsToCreate", "MonitoredItemCreateRequest", parseMonitoredItemCreateRequest, ett_opcua_array_MonitoredItemCreateRequest); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateMonitoredItemsResponse, &ti, "CreateMonitoredItemsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "MonitoredItemCreateResult", parseMonitoredItemCreateResult, ett_opcua_array_MonitoredItemCreateResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseModifyMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ModifyMonitoredItemsRequest, &ti, "ModifyMonitoredItemsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseTimestampsToReturn(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfItemsToModify */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "ItemsToModify", "MonitoredItemModifyRequest", parseMonitoredItemModifyRequest, ett_opcua_array_MonitoredItemModifyRequest); proto_item_set_end(ti, tvb, *pOffset); } void parseModifyMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ModifyMonitoredItemsResponse, &ti, "ModifyMonitoredItemsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "MonitoredItemModifyResult", parseMonitoredItemModifyResult, ett_opcua_array_MonitoredItemModifyResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseSetMonitoringModeRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetMonitoringModeRequest, &ti, "SetMonitoringModeRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseMonitoringMode(subtree, tvb, pinfo, pOffset); /* Array length field ignored: NoOfMonitoredItemIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "MonitoredItemIds", "UInt32", hf_opcua_MonitoredItemIds, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseSetMonitoringModeResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetMonitoringModeResponse, &ti, "SetMonitoringModeResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseSetTriggeringRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetTriggeringRequest, &ti, "SetTriggeringRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TriggeringItemId); /* Array length field ignored: NoOfLinksToAdd */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LinksToAdd", "UInt32", hf_opcua_LinksToAdd, parseUInt32, ett_opcua_array_UInt32); /* Array length field ignored: NoOfLinksToRemove */ parseArraySimple(subtree, tvb, pinfo, pOffset, "LinksToRemove", "UInt32", hf_opcua_LinksToRemove, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseSetTriggeringResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetTriggeringResponse, &ti, "SetTriggeringResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfAddResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "AddResults", "StatusCode", hf_opcua_AddResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfAddDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "AddDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); /* Array length field ignored: NoOfRemoveResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "RemoveResults", "StatusCode", hf_opcua_RemoveResults, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfRemoveDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "RemoveDiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteMonitoredItemsRequest, &ti, "DeleteMonitoredItemsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); /* Array length field ignored: NoOfMonitoredItemIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "MonitoredItemIds", "UInt32", hf_opcua_MonitoredItemIds, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteMonitoredItemsResponse, &ti, "DeleteMonitoredItemsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateSubscriptionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateSubscriptionRequest, &ti, "CreateSubscriptionRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedPublishingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedMaxKeepAliveCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxNotificationsPerPublish); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_PublishingEnabled); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_Priority); proto_item_set_end(ti, tvb, *pOffset); } void parseCreateSubscriptionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_CreateSubscriptionResponse, &ti, "CreateSubscriptionResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedPublishingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedMaxKeepAliveCount); proto_item_set_end(ti, tvb, *pOffset); } void parseModifySubscriptionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ModifySubscriptionRequest, &ti, "ModifySubscriptionRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedPublishingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RequestedMaxKeepAliveCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_MaxNotificationsPerPublish); parseByte(subtree, tvb, pinfo, pOffset, hf_opcua_Priority); proto_item_set_end(ti, tvb, *pOffset); } void parseModifySubscriptionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_ModifySubscriptionResponse, &ti, "ModifySubscriptionResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedPublishingInterval); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedLifetimeCount); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RevisedMaxKeepAliveCount); proto_item_set_end(ti, tvb, *pOffset); } void parseSetPublishingModeRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetPublishingModeRequest, &ti, "SetPublishingModeRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_PublishingEnabled); /* Array length field ignored: NoOfSubscriptionIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "SubscriptionIds", "UInt32", hf_opcua_SubscriptionIds, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseSetPublishingModeResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_SetPublishingModeResponse, &ti, "SetPublishingModeResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parsePublishRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_PublishRequest, &ti, "PublishRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfSubscriptionAcknowledgements */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "SubscriptionAcknowledgements", "SubscriptionAcknowledgement", parseSubscriptionAcknowledgement, ett_opcua_array_SubscriptionAcknowledgement); proto_item_set_end(ti, tvb, *pOffset); } void parsePublishResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_PublishResponse, &ti, "PublishResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); /* Array length field ignored: NoOfAvailableSequenceNumbers */ parseArraySimple(subtree, tvb, pinfo, pOffset, "AvailableSequenceNumbers", "UInt32", hf_opcua_AvailableSequenceNumbers, parseUInt32, ett_opcua_array_UInt32); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_MoreNotifications); parseNotificationMessage(subtree, tvb, pinfo, pOffset, "NotificationMessage"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseRepublishRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RepublishRequest, &ti, "RepublishRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_SubscriptionId); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_RetransmitSequenceNumber); proto_item_set_end(ti, tvb, *pOffset); } void parseRepublishResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_RepublishResponse, &ti, "RepublishResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseNotificationMessage(subtree, tvb, pinfo, pOffset, "NotificationMessage"); proto_item_set_end(ti, tvb, *pOffset); } void parseTransferSubscriptionsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TransferSubscriptionsRequest, &ti, "TransferSubscriptionsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfSubscriptionIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "SubscriptionIds", "UInt32", hf_opcua_SubscriptionIds, parseUInt32, ett_opcua_array_UInt32); parseBoolean(subtree, tvb, pinfo, pOffset, hf_opcua_SendInitialValues); proto_item_set_end(ti, tvb, *pOffset); } void parseTransferSubscriptionsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TransferSubscriptionsResponse, &ti, "TransferSubscriptionsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "Results", "TransferResult", parseTransferResult, ett_opcua_array_TransferResult); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteSubscriptionsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteSubscriptionsRequest, &ti, "DeleteSubscriptionsRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); /* Array length field ignored: NoOfSubscriptionIds */ parseArraySimple(subtree, tvb, pinfo, pOffset, "SubscriptionIds", "UInt32", hf_opcua_SubscriptionIds, parseUInt32, ett_opcua_array_UInt32); proto_item_set_end(ti, tvb, *pOffset); } void parseDeleteSubscriptionsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_DeleteSubscriptionsResponse, &ti, "DeleteSubscriptionsResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); /* Array length field ignored: NoOfResults */ parseArraySimple(subtree, tvb, pinfo, pOffset, "Results", "StatusCode", hf_opcua_Results, parseStatusCode, ett_opcua_array_StatusCode); /* Array length field ignored: NoOfDiagnosticInfos */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "DiagnosticInfos", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); proto_item_set_end(ti, tvb, *pOffset); } void parseTestStackRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TestStackRequest, &ti, "TestStackRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TestId); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_Iteration); parseVariant(subtree, tvb, pinfo, pOffset, "Input"); proto_item_set_end(ti, tvb, *pOffset); } void parseTestStackResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TestStackResponse, &ti, "TestStackResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseVariant(subtree, tvb, pinfo, pOffset, "Output"); proto_item_set_end(ti, tvb, *pOffset); } void parseTestStackExRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TestStackExRequest, &ti, "TestStackExRequest"); parseRequestHeader(subtree, tvb, pinfo, pOffset, "RequestHeader"); parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_TestId); parseInt32(subtree, tvb, pinfo, pOffset, hf_opcua_Iteration); parseCompositeTestType(subtree, tvb, pinfo, pOffset, "Input"); proto_item_set_end(ti, tvb, *pOffset); } void parseTestStackExResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_TestStackExResponse, &ti, "TestStackExResponse"); parseResponseHeader(subtree, tvb, pinfo, pOffset, "ResponseHeader"); parseCompositeTestType(subtree, tvb, pinfo, pOffset, "Output"); proto_item_set_end(ti, tvb, *pOffset); } /** Setup protocol subtree array */ static gint *ett[] = { &ett_opcua_ServiceFault, &ett_opcua_array_ServiceFault, &ett_opcua_FindServersRequest, &ett_opcua_array_FindServersRequest, &ett_opcua_FindServersResponse, &ett_opcua_array_FindServersResponse, &ett_opcua_FindServersOnNetworkRequest, &ett_opcua_array_FindServersOnNetworkRequest, &ett_opcua_FindServersOnNetworkResponse, &ett_opcua_array_FindServersOnNetworkResponse, &ett_opcua_GetEndpointsRequest, &ett_opcua_array_GetEndpointsRequest, &ett_opcua_GetEndpointsResponse, &ett_opcua_array_GetEndpointsResponse, &ett_opcua_RegisterServerRequest, &ett_opcua_array_RegisterServerRequest, &ett_opcua_RegisterServerResponse, &ett_opcua_array_RegisterServerResponse, &ett_opcua_RegisterServer2Request, &ett_opcua_array_RegisterServer2Request, &ett_opcua_RegisterServer2Response, &ett_opcua_array_RegisterServer2Response, &ett_opcua_OpenSecureChannelRequest, &ett_opcua_array_OpenSecureChannelRequest, &ett_opcua_OpenSecureChannelResponse, &ett_opcua_array_OpenSecureChannelResponse, &ett_opcua_CloseSecureChannelRequest, &ett_opcua_array_CloseSecureChannelRequest, &ett_opcua_CloseSecureChannelResponse, &ett_opcua_array_CloseSecureChannelResponse, &ett_opcua_CreateSessionRequest, &ett_opcua_array_CreateSessionRequest, &ett_opcua_CreateSessionResponse, &ett_opcua_array_CreateSessionResponse, &ett_opcua_ActivateSessionRequest, &ett_opcua_array_ActivateSessionRequest, &ett_opcua_ActivateSessionResponse, &ett_opcua_array_ActivateSessionResponse, &ett_opcua_CloseSessionRequest, &ett_opcua_array_CloseSessionRequest, &ett_opcua_CloseSessionResponse, &ett_opcua_array_CloseSessionResponse, &ett_opcua_CancelRequest, &ett_opcua_array_CancelRequest, &ett_opcua_CancelResponse, &ett_opcua_array_CancelResponse, &ett_opcua_AddNodesRequest, &ett_opcua_array_AddNodesRequest, &ett_opcua_AddNodesResponse, &ett_opcua_array_AddNodesResponse, &ett_opcua_AddReferencesRequest, &ett_opcua_array_AddReferencesRequest, &ett_opcua_AddReferencesResponse, &ett_opcua_array_AddReferencesResponse, &ett_opcua_DeleteNodesRequest, &ett_opcua_array_DeleteNodesRequest, &ett_opcua_DeleteNodesResponse, &ett_opcua_array_DeleteNodesResponse, &ett_opcua_DeleteReferencesRequest, &ett_opcua_array_DeleteReferencesRequest, &ett_opcua_DeleteReferencesResponse, &ett_opcua_array_DeleteReferencesResponse, &ett_opcua_BrowseRequest, &ett_opcua_array_BrowseRequest, &ett_opcua_BrowseResponse, &ett_opcua_array_BrowseResponse, &ett_opcua_BrowseNextRequest, &ett_opcua_array_BrowseNextRequest, &ett_opcua_BrowseNextResponse, &ett_opcua_array_BrowseNextResponse, &ett_opcua_TranslateBrowsePathsToNodeIdsRequest, &ett_opcua_array_TranslateBrowsePathsToNodeIdsRequest, &ett_opcua_TranslateBrowsePathsToNodeIdsResponse, &ett_opcua_array_TranslateBrowsePathsToNodeIdsResponse, &ett_opcua_RegisterNodesRequest, &ett_opcua_array_RegisterNodesRequest, &ett_opcua_RegisterNodesResponse, &ett_opcua_array_RegisterNodesResponse, &ett_opcua_UnregisterNodesRequest, &ett_opcua_array_UnregisterNodesRequest, &ett_opcua_UnregisterNodesResponse, &ett_opcua_array_UnregisterNodesResponse, &ett_opcua_QueryFirstRequest, &ett_opcua_array_QueryFirstRequest, &ett_opcua_QueryFirstResponse, &ett_opcua_array_QueryFirstResponse, &ett_opcua_QueryNextRequest, &ett_opcua_array_QueryNextRequest, &ett_opcua_QueryNextResponse, &ett_opcua_array_QueryNextResponse, &ett_opcua_ReadRequest, &ett_opcua_array_ReadRequest, &ett_opcua_ReadResponse, &ett_opcua_array_ReadResponse, &ett_opcua_HistoryReadRequest, &ett_opcua_array_HistoryReadRequest, &ett_opcua_HistoryReadResponse, &ett_opcua_array_HistoryReadResponse, &ett_opcua_WriteRequest, &ett_opcua_array_WriteRequest, &ett_opcua_WriteResponse, &ett_opcua_array_WriteResponse, &ett_opcua_HistoryUpdateRequest, &ett_opcua_array_HistoryUpdateRequest, &ett_opcua_HistoryUpdateResponse, &ett_opcua_array_HistoryUpdateResponse, &ett_opcua_CallRequest, &ett_opcua_array_CallRequest, &ett_opcua_CallResponse, &ett_opcua_array_CallResponse, &ett_opcua_CreateMonitoredItemsRequest, &ett_opcua_array_CreateMonitoredItemsRequest, &ett_opcua_CreateMonitoredItemsResponse, &ett_opcua_array_CreateMonitoredItemsResponse, &ett_opcua_ModifyMonitoredItemsRequest, &ett_opcua_array_ModifyMonitoredItemsRequest, &ett_opcua_ModifyMonitoredItemsResponse, &ett_opcua_array_ModifyMonitoredItemsResponse, &ett_opcua_SetMonitoringModeRequest, &ett_opcua_array_SetMonitoringModeRequest, &ett_opcua_SetMonitoringModeResponse, &ett_opcua_array_SetMonitoringModeResponse, &ett_opcua_SetTriggeringRequest, &ett_opcua_array_SetTriggeringRequest, &ett_opcua_SetTriggeringResponse, &ett_opcua_array_SetTriggeringResponse, &ett_opcua_DeleteMonitoredItemsRequest, &ett_opcua_array_DeleteMonitoredItemsRequest, &ett_opcua_DeleteMonitoredItemsResponse, &ett_opcua_array_DeleteMonitoredItemsResponse, &ett_opcua_CreateSubscriptionRequest, &ett_opcua_array_CreateSubscriptionRequest, &ett_opcua_CreateSubscriptionResponse, &ett_opcua_array_CreateSubscriptionResponse, &ett_opcua_ModifySubscriptionRequest, &ett_opcua_array_ModifySubscriptionRequest, &ett_opcua_ModifySubscriptionResponse, &ett_opcua_array_ModifySubscriptionResponse, &ett_opcua_SetPublishingModeRequest, &ett_opcua_array_SetPublishingModeRequest, &ett_opcua_SetPublishingModeResponse, &ett_opcua_array_SetPublishingModeResponse, &ett_opcua_PublishRequest, &ett_opcua_array_PublishRequest, &ett_opcua_PublishResponse, &ett_opcua_array_PublishResponse, &ett_opcua_RepublishRequest, &ett_opcua_array_RepublishRequest, &ett_opcua_RepublishResponse, &ett_opcua_array_RepublishResponse, &ett_opcua_TransferSubscriptionsRequest, &ett_opcua_array_TransferSubscriptionsRequest, &ett_opcua_TransferSubscriptionsResponse, &ett_opcua_array_TransferSubscriptionsResponse, &ett_opcua_DeleteSubscriptionsRequest, &ett_opcua_array_DeleteSubscriptionsRequest, &ett_opcua_DeleteSubscriptionsResponse, &ett_opcua_array_DeleteSubscriptionsResponse, &ett_opcua_TestStackRequest, &ett_opcua_array_TestStackRequest, &ett_opcua_TestStackResponse, &ett_opcua_array_TestStackResponse, &ett_opcua_TestStackExRequest, &ett_opcua_array_TestStackExRequest, &ett_opcua_TestStackExResponse, &ett_opcua_array_TestStackExResponse, }; void registerServiceTypes(void) { proto_register_subtree_array(ett, array_length(ett)); }
C/C++
wireshark/plugins/epan/opcua/opcua_serviceparser.h
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Service Type Parser ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** XXX - well, except that you may have to. See the README. ** ******************************************************************************/ #include <glib.h> #include <epan/packet.h> extern gint ett_opcua_ServiceFault; extern gint ett_opcua_array_ServiceFault; extern gint ett_opcua_FindServersRequest; extern gint ett_opcua_array_FindServersRequest; extern gint ett_opcua_FindServersResponse; extern gint ett_opcua_array_FindServersResponse; extern gint ett_opcua_FindServersOnNetworkRequest; extern gint ett_opcua_array_FindServersOnNetworkRequest; extern gint ett_opcua_FindServersOnNetworkResponse; extern gint ett_opcua_array_FindServersOnNetworkResponse; extern gint ett_opcua_GetEndpointsRequest; extern gint ett_opcua_array_GetEndpointsRequest; extern gint ett_opcua_GetEndpointsResponse; extern gint ett_opcua_array_GetEndpointsResponse; extern gint ett_opcua_RegisterServerRequest; extern gint ett_opcua_array_RegisterServerRequest; extern gint ett_opcua_RegisterServerResponse; extern gint ett_opcua_array_RegisterServerResponse; extern gint ett_opcua_RegisterServer2Request; extern gint ett_opcua_array_RegisterServer2Request; extern gint ett_opcua_RegisterServer2Response; extern gint ett_opcua_array_RegisterServer2Response; extern gint ett_opcua_OpenSecureChannelRequest; extern gint ett_opcua_array_OpenSecureChannelRequest; extern gint ett_opcua_OpenSecureChannelResponse; extern gint ett_opcua_array_OpenSecureChannelResponse; extern gint ett_opcua_CloseSecureChannelRequest; extern gint ett_opcua_array_CloseSecureChannelRequest; extern gint ett_opcua_CloseSecureChannelResponse; extern gint ett_opcua_array_CloseSecureChannelResponse; extern gint ett_opcua_CreateSessionRequest; extern gint ett_opcua_array_CreateSessionRequest; extern gint ett_opcua_CreateSessionResponse; extern gint ett_opcua_array_CreateSessionResponse; extern gint ett_opcua_ActivateSessionRequest; extern gint ett_opcua_array_ActivateSessionRequest; extern gint ett_opcua_ActivateSessionResponse; extern gint ett_opcua_array_ActivateSessionResponse; extern gint ett_opcua_CloseSessionRequest; extern gint ett_opcua_array_CloseSessionRequest; extern gint ett_opcua_CloseSessionResponse; extern gint ett_opcua_array_CloseSessionResponse; extern gint ett_opcua_CancelRequest; extern gint ett_opcua_array_CancelRequest; extern gint ett_opcua_CancelResponse; extern gint ett_opcua_array_CancelResponse; extern gint ett_opcua_AddNodesRequest; extern gint ett_opcua_array_AddNodesRequest; extern gint ett_opcua_AddNodesResponse; extern gint ett_opcua_array_AddNodesResponse; extern gint ett_opcua_AddReferencesRequest; extern gint ett_opcua_array_AddReferencesRequest; extern gint ett_opcua_AddReferencesResponse; extern gint ett_opcua_array_AddReferencesResponse; extern gint ett_opcua_DeleteNodesRequest; extern gint ett_opcua_array_DeleteNodesRequest; extern gint ett_opcua_DeleteNodesResponse; extern gint ett_opcua_array_DeleteNodesResponse; extern gint ett_opcua_DeleteReferencesRequest; extern gint ett_opcua_array_DeleteReferencesRequest; extern gint ett_opcua_DeleteReferencesResponse; extern gint ett_opcua_array_DeleteReferencesResponse; extern gint ett_opcua_BrowseRequest; extern gint ett_opcua_array_BrowseRequest; extern gint ett_opcua_BrowseResponse; extern gint ett_opcua_array_BrowseResponse; extern gint ett_opcua_BrowseNextRequest; extern gint ett_opcua_array_BrowseNextRequest; extern gint ett_opcua_BrowseNextResponse; extern gint ett_opcua_array_BrowseNextResponse; extern gint ett_opcua_TranslateBrowsePathsToNodeIdsRequest; extern gint ett_opcua_array_TranslateBrowsePathsToNodeIdsRequest; extern gint ett_opcua_TranslateBrowsePathsToNodeIdsResponse; extern gint ett_opcua_array_TranslateBrowsePathsToNodeIdsResponse; extern gint ett_opcua_RegisterNodesRequest; extern gint ett_opcua_array_RegisterNodesRequest; extern gint ett_opcua_RegisterNodesResponse; extern gint ett_opcua_array_RegisterNodesResponse; extern gint ett_opcua_UnregisterNodesRequest; extern gint ett_opcua_array_UnregisterNodesRequest; extern gint ett_opcua_UnregisterNodesResponse; extern gint ett_opcua_array_UnregisterNodesResponse; extern gint ett_opcua_QueryFirstRequest; extern gint ett_opcua_array_QueryFirstRequest; extern gint ett_opcua_QueryFirstResponse; extern gint ett_opcua_array_QueryFirstResponse; extern gint ett_opcua_QueryNextRequest; extern gint ett_opcua_array_QueryNextRequest; extern gint ett_opcua_QueryNextResponse; extern gint ett_opcua_array_QueryNextResponse; extern gint ett_opcua_ReadRequest; extern gint ett_opcua_array_ReadRequest; extern gint ett_opcua_ReadResponse; extern gint ett_opcua_array_ReadResponse; extern gint ett_opcua_HistoryReadRequest; extern gint ett_opcua_array_HistoryReadRequest; extern gint ett_opcua_HistoryReadResponse; extern gint ett_opcua_array_HistoryReadResponse; extern gint ett_opcua_WriteRequest; extern gint ett_opcua_array_WriteRequest; extern gint ett_opcua_WriteResponse; extern gint ett_opcua_array_WriteResponse; extern gint ett_opcua_HistoryUpdateRequest; extern gint ett_opcua_array_HistoryUpdateRequest; extern gint ett_opcua_HistoryUpdateResponse; extern gint ett_opcua_array_HistoryUpdateResponse; extern gint ett_opcua_CallRequest; extern gint ett_opcua_array_CallRequest; extern gint ett_opcua_CallResponse; extern gint ett_opcua_array_CallResponse; extern gint ett_opcua_CreateMonitoredItemsRequest; extern gint ett_opcua_array_CreateMonitoredItemsRequest; extern gint ett_opcua_CreateMonitoredItemsResponse; extern gint ett_opcua_array_CreateMonitoredItemsResponse; extern gint ett_opcua_ModifyMonitoredItemsRequest; extern gint ett_opcua_array_ModifyMonitoredItemsRequest; extern gint ett_opcua_ModifyMonitoredItemsResponse; extern gint ett_opcua_array_ModifyMonitoredItemsResponse; extern gint ett_opcua_SetMonitoringModeRequest; extern gint ett_opcua_array_SetMonitoringModeRequest; extern gint ett_opcua_SetMonitoringModeResponse; extern gint ett_opcua_array_SetMonitoringModeResponse; extern gint ett_opcua_SetTriggeringRequest; extern gint ett_opcua_array_SetTriggeringRequest; extern gint ett_opcua_SetTriggeringResponse; extern gint ett_opcua_array_SetTriggeringResponse; extern gint ett_opcua_DeleteMonitoredItemsRequest; extern gint ett_opcua_array_DeleteMonitoredItemsRequest; extern gint ett_opcua_DeleteMonitoredItemsResponse; extern gint ett_opcua_array_DeleteMonitoredItemsResponse; extern gint ett_opcua_CreateSubscriptionRequest; extern gint ett_opcua_array_CreateSubscriptionRequest; extern gint ett_opcua_CreateSubscriptionResponse; extern gint ett_opcua_array_CreateSubscriptionResponse; extern gint ett_opcua_ModifySubscriptionRequest; extern gint ett_opcua_array_ModifySubscriptionRequest; extern gint ett_opcua_ModifySubscriptionResponse; extern gint ett_opcua_array_ModifySubscriptionResponse; extern gint ett_opcua_SetPublishingModeRequest; extern gint ett_opcua_array_SetPublishingModeRequest; extern gint ett_opcua_SetPublishingModeResponse; extern gint ett_opcua_array_SetPublishingModeResponse; extern gint ett_opcua_PublishRequest; extern gint ett_opcua_array_PublishRequest; extern gint ett_opcua_PublishResponse; extern gint ett_opcua_array_PublishResponse; extern gint ett_opcua_RepublishRequest; extern gint ett_opcua_array_RepublishRequest; extern gint ett_opcua_RepublishResponse; extern gint ett_opcua_array_RepublishResponse; extern gint ett_opcua_TransferSubscriptionsRequest; extern gint ett_opcua_array_TransferSubscriptionsRequest; extern gint ett_opcua_TransferSubscriptionsResponse; extern gint ett_opcua_array_TransferSubscriptionsResponse; extern gint ett_opcua_DeleteSubscriptionsRequest; extern gint ett_opcua_array_DeleteSubscriptionsRequest; extern gint ett_opcua_DeleteSubscriptionsResponse; extern gint ett_opcua_array_DeleteSubscriptionsResponse; extern gint ett_opcua_TestStackRequest; extern gint ett_opcua_array_TestStackRequest; extern gint ett_opcua_TestStackResponse; extern gint ett_opcua_array_TestStackResponse; extern gint ett_opcua_TestStackExRequest; extern gint ett_opcua_array_TestStackExRequest; extern gint ett_opcua_TestStackExResponse; extern gint ett_opcua_array_TestStackExResponse; void parseServiceFault(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseFindServersRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseFindServersResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseFindServersOnNetworkRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseFindServersOnNetworkResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseGetEndpointsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseGetEndpointsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterServerRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterServerResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterServer2Request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterServer2Response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseOpenSecureChannelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseOpenSecureChannelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCloseSecureChannelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCloseSecureChannelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseActivateSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseActivateSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCloseSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCloseSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCancelRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCancelResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAddNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAddNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAddReferencesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAddReferencesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteReferencesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteReferencesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseBrowseRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseBrowseResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseBrowseNextRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseBrowseNextResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTranslateBrowsePathsToNodeIdsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTranslateBrowsePathsToNodeIdsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRegisterNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseUnregisterNodesRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseUnregisterNodesResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseQueryFirstRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseQueryFirstResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseQueryNextRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseQueryNextResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseReadRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseReadResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseHistoryReadRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseHistoryReadResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseWriteRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseWriteResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseHistoryUpdateRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseHistoryUpdateResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCallRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCallResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseModifyMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseModifyMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetMonitoringModeRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetMonitoringModeResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetTriggeringRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetTriggeringResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteMonitoredItemsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteMonitoredItemsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateSubscriptionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseCreateSubscriptionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseModifySubscriptionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseModifySubscriptionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetPublishingModeRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseSetPublishingModeResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parsePublishRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parsePublishResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRepublishRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseRepublishResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTransferSubscriptionsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTransferSubscriptionsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteSubscriptionsRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseDeleteSubscriptionsResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTestStackRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTestStackResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTestStackExRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseTestStackExResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void registerServiceTypes(void);
C
wireshark/plugins/epan/opcua/opcua_servicetable.c
/****************************************************************************** ** Copyright (C) 2006-2015 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Service table and service dispatcher. ** ** This file was autogenerated on 13.10.2015. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_identifiers.h" #include "opcua_serviceparser.h" #include "opcua_serviceids.h" #include "opcua_servicetable.h" ParserEntry g_arParserTable[] = { { OpcUaId_ServiceFault_Encoding_DefaultBinary, parseServiceFault }, { OpcUaId_FindServersRequest_Encoding_DefaultBinary, parseFindServersRequest }, { OpcUaId_FindServersResponse_Encoding_DefaultBinary, parseFindServersResponse }, { OpcUaId_FindServersOnNetworkRequest_Encoding_DefaultBinary, parseFindServersOnNetworkRequest }, { OpcUaId_FindServersOnNetworkResponse_Encoding_DefaultBinary, parseFindServersOnNetworkResponse }, { OpcUaId_GetEndpointsRequest_Encoding_DefaultBinary, parseGetEndpointsRequest }, { OpcUaId_GetEndpointsResponse_Encoding_DefaultBinary, parseGetEndpointsResponse }, { OpcUaId_RegisterServerRequest_Encoding_DefaultBinary, parseRegisterServerRequest }, { OpcUaId_RegisterServerResponse_Encoding_DefaultBinary, parseRegisterServerResponse }, { OpcUaId_RegisterServer2Request_Encoding_DefaultBinary, parseRegisterServer2Request }, { OpcUaId_RegisterServer2Response_Encoding_DefaultBinary, parseRegisterServer2Response }, { OpcUaId_OpenSecureChannelRequest_Encoding_DefaultBinary, parseOpenSecureChannelRequest }, { OpcUaId_OpenSecureChannelResponse_Encoding_DefaultBinary, parseOpenSecureChannelResponse }, { OpcUaId_CloseSecureChannelRequest_Encoding_DefaultBinary, parseCloseSecureChannelRequest }, { OpcUaId_CloseSecureChannelResponse_Encoding_DefaultBinary, parseCloseSecureChannelResponse }, { OpcUaId_CreateSessionRequest_Encoding_DefaultBinary, parseCreateSessionRequest }, { OpcUaId_CreateSessionResponse_Encoding_DefaultBinary, parseCreateSessionResponse }, { OpcUaId_ActivateSessionRequest_Encoding_DefaultBinary, parseActivateSessionRequest }, { OpcUaId_ActivateSessionResponse_Encoding_DefaultBinary, parseActivateSessionResponse }, { OpcUaId_CloseSessionRequest_Encoding_DefaultBinary, parseCloseSessionRequest }, { OpcUaId_CloseSessionResponse_Encoding_DefaultBinary, parseCloseSessionResponse }, { OpcUaId_CancelRequest_Encoding_DefaultBinary, parseCancelRequest }, { OpcUaId_CancelResponse_Encoding_DefaultBinary, parseCancelResponse }, { OpcUaId_AddNodesRequest_Encoding_DefaultBinary, parseAddNodesRequest }, { OpcUaId_AddNodesResponse_Encoding_DefaultBinary, parseAddNodesResponse }, { OpcUaId_AddReferencesRequest_Encoding_DefaultBinary, parseAddReferencesRequest }, { OpcUaId_AddReferencesResponse_Encoding_DefaultBinary, parseAddReferencesResponse }, { OpcUaId_DeleteNodesRequest_Encoding_DefaultBinary, parseDeleteNodesRequest }, { OpcUaId_DeleteNodesResponse_Encoding_DefaultBinary, parseDeleteNodesResponse }, { OpcUaId_DeleteReferencesRequest_Encoding_DefaultBinary, parseDeleteReferencesRequest }, { OpcUaId_DeleteReferencesResponse_Encoding_DefaultBinary, parseDeleteReferencesResponse }, { OpcUaId_BrowseRequest_Encoding_DefaultBinary, parseBrowseRequest }, { OpcUaId_BrowseResponse_Encoding_DefaultBinary, parseBrowseResponse }, { OpcUaId_BrowseNextRequest_Encoding_DefaultBinary, parseBrowseNextRequest }, { OpcUaId_BrowseNextResponse_Encoding_DefaultBinary, parseBrowseNextResponse }, { OpcUaId_TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary, parseTranslateBrowsePathsToNodeIdsRequest }, { OpcUaId_TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary, parseTranslateBrowsePathsToNodeIdsResponse }, { OpcUaId_RegisterNodesRequest_Encoding_DefaultBinary, parseRegisterNodesRequest }, { OpcUaId_RegisterNodesResponse_Encoding_DefaultBinary, parseRegisterNodesResponse }, { OpcUaId_UnregisterNodesRequest_Encoding_DefaultBinary, parseUnregisterNodesRequest }, { OpcUaId_UnregisterNodesResponse_Encoding_DefaultBinary, parseUnregisterNodesResponse }, { OpcUaId_QueryFirstRequest_Encoding_DefaultBinary, parseQueryFirstRequest }, { OpcUaId_QueryFirstResponse_Encoding_DefaultBinary, parseQueryFirstResponse }, { OpcUaId_QueryNextRequest_Encoding_DefaultBinary, parseQueryNextRequest }, { OpcUaId_QueryNextResponse_Encoding_DefaultBinary, parseQueryNextResponse }, { OpcUaId_ReadRequest_Encoding_DefaultBinary, parseReadRequest }, { OpcUaId_ReadResponse_Encoding_DefaultBinary, parseReadResponse }, { OpcUaId_HistoryReadRequest_Encoding_DefaultBinary, parseHistoryReadRequest }, { OpcUaId_HistoryReadResponse_Encoding_DefaultBinary, parseHistoryReadResponse }, { OpcUaId_WriteRequest_Encoding_DefaultBinary, parseWriteRequest }, { OpcUaId_WriteResponse_Encoding_DefaultBinary, parseWriteResponse }, { OpcUaId_HistoryUpdateRequest_Encoding_DefaultBinary, parseHistoryUpdateRequest }, { OpcUaId_HistoryUpdateResponse_Encoding_DefaultBinary, parseHistoryUpdateResponse }, { OpcUaId_CallRequest_Encoding_DefaultBinary, parseCallRequest }, { OpcUaId_CallResponse_Encoding_DefaultBinary, parseCallResponse }, { OpcUaId_CreateMonitoredItemsRequest_Encoding_DefaultBinary, parseCreateMonitoredItemsRequest }, { OpcUaId_CreateMonitoredItemsResponse_Encoding_DefaultBinary, parseCreateMonitoredItemsResponse }, { OpcUaId_ModifyMonitoredItemsRequest_Encoding_DefaultBinary, parseModifyMonitoredItemsRequest }, { OpcUaId_ModifyMonitoredItemsResponse_Encoding_DefaultBinary, parseModifyMonitoredItemsResponse }, { OpcUaId_SetMonitoringModeRequest_Encoding_DefaultBinary, parseSetMonitoringModeRequest }, { OpcUaId_SetMonitoringModeResponse_Encoding_DefaultBinary, parseSetMonitoringModeResponse }, { OpcUaId_SetTriggeringRequest_Encoding_DefaultBinary, parseSetTriggeringRequest }, { OpcUaId_SetTriggeringResponse_Encoding_DefaultBinary, parseSetTriggeringResponse }, { OpcUaId_DeleteMonitoredItemsRequest_Encoding_DefaultBinary, parseDeleteMonitoredItemsRequest }, { OpcUaId_DeleteMonitoredItemsResponse_Encoding_DefaultBinary, parseDeleteMonitoredItemsResponse }, { OpcUaId_CreateSubscriptionRequest_Encoding_DefaultBinary, parseCreateSubscriptionRequest }, { OpcUaId_CreateSubscriptionResponse_Encoding_DefaultBinary, parseCreateSubscriptionResponse }, { OpcUaId_ModifySubscriptionRequest_Encoding_DefaultBinary, parseModifySubscriptionRequest }, { OpcUaId_ModifySubscriptionResponse_Encoding_DefaultBinary, parseModifySubscriptionResponse }, { OpcUaId_SetPublishingModeRequest_Encoding_DefaultBinary, parseSetPublishingModeRequest }, { OpcUaId_SetPublishingModeResponse_Encoding_DefaultBinary, parseSetPublishingModeResponse }, { OpcUaId_PublishRequest_Encoding_DefaultBinary, parsePublishRequest }, { OpcUaId_PublishResponse_Encoding_DefaultBinary, parsePublishResponse }, { OpcUaId_RepublishRequest_Encoding_DefaultBinary, parseRepublishRequest }, { OpcUaId_RepublishResponse_Encoding_DefaultBinary, parseRepublishResponse }, { OpcUaId_TransferSubscriptionsRequest_Encoding_DefaultBinary, parseTransferSubscriptionsRequest }, { OpcUaId_TransferSubscriptionsResponse_Encoding_DefaultBinary, parseTransferSubscriptionsResponse }, { OpcUaId_DeleteSubscriptionsRequest_Encoding_DefaultBinary, parseDeleteSubscriptionsRequest }, { OpcUaId_DeleteSubscriptionsResponse_Encoding_DefaultBinary, parseDeleteSubscriptionsResponse }, { OpcUaId_TestStackRequest_Encoding_DefaultBinary, parseTestStackRequest }, { OpcUaId_TestStackResponse_Encoding_DefaultBinary, parseTestStackResponse }, { OpcUaId_TestStackExRequest_Encoding_DefaultBinary, parseTestStackExRequest }, { OpcUaId_TestStackExResponse_Encoding_DefaultBinary, parseTestStackExResponse }, }; const int g_NumServices = sizeof(g_arParserTable) / sizeof(ParserEntry); /** Service type table */ const value_string g_requesttypes[] = { { OpcUaId_ServiceFault_Encoding_DefaultBinary, "ServiceFault" }, { OpcUaId_FindServersRequest_Encoding_DefaultBinary, "FindServersRequest" }, { OpcUaId_FindServersResponse_Encoding_DefaultBinary, "FindServersResponse" }, { OpcUaId_FindServersOnNetworkRequest_Encoding_DefaultBinary, "FindServersOnNetworkRequest" }, { OpcUaId_FindServersOnNetworkResponse_Encoding_DefaultBinary, "FindServersOnNetworkResponse" }, { OpcUaId_GetEndpointsRequest_Encoding_DefaultBinary, "GetEndpointsRequest" }, { OpcUaId_GetEndpointsResponse_Encoding_DefaultBinary, "GetEndpointsResponse" }, { OpcUaId_RegisterServerRequest_Encoding_DefaultBinary, "RegisterServerRequest" }, { OpcUaId_RegisterServerResponse_Encoding_DefaultBinary, "RegisterServerResponse" }, { OpcUaId_RegisterServer2Request_Encoding_DefaultBinary, "RegisterServer2Request" }, { OpcUaId_RegisterServer2Response_Encoding_DefaultBinary, "RegisterServer2Response" }, { OpcUaId_OpenSecureChannelRequest_Encoding_DefaultBinary, "OpenSecureChannelRequest" }, { OpcUaId_OpenSecureChannelResponse_Encoding_DefaultBinary, "OpenSecureChannelResponse" }, { OpcUaId_CloseSecureChannelRequest_Encoding_DefaultBinary, "CloseSecureChannelRequest" }, { OpcUaId_CloseSecureChannelResponse_Encoding_DefaultBinary, "CloseSecureChannelResponse" }, { OpcUaId_CreateSessionRequest_Encoding_DefaultBinary, "CreateSessionRequest" }, { OpcUaId_CreateSessionResponse_Encoding_DefaultBinary, "CreateSessionResponse" }, { OpcUaId_ActivateSessionRequest_Encoding_DefaultBinary, "ActivateSessionRequest" }, { OpcUaId_ActivateSessionResponse_Encoding_DefaultBinary, "ActivateSessionResponse" }, { OpcUaId_CloseSessionRequest_Encoding_DefaultBinary, "CloseSessionRequest" }, { OpcUaId_CloseSessionResponse_Encoding_DefaultBinary, "CloseSessionResponse" }, { OpcUaId_CancelRequest_Encoding_DefaultBinary, "CancelRequest" }, { OpcUaId_CancelResponse_Encoding_DefaultBinary, "CancelResponse" }, { OpcUaId_AddNodesRequest_Encoding_DefaultBinary, "AddNodesRequest" }, { OpcUaId_AddNodesResponse_Encoding_DefaultBinary, "AddNodesResponse" }, { OpcUaId_AddReferencesRequest_Encoding_DefaultBinary, "AddReferencesRequest" }, { OpcUaId_AddReferencesResponse_Encoding_DefaultBinary, "AddReferencesResponse" }, { OpcUaId_DeleteNodesRequest_Encoding_DefaultBinary, "DeleteNodesRequest" }, { OpcUaId_DeleteNodesResponse_Encoding_DefaultBinary, "DeleteNodesResponse" }, { OpcUaId_DeleteReferencesRequest_Encoding_DefaultBinary, "DeleteReferencesRequest" }, { OpcUaId_DeleteReferencesResponse_Encoding_DefaultBinary, "DeleteReferencesResponse" }, { OpcUaId_BrowseRequest_Encoding_DefaultBinary, "BrowseRequest" }, { OpcUaId_BrowseResponse_Encoding_DefaultBinary, "BrowseResponse" }, { OpcUaId_BrowseNextRequest_Encoding_DefaultBinary, "BrowseNextRequest" }, { OpcUaId_BrowseNextResponse_Encoding_DefaultBinary, "BrowseNextResponse" }, { OpcUaId_TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary, "TranslateBrowsePathsToNodeIdsRequest" }, { OpcUaId_TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary, "TranslateBrowsePathsToNodeIdsResponse" }, { OpcUaId_RegisterNodesRequest_Encoding_DefaultBinary, "RegisterNodesRequest" }, { OpcUaId_RegisterNodesResponse_Encoding_DefaultBinary, "RegisterNodesResponse" }, { OpcUaId_UnregisterNodesRequest_Encoding_DefaultBinary, "UnregisterNodesRequest" }, { OpcUaId_UnregisterNodesResponse_Encoding_DefaultBinary, "UnregisterNodesResponse" }, { OpcUaId_QueryFirstRequest_Encoding_DefaultBinary, "QueryFirstRequest" }, { OpcUaId_QueryFirstResponse_Encoding_DefaultBinary, "QueryFirstResponse" }, { OpcUaId_QueryNextRequest_Encoding_DefaultBinary, "QueryNextRequest" }, { OpcUaId_QueryNextResponse_Encoding_DefaultBinary, "QueryNextResponse" }, { OpcUaId_ReadRequest_Encoding_DefaultBinary, "ReadRequest" }, { OpcUaId_ReadResponse_Encoding_DefaultBinary, "ReadResponse" }, { OpcUaId_HistoryReadRequest_Encoding_DefaultBinary, "HistoryReadRequest" }, { OpcUaId_HistoryReadResponse_Encoding_DefaultBinary, "HistoryReadResponse" }, { OpcUaId_WriteRequest_Encoding_DefaultBinary, "WriteRequest" }, { OpcUaId_WriteResponse_Encoding_DefaultBinary, "WriteResponse" }, { OpcUaId_HistoryUpdateRequest_Encoding_DefaultBinary, "HistoryUpdateRequest" }, { OpcUaId_HistoryUpdateResponse_Encoding_DefaultBinary, "HistoryUpdateResponse" }, { OpcUaId_CallRequest_Encoding_DefaultBinary, "CallRequest" }, { OpcUaId_CallResponse_Encoding_DefaultBinary, "CallResponse" }, { OpcUaId_CreateMonitoredItemsRequest_Encoding_DefaultBinary, "CreateMonitoredItemsRequest" }, { OpcUaId_CreateMonitoredItemsResponse_Encoding_DefaultBinary, "CreateMonitoredItemsResponse" }, { OpcUaId_ModifyMonitoredItemsRequest_Encoding_DefaultBinary, "ModifyMonitoredItemsRequest" }, { OpcUaId_ModifyMonitoredItemsResponse_Encoding_DefaultBinary, "ModifyMonitoredItemsResponse" }, { OpcUaId_SetMonitoringModeRequest_Encoding_DefaultBinary, "SetMonitoringModeRequest" }, { OpcUaId_SetMonitoringModeResponse_Encoding_DefaultBinary, "SetMonitoringModeResponse" }, { OpcUaId_SetTriggeringRequest_Encoding_DefaultBinary, "SetTriggeringRequest" }, { OpcUaId_SetTriggeringResponse_Encoding_DefaultBinary, "SetTriggeringResponse" }, { OpcUaId_DeleteMonitoredItemsRequest_Encoding_DefaultBinary, "DeleteMonitoredItemsRequest" }, { OpcUaId_DeleteMonitoredItemsResponse_Encoding_DefaultBinary, "DeleteMonitoredItemsResponse" }, { OpcUaId_CreateSubscriptionRequest_Encoding_DefaultBinary, "CreateSubscriptionRequest" }, { OpcUaId_CreateSubscriptionResponse_Encoding_DefaultBinary, "CreateSubscriptionResponse" }, { OpcUaId_ModifySubscriptionRequest_Encoding_DefaultBinary, "ModifySubscriptionRequest" }, { OpcUaId_ModifySubscriptionResponse_Encoding_DefaultBinary, "ModifySubscriptionResponse" }, { OpcUaId_SetPublishingModeRequest_Encoding_DefaultBinary, "SetPublishingModeRequest" }, { OpcUaId_SetPublishingModeResponse_Encoding_DefaultBinary, "SetPublishingModeResponse" }, { OpcUaId_PublishRequest_Encoding_DefaultBinary, "PublishRequest" }, { OpcUaId_PublishResponse_Encoding_DefaultBinary, "PublishResponse" }, { OpcUaId_RepublishRequest_Encoding_DefaultBinary, "RepublishRequest" }, { OpcUaId_RepublishResponse_Encoding_DefaultBinary, "RepublishResponse" }, { OpcUaId_TransferSubscriptionsRequest_Encoding_DefaultBinary, "TransferSubscriptionsRequest" }, { OpcUaId_TransferSubscriptionsResponse_Encoding_DefaultBinary, "TransferSubscriptionsResponse" }, { OpcUaId_DeleteSubscriptionsRequest_Encoding_DefaultBinary, "DeleteSubscriptionsRequest" }, { OpcUaId_DeleteSubscriptionsResponse_Encoding_DefaultBinary, "DeleteSubscriptionsResponse" }, { OpcUaId_TestStackRequest_Encoding_DefaultBinary, "TestStackRequest" }, { OpcUaId_TestStackResponse_Encoding_DefaultBinary, "TestStackResponse" }, { OpcUaId_TestStackExRequest_Encoding_DefaultBinary, "TestStackExRequest" }, { OpcUaId_TestStackExResponse_Encoding_DefaultBinary, "TestStackExResponse" }, { OpcUaId_ServiceFault_Encoding_DefaultXml, "ServiceFault (XML Encoding)" }, { OpcUaId_FindServersRequest_Encoding_DefaultXml, "FindServersRequest (XML Encoding)" }, { OpcUaId_FindServersResponse_Encoding_DefaultXml, "FindServersResponse (XML Encoding)" }, { OpcUaId_FindServersOnNetworkRequest_Encoding_DefaultXml, "FindServersOnNetworkRequest (XML Encoding)" }, { OpcUaId_FindServersOnNetworkResponse_Encoding_DefaultXml, "FindServersOnNetworkResponse (XML Encoding)" }, { OpcUaId_GetEndpointsRequest_Encoding_DefaultXml, "GetEndpointsRequest (XML Encoding)" }, { OpcUaId_GetEndpointsResponse_Encoding_DefaultXml, "GetEndpointsResponse (XML Encoding)" }, { OpcUaId_RegisterServerRequest_Encoding_DefaultXml, "RegisterServerRequest (XML Encoding)" }, { OpcUaId_RegisterServerResponse_Encoding_DefaultXml, "RegisterServerResponse (XML Encoding)" }, { OpcUaId_RegisterServer2Request_Encoding_DefaultXml, "RegisterServer2Request (XML Encoding)" }, { OpcUaId_RegisterServer2Response_Encoding_DefaultXml, "RegisterServer2Response (XML Encoding)" }, { OpcUaId_OpenSecureChannelRequest_Encoding_DefaultXml, "OpenSecureChannelRequest (XML Encoding)" }, { OpcUaId_OpenSecureChannelResponse_Encoding_DefaultXml, "OpenSecureChannelResponse (XML Encoding)" }, { OpcUaId_CloseSecureChannelRequest_Encoding_DefaultXml, "CloseSecureChannelRequest (XML Encoding)" }, { OpcUaId_CloseSecureChannelResponse_Encoding_DefaultXml, "CloseSecureChannelResponse (XML Encoding)" }, { OpcUaId_CreateSessionRequest_Encoding_DefaultXml, "CreateSessionRequest (XML Encoding)" }, { OpcUaId_CreateSessionResponse_Encoding_DefaultXml, "CreateSessionResponse (XML Encoding)" }, { OpcUaId_ActivateSessionRequest_Encoding_DefaultXml, "ActivateSessionRequest (XML Encoding)" }, { OpcUaId_ActivateSessionResponse_Encoding_DefaultXml, "ActivateSessionResponse (XML Encoding)" }, { OpcUaId_CloseSessionRequest_Encoding_DefaultXml, "CloseSessionRequest (XML Encoding)" }, { OpcUaId_CloseSessionResponse_Encoding_DefaultXml, "CloseSessionResponse (XML Encoding)" }, { OpcUaId_CancelRequest_Encoding_DefaultXml, "CancelRequest (XML Encoding)" }, { OpcUaId_CancelResponse_Encoding_DefaultXml, "CancelResponse (XML Encoding)" }, { OpcUaId_AddNodesRequest_Encoding_DefaultXml, "AddNodesRequest (XML Encoding)" }, { OpcUaId_AddNodesResponse_Encoding_DefaultXml, "AddNodesResponse (XML Encoding)" }, { OpcUaId_AddReferencesRequest_Encoding_DefaultXml, "AddReferencesRequest (XML Encoding)" }, { OpcUaId_AddReferencesResponse_Encoding_DefaultXml, "AddReferencesResponse (XML Encoding)" }, { OpcUaId_DeleteNodesRequest_Encoding_DefaultXml, "DeleteNodesRequest (XML Encoding)" }, { OpcUaId_DeleteNodesResponse_Encoding_DefaultXml, "DeleteNodesResponse (XML Encoding)" }, { OpcUaId_DeleteReferencesRequest_Encoding_DefaultXml, "DeleteReferencesRequest (XML Encoding)" }, { OpcUaId_DeleteReferencesResponse_Encoding_DefaultXml, "DeleteReferencesResponse (XML Encoding)" }, { OpcUaId_BrowseRequest_Encoding_DefaultXml, "BrowseRequest (XML Encoding)" }, { OpcUaId_BrowseResponse_Encoding_DefaultXml, "BrowseResponse (XML Encoding)" }, { OpcUaId_BrowseNextRequest_Encoding_DefaultXml, "BrowseNextRequest (XML Encoding)" }, { OpcUaId_BrowseNextResponse_Encoding_DefaultXml, "BrowseNextResponse (XML Encoding)" }, { OpcUaId_TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultXml, "TranslateBrowsePathsToNodeIdsRequest (XML Encoding)" }, { OpcUaId_TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultXml, "TranslateBrowsePathsToNodeIdsResponse (XML Encoding)" }, { OpcUaId_RegisterNodesRequest_Encoding_DefaultXml, "RegisterNodesRequest (XML Encoding)" }, { OpcUaId_RegisterNodesResponse_Encoding_DefaultXml, "RegisterNodesResponse (XML Encoding)" }, { OpcUaId_UnregisterNodesRequest_Encoding_DefaultXml, "UnregisterNodesRequest (XML Encoding)" }, { OpcUaId_UnregisterNodesResponse_Encoding_DefaultXml, "UnregisterNodesResponse (XML Encoding)" }, { OpcUaId_QueryFirstRequest_Encoding_DefaultXml, "QueryFirstRequest (XML Encoding)" }, { OpcUaId_QueryFirstResponse_Encoding_DefaultXml, "QueryFirstResponse (XML Encoding)" }, { OpcUaId_QueryNextRequest_Encoding_DefaultXml, "QueryNextRequest (XML Encoding)" }, { OpcUaId_QueryNextResponse_Encoding_DefaultXml, "QueryNextResponse (XML Encoding)" }, { OpcUaId_ReadRequest_Encoding_DefaultXml, "ReadRequest (XML Encoding)" }, { OpcUaId_ReadResponse_Encoding_DefaultXml, "ReadResponse (XML Encoding)" }, { OpcUaId_HistoryReadRequest_Encoding_DefaultXml, "HistoryReadRequest (XML Encoding)" }, { OpcUaId_HistoryReadResponse_Encoding_DefaultXml, "HistoryReadResponse (XML Encoding)" }, { OpcUaId_WriteRequest_Encoding_DefaultXml, "WriteRequest (XML Encoding)" }, { OpcUaId_WriteResponse_Encoding_DefaultXml, "WriteResponse (XML Encoding)" }, { OpcUaId_HistoryUpdateRequest_Encoding_DefaultXml, "HistoryUpdateRequest (XML Encoding)" }, { OpcUaId_HistoryUpdateResponse_Encoding_DefaultXml, "HistoryUpdateResponse (XML Encoding)" }, { OpcUaId_CallRequest_Encoding_DefaultXml, "CallRequest (XML Encoding)" }, { OpcUaId_CallResponse_Encoding_DefaultXml, "CallResponse (XML Encoding)" }, { OpcUaId_CreateMonitoredItemsRequest_Encoding_DefaultXml, "CreateMonitoredItemsRequest (XML Encoding)" }, { OpcUaId_CreateMonitoredItemsResponse_Encoding_DefaultXml, "CreateMonitoredItemsResponse (XML Encoding)" }, { OpcUaId_ModifyMonitoredItemsRequest_Encoding_DefaultXml, "ModifyMonitoredItemsRequest (XML Encoding)" }, { OpcUaId_ModifyMonitoredItemsResponse_Encoding_DefaultXml, "ModifyMonitoredItemsResponse (XML Encoding)" }, { OpcUaId_SetMonitoringModeRequest_Encoding_DefaultXml, "SetMonitoringModeRequest (XML Encoding)" }, { OpcUaId_SetMonitoringModeResponse_Encoding_DefaultXml, "SetMonitoringModeResponse (XML Encoding)" }, { OpcUaId_SetTriggeringRequest_Encoding_DefaultXml, "SetTriggeringRequest (XML Encoding)" }, { OpcUaId_SetTriggeringResponse_Encoding_DefaultXml, "SetTriggeringResponse (XML Encoding)" }, { OpcUaId_DeleteMonitoredItemsRequest_Encoding_DefaultXml, "DeleteMonitoredItemsRequest (XML Encoding)" }, { OpcUaId_DeleteMonitoredItemsResponse_Encoding_DefaultXml, "DeleteMonitoredItemsResponse (XML Encoding)" }, { OpcUaId_CreateSubscriptionRequest_Encoding_DefaultXml, "CreateSubscriptionRequest (XML Encoding)" }, { OpcUaId_CreateSubscriptionResponse_Encoding_DefaultXml, "CreateSubscriptionResponse (XML Encoding)" }, { OpcUaId_ModifySubscriptionRequest_Encoding_DefaultXml, "ModifySubscriptionRequest (XML Encoding)" }, { OpcUaId_ModifySubscriptionResponse_Encoding_DefaultXml, "ModifySubscriptionResponse (XML Encoding)" }, { OpcUaId_SetPublishingModeRequest_Encoding_DefaultXml, "SetPublishingModeRequest (XML Encoding)" }, { OpcUaId_SetPublishingModeResponse_Encoding_DefaultXml, "SetPublishingModeResponse (XML Encoding)" }, { OpcUaId_PublishRequest_Encoding_DefaultXml, "PublishRequest (XML Encoding)" }, { OpcUaId_PublishResponse_Encoding_DefaultXml, "PublishResponse (XML Encoding)" }, { OpcUaId_RepublishRequest_Encoding_DefaultXml, "RepublishRequest (XML Encoding)" }, { OpcUaId_RepublishResponse_Encoding_DefaultXml, "RepublishResponse (XML Encoding)" }, { OpcUaId_TransferSubscriptionsRequest_Encoding_DefaultXml, "TransferSubscriptionsRequest (XML Encoding)" }, { OpcUaId_TransferSubscriptionsResponse_Encoding_DefaultXml, "TransferSubscriptionsResponse (XML Encoding)" }, { OpcUaId_DeleteSubscriptionsRequest_Encoding_DefaultXml, "DeleteSubscriptionsRequest (XML Encoding)" }, { OpcUaId_DeleteSubscriptionsResponse_Encoding_DefaultXml, "DeleteSubscriptionsResponse (XML Encoding)" }, { OpcUaId_TestStackRequest_Encoding_DefaultXml, "TestStackRequest (XML Encoding)" }, { OpcUaId_TestStackResponse_Encoding_DefaultXml, "TestStackResponse (XML Encoding)" }, { OpcUaId_TestStackExRequest_Encoding_DefaultXml, "TestStackExRequest (XML Encoding)" }, { OpcUaId_TestStackExResponse_Encoding_DefaultXml, "TestStackExResponse (XML Encoding)" }, { 0, NULL } }; /** Dispatch all services to a special parser function. */ void dispatchService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int ServiceId) { int indx = 0; while (indx < g_NumServices) { if (g_arParserTable[indx].iRequestId == ServiceId) { (*g_arParserTable[indx].pParser)(tree, tvb, pinfo, pOffset); break; } indx++; } }
C/C++
wireshark/plugins/epan/opcua/opcua_servicetable.h
/****************************************************************************** ** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Service table and service dispatcher. ** ******************************************************************************/ void dispatchService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int ServiceId);
C
wireshark/plugins/epan/opcua/opcua_simpletypes.c
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Implementation of OpcUa built-in type parsers. ** This contains all the simple types and some complex types. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include <epan/expert.h> #include <epan/dissectors/packet-windows-common.h> #include <epan/proto_data.h> #include "opcua_simpletypes.h" #include "opcua_hfindeces.h" #include "opcua_statuscode.h" #define DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG 0x01 #define DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG 0x02 #define DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG 0x04 #define DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG 0x08 #define DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG 0x10 #define DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG 0x20 #define DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG 0x40 #define LOCALIZEDTEXT_ENCODINGBYTE_LOCALE 0x01 #define LOCALIZEDTEXT_ENCODINGBYTE_TEXT 0x02 #define NODEID_NAMESPACEURIFLAG 0x80 #define NODEID_SERVERINDEXFLAG 0x40 #define DATAVALUE_ENCODINGBYTE_VALUE 0x01 #define DATAVALUE_ENCODINGBYTE_STATUSCODE 0x02 #define DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP 0x04 #define DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP 0x08 #define DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS 0x10 #define DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS 0x20 #define EXTOBJ_ENCODINGMASK_BINBODY_FLAG 0x01 #define EXTOBJ_ENCODINGMASK_XMLBODY_FLAG 0x02 #define STATUSCODE_STRUCTURECHANGED 0x8000 #define STATUSCODE_SEMANTICSCHANGED 0x4000 #define STATUSCODE_INFOTYPE_DATAVALUE 0x00000400 #define STATUSCODE_INFOBIT_OVERFLOW 0x0080 #define STATUSCODE_INFOBIT_HISTORIAN_PARTIAL 0x0004 #define STATUSCODE_INFOBIT_HISTORIAN_EXTRADATA 0x0008 #define STATUSCODE_INFOBIT_HISTORIAN_MULTIVALUE 0x0010 #define RETURNDIAGNOSTICS_SERVICELEVEL_SYMBOLICID 0x0001 #define RETURNDIAGNOSTICS_SERVICELEVEL_LOCALIZEDTEXT 0x0002 #define RETURNDIAGNOSTICS_SERVICELEVEL_ADDITIONALINFO 0x0004 #define RETURNDIAGNOSTICS_SERVICELEVEL_INNERSTATUSCODE 0x0008 #define RETURNDIAGNOSTICS_SERVICELEVEL_INNERDIAGNOSTICS 0x0010 #define RETURNDIAGNOSTICS_OPERATIONLEVEL_SYMBOLICID 0x0020 #define RETURNDIAGNOSTICS_OPERATIONLEVEL_LOCALIZEDTEXT 0x0040 #define RETURNDIAGNOSTICS_OPERATIONLEVEL_ADDITIONALINFO 0x0080 #define RETURNDIAGNOSTICS_OPERATIONLEVEL_INNERSTATUSCODE 0x0100 #define RETURNDIAGNOSTICS_OPERATIONLEVEL_INNERDIAGNOSTICS 0x0200 #define NODECLASSMASK_ALL 0x0000 #define NODECLASSMASK_OBJECT 0x0001 #define NODECLASSMASK_VARIABLE 0x0002 #define NODECLASSMASK_METHOD 0x0004 #define NODECLASSMASK_OBJECTTYPE 0x0008 #define NODECLASSMASK_VARIABLETYPE 0x0010 #define NODECLASSMASK_REFERENCETYPE 0x0020 #define NODECLASSMASK_DATATYPE 0x0040 #define NODECLASSMASK_VIEW 0x0080 #define RESULTMASK_REFERENCETYPE 0x0001 #define RESULTMASK_ISFORWARD 0x0002 #define RESULTMASK_NODECLASS 0x0004 #define RESULTMASK_BROWSENAME 0x0008 #define RESULTMASK_DISPLAYNAME 0x0010 #define RESULTMASK_TYPEDEFINITION 0x0020 #define RESULTMASK_ALL 0x003F /* Chosen arbitrarily */ #define MAX_ARRAY_LEN 10000 #define MAX_NESTING_DEPTH 100 static int hf_opcua_diag_mask = -1; static int hf_opcua_diag_mask_symbolicflag = -1; static int hf_opcua_diag_mask_namespaceflag = -1; static int hf_opcua_diag_mask_localizedtextflag = -1; static int hf_opcua_diag_mask_localeflag = -1; static int hf_opcua_diag_mask_additionalinfoflag = -1; static int hf_opcua_diag_mask_innerstatuscodeflag = -1; static int hf_opcua_diag_mask_innerdiaginfoflag = -1; static int hf_opcua_loctext_mask = -1; static int hf_opcua_loctext_mask_localeflag = -1; static int hf_opcua_loctext_mask_textflag = -1; static int hf_opcua_datavalue_mask = -1; static int hf_opcua_datavalue_mask_valueflag = -1; static int hf_opcua_datavalue_mask_statuscodeflag = -1; static int hf_opcua_datavalue_mask_sourcetimestampflag = -1; static int hf_opcua_datavalue_mask_servertimestampflag = -1; static int hf_opcua_datavalue_mask_sourcepicoseconds = -1; static int hf_opcua_datavalue_mask_serverpicoseconds = -1; static int hf_opcua_nodeid_encodingmask = -1; static int hf_opcua_expandednodeid_mask = -1; static int hf_opcua_expandednodeid_mask_namespaceuri = -1; static int hf_opcua_expandednodeid_mask_serverindex = -1; static int hf_opcua_variant_encodingmask = -1; static int hf_opcua_nodeid_nsindex = -1; static int hf_opcua_nodeid_numeric = -1; static int hf_opcua_nodeid_string = -1; static int hf_opcua_nodeid_guid = -1; static int hf_opcua_nodeid_bytestring = -1; static int hf_opcua_localizedtext_locale = -1; static int hf_opcua_localizedtext_text = -1; static int hf_opcua_qualifiedname_id = -1; static int hf_opcua_qualifiedname_name = -1; static int hf_opcua_SourceTimestamp = -1; static int hf_opcua_SourcePicoseconds = -1; static int hf_opcua_ServerTimestamp = -1; static int hf_opcua_ServerPicoseconds = -1; static int hf_opcua_diag_symbolicid = -1; static int hf_opcua_diag_namespace = -1; static int hf_opcua_diag_localizedtext = -1; static int hf_opcua_diag_locale = -1; static int hf_opcua_diag_additionalinfo = -1; static int hf_opcua_diag_innerstatuscode = -1; static int hf_opcua_extobj_mask = -1; static int hf_opcua_extobj_mask_binbodyflag = -1; static int hf_opcua_extobj_mask_xmlbodyflag = -1; static int hf_opcua_ArraySize = -1; static int hf_opcua_ServerIndex = -1; static int hf_opcua_status_StructureChanged = -1; static int hf_opcua_status_SemanticsChanged = -1; static int hf_opcua_status_InfoBit_Limit_Overflow = -1; static int hf_opcua_status_InfoBit_Historian_Partial = -1; static int hf_opcua_status_InfoBit_Historian_ExtraData = -1; static int hf_opcua_status_InfoBit_Historian_MultiValue = -1; static int hf_opcua_status_InfoType = -1; static int hf_opcua_status_Limit = -1; static int hf_opcua_status_Historian = -1; int hf_opcua_returnDiag = -1; int hf_opcua_returnDiag_mask_sl_symbolicId = -1; int hf_opcua_returnDiag_mask_sl_localizedText = -1; int hf_opcua_returnDiag_mask_sl_additionalinfo = -1; int hf_opcua_returnDiag_mask_sl_innerstatuscode = -1; int hf_opcua_returnDiag_mask_sl_innerdiagnostics = -1; int hf_opcua_returnDiag_mask_ol_symbolicId = -1; int hf_opcua_returnDiag_mask_ol_localizedText = -1; int hf_opcua_returnDiag_mask_ol_additionalinfo = -1; int hf_opcua_returnDiag_mask_ol_innerstatuscode = -1; int hf_opcua_returnDiag_mask_ol_innerdiagnostics = -1; int hf_opcua_nodeClassMask = -1; int hf_opcua_nodeClassMask_all = -1; int hf_opcua_nodeClassMask_object = -1; int hf_opcua_nodeClassMask_variable = -1; int hf_opcua_nodeClassMask_method = -1; int hf_opcua_nodeClassMask_objecttype = -1; int hf_opcua_nodeClassMask_variabletype = -1; int hf_opcua_nodeClassMask_referencetype = -1; int hf_opcua_nodeClassMask_datatype = -1; int hf_opcua_nodeClassMask_view = -1; int hf_opcua_resultMask = -1; int hf_opcua_resultMask_all = -1; int hf_opcua_resultMask_referencetype = -1; int hf_opcua_resultMask_isforward = -1; int hf_opcua_resultMask_nodeclass = -1; int hf_opcua_resultMask_browsename = -1; int hf_opcua_resultMask_displayname = -1; int hf_opcua_resultMask_typedefinition = -1; static expert_field ei_array_length = EI_INIT; static expert_field ei_nesting_depth = EI_INIT; extern int proto_opcua; /** NodeId encoding mask table */ static const value_string g_nodeidmasks[] = { { 0x00, "Two byte encoded Numeric" }, { 0x01, "Four byte encoded Numeric" }, { 0x02, "Numeric of arbitrary length" }, { 0x03, "String" }, { 0x04, "GUID" }, { 0x05, "Opaque" }, { 0, NULL } }; /** StatusCode info types */ static const value_string g_infotype[] = { { 0x00, "Not used" }, { 0x01, "DataValue" }, { 0x02, "Reserved" }, { 0x03, "Reserved" }, { 0, NULL } }; /** StatusCode Limit types */ static const value_string g_limit[] = { { 0x00, "None" }, { 0x01, "Low" }, { 0x02, "High" }, { 0x03, "Constant" }, { 0, NULL } }; /** StatusCode Historian types */ static const value_string g_historian[] = { { 0x00, "Raw" }, { 0x01, "Calculated" }, { 0x02, "Interpolated" }, { 0x03, "Reserved" }, { 0, NULL } }; /** UA Variant Type enum */ typedef enum _OpcUa_BuiltInType { OpcUaType_Null = 0, OpcUaType_Boolean = 1, OpcUaType_SByte = 2, OpcUaType_Byte = 3, OpcUaType_Int16 = 4, OpcUaType_UInt16 = 5, OpcUaType_Int32 = 6, OpcUaType_UInt32 = 7, OpcUaType_Int64 = 8, OpcUaType_UInt64 = 9, OpcUaType_Float = 10, OpcUaType_Double = 11, OpcUaType_String = 12, OpcUaType_DateTime = 13, OpcUaType_Guid = 14, OpcUaType_ByteString = 15, OpcUaType_XmlElement = 16, OpcUaType_NodeId = 17, OpcUaType_ExpandedNodeId = 18, OpcUaType_StatusCode = 19, OpcUaType_QualifiedName = 20, OpcUaType_LocalizedText = 21, OpcUaType_ExtensionObject = 22, OpcUaType_DataValue = 23, OpcUaType_Variant = 24, OpcUaType_DiagnosticInfo = 25 } OpcUa_BuiltInType; /** Variant encoding mask table */ static const value_string g_VariantTypes[] = { { 0, "Null" }, { 1, "Boolean" }, { 2, "SByte" }, { 3, "Byte" }, { 4, "Int16" }, { 5, "UInt16" }, { 6, "Int32" }, { 7, "UInt32" }, { 8, "Int64" }, { 9, "UInt64" }, { 10, "Float" }, { 11, "Double" }, { 12, "String" }, { 13, "DateTime" }, { 14, "Guid" }, { 15, "ByteString" }, { 16, "XmlElement" }, { 17, "NodeId" }, { 18, "ExpandedNodeId" }, { 19, "StatusCode" }, { 20, "QualifiedName" }, { 21, "LocalizedText" }, { 22, "ExtensionObject" }, { 23, "DataValue" }, { 24, "Variant" }, { 25, "DiagnosticInfo" }, { 0x80, "Array of Null" }, { 0x80+1, "Array of Boolean" }, { 0x80+2, "Array of SByte" }, { 0x80+3, "Array of Byte" }, { 0x80+4, "Array of Int16" }, { 0x80+5, "Array of UInt16" }, { 0x80+6, "Array of Int32" }, { 0x80+7, "Array of UInt32" }, { 0x80+8, "Array of Int64" }, { 0x80+9, "Array of UInt64" }, { 0x80+10, "Array of Float" }, { 0x80+11, "Array of Double" }, { 0x80+12, "Array of String" }, { 0x80+13, "Array of DateTime" }, { 0x80+14, "Array of Guid" }, { 0x80+15, "Array of ByteString" }, { 0x80+16, "Array of XmlElement" }, { 0x80+17, "Array of NodeId" }, { 0x80+18, "Array of ExpandedNodeId" }, { 0x80+19, "Array of StatusCode" }, { 0x80+20, "Array of QualifiedName" }, { 0x80+21, "Array of LocalizedText" }, { 0x80+22, "Array of ExtensionObject" }, { 0x80+23, "Array of DataValue" }, { 0x80+24, "Array of Variant" }, { 0x80+25, "Array of DiagnosticInfo" }, { 0xC0, "Matrix of Null" }, { 0xC0+1, "Matrix of Boolean" }, { 0xC0+2, "Matrix of SByte" }, { 0xC0+3, "Matrix of Byte" }, { 0xC0+4, "Matrix of Int16" }, { 0xC0+5, "Matrix of UInt16" }, { 0xC0+6, "Matrix of Int32" }, { 0xC0+7, "Matrix of UInt32" }, { 0xC0+8, "Matrix of Int64" }, { 0xC0+9, "Matrix of UInt64" }, { 0xC0+10, "Matrix of Float" }, { 0xC0+11, "Matrix of Double" }, { 0xC0+12, "Matrix of String" }, { 0xC0+13, "Matrix of DateTime" }, { 0xC0+14, "Matrix of Guid" }, { 0xC0+15, "Matrix of ByteString" }, { 0xC0+16, "Matrix of XmlElement" }, { 0xC0+17, "Matrix of NodeId" }, { 0xC0+18, "Matrix of ExpandedNodeId" }, { 0xC0+19, "Matrix of StatusCode" }, { 0xC0+20, "Matrix of QualifiedName" }, { 0xC0+21, "Matrix of LocalizedText" }, { 0xC0+22, "Matrix of ExtensionObject" }, { 0xC0+23, "Matrix of DataValue" }, { 0xC0+24, "Matrix of Variant" }, { 0xC0+25, "Matrix of DiagnosticInfo" }, { 0, NULL } }; #define VARIANT_ARRAYDIMENSIONS 0x40 #define VARIANT_ARRAYMASK 0x80 /** BrowseRequest's BrowseDescription's NodeClassMaskTable enum table */ static const value_string g_NodeClassMask[] = { { NODECLASSMASK_ALL, "All" }, { 0, NULL } }; /* BrowseRequest's BrowseDescription's ResultMaskTable enum table */ static const value_string g_ResultMask[] = { { RESULTMASK_ALL, "All" }, { 0, NULL } }; /* trees */ static gint ett_opcua_diagnosticinfo = -1; static gint ett_opcua_diagnosticinfo_encodingmask = -1; static gint ett_opcua_nodeid = -1; static gint ett_opcua_expandednodeid = -1; static gint ett_opcua_expandednodeid_encodingmask = -1; static gint ett_opcua_localizedtext = -1; static gint ett_opcua_localizedtext_encodingmask = -1; static gint ett_opcua_qualifiedname = -1; static gint ett_opcua_datavalue = -1; static gint ett_opcua_datavalue_encodingmask = -1; static gint ett_opcua_variant = -1; static gint ett_opcua_variant_arraydims = -1; static gint ett_opcua_extensionobject = -1; static gint ett_opcua_extensionobject_encodingmask = -1; static gint ett_opcua_statuscode = -1; static gint ett_opcua_statuscode_info = -1; gint ett_opcua_array_Boolean = -1; gint ett_opcua_array_SByte = -1; gint ett_opcua_array_Byte = -1; gint ett_opcua_array_Int16 = -1; gint ett_opcua_array_UInt16 = -1; gint ett_opcua_array_Int32 = -1; gint ett_opcua_array_UInt32 = -1; gint ett_opcua_array_Int64 = -1; gint ett_opcua_array_UInt64 = -1; gint ett_opcua_array_Float = -1; gint ett_opcua_array_Double = -1; gint ett_opcua_array_String = -1; gint ett_opcua_array_DateTime = -1; gint ett_opcua_array_Guid = -1; gint ett_opcua_array_ByteString = -1; gint ett_opcua_array_XmlElement = -1; gint ett_opcua_array_NodeId = -1; gint ett_opcua_array_ExpandedNodeId = -1; gint ett_opcua_array_StatusCode = -1; gint ett_opcua_array_DiagnosticInfo = -1; gint ett_opcua_array_QualifiedName = -1; gint ett_opcua_array_LocalizedText = -1; gint ett_opcua_array_ExtensionObject = -1; gint ett_opcua_array_DataValue = -1; gint ett_opcua_array_Variant = -1; gint ett_opcua_returnDiagnostics = -1; gint ett_opcua_nodeClassMask = -1; gint ett_opcua_resultMask = -1; static gint *ett[] = { &ett_opcua_diagnosticinfo, &ett_opcua_diagnosticinfo_encodingmask, &ett_opcua_nodeid, &ett_opcua_expandednodeid, &ett_opcua_expandednodeid_encodingmask, &ett_opcua_localizedtext, &ett_opcua_localizedtext_encodingmask, &ett_opcua_qualifiedname, &ett_opcua_datavalue, &ett_opcua_datavalue_encodingmask, &ett_opcua_variant, &ett_opcua_variant_arraydims, &ett_opcua_extensionobject, &ett_opcua_extensionobject_encodingmask, &ett_opcua_statuscode, &ett_opcua_statuscode_info, &ett_opcua_array_Boolean, &ett_opcua_array_SByte, &ett_opcua_array_Byte, &ett_opcua_array_Int16, &ett_opcua_array_UInt16, &ett_opcua_array_Int32, &ett_opcua_array_UInt32, &ett_opcua_array_Int64, &ett_opcua_array_UInt64, &ett_opcua_array_Float, &ett_opcua_array_Double, &ett_opcua_array_String, &ett_opcua_array_DateTime, &ett_opcua_array_Guid, &ett_opcua_array_ByteString, &ett_opcua_array_XmlElement, &ett_opcua_array_NodeId, &ett_opcua_array_ExpandedNodeId, &ett_opcua_array_StatusCode, &ett_opcua_array_DiagnosticInfo, &ett_opcua_array_QualifiedName, &ett_opcua_array_LocalizedText, &ett_opcua_array_ExtensionObject, &ett_opcua_array_DataValue, &ett_opcua_array_Variant, &ett_opcua_returnDiagnostics, &ett_opcua_nodeClassMask, &ett_opcua_resultMask }; void registerSimpleTypes(int proto) { expert_module_t* expert_proto; static hf_register_info hf[] = { /* id full name abbreviation type display strings bitmask blurb HFILL */ {&hf_opcua_diag_mask, {"EncodingMask", "opcua.diag.mask", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_mask_symbolicflag, {"has symbolic id", "opcua.diag.has_symbolic_id", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_namespaceflag, {"has namespace", "opcua.diag.has_namespace", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_localizedtextflag, {"has localizedtext", "opcua.diag.has_localizedtext", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_localeflag, {"has locale", "opcua.diag.has_locale", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_additionalinfoflag, {"has additional info", "opcua.diag.has_additional_info", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_innerstatuscodeflag, {"has inner statuscode", "opcua.diag.has_inner_statuscode", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG, NULL, HFILL}}, {&hf_opcua_diag_mask_innerdiaginfoflag, {"has inner diagnostic info", "opcua.diag.has_inner_diagnostic_code", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG, NULL, HFILL}}, {&hf_opcua_loctext_mask, {"EncodingMask", "opcua.loctext.mask", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_loctext_mask_localeflag, {"has locale information", "opcua.loctext.has_locale_information", FT_BOOLEAN, 8, NULL, LOCALIZEDTEXT_ENCODINGBYTE_LOCALE, NULL, HFILL}}, {&hf_opcua_loctext_mask_textflag, {"has text", "opcua.loctext.has_text", FT_BOOLEAN, 8, NULL, LOCALIZEDTEXT_ENCODINGBYTE_TEXT, NULL, HFILL}}, {&hf_opcua_nodeid_encodingmask, {"EncodingMask", "opcua.nodeid.encodingmask", FT_UINT8, BASE_HEX, VALS(g_nodeidmasks), 0x0F, NULL, HFILL}}, {&hf_opcua_nodeid_nsindex, {"Namespace Index", "opcua.nodeid.nsindex", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_nodeid_numeric, {"Identifier Numeric", "opcua.nodeid.numeric", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_nodeid_string, {"Identifier String", "opcua.nodeid.string", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_nodeid_guid, {"Identifier Guid", "opcua.nodeid.guid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_nodeid_bytestring, {"Identifier ByteString", "opcua.nodeid.bytestring", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_expandednodeid_mask, {"EncodingMask", "opcua.expandednodeid.mask", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_expandednodeid_mask_namespaceuri, {"has namespace uri", "opcua.expandednodeid.has_namespace_uri", FT_BOOLEAN, 8, NULL, NODEID_NAMESPACEURIFLAG, NULL, HFILL}}, {&hf_opcua_expandednodeid_mask_serverindex, {"has server index", "opcua.expandednodeid.has_server_index", FT_BOOLEAN, 8, NULL, NODEID_SERVERINDEXFLAG, NULL, HFILL}}, {&hf_opcua_localizedtext_locale, {"Locale", "opcua.loctext.Locale", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_localizedtext_text, {"Text", "opcua.loctext.Text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_qualifiedname_id, {"Id", "opcua.qualname.Id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_qualifiedname_name, {"Name", "opcua.qualname.Name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_datavalue_mask, {"EncodingMask", "opcua.datavalue.mask", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_datavalue_mask_valueflag, {"has value", "opcua.datavalue.has_value", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_VALUE, NULL, HFILL}}, {&hf_opcua_datavalue_mask_statuscodeflag, {"has statuscode", "opcua.datavalue.has_statuscode", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_STATUSCODE, NULL, HFILL}}, {&hf_opcua_datavalue_mask_sourcetimestampflag, {"has source timestamp", "opcua.datavalue.has_source_timestamp", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP, NULL, HFILL}}, {&hf_opcua_datavalue_mask_servertimestampflag, {"has server timestamp", "opcua.datavalue.has_server_timestamp", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP, NULL, HFILL}}, {&hf_opcua_datavalue_mask_sourcepicoseconds, {"has source picoseconds", "opcua.datavalue.has_source_picoseconds", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS, NULL, HFILL}}, {&hf_opcua_datavalue_mask_serverpicoseconds, {"has server picoseconds", "opcua.datavalue.has_server_picoseconds", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS, NULL, HFILL}}, {&hf_opcua_variant_encodingmask, {"Variant Type", "opcua.variant.has_value", FT_UINT8, BASE_HEX, VALS(g_VariantTypes), 0x0, NULL, HFILL}}, {&hf_opcua_SourceTimestamp, {"SourceTimestamp", "opcua.datavalue.SourceTimestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_SourcePicoseconds, {"SourcePicoseconds", "opcua.datavalue.SourcePicoseconds", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_ServerTimestamp, {"ServerTimestamp", "opcua.datavalue.ServerTimestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_ServerPicoseconds, {"ServerPicoseconds", "opcua.datavalue.ServerPicoseconds", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_symbolicid, {"SymbolicId", "opcua.diag.SymbolicId", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_namespace, {"Namespace", "opcua.diag.Namespace", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_localizedtext, {"LocalizedText", "opcua.diag.LocalizedText", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_locale, {"Locale", "opcua.diag.Locale", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_additionalinfo, {"AdditionalInfo", "opcua.diag.AdditionalInfo", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_diag_innerstatuscode, {"InnerStatusCode", "opcua.diag.InnerStatusCode", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_extobj_mask, {"EncodingMask", "opcua.extobj.mask", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_extobj_mask_binbodyflag, {"has binary body", "opcua.extobj.has_binary_body", FT_BOOLEAN, 8, NULL, EXTOBJ_ENCODINGMASK_BINBODY_FLAG, NULL, HFILL}}, {&hf_opcua_extobj_mask_xmlbodyflag, {"has xml body", "opcua.extobj.has_xml_body", FT_BOOLEAN, 8, NULL, EXTOBJ_ENCODINGMASK_XMLBODY_FLAG, NULL, HFILL}}, {&hf_opcua_ArraySize, {"ArraySize", "opcua.variant.ArraySize", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_ServerIndex, {"ServerIndex", "opcua.expandednodeid.ServerIndex", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_status_StructureChanged, {"StructureChanged", "opcua.statuscode.structureChanged", FT_BOOLEAN, 16, NULL, STATUSCODE_STRUCTURECHANGED, NULL, HFILL}}, {&hf_opcua_status_SemanticsChanged, {"SemanticsChanged", "opcua.statuscode.semanticsChanged", FT_BOOLEAN, 16, NULL, STATUSCODE_SEMANTICSCHANGED, NULL, HFILL}}, {&hf_opcua_status_InfoBit_Limit_Overflow, {"Overflow", "opcua.statuscode.overflow", FT_BOOLEAN, 16, NULL, STATUSCODE_INFOBIT_OVERFLOW, NULL, HFILL}}, {&hf_opcua_status_InfoBit_Historian_Partial, {"HistorianBit: Partial", "opcua.statuscode.historian.partial", FT_BOOLEAN, 16, NULL, STATUSCODE_INFOBIT_HISTORIAN_PARTIAL, NULL, HFILL}}, {&hf_opcua_status_InfoBit_Historian_ExtraData, {"HistorianBit: ExtraData", "opcua.statuscode.historian.extraData", FT_BOOLEAN, 16, NULL, STATUSCODE_INFOBIT_HISTORIAN_EXTRADATA, NULL, HFILL}}, {&hf_opcua_status_InfoBit_Historian_MultiValue, {"HistorianBit: MultiValue", "opcua.statuscode.historian.multiValue", FT_BOOLEAN, 16, NULL, STATUSCODE_INFOBIT_HISTORIAN_MULTIVALUE, NULL, HFILL}}, {&hf_opcua_status_InfoType, {"InfoType", "opcua.statuscode.infoType", FT_UINT16, BASE_HEX, VALS(g_infotype), 0x0C00, NULL, HFILL}}, {&hf_opcua_status_Limit, {"Limit", "opcua.statuscode.limit", FT_UINT16, BASE_HEX, VALS(g_limit), 0x0300, NULL, HFILL}}, {&hf_opcua_status_Historian, {"Historian", "opcua.statuscode.historian", FT_UINT16, BASE_HEX, VALS(g_historian), 0x0003, NULL, HFILL}}, {&hf_opcua_returnDiag, {"Return Diagnostics", "opcua.returndiag", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_sl_symbolicId, {"ServiceLevel / SymbolicId", "opcua.returndiag.servicelevel.symbolicid", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_SERVICELEVEL_SYMBOLICID, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_sl_localizedText, {"ServiceLevel / LocalizedText", "opcua.returndiag.servicelevel.localizedtext", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_SERVICELEVEL_LOCALIZEDTEXT, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_sl_additionalinfo, {"ServiceLevel / AdditionalInfo", "opcua.returndiag.servicelevel.additionalinfo", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_SERVICELEVEL_ADDITIONALINFO, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_sl_innerstatuscode, {"ServiceLevel / Inner StatusCode", "opcua.returndiag.servicelevel.innerstatuscode", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_SERVICELEVEL_INNERSTATUSCODE, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_sl_innerdiagnostics, {"ServiceLevel / Inner Diagnostics", "opcua.returndiag.servicelevel.innerdiagnostics", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_SERVICELEVEL_INNERDIAGNOSTICS, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_ol_symbolicId, {"OperationLevel / SymbolicId", "opcua.returndiag.operationlevel.symbolicid", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_OPERATIONLEVEL_SYMBOLICID, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_ol_localizedText, {"OperationLevel / LocalizedText", "opcua.returndiag.operationlevel.localizedtext", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_OPERATIONLEVEL_LOCALIZEDTEXT, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_ol_additionalinfo, {"OperationLevel / AdditionalInfo", "opcua.returndiag.operationlevel.additionalinfo", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_OPERATIONLEVEL_ADDITIONALINFO, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_ol_innerstatuscode, {"OperationLevel / Inner StatusCode", "opcua.returndiag.operationlevel.innerstatuscode", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_OPERATIONLEVEL_INNERSTATUSCODE, NULL, HFILL}}, {&hf_opcua_returnDiag_mask_ol_innerdiagnostics, {"OperationLevel / Inner Diagnostics", "opcua.returndiag.operationlevel.innerdiagnostics", FT_BOOLEAN, 16, NULL, RETURNDIAGNOSTICS_OPERATIONLEVEL_INNERDIAGNOSTICS, NULL, HFILL}}, {&hf_opcua_nodeClassMask, {"Node Class Mask", "opcua.nodeclassmask", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_nodeClassMask_all, {"Node Class Mask", "opcua.nodeclassmask.all", FT_UINT32, BASE_HEX, VALS(g_NodeClassMask), 0x0, NULL, HFILL}}, {&hf_opcua_nodeClassMask_object, {"Object", "opcua.nodeclassmask.object", FT_BOOLEAN, 16, NULL, NODECLASSMASK_OBJECT, NULL, HFILL}}, {&hf_opcua_nodeClassMask_variable, {"Variable", "opcua.nodeclassmask.variable", FT_BOOLEAN, 16, NULL, NODECLASSMASK_VARIABLE, NULL, HFILL}}, {&hf_opcua_nodeClassMask_method, {"Method", "opcua.nodeclassmask.method", FT_BOOLEAN, 16, NULL, NODECLASSMASK_METHOD, NULL, HFILL}}, {&hf_opcua_nodeClassMask_objecttype, {"ObjectType", "opcua.nodeclassmask.objecttype", FT_BOOLEAN, 16, NULL, NODECLASSMASK_OBJECTTYPE, NULL, HFILL}}, {&hf_opcua_nodeClassMask_variabletype, {"VariableType", "opcua.nodeclassmask.variabletype", FT_BOOLEAN, 16, NULL, NODECLASSMASK_VARIABLETYPE, NULL, HFILL}}, {&hf_opcua_nodeClassMask_referencetype, {"ReferenceType", "opcua.nodeclassmask.referencetype", FT_BOOLEAN, 16, NULL, NODECLASSMASK_REFERENCETYPE, NULL, HFILL}}, {&hf_opcua_nodeClassMask_datatype, {"DataType", "opcua.nodeclassmask.datatype", FT_BOOLEAN, 16, NULL, NODECLASSMASK_DATATYPE, NULL, HFILL}}, {&hf_opcua_nodeClassMask_view, {"View", "opcua.nodeclassmask.view", FT_BOOLEAN, 16, NULL, NODECLASSMASK_VIEW, NULL, HFILL}}, {&hf_opcua_resultMask, {"Result Mask", "opcua.resultmask", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_resultMask_referencetype, {"Reference Type", "opcua.resultmask.referencetype", FT_BOOLEAN, 16, NULL, RESULTMASK_REFERENCETYPE, NULL, HFILL}}, {&hf_opcua_resultMask_isforward, {"Is Forward", "opcua.resultmask.isforward", FT_BOOLEAN, 16, NULL, RESULTMASK_ISFORWARD, NULL, HFILL}}, {&hf_opcua_resultMask_nodeclass, {"Node Class", "opcua.resultmask.nodeclass", FT_BOOLEAN, 16, NULL, RESULTMASK_NODECLASS, NULL, HFILL}}, {&hf_opcua_resultMask_browsename, {"Browse Name", "opcua.resultmask.browsename", FT_BOOLEAN, 16, NULL, RESULTMASK_BROWSENAME, NULL, HFILL}}, {&hf_opcua_resultMask_displayname, {"Display Name", "opcua.resultmask.displayname", FT_BOOLEAN, 16, NULL, RESULTMASK_DISPLAYNAME, NULL, HFILL}}, {&hf_opcua_resultMask_typedefinition, {"Type Definition", "opcua.resultmask.typedefinition", FT_BOOLEAN, 16, NULL, RESULTMASK_TYPEDEFINITION, NULL, HFILL}}, {&hf_opcua_resultMask_all, {"Result Mask", "opcua.resultmask.all", FT_UINT32, BASE_HEX, VALS(g_ResultMask), 0x0, NULL, HFILL}}, }; static ei_register_info ei[] = { { &ei_array_length, { "opcua.array.length", PI_UNDECODED, PI_ERROR, "Max array length exceeded", EXPFILL }}, { &ei_nesting_depth, { "opcua.nestingdepth", PI_UNDECODED, PI_ERROR, "Max nesting depth exceeded", EXPFILL }}, }; proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_proto = expert_register_protocol(proto); expert_register_field_array(expert_proto, ei, array_length(ei)); } proto_item* parseBoolean(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1; return item; } proto_item* parseByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1; return item; } proto_item* parseSByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1; return item; } proto_item* parseUInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2; return item; } proto_item* parseInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2; return item; } proto_item* parseUInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; return item; } proto_item* parseInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; return item; } proto_item* parseUInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8; return item; } proto_item* parseInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8; return item; } proto_item* parseString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = NULL; char *szValue; gint iOffset = *pOffset; gint32 iLen = tvb_get_letohl(tvb, *pOffset); iOffset+=4; if (iLen == -1) { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); proto_item_append_text(item, "[OpcUa Null String]"); proto_item_set_end(item, tvb, *pOffset + 4); } else if (iLen == 0) { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); proto_item_append_text(item, "[OpcUa Empty String]"); proto_item_set_end(item, tvb, *pOffset + 4); } else if (iLen > 0) { item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_UTF_8|ENC_NA); iOffset += iLen; /* eat the whole string */ } else { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); szValue = wmem_strdup_printf(pinfo->pool, "[Invalid String] Invalid length: %d", iLen); proto_item_append_text(item, "%s", szValue); proto_item_set_end(item, tvb, *pOffset + 4); } *pOffset = iOffset; return item; } proto_item* parseStatusCode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = NULL; guint32 uStatusCode = 0; const gchar *szStatusCode = NULL; item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); uStatusCode = tvb_get_letohl(tvb, *pOffset); szStatusCode = val_to_str_const(uStatusCode & 0xFFFF0000, g_statusCodes, "Unknown Status Code"); proto_item_append_text(item, " [%s]", szStatusCode); /* check for status code info flags */ if (uStatusCode & 0x0000FFFF) { gint iOffset = *pOffset; proto_tree *flags_tree; proto_item *ti_inner; flags_tree = proto_item_add_subtree(item, ett_opcua_statuscode); proto_tree_add_item(flags_tree, hf_opcua_status_StructureChanged, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(flags_tree, hf_opcua_status_SemanticsChanged, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); ti_inner = proto_tree_add_item(flags_tree, hf_opcua_status_InfoType, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); switch (uStatusCode & 0x00000C00) { case STATUSCODE_INFOTYPE_DATAVALUE: { /* InfoType == DataValue */ proto_tree *tree_inner; tree_inner = proto_item_add_subtree(ti_inner, ett_opcua_statuscode_info); proto_tree_add_item(tree_inner, hf_opcua_status_Limit, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree_inner, hf_opcua_status_InfoBit_Limit_Overflow, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree_inner, hf_opcua_status_InfoBit_Historian_MultiValue, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree_inner, hf_opcua_status_InfoBit_Historian_ExtraData, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree_inner, hf_opcua_status_InfoBit_Historian_Partial, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(tree_inner, hf_opcua_status_Historian, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); } default: break; } } *pOffset += 4; return item; } void parseLocalizedText(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const loctext_mask[] = {&hf_opcua_loctext_mask_localeflag, &hf_opcua_loctext_mask_textflag, NULL}; gint iOffset = *pOffset; guint8 EncodingMask; proto_tree *subtree; proto_item *ti; subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_localizedtext, &ti, "%s: LocalizedText", szFieldName); /* parse encoding mask */ EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_bitmask(subtree, tvb, iOffset, hf_opcua_loctext_mask, ett_opcua_localizedtext_encodingmask, loctext_mask, ENC_LITTLE_ENDIAN); iOffset++; if (EncodingMask & LOCALIZEDTEXT_ENCODINGBYTE_LOCALE) { parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_localizedtext_locale); } if (EncodingMask & LOCALIZEDTEXT_ENCODINGBYTE_TEXT) { parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_localizedtext_text); } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; } proto_item* parseGuid(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, GUID_LEN, ENC_LITTLE_ENDIAN); *pOffset+=GUID_LEN; return item; } proto_item* parseByteString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = NULL; char *szValue; int iOffset = *pOffset; gint32 iLen = tvb_get_letohl(tvb, iOffset); iOffset += 4; if (iLen == -1) { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); proto_item_append_text(item, "[OpcUa Null ByteString]"); proto_item_set_end(item, tvb, *pOffset + 4); } else if (iLen == 0) { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); proto_item_append_text(item, "[OpcUa Empty ByteString]"); proto_item_set_end(item, tvb, *pOffset + 4); } else if (iLen > 0) { item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA); iOffset += iLen; /* eat the whole bytestring */ } else { item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA); szValue = wmem_strdup_printf(pinfo->pool, "[Invalid ByteString] Invalid length: %d", iLen); proto_item_append_text(item, "%s", szValue); proto_item_set_end(item, tvb, *pOffset + 4); } *pOffset = iOffset; return item; } proto_item* parseXmlElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex) { return parseByteString(tree, tvb, pinfo, pOffset, hfIndex); } proto_item* parseFloat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gfloat), ENC_LITTLE_ENDIAN); *pOffset += (int)sizeof(gfloat); return item; } proto_item* parseDouble(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gdouble), ENC_LITTLE_ENDIAN); *pOffset += (int)sizeof(gdouble); return item; } proto_item* parseDateTime(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex) { proto_item *item = NULL; *pOffset = dissect_nt_64bit_time_ex(tvb, tree, *pOffset, hfIndex, &item, FALSE); return item; } void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const diag_mask[] = {&hf_opcua_diag_mask_symbolicflag, &hf_opcua_diag_mask_namespaceflag, &hf_opcua_diag_mask_localizedtextflag, &hf_opcua_diag_mask_localeflag, &hf_opcua_diag_mask_additionalinfoflag, &hf_opcua_diag_mask_innerstatuscodeflag, &hf_opcua_diag_mask_innerdiaginfoflag, NULL}; gint iOffset = *pOffset; guint8 EncodingMask; proto_tree *subtree; proto_item *ti; guint opcua_nested_count; subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_diagnosticinfo, &ti, "%s: DiagnosticInfo", szFieldName); /* prevent a too high nesting depth */ opcua_nested_count = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_opcua, 0)); if (opcua_nested_count >= MAX_NESTING_DEPTH) { expert_add_info(pinfo, ti, &ei_nesting_depth); return; } opcua_nested_count++; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); /* parse encoding mask */ EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_bitmask(subtree, tvb, iOffset, hf_opcua_diag_mask, ett_opcua_diagnosticinfo_encodingmask, diag_mask, ENC_LITTLE_ENDIAN); iOffset++; if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG) { parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_symbolicid); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG) { parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_namespace); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG) { parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_locale); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG) { parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_localizedtext); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG) { parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_additionalinfo); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG) { parseStatusCode(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_innerstatuscode); } if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG) { parseDiagnosticInfo(subtree, tvb, pinfo, &iOffset, "Inner DiagnosticInfo"); } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; opcua_nested_count--; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); } void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_qualifiedname, &ti, "%s: QualifiedName", szFieldName); parseUInt16(subtree, tvb, pinfo, pOffset, hf_opcua_qualifiedname_id); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_qualifiedname_name); proto_item_set_end(ti, tvb, *pOffset); } void parseDataValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const datavalue_mask[] = {&hf_opcua_datavalue_mask_valueflag, &hf_opcua_datavalue_mask_statuscodeflag, &hf_opcua_datavalue_mask_sourcetimestampflag, &hf_opcua_datavalue_mask_servertimestampflag, &hf_opcua_datavalue_mask_sourcepicoseconds, &hf_opcua_datavalue_mask_serverpicoseconds, NULL}; proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_datavalue, &ti, "%s: DataValue", szFieldName); gint iOffset = *pOffset; guint8 EncodingMask; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_bitmask(subtree, tvb, iOffset, hf_opcua_datavalue_mask, ett_opcua_datavalue_encodingmask, datavalue_mask, ENC_LITTLE_ENDIAN); iOffset++; if (EncodingMask & DATAVALUE_ENCODINGBYTE_VALUE) { parseVariant(subtree, tvb, pinfo, &iOffset, "Value"); } if (EncodingMask & DATAVALUE_ENCODINGBYTE_STATUSCODE) { parseStatusCode(subtree, tvb, pinfo, &iOffset, hf_opcua_StatusCode); } if (EncodingMask & DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP) { parseDateTime(subtree, tvb, pinfo, &iOffset, hf_opcua_SourceTimestamp); } if (EncodingMask & DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS) { parseUInt16(subtree, tvb, pinfo, &iOffset, hf_opcua_SourcePicoseconds); } if (EncodingMask & DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP) { parseDateTime(subtree, tvb, pinfo, &iOffset, hf_opcua_ServerTimestamp); } if (EncodingMask & DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS) { parseUInt16(subtree, tvb, pinfo, &iOffset, hf_opcua_ServerPicoseconds); } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; } void parseVariant(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_variant, &ti, "%s: Variant", szFieldName); gint iOffset = *pOffset; guint8 EncodingMask; gint32 ArrayDimensions = 0; guint opcua_nested_count; /* prevent a too high nesting depth */ opcua_nested_count = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_opcua, 0)); if (opcua_nested_count >= MAX_NESTING_DEPTH) { expert_add_info(pinfo, ti, &ei_nesting_depth); return; } opcua_nested_count++; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_variant_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset++; if (EncodingMask & VARIANT_ARRAYMASK) { /* type is encoded in bits 0-5 */ switch(EncodingMask & 0x3f) { case OpcUaType_Null: break; case OpcUaType_Boolean: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Boolean", "Boolean", hf_opcua_Boolean, parseBoolean, ett_opcua_array_Boolean); break; case OpcUaType_SByte: parseArraySimple(subtree, tvb, pinfo, &iOffset, "SByte", "SByte", hf_opcua_SByte, parseSByte, ett_opcua_array_SByte); break; case OpcUaType_Byte: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Byte", "Byte", hf_opcua_Byte, parseByte, ett_opcua_array_Byte); break; case OpcUaType_Int16: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Int16", "Int16", hf_opcua_Int16, parseInt16, ett_opcua_array_Int16); break; case OpcUaType_UInt16: parseArraySimple(subtree, tvb, pinfo, &iOffset, "UInt16", "UInt16", hf_opcua_UInt16, parseUInt16, ett_opcua_array_UInt16); break; case OpcUaType_Int32: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Int32", "Int32", hf_opcua_Int32, parseInt32, ett_opcua_array_Int32); break; case OpcUaType_UInt32: parseArraySimple(subtree, tvb, pinfo, &iOffset, "UInt32", "UInt32", hf_opcua_UInt32, parseUInt32, ett_opcua_array_UInt32); break; case OpcUaType_Int64: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Int64", "Int64", hf_opcua_Int64, parseInt64, ett_opcua_array_Int64); break; case OpcUaType_UInt64: parseArraySimple(subtree, tvb, pinfo, &iOffset, "UInt64", "UInt64", hf_opcua_UInt64, parseUInt64, ett_opcua_array_UInt64); break; case OpcUaType_Float: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Float", "Float", hf_opcua_Float, parseFloat, ett_opcua_array_Float); break; case OpcUaType_Double: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Double", "Double", hf_opcua_Double, parseDouble, ett_opcua_array_Double); break; case OpcUaType_String: parseArraySimple(subtree, tvb, pinfo, &iOffset, "String", "String", hf_opcua_String, parseString, ett_opcua_array_String); break; case OpcUaType_DateTime: parseArraySimple(subtree, tvb, pinfo, &iOffset, "DateTime", "DateTime", hf_opcua_DateTime, parseDateTime, ett_opcua_array_DateTime); break; case OpcUaType_Guid: parseArraySimple(subtree, tvb, pinfo, &iOffset, "Guid", "Guid", hf_opcua_Guid, parseGuid, ett_opcua_array_Guid); break; case OpcUaType_ByteString: parseArraySimple(subtree, tvb, pinfo, &iOffset, "ByteString", "ByteString", hf_opcua_ByteString, parseByteString, ett_opcua_array_ByteString); break; case OpcUaType_XmlElement: parseArraySimple(subtree, tvb, pinfo, &iOffset, "XmlElement", "XmlElement", hf_opcua_XmlElement, parseXmlElement, ett_opcua_array_XmlElement); break; case OpcUaType_NodeId: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "NodeId", "NodeId", parseNodeId, ett_opcua_array_NodeId); break; case OpcUaType_ExpandedNodeId: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "ExpandedNodeId", "ExpandedNodeId", parseExpandedNodeId, ett_opcua_array_ExpandedNodeId); break; case OpcUaType_StatusCode: parseArraySimple(subtree, tvb, pinfo, &iOffset, "StatusCode", "StatusCode", hf_opcua_StatusCode, parseStatusCode, ett_opcua_array_StatusCode); break; case OpcUaType_DiagnosticInfo: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "DiagnosticInfo", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); break; case OpcUaType_QualifiedName: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "QualifiedName", "QualifiedName", parseQualifiedName, ett_opcua_array_QualifiedName); break; case OpcUaType_LocalizedText: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "LocalizedText", "LocalizedText", parseLocalizedText, ett_opcua_array_LocalizedText); break; case OpcUaType_ExtensionObject: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "ExtensionObject", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); break; case OpcUaType_DataValue: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "DataValue", "DataValue", parseDataValue, ett_opcua_array_DataValue); break; case OpcUaType_Variant: parseArrayComplex(subtree, tvb, pinfo, &iOffset, "Variant", "Variant", parseVariant, ett_opcua_array_Variant); break; } if (EncodingMask & VARIANT_ARRAYDIMENSIONS) { proto_item *ti_2; proto_tree *subtree_2 = proto_tree_add_subtree(subtree, tvb, iOffset, -1, ett_opcua_variant_arraydims, &ti_2, "ArrayDimensions"); int i; /* read array length */ ArrayDimensions = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree_2, hf_opcua_ArraySize, tvb, iOffset, 4, ENC_LITTLE_ENDIAN); if (ArrayDimensions > MAX_ARRAY_LEN) { proto_tree_add_expert_format(subtree_2, pinfo, &ei_array_length, tvb, iOffset, 4, "ArrayDimensions length %d too large to process", ArrayDimensions); return; } iOffset += 4; for (i=0; i<ArrayDimensions; i++) { parseInt32(subtree_2, tvb, pinfo, &iOffset, hf_opcua_Int32); } proto_item_set_end(ti_2, tvb, iOffset); } } else { /* type is encoded in bits 0-5 */ switch(EncodingMask & 0x3f) { case OpcUaType_Null: break; case OpcUaType_Boolean: parseBoolean(subtree, tvb, pinfo, &iOffset, hf_opcua_Boolean); break; case OpcUaType_SByte: parseSByte(subtree, tvb, pinfo, &iOffset, hf_opcua_SByte); break; case OpcUaType_Byte: parseByte(subtree, tvb, pinfo, &iOffset, hf_opcua_Byte); break; case OpcUaType_Int16: parseInt16(subtree, tvb, pinfo, &iOffset, hf_opcua_Int16); break; case OpcUaType_UInt16: parseUInt16(subtree, tvb, pinfo, &iOffset, hf_opcua_UInt16); break; case OpcUaType_Int32: parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_Int32); break; case OpcUaType_UInt32: parseUInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_UInt32); break; case OpcUaType_Int64: parseInt64(subtree, tvb, pinfo, &iOffset, hf_opcua_Int64); break; case OpcUaType_UInt64: parseUInt64(subtree, tvb, pinfo, &iOffset, hf_opcua_UInt64); break; case OpcUaType_Float: parseFloat(subtree, tvb, pinfo, &iOffset, hf_opcua_Float); break; case OpcUaType_Double: parseDouble(subtree, tvb, pinfo, &iOffset, hf_opcua_Double); break; case OpcUaType_String: parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_String); break; case OpcUaType_DateTime: parseDateTime(subtree, tvb, pinfo, &iOffset, hf_opcua_DateTime); break; case OpcUaType_Guid: parseGuid(subtree, tvb, pinfo, &iOffset, hf_opcua_Guid); break; case OpcUaType_ByteString: parseByteString(subtree, tvb, pinfo, &iOffset, hf_opcua_ByteString); break; case OpcUaType_XmlElement: parseXmlElement(subtree, tvb, pinfo, &iOffset, hf_opcua_XmlElement); break; case OpcUaType_NodeId: parseNodeId(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_ExpandedNodeId: parseExpandedNodeId(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_StatusCode: parseStatusCode(subtree, tvb, pinfo, &iOffset, hf_opcua_StatusCode); break; case OpcUaType_DiagnosticInfo: parseDiagnosticInfo(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_QualifiedName: parseQualifiedName(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_LocalizedText: parseLocalizedText(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_ExtensionObject: parseExtensionObject(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_DataValue: parseDataValue(subtree, tvb, pinfo, &iOffset, "Value"); break; case OpcUaType_Variant: parseVariant(subtree, tvb, pinfo, &iOffset, "Value"); break; } } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; opcua_nested_count--; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); } /** General parsing function for arrays of simple types. * All arrays have one 4 byte signed integer length information, * followed by n data elements. */ void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, int hfIndex, fctSimpleTypeParser pParserFunction, const gint idx) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName); int i; gint32 iLen; /* read array length */ iLen = tvb_get_letohl(tvb, *pOffset); proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); if (iLen > MAX_ARRAY_LEN) { proto_tree_add_expert_format(subtree, pinfo, &ei_array_length, tvb, *pOffset, 4, "Array length %d too large to process", iLen); return; } *pOffset += 4; for (i=0; i<iLen; i++) { proto_item *arrayItem = (*pParserFunction)(subtree, tvb, pinfo, pOffset, hfIndex); if (arrayItem != NULL) { proto_item_prepend_text(arrayItem, "[%i]: ", i); } } proto_item_set_end(ti, tvb, *pOffset); } /** General parsing function for arrays of enums. * All arrays have one 4 byte signed integer length information, * followed by n data elements. */ void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctEnumParser pParserFunction, const gint idx) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName); int i; gint32 iLen; /* read array length */ iLen = tvb_get_letohl(tvb, *pOffset); proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); if (iLen > MAX_ARRAY_LEN) { proto_tree_add_expert_format(subtree, pinfo, &ei_array_length, tvb, *pOffset, 4, "Array length %d too large to process", iLen); return; } *pOffset += 4; for (i=0; i<iLen; i++) { (*pParserFunction)(subtree, tvb, pinfo, pOffset); } proto_item_set_end(ti, tvb, *pOffset); } /** General parsing function for arrays of complex types. * All arrays have one 4 byte signed integer length information, * followed by n data elements. */ void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctComplexTypeParser pParserFunction, const gint idx) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName); int i; gint32 iLen; /* read array length */ iLen = tvb_get_letohl(tvb, *pOffset); proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); if (iLen > MAX_ARRAY_LEN) { proto_tree_add_expert_format(subtree, pinfo, &ei_array_length, tvb, *pOffset, 4, "Array length %d too large to process", iLen); return; } *pOffset += 4; for (i=0; i<iLen; i++) { char szNum[20]; snprintf(szNum, 20, "[%i]", i); (*pParserFunction)(subtree, tvb, pinfo, pOffset, szNum); } proto_item_set_end(ti, tvb, *pOffset); } void parseNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_nodeid, &ti, "%s: NodeId", szFieldName); gint iOffset = *pOffset; guint8 EncodingMask; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset++; switch(EncodingMask) { case 0x00: /* two byte node id */ proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; break; case 0x01: /* four byte node id */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, ENC_LITTLE_ENDIAN); iOffset+=4; break; case 0x03: /* string */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_string); break; case 0x04: /* guid */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseGuid(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_guid); break; case 0x05: /* byte string */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseByteString(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_bytestring); break; }; proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; } void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const extobj_mask[] = {&hf_opcua_extobj_mask_binbodyflag, &hf_opcua_extobj_mask_xmlbodyflag, NULL}; gint iOffset = *pOffset; guint8 EncodingMask; guint32 TypeId; proto_tree *extobj_tree; proto_item *ti; guint opcua_nested_count; /* add extension object subtree */ extobj_tree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_extensionobject, &ti, "%s: ExtensionObject", szFieldName); /* prevent a too high nesting depth */ opcua_nested_count = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, proto_opcua, 0)); if (opcua_nested_count >= MAX_NESTING_DEPTH) { expert_add_info(pinfo, ti, &ei_nesting_depth); return; } opcua_nested_count++; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); /* add nodeid subtree */ TypeId = getExtensionObjectType(tvb, &iOffset); parseNodeId(extobj_tree, tvb, pinfo, &iOffset, "TypeId"); /* parse encoding mask */ EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_bitmask(extobj_tree, tvb, iOffset, hf_opcua_extobj_mask, ett_opcua_extensionobject_encodingmask, extobj_mask, ENC_LITTLE_ENDIAN); iOffset++; if (EncodingMask & EXTOBJ_ENCODINGMASK_BINBODY_FLAG) /* has binary body ? */ { dispatchExtensionObjectType(extobj_tree, tvb, pinfo, &iOffset, TypeId); } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; opcua_nested_count--; p_add_proto_data(pinfo->pool, pinfo, proto_opcua, 0, GUINT_TO_POINTER(opcua_nested_count)); } void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { static int * const expandednodeid_mask[] = {&hf_opcua_nodeid_encodingmask, &hf_opcua_expandednodeid_mask_serverindex, &hf_opcua_expandednodeid_mask_namespaceuri, NULL}; proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_expandednodeid, &ti, "%s: ExpandedNodeId", szFieldName); gint iOffset = *pOffset; guint8 EncodingMask; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_bitmask(subtree, tvb, iOffset, hf_opcua_expandednodeid_mask, ett_opcua_expandednodeid_encodingmask, expandednodeid_mask, ENC_LITTLE_ENDIAN); iOffset++; switch(EncodingMask & 0x0F) { case 0x00: /* two byte node id */ proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; break; case 0x01: /* four byte node id */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset+=1; proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, ENC_LITTLE_ENDIAN); iOffset+=4; break; case 0x03: /* string */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_string); break; case 0x04: /* guid */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseGuid(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_guid); break; case 0x05: /* byte string */ proto_tree_add_item(subtree, hf_opcua_nodeid_nsindex, tvb, iOffset, 2, ENC_LITTLE_ENDIAN); iOffset+=2; parseByteString(subtree, tvb, pinfo, &iOffset, hf_opcua_nodeid_bytestring); break; }; if (EncodingMask & NODEID_NAMESPACEURIFLAG) { parseString(subtree, tvb, pinfo, &iOffset, hf_opcua_NamespaceUri); } if (EncodingMask & NODEID_SERVERINDEXFLAG) { parseUInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_ServerIndex); } proto_item_set_end(ti, tvb, iOffset); *pOffset = iOffset; } guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset) { gint iOffset = *pOffset; guint8 EncodingMask; guint32 Numeric = 0; EncodingMask = tvb_get_guint8(tvb, iOffset); iOffset++; switch(EncodingMask) { case 0x00: /* two byte node id */ Numeric = tvb_get_guint8(tvb, iOffset); /*iOffset+=1;*/ break; case 0x01: /* four byte node id */ iOffset+=1; Numeric = tvb_get_letohs(tvb, iOffset); break; case 0x02: /* numeric, that does not fit into four bytes */ iOffset+=2; Numeric = tvb_get_letohl(tvb, iOffset); break; case 0x03: /* string */ case 0x04: /* uri */ case 0x05: /* guid */ case 0x06: /* byte string */ /* NOT USED */ break; }; return Numeric; } void parseNodeClassMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { static int * const nodeclass_mask[] = { &hf_opcua_nodeClassMask_object, &hf_opcua_nodeClassMask_variable, &hf_opcua_nodeClassMask_method, &hf_opcua_nodeClassMask_objecttype, &hf_opcua_nodeClassMask_variabletype, &hf_opcua_nodeClassMask_referencetype, &hf_opcua_nodeClassMask_datatype, &hf_opcua_nodeClassMask_view, NULL}; guint8 NodeClassMask = tvb_get_guint8(tvb, *pOffset); if(NodeClassMask == NODECLASSMASK_ALL) { proto_tree_add_item(tree, hf_opcua_nodeClassMask_all, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); } else { proto_tree_add_bitmask(tree, tvb, *pOffset, hf_opcua_nodeClassMask, ett_opcua_nodeClassMask, nodeclass_mask, ENC_LITTLE_ENDIAN); } *pOffset+=4; } void parseResultMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { static int * const browseresult_mask[] = { &hf_opcua_resultMask_referencetype, &hf_opcua_resultMask_isforward, &hf_opcua_resultMask_nodeclass, &hf_opcua_resultMask_browsename, &hf_opcua_resultMask_displayname, &hf_opcua_resultMask_typedefinition, NULL}; guint8 ResultMask = tvb_get_guint8(tvb, *pOffset); if(ResultMask == RESULTMASK_ALL) { proto_tree_add_item(tree, hf_opcua_resultMask_all, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); } else { proto_tree_add_bitmask(tree, tvb, *pOffset, hf_opcua_resultMask, ett_opcua_resultMask, browseresult_mask, ENC_LITTLE_ENDIAN); } *pOffset+=4; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/opcua/opcua_simpletypes.h
/****************************************************************************** ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: Implementation of OpcUa built-in type parsers. ** This contains all the simple types and some complex types. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "opcua_identifiers.h" /* simple header fields */ extern int hf_opcua_returnDiag; extern int hf_opcua_returnDiag_mask_sl_symbolicId; extern int hf_opcua_returnDiag_mask_sl_localizedText; extern int hf_opcua_returnDiag_mask_sl_additionalinfo; extern int hf_opcua_returnDiag_mask_sl_innerstatuscode; extern int hf_opcua_returnDiag_mask_sl_innerdiagnostics; extern int hf_opcua_returnDiag_mask_ol_symbolicId; extern int hf_opcua_returnDiag_mask_ol_localizedText; extern int hf_opcua_returnDiag_mask_ol_additionalinfo; extern int hf_opcua_returnDiag_mask_ol_innerstatuscode; extern int hf_opcua_returnDiag_mask_ol_innerdiagnostics; extern int hf_opcua_nodeClassMask; extern int hf_opcua_nodeClassMask_object; extern int hf_opcua_nodeClassMask_variable; extern int hf_opcua_nodeClassMask_method; extern int hf_opcua_nodeClassMask_objecttype; extern int hf_opcua_nodeClassMask_variabletype; extern int hf_opcua_nodeClassMask_referencetype; extern int hf_opcua_nodeClassMask_datatype; extern int hf_opcua_nodeClassMask_view; /* simple types trees */ extern gint ett_opcua_array_Boolean; extern gint ett_opcua_array_SByte; extern gint ett_opcua_array_Byte; extern gint ett_opcua_array_Int16; extern gint ett_opcua_array_UInt16; extern gint ett_opcua_array_Int32; extern gint ett_opcua_array_UInt32; extern gint ett_opcua_array_Int64; extern gint ett_opcua_array_UInt64; extern gint ett_opcua_array_Float; extern gint ett_opcua_array_Double; extern gint ett_opcua_array_String; extern gint ett_opcua_array_DateTime; extern gint ett_opcua_array_Guid; extern gint ett_opcua_array_ByteString; extern gint ett_opcua_array_XmlElement; extern gint ett_opcua_array_NodeId; extern gint ett_opcua_array_ExpandedNodeId; extern gint ett_opcua_array_StatusCode; extern gint ett_opcua_array_DiagnosticInfo; extern gint ett_opcua_array_QualifiedName; extern gint ett_opcua_array_LocalizedText; extern gint ett_opcua_array_ExtensionObject; extern gint ett_opcua_array_DataValue; extern gint ett_opcua_array_Variant; extern gint ett_opcua_returnDiagnostics; /* simple types */ proto_item* parseBoolean(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseSByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseUInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseUInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseUInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseGuid(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseByteString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseXmlElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseFloat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseDouble(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseDateTime(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); proto_item* parseStatusCode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); /* complex types */ void parseLocalizedText(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseDataValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseVariant(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName); void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, int hfIndex, fctSimpleTypeParser pParserFunction, const gint idx); void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctEnumParser pParserFunction, const gint idx); void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctComplexTypeParser pParserFunction, const gint idx); void registerSimpleTypes(int proto); guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset); void parseNodeClassMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseResultMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int TypeId);
C
wireshark/plugins/epan/opcua/opcua_statuscode.c
/****************************************************************************** ** Copyright (C) 2014 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Author: Hannes Mezger <[email protected]> ** ** This file was autogenerated on 10.06.2014. ** DON'T MODIFY THIS FILE! ** ******************************************************************************/ #include "config.h" #include <epan/value_string.h> const value_string g_statusCodes[] = { {0x00000000, "Good"}, {0x40000000, "Uncertain"}, {0x80000000, "Bad"}, {0x80010000, "BadUnexpectedError"}, {0x80020000, "BadInternalError"}, {0x80030000, "BadOutOfMemory"}, {0x80040000, "BadResourceUnavailable"}, {0x80050000, "BadCommunicationError"}, {0x80060000, "BadEncodingError"}, {0x80070000, "BadDecodingError"}, {0x80080000, "BadEncodingLimitsExceeded"}, {0x80B80000, "BadRequestTooLarge"}, {0x80B90000, "BadResponseTooLarge"}, {0x80090000, "BadUnknownResponse"}, {0x800A0000, "BadTimeout"}, {0x800B0000, "BadServiceUnsupported"}, {0x800C0000, "BadShutdown"}, {0x800D0000, "BadServerNotConnected"}, {0x800E0000, "BadServerHalted"}, {0x800F0000, "BadNothingToDo"}, {0x80100000, "BadTooManyOperations"}, {0x80DB0000, "BadTooManyMonitoredItems"}, {0x80110000, "BadDataTypeIdUnknown"}, {0x80120000, "BadCertificateInvalid"}, {0x80130000, "BadSecurityChecksFailed"}, {0x80140000, "BadCertificateTimeInvalid"}, {0x80150000, "BadCertificateIssuerTimeInvalid"}, {0x80160000, "BadCertificateHostNameInvalid"}, {0x80170000, "BadCertificateUriInvalid"}, {0x80180000, "BadCertificateUseNotAllowed"}, {0x80190000, "BadCertificateIssuerUseNotAllowed"}, {0x801A0000, "BadCertificateUntrusted"}, {0x801B0000, "BadCertificateRevocationUnknown"}, {0x801C0000, "BadCertificateIssuerRevocationUnknown"}, {0x801D0000, "BadCertificateRevoked"}, {0x801E0000, "BadCertificateIssuerRevoked"}, {0x810D0000, "BadCertificateChainIncomplete"}, {0x801F0000, "BadUserAccessDenied"}, {0x80200000, "BadIdentityTokenInvalid"}, {0x80210000, "BadIdentityTokenRejected"}, {0x80220000, "BadSecureChannelIdInvalid"}, {0x80230000, "BadInvalidTimestamp"}, {0x80240000, "BadNonceInvalid"}, {0x80250000, "BadSessionIdInvalid"}, {0x80260000, "BadSessionClosed"}, {0x80270000, "BadSessionNotActivated"}, {0x80280000, "BadSubscriptionIdInvalid"}, {0x802A0000, "BadRequestHeaderInvalid"}, {0x802B0000, "BadTimestampsToReturnInvalid"}, {0x802C0000, "BadRequestCancelledByClient"}, {0x80E50000, "BadTooManyArguments"}, {0x002D0000, "GoodSubscriptionTransferred"}, {0x002E0000, "GoodCompletesAsynchronously"}, {0x002F0000, "GoodOverload"}, {0x00300000, "GoodClamped"}, {0x80310000, "BadNoCommunication"}, {0x80320000, "BadWaitingForInitialData"}, {0x80330000, "BadNodeIdInvalid"}, {0x80340000, "BadNodeIdUnknown"}, {0x80350000, "BadAttributeIdInvalid"}, {0x80360000, "BadIndexRangeInvalid"}, {0x80370000, "BadIndexRangeNoData"}, {0x80380000, "BadDataEncodingInvalid"}, {0x80390000, "BadDataEncodingUnsupported"}, {0x803A0000, "BadNotReadable"}, {0x803B0000, "BadNotWritable"}, {0x803C0000, "BadOutOfRange"}, {0x803D0000, "BadNotSupported"}, {0x803E0000, "BadNotFound"}, {0x803F0000, "BadObjectDeleted"}, {0x80400000, "BadNotImplemented"}, {0x80410000, "BadMonitoringModeInvalid"}, {0x80420000, "BadMonitoredItemIdInvalid"}, {0x80430000, "BadMonitoredItemFilterInvalid"}, {0x80440000, "BadMonitoredItemFilterUnsupported"}, {0x80450000, "BadFilterNotAllowed"}, {0x80460000, "BadStructureMissing"}, {0x80470000, "BadEventFilterInvalid"}, {0x80480000, "BadContentFilterInvalid"}, {0x80C10000, "BadFilterOperatorInvalid"}, {0x80C20000, "BadFilterOperatorUnsupported"}, {0x80C30000, "BadFilterOperandCountMismatch"}, {0x80490000, "BadFilterOperandInvalid"}, {0x80C40000, "BadFilterElementInvalid"}, {0x80C50000, "BadFilterLiteralInvalid"}, {0x804A0000, "BadContinuationPointInvalid"}, {0x804B0000, "BadNoContinuationPoints"}, {0x804C0000, "BadReferenceTypeIdInvalid"}, {0x804D0000, "BadBrowseDirectionInvalid"}, {0x804E0000, "BadNodeNotInView"}, {0x804F0000, "BadServerUriInvalid"}, {0x80500000, "BadServerNameMissing"}, {0x80510000, "BadDiscoveryUrlMissing"}, {0x80520000, "BadSemaphoreFileMissing"}, {0x80530000, "BadRequestTypeInvalid"}, {0x80540000, "BadSecurityModeRejected"}, {0x80550000, "BadSecurityPolicyRejected"}, {0x80560000, "BadTooManySessions"}, {0x80570000, "BadUserSignatureInvalid"}, {0x80580000, "BadApplicationSignatureInvalid"}, {0x80590000, "BadNoValidCertificates"}, {0x80C60000, "BadIdentityChangeNotSupported"}, {0x805A0000, "BadRequestCancelledByRequest"}, {0x805B0000, "BadParentNodeIdInvalid"}, {0x805C0000, "BadReferenceNotAllowed"}, {0x805D0000, "BadNodeIdRejected"}, {0x805E0000, "BadNodeIdExists"}, {0x805F0000, "BadNodeClassInvalid"}, {0x80600000, "BadBrowseNameInvalid"}, {0x80610000, "BadBrowseNameDuplicated"}, {0x80620000, "BadNodeAttributesInvalid"}, {0x80630000, "BadTypeDefinitionInvalid"}, {0x80640000, "BadSourceNodeIdInvalid"}, {0x80650000, "BadTargetNodeIdInvalid"}, {0x80660000, "BadDuplicateReferenceNotAllowed"}, {0x80670000, "BadInvalidSelfReference"}, {0x80680000, "BadReferenceLocalOnly"}, {0x80690000, "BadNoDeleteRights"}, {0x40BC0000, "UncertainReferenceNotDeleted"}, {0x806A0000, "BadServerIndexInvalid"}, {0x806B0000, "BadViewIdUnknown"}, {0x80C90000, "BadViewTimestampInvalid"}, {0x80CA0000, "BadViewParameterMismatch"}, {0x80CB0000, "BadViewVersionInvalid"}, {0x40C00000, "UncertainNotAllNodesAvailable"}, {0x00BA0000, "GoodResultsMayBeIncomplete"}, {0x80C80000, "BadNotTypeDefinition"}, {0x406C0000, "UncertainReferenceOutOfServer"}, {0x806D0000, "BadTooManyMatches"}, {0x806E0000, "BadQueryTooComplex"}, {0x806F0000, "BadNoMatch"}, {0x80700000, "BadMaxAgeInvalid"}, {0x80E60000, "BadSecurityModeInsufficient"}, {0x80710000, "BadHistoryOperationInvalid"}, {0x80720000, "BadHistoryOperationUnsupported"}, {0x80BD0000, "BadInvalidTimestampArgument"}, {0x80730000, "BadWriteNotSupported"}, {0x80740000, "BadTypeMismatch"}, {0x80750000, "BadMethodInvalid"}, {0x80760000, "BadArgumentsMissing"}, {0x80770000, "BadTooManySubscriptions"}, {0x80780000, "BadTooManyPublishRequests"}, {0x80790000, "BadNoSubscription"}, {0x807A0000, "BadSequenceNumberUnknown"}, {0x807B0000, "BadMessageNotAvailable"}, {0x807C0000, "BadInsufficientClientProfile"}, {0x80BF0000, "BadStateNotActive"}, {0x807D0000, "BadTcpServerTooBusy"}, {0x807E0000, "BadTcpMessageTypeInvalid"}, {0x807F0000, "BadTcpSecureChannelUnknown"}, {0x80800000, "BadTcpMessageTooLarge"}, {0x80810000, "BadTcpNotEnoughResources"}, {0x80820000, "BadTcpInternalError"}, {0x80830000, "BadTcpEndpointUrlInvalid"}, {0x80840000, "BadRequestInterrupted"}, {0x80850000, "BadRequestTimeout"}, {0x80860000, "BadSecureChannelClosed"}, {0x80870000, "BadSecureChannelTokenUnknown"}, {0x80880000, "BadSequenceNumberInvalid"}, {0x80BE0000, "BadProtocolVersionUnsupported"}, {0x80890000, "BadConfigurationError"}, {0x808A0000, "BadNotConnected"}, {0x808B0000, "BadDeviceFailure"}, {0x808C0000, "BadSensorFailure"}, {0x808D0000, "BadOutOfService"}, {0x808E0000, "BadDeadbandFilterInvalid"}, {0x408F0000, "UncertainNoCommunicationLastUsableValue"}, {0x40900000, "UncertainLastUsableValue"}, {0x40910000, "UncertainSubstituteValue"}, {0x40920000, "UncertainInitialValue"}, {0x40930000, "UncertainSensorNotAccurate"}, {0x40940000, "UncertainEngineeringUnitsExceeded"}, {0x40950000, "UncertainSubNormal"}, {0x00960000, "GoodLocalOverride"}, {0x80970000, "BadRefreshInProgress"}, {0x80980000, "BadConditionAlreadyDisabled"}, {0x80CC0000, "BadConditionAlreadyEnabled"}, {0x80990000, "BadConditionDisabled"}, {0x809A0000, "BadEventIdUnknown"}, {0x80BB0000, "BadEventNotAcknowledgeable"}, {0x80CD0000, "BadDialogNotActive"}, {0x80CE0000, "BadDialogResponseInvalid"}, {0x80CF0000, "BadConditionBranchAlreadyAcked"}, {0x80D00000, "BadConditionBranchAlreadyConfirmed"}, {0x80D10000, "BadConditionAlreadyShelved"}, {0x80D20000, "BadConditionNotShelved"}, {0x80D30000, "BadShelvingTimeOutOfRange"}, {0x809B0000, "BadNoData"}, {0x80D70000, "BadBoundNotFound"}, {0x80D80000, "BadBoundNotSupported"}, {0x809D0000, "BadDataLost"}, {0x809E0000, "BadDataUnavailable"}, {0x809F0000, "BadEntryExists"}, {0x80A00000, "BadNoEntryExists"}, {0x80A10000, "BadTimestampNotSupported"}, {0x00A20000, "GoodEntryInserted"}, {0x00A30000, "GoodEntryReplaced"}, {0x40A40000, "UncertainDataSubNormal"}, {0x00A50000, "GoodNoData"}, {0x00A60000, "GoodMoreData"}, {0x80D40000, "BadAggregateListMismatch"}, {0x80D50000, "BadAggregateNotSupported"}, {0x80D60000, "BadAggregateInvalidInputs"}, {0x80DA0000, "BadAggregateConfigurationRejected"}, {0x00D90000, "GoodDataIgnored"}, {0x80E40000, "BadRequestNotAllowed"}, {0x00DC0000, "GoodEdited"}, {0x00DD0000, "GoodPostActionFailed"}, {0x40DE0000, "UncertainDominantValueChanged"}, {0x00E00000, "GoodDependentValueChanged"}, {0x80E10000, "BadDominantValueChanged"}, {0x40E20000, "UncertainDependentValueChanged"}, {0x80E30000, "BadDependentValueChanged"}, {0x00A70000, "GoodCommunicationEvent"}, {0x00A80000, "GoodShutdownEvent"}, {0x00A90000, "GoodCallAgain"}, {0x00AA0000, "GoodNonCriticalTimeout"}, {0x80AB0000, "BadInvalidArgument"}, {0x80AC0000, "BadConnectionRejected"}, {0x80AD0000, "BadDisconnect"}, {0x80AE0000, "BadConnectionClosed"}, {0x80AF0000, "BadInvalidState"}, {0x80B00000, "BadEndOfStream"}, {0x80B10000, "BadNoDataAvailable"}, {0x80B20000, "BadWaitingForResponse"}, {0x80B30000, "BadOperationAbandoned"}, {0x80B40000, "BadExpectedStreamToBlock"}, {0x80B50000, "BadWouldBlock"}, {0x80B60000, "BadSyntaxError"}, {0x80B70000, "BadMaxConnectionsReached"}, {0x81000000, "StartOfStackStatusCodes"}, {0x81010000, "BadSignatureInvalid"}, {0x81040000, "BadExtensibleParameterInvalid"}, {0x81050000, "BadExtensibleParameterUnsupported"}, {0x81060000, "BadHostUnknown"}, {0x81070000, "BadTooManyPosts"}, {0x81080000, "BadSecurityConfig"}, {0x81090000, "BadFileNotFound"}, {0x810A0000, "BadContinue"}, {0x810B0000, "BadHttpMethodNotAllowed"}, {0x810C0000, "BadFileExists"}, {0x810D0000, "BadCertificateChainIncomplete"}, {0, NULL} };
C/C++
wireshark/plugins/epan/opcua/opcua_statuscode.h
/****************************************************************************** ** Copyright (C) 2014 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Author: Hannes Mezger <[email protected]> ** ******************************************************************************/ extern const value_string g_statusCodes[];
C
wireshark/plugins/epan/opcua/opcua_transport_layer.c
/****************************************************************************** ** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Transport Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ #include "config.h" #include <epan/packet.h> #include "opcua_security_layer.h" #include "opcua_application_layer.h" #include "opcua_simpletypes.h" #include "opcua_transport_layer.h" #include "opcua_servicetable.h" static int hf_opcua_transport_type = -1; static int hf_opcua_transport_chunk = -1; static int hf_opcua_transport_size = -1; static int hf_opcua_transport_ver = -1; static int hf_opcua_transport_scid = -1; static int hf_opcua_transport_rbs = -1; static int hf_opcua_transport_sbs = -1; static int hf_opcua_transport_mms = -1; static int hf_opcua_transport_mcc = -1; static int hf_opcua_transport_endpoint = -1; static int hf_opcua_transport_suri = -1; static int hf_opcua_transport_error = -1; static int hf_opcua_transport_reason = -1; static int hf_opcua_transport_spu = -1; static int hf_opcua_transport_scert = -1; static int hf_opcua_transport_rcthumb = -1; static int hf_opcua_transport_seq = -1; static int hf_opcua_transport_rqid = -1; /** subtree types */ extern gint ett_opcua_nodeid; extern gint ett_opcua_extensionobject; /** Register transport layer types. */ void registerTransportLayerTypes(int proto) { static hf_register_info hf[] = { /* id full name abbreviation type display strings bitmask blurb HFILL */ {&hf_opcua_transport_type, {"Message Type", "opcua.transport.type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_chunk, {"Chunk Type", "opcua.transport.chunk", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_size, {"Message Size", "opcua.transport.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_ver, {"Version", "opcua.transport.ver", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_scid, {"SecureChannelId", "opcua.transport.scid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_rbs, {"ReceiveBufferSize", "opcua.transport.rbs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_sbs, {"SendBufferSize", "opcua.transport.sbs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_mms, {"MaxMessageSize", "opcua.transport.mms", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_mcc, {"MaxChunkCount", "opcua.transport.mcc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_endpoint, {"EndpointUrl", "opcua.transport.endpoint", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_suri, {"ServerUri", "opcua.transport.suri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_error, {"Error", "opcua.transport.error", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_reason, {"Reason", "opcua.transport.reason", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_spu, {"SecurityPolicyUri", "opcua.security.spu", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_scert, {"SenderCertificate", "opcua.security.scert", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_rcthumb, {"ReceiverCertificateThumbprint", "opcua.security.rcthumb", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_seq, {"SequenceNumber", "opcua.security.seq", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, {&hf_opcua_transport_rqid, {"RequestId", "opcua.security.rqid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, }; proto_register_field_array(proto, hf, array_length(hf)); } /* Transport Layer: message parsers */ int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_ver, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_rbs, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_sbs, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_mms, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_mcc, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_endpoint); return -1; } int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_ver, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_rbs, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_sbs, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_mms, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_mcc, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; return -1; } int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; parseStatusCode(tree, tvb, pinfo, pOffset, hf_opcua_transport_error); parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_reason); return -1; } int parseReverseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_suri); parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_endpoint); return -1; } int parseMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_scid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; /* message data contains the security layer */ parseSecurityLayer(tree, tvb, pOffset); return -1; } int parseAbort(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { parseStatusCode(tree, tvb, pinfo, pOffset, hf_opcua_transport_error); parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_reason); return -1; } int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_item *ti_inner; proto_tree *encobj_tree; proto_tree *nodeid_tree; int ServiceId = 0; /* AT THE MOMENT NO SECURITY IS IMPLEMENTED IN UA. * WE CAN JUST JUMP INTO THE APPLICATION LAYER DATA. * THIS WILL CHAHNGE IN THE FUTURE. */ /* add encodeable object subtree */ encobj_tree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_extensionobject, &ti, "OpcUa Service : Encodeable Object"); /* add nodeid subtree */ nodeid_tree = proto_tree_add_subtree(encobj_tree, tvb, *pOffset, -1, ett_opcua_nodeid, &ti_inner, "TypeId : ExpandedNodeId"); ServiceId = parseServiceNodeId(nodeid_tree, tvb, pOffset); proto_item_set_end(ti_inner, tvb, *pOffset); dispatchService(encobj_tree, tvb, pinfo, pOffset, ServiceId); proto_item_set_end(ti, tvb, *pOffset); return ServiceId; } int parseOpenSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_item *ti_inner; proto_tree *encobj_tree; proto_tree *nodeid_tree; int ServiceId = 0; proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_scid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; parseString(tree, tvb, pinfo, pOffset, hf_opcua_transport_spu); parseByteString(tree, tvb, pinfo, pOffset, hf_opcua_transport_scert); parseByteString(tree, tvb, pinfo, pOffset, hf_opcua_transport_rcthumb); proto_tree_add_item(tree, hf_opcua_transport_seq, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_rqid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; /* add encodeable object subtree */ encobj_tree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_extensionobject, &ti, "Message : Encodeable Object"); /* add nodeid subtree */ nodeid_tree = proto_tree_add_subtree(encobj_tree, tvb, *pOffset, -1, ett_opcua_nodeid, &ti_inner, "TypeId : ExpandedNodeId"); ServiceId = parseServiceNodeId(nodeid_tree, tvb, pOffset); proto_item_set_end(ti_inner, tvb, *pOffset); dispatchService(encobj_tree, tvb, pinfo, pOffset, ServiceId); proto_item_set_end(ti, tvb, *pOffset); return ServiceId; } int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { proto_item *ti; proto_item *ti_inner; proto_tree *encobj_tree; proto_tree *nodeid_tree; int ServiceId = 0; proto_tree_add_item(tree, hf_opcua_transport_type, tvb, *pOffset, 3, ENC_ASCII|ENC_NA); *pOffset+=3; proto_tree_add_item(tree, hf_opcua_transport_chunk, tvb, *pOffset, 1, ENC_ASCII|ENC_NA); *pOffset+=1; proto_tree_add_item(tree, hf_opcua_transport_size, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; proto_tree_add_item(tree, hf_opcua_transport_scid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; parseSecurityLayer(tree, tvb, pOffset); /* add encodeable object subtree */ encobj_tree = proto_tree_add_subtree(tree, tvb, *pOffset, -1, ett_opcua_extensionobject, &ti, "Message : Encodeable Object"); /* add nodeid subtree */ nodeid_tree = proto_tree_add_subtree(encobj_tree, tvb, *pOffset, -1, ett_opcua_nodeid, &ti_inner, "TypeId : ExpandedNodeId"); ServiceId = parseServiceNodeId(nodeid_tree, tvb, pOffset); proto_item_set_end(ti_inner, tvb, *pOffset); dispatchService(encobj_tree, tvb, pinfo, pOffset, ServiceId); proto_item_set_end(ti, tvb, *pOffset); return ServiceId; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/opcua/opcua_transport_layer.h
/****************************************************************************** ** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved. ** Web: http://www.ascolab.com ** ** SPDX-License-Identifier: GPL-2.0-or-later ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** Project: OpcUa Wireshark Plugin ** ** Description: OpcUa Transport Layer Decoder. ** ** Author: Gerhard Gappmeier <[email protected]> ******************************************************************************/ /* Transport Layer: message parsers */ int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseReverseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseAbort(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseOpenSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void registerTransportLayerTypes(int proto);
wireshark/plugins/epan/opcua/README
OpcUa Plugin: ============= This plugin implements the dissection of the OpcUa Binary Protocol. Authors: Gerhard Gappmeier & Hannes Mezger ascolab GmbH http://www.ascolab.com Overview: ========= OpcUa (OPC Unified Architecture) is a vendor and platform independent protocol for automation technology. It is the successor of the COM/DCOM based specifications OPC DA, OPC Alarm & Events, OPC HDA, etc. It unifies all this technologies into a single protocol. The specification describes abstract services that are independent of the underlying protocol. For now there exist protocol mappings to a Binary TCP based protocol and a SOAP based Webservice. Also a hybrid version will be available where the Binary messages are transported by a single webservice command called "Invoke". More information about the technology you can find on http://www.ascolab.com/index.php?file=ua&lang=en. Protocol Mappings: ================== Binary (TCP): The fastest and most flexible version (small footprint, no XML and SOAP necessary) can easily be tunneled (SSH, IPSEC, etc.), redirected, ... SOAP version: Easy to implement with verious tools like .Net, JAVA, gSOAP, etc. Better to communicate through firewalls via HTTP. SOAP with Binary Attachment: Combines the advantages of both. The messages are encoded as Binary, and transported via SOAP as binary attachment. The OPC Foundation offers a free Opc Ua stack implementation in ANSI C for all members. This stack implements the binary protocol as well as the SOAP version. It's easily portable to different kinds of operating systems from embedded devices to servers. This makes it easy to implement Opc Ua applications based on this stack and it is expected that the binary protocol will be the most used protocol. Nevertheless it's free to everbody to implement an own stack according to the specification. An own implementation of the SOAP version should be easy with the various SOAP toolkits. For more information see http://www.opcfoundation.org Known limitations: ================== * Only the security policy http://opcfoundation.org/UA/SecurityPolicy#None is supported, which means the encryption and signing is turned off. Machine-generated dissector: ============================ Parts of the OpcUa dissector are machine generated. Several of the files are marked "DON'T MODIFY THIS FILE!" for this reason. However, the code to create this dissector is not part of the Wireshark source source code distribution. This was discussed prior to the plugin's inclusion. From https://www.wireshark.org/lists/wireshark-dev/200704/msg00025.html : ~~~ > a lot of the code seems to be autogenerated (as the comments suggest) > It might make sense to include the sources and the build process instead > of the intermediate files (if the amount of code/tools to build the > files seems reasonable). The reason: When people start to hack your code > (e.g. to remove warnings on a compiler you don't even think about), > you'll might get into annoying trouble with merging code the next time > you've update the upcua files. > > I'm sorry, but I cannot give you the sources of the code generator, because they are owned by the OPC Foundation. I only extended the existing code generator to produce also wireshark code. It's .Net based so I guess you don't want to have it anyway ;-) ~~~ So, if changes must be made to the machine-generated files, it just means the upstream source will have to be modified before pushing any updates back to Wireshark. Of course it also means that care must be taken when applying patches from upstream to ensure local changes aren't reversed.
Text
wireshark/plugins/epan/pluginifdemo/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(pluginifdemo 0 0 2 0) SET(CMAKE_AUTOMOC ON) SET(CMAKE_AUTOUIC ON) if(USE_qt6) set(qtver "6") else() set(qtver "5") endif() find_package(Qt${qtver}Core) find_package(Qt${qtver}PrintSupport) find_package(Qt${qtver}Widgets) set(DISSECTOR_SRC pluginifdemo.c ui/uihandler.cpp ui/uiclasshandler.cpp ui/pluginifdemo_main.cpp ui/pluginifdemo_about.cpp ${UI_SRC} ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ) set_source_files_properties( plugin.c PROPERTIES SKIP_AUTOGEN ON ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ) add_wireshark_plugin_library(pluginifdemo epan) target_link_libraries(pluginifdemo epan Qt${qtver}::Core Qt${qtver}::Widgets Qt${qtver}::PrintSupport) install_plugin(pluginifdemo epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME pluginifdemo SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_HEADERS} )
C
wireshark/plugins/epan/pluginifdemo/pluginifdemo.c
/* pluginifdemo.c * Routines for plugin_if demo capability * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <stdio.h> #include <epan/packet.h> #include <epan/prefs.h> #include <epan/tap.h> #include <epan/plugin_if.h> #include "pluginifdemo.h" #include "ui/uihandler.h" void proto_register_pluginifdemo(void); void proto_reg_handoff_pluginifdemo(void); static int proto_pluginifdemo = -1; void toolbar_cb(gpointer object, gpointer item_data, gpointer user_data); void menu_cb(ext_menubar_gui_type gui_type, gpointer gui_data, gpointer user_data _U_) { pluginifdemo_ui_main(gui_type, gui_data); } void about_cb(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_, gpointer user_data _U_) { pluginifdemo_ui_about(gui_type, gui_data); } void proto_register_pluginifdemo(void) { #if 0 module_t *pluginif_module = NULL; #endif ext_menu_t * ext_menu = NULL; proto_pluginifdemo = proto_register_protocol("Plugin IF Demo Protocol", "Pluginifdemo", "pluginifdemo"); ext_menu = ext_menubar_register_menu ( proto_pluginifdemo, "Plugin IF Demonstration", TRUE ); ext_menubar_set_parentmenu (ext_menu, "Tools"); ext_menubar_add_entry(ext_menu, "Toolbar Action Demonstrator", "Action demonstrator for the plugin toolbar", menu_cb, NULL); ext_menubar_add_separator(ext_menu); ext_menubar_add_website(ext_menu, "Wireshark Development", "See Wireshark Development", "https://www.wireshark.org/develop.html"); ext_menubar_add_separator(ext_menu); ext_menubar_add_entry(ext_menu, "&About Plugin IF Demonstration", "Further information", about_cb, NULL); #if 0 pluginif_module = prefs_register_protocol(proto_pluginifdemo, NULL); #endif ext_toolbar_t * tb = ext_toolbar_register_toolbar("Plugin Interface Demo Toolbar"); ext_toolbar_add_entry(tb, EXT_TOOLBAR_BUTTON, "Button 1", 0, "Button 1 to press", FALSE, 0, FALSE, 0, toolbar_cb, 0); ext_toolbar_add_entry(tb, EXT_TOOLBAR_BUTTON, "Button 2", 0, "Button 2 to press", TRUE, 0, FALSE, 0, toolbar_cb, 0); ext_toolbar_add_entry(tb, EXT_TOOLBAR_BOOLEAN, "Checkbox", 0, "Checkbox to Select", FALSE, 0, FALSE, 0, toolbar_cb, 0); ext_toolbar_add_entry(tb, EXT_TOOLBAR_STRING, "String 1", "Default String", "String without validation", FALSE, 0, TRUE, 0, toolbar_cb, 0); ext_toolbar_add_entry(tb, EXT_TOOLBAR_STRING, "String 2", "ABC", "String with validation", FALSE, 0, FALSE, "^[A-Z]+", toolbar_cb, 0); GList * entries = 0; entries = ext_toolbar_add_val( entries, "1", "ABCD", FALSE ); entries = ext_toolbar_add_val(entries, "2", "EFG", FALSE ); entries = ext_toolbar_add_val(entries, "3", "HIJ", TRUE ); entries = ext_toolbar_add_val(entries, "4", "KLM", FALSE ); entries = ext_toolbar_add_val(entries, "5", "NOP", FALSE ); entries = ext_toolbar_add_val(entries, "6", "QRS", FALSE ); entries = ext_toolbar_add_val(entries, "7", "TUVW", FALSE ); entries = ext_toolbar_add_val(entries, "8", "XYZ", FALSE ); ext_toolbar_add_entry(tb, EXT_TOOLBAR_SELECTOR, "Selector", 0, "Selector to choose from", FALSE, entries, FALSE, 0, toolbar_cb, 0); pluginifdemo_toolbar_register(tb); } void* get_frame_data_cb(frame_data* fdata, void* user_data _U_) { return GUINT_TO_POINTER(fdata->num); } void* get_capture_file_cb(capture_file* cf, void* user_data _U_) { return cf->filename; } void toolbar_cb(gpointer toolbar_item, gpointer item_data, gpointer user_data _U_) { if ( ! toolbar_item ) return; gchar * message = 0; ext_toolbar_t * entry = (ext_toolbar_t *)toolbar_item; if (entry->item_type == EXT_TOOLBAR_BUTTON) { pluginifdemo_toolbar_log("Button pressed at toolbar"); guint32 fnum = GPOINTER_TO_UINT(plugin_if_get_frame_data(get_frame_data_cb, NULL)); if (fnum) { message = ws_strdup_printf("Current frame is: %u", fnum); pluginifdemo_toolbar_log(message); } const gchar* fnm = (const gchar*)plugin_if_get_capture_file(get_capture_file_cb, NULL); if (fnm) { message = ws_strdup_printf("Capture file name is: %s", fnm); pluginifdemo_toolbar_log(message); } } else if ( entry->item_type == EXT_TOOLBAR_BOOLEAN ) { gboolean data = *((gboolean *)item_data); message = ws_strdup_printf( "Checkbox selected value: %d", (int) (data) ); pluginifdemo_toolbar_log(message); } else if ( entry->item_type == EXT_TOOLBAR_STRING ) { gchar * data = (gchar *)item_data; message = ws_strdup_printf( "String entered in toolbar: %s", data ); pluginifdemo_toolbar_log(message); } else if ( entry->item_type == EXT_TOOLBAR_SELECTOR ) { ext_toolbar_value_t * data = (ext_toolbar_value_t *)item_data; message = ws_strdup_printf( "Value from toolbar: %s", data->value ); pluginifdemo_toolbar_log(message); } g_free(message); } void proto_reg_handoff_pluginifdemo(void) { } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/pluginifdemo/pluginifdemo.h
/* pluginifdemo.h * Definitions for plugin_if_demo structures and routines * By Steve Limkemann <[email protected]> * Copyright 1998 Steve Limkemann * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */
C++
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_about.cpp
/* pluginifdemo_about.cpp * * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include <plugins/epan/pluginifdemo/ui/pluginifdemo_about.h> #include <ui_pluginifdemo_about.h> #include <config.h> #include <QDialog> #include <QWidget> #include <QAbstractButton> PluginIFDemo_About::PluginIFDemo_About(QWidget *parent) : QDialog(parent), ui(new Ui::PluginIFDemo_About) { ui->setupUi(this); } PluginIFDemo_About::~PluginIFDemo_About() { delete ui; } void PluginIFDemo_About::on_buttonBox_clicked(QAbstractButton *) { this->close(); } /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_about.h
/* pluginifdemo_about.h * * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef PLUGINIFDEMO_ABOUT_H_ #define PLUGINIFDEMO_ABOUT_H_ #include <QWidget> #include <QDialog> #include <QAbstractButton> #include <QPixmap> #include <QGraphicsScene> namespace Ui { class PluginIFDemo_About; } class PluginIFDemo_About : public QDialog { Q_OBJECT public: explicit PluginIFDemo_About(QWidget *parent = 0); ~PluginIFDemo_About(); private slots: void on_buttonBox_clicked(QAbstractButton *button); private: Ui::PluginIFDemo_About *ui; }; #endif /* PLUGINIFDEMO_ABOUT_H_ */ /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
User Interface
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>PluginIFDemo_About</class> <widget class="QDialog" name="PluginIFDemo_About"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>545</width> <height>401</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>545</width> <height>401</height> </size> </property> <property name="maximumSize"> <size> <width>545</width> <height>401</height> </size> </property> <property name="contextMenuPolicy"> <enum>Qt::NoContextMenu</enum> </property> <property name="windowTitle"> <string>About Plugin Interface Demonstrator</string> </property> <property name="modal"> <bool>true</bool> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="spacing"> <number>0</number> </property> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> <number>10</number> </property> <property name="leftMargin"> <number>9</number> </property> <property name="topMargin"> <number>9</number> </property> <property name="rightMargin"> <number>9</number> </property> <property name="bottomMargin"> <number>9</number> </property> <item> <widget class="QLabel" name="lblAboutDialog"> <property name="text"> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;PlugIn Interface Demonstration&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Version: &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;0.0.2 &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright © &lt;/span&gt;&lt;span style=&quot; font-size:10pt; font-style:italic;&quot;&gt;Wireshark Foundation&lt;/span&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;a href=&quot;https://www.wireshark.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;www.wireshark.org&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> </property> <property name="wordWrap"> <bool>true</bool> </property> </widget> </item> <item> <widget class="QTabWidget" name="tabWidget"> <widget class="QWidget" name="tab"> <attribute name="title"> <string>License Information</string> </attribute> <widget class="QLabel" name="lblLicense"> <property name="geometry"> <rect> <x>10</x> <y>0</y> <width>511</width> <height>102</height> </rect> </property> <property name="text"> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This PlugIn demonstrates functionality of the interface API for plugins and extcap interfaces.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> </property> <property name="wordWrap"> <bool>true</bool> </property> </widget> </widget> </widget> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="leftMargin"> <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> <number>0</number> </property> <item> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="standardButtons"> <set>QDialogButtonBox::Ok</set> </property> <property name="centerButtons"> <bool>false</bool> </property> </widget> </item> </layout> </item> </layout> </item> </layout> </widget> <resources/> <connections/> </ui>
C++
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp
/* pluginifdemo_main.cpp * * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include <plugins/epan/pluginifdemo/ui/pluginifdemo_main.h> #include <ui_pluginifdemo_main.h> #include <config.h> #include "uihandler.h" #include <QWidget> #include <QLineEdit> #include <QListView> #include <QStandardItemModel> PluginIfType::PluginIfType(const QString &label, const ext_toolbar_item_t &itemType) : m_label(label), m_itemType(itemType) {} QString PluginIfType::label() const { return m_label; } ext_toolbar_item_t PluginIfType::itemType() const { return m_itemType; } PluginIfTypeModel::PluginIfTypeModel(QObject * parent) :QAbstractListModel(parent) { } void PluginIfTypeModel::addPluginIfType(const PluginIfType &ifType) { beginInsertRows(QModelIndex(), rowCount(), rowCount()); m_pluginIfTypes << ifType; endInsertRows(); } int PluginIfTypeModel::rowCount(const QModelIndex &) const { return static_cast<int>(m_pluginIfTypes.count()); } QVariant PluginIfTypeModel::data(const QModelIndex & idx, int role) const { if ( idx.row() < 0 || idx.row() >= m_pluginIfTypes.count() ) return QVariant(); const PluginIfType &ifType = m_pluginIfTypes[idx.row()]; if ( role == Qt::UserRole ) { return ifType.itemType(); } else if ( role == Qt::DisplayRole ) { return ifType.label(); } return QVariant(); } PluginIfTypeSortFilterProxyModel::PluginIfTypeSortFilterProxyModel(QObject * parent) :QSortFilterProxyModel(parent) { m_filterType = EXT_TOOLBAR_BOOLEAN; } void PluginIfTypeSortFilterProxyModel::setFilterElement(ext_toolbar_item_t filterType) { m_filterType = filterType; invalidateFilter(); } bool PluginIfTypeSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { QModelIndex dataIndex = sourceModel()->index(sourceRow, 0, sourceParent); QVariant varData = sourceModel()->data(dataIndex, Qt::UserRole); if ( varData.isValid() && varData.toInt() == (int) m_filterType ) return true; return false; } PluginIFDemo_Main::PluginIFDemo_Main(QWidget *parent) : QDialog(parent), ui(new Ui::PluginIFDemo_Main) { ui->setupUi(this); _toolbar = 0; sourceModel = new PluginIfTypeModel(this); proxyModel = new PluginIfTypeSortFilterProxyModel(this); proxyModel->setSourceModel(sourceModel); ui->cmbElements->setModel(proxyModel); listModel = new QStandardItemModel(this); ui->lstItems->setModel(listModel); indexModel = new QStandardItemModel(this); ui->cmbEntryIndex->setModel(indexModel); ui->logView->setModel(new QStandardItemModel(ui->logView)); ui->tabInterfaceTypes->setCurrentIndex(0); connect ( GuiHandler::getInstance(), SIGNAL(reset(void)), this, SLOT(closeDialog()) ); connect ( GuiHandler::getInstance(), SIGNAL(logChanged(QString)), this, SLOT(logChanged(QString)) ); } PluginIFDemo_Main::~PluginIFDemo_Main() { delete ui; } void PluginIFDemo_Main::setToolbar(ext_toolbar_t * &toolbar) { _toolbar = toolbar; GList * walker = toolbar->children; while ( walker && walker->data ) { ext_toolbar_t * entry = (ext_toolbar_t *)walker->data; if ( entry && entry->type == EXT_TOOLBAR_ITEM && entry->name ) sourceModel->addPluginIfType(PluginIfType(QString(entry->name), entry->item_type)); walker = g_list_next(walker); } } void PluginIFDemo_Main::closeDialog() { this->close(); } void PluginIFDemo_Main::on_buttonBox_clicked(QAbstractButton *button _U_) { this->close(); } void PluginIFDemo_Main::logChanged(QString message) { QStandardItemModel * model = (QStandardItemModel *) ui->logView->model(); model->appendRow(new QStandardItem(message)); } void PluginIFDemo_Main::on_btnSendButtonText_clicked() { if ( ! _toolbar ) return; ext_toolbar_t *item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item ) return; QString entryText = ui->txtButtonName->text(); bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; ext_toolbar_update_value(item, (gpointer) entryText.toStdString().c_str(), silent); } void PluginIFDemo_Main::on_btnSendText_clicked() { if ( ! _toolbar ) return; ext_toolbar_t *item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item ) return; QString entryText = ui->txtEdit->text(); bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; ext_toolbar_update_value(item, (gpointer) entryText.toStdString().c_str(), silent); } void PluginIFDemo_Main::on_chkTestCheckbox_stateChanged(int newState) { if ( ! _toolbar ) return; ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item ) return; bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; ext_toolbar_update_value(item, GINT_TO_POINTER(newState == Qt::Checked ? 1 : 0), silent); } void PluginIFDemo_Main::on_tabInterfaceTypes_currentChanged(int newTab) { proxyModel->setFilterElement((ext_toolbar_item_t) newTab); } void PluginIFDemo_Main::on_cmbElements_currentTextChanged(const QString & newText) { if ( ! _toolbar ) return; ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, newText.toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; listModel->clear(); indexModel->clear(); GList * walker = item->values; while ( walker && walker->data ) { ext_toolbar_value_t * listItem = (ext_toolbar_value_t *)walker->data; QString content = QString("%1: %2").arg(listItem->value).arg(listItem->display); listModel->appendRow(new QStandardItem(content)); indexModel->appendRow(new QStandardItem(listItem->value)); walker = g_list_next(walker); } } void PluginIFDemo_Main::on_btnEnable_clicked() { ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item ) return; ext_toolbar_update_data_set_active(item, true); } void PluginIFDemo_Main::on_btnDisable_clicked() { ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item ) return; ext_toolbar_update_data_set_active(item, false); } void PluginIFDemo_Main::on_btnAddItem_clicked() { if ( ui->txtNewItemDisplay->text().length() <= 0 || ui->txtNewItemValue->text().length() <= 0 ) return; QString content = QString("%1: %2").arg(ui->txtNewItemValue->text()).arg(ui->txtNewItemDisplay->text()); QList<QStandardItem *> items = listModel->findItems(content); if ( items.count() > 0 ) return; items = listModel->findItems(QString("%1: ").arg(ui->txtNewItemValue->text()), Qt::MatchStartsWith); if ( items.count() > 0 ) return; listModel->appendRow(new QStandardItem(content)); if ( ui->chkAddRemoveImmediate->checkState() == Qt::Checked ) { ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; gchar * value = g_strdup(ui->txtNewItemValue->text().toUtf8().constData()); gchar * display = g_strdup(ui->txtNewItemDisplay->text().toUtf8().constData()); ext_toolbar_update_data_add_entry(item, display, value, silent); g_free(value); g_free(display); } } void PluginIFDemo_Main::on_btnRemoveItem_clicked() { QItemSelectionModel * selModel = ui->lstItems->selectionModel(); if ( selModel->selectedIndexes().count() == 0 ) return; QModelIndexList selIndeces = selModel-> selectedIndexes(); foreach(QModelIndex idx, selIndeces) { if ( ui->chkAddRemoveImmediate->checkState() == Qt::Checked ) { ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; QString content = listModel->data(idx).toString(); int pos = static_cast<int>(content.indexOf(":")); gchar * value = g_strdup(content.left(pos).toUtf8().constData() ); /* -2 because removal of : and space */ gchar * display = g_strdup(content.right(content.size() - pos - 2).toUtf8().constData()); ext_toolbar_update_data_remove_entry(item, display, value, silent); g_free(value); g_free(display); } listModel->removeRow(idx.row()); } } void PluginIFDemo_Main::on_btnSendList_clicked() { if ( ! _toolbar ) return; ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; GList * items = NULL; for( int i = 0; i < listModel->rowCount(); i++ ) { QString content = listModel->data(listModel->index(i, 0)).toString(); int pos = static_cast<int>(content.indexOf(":")); ext_toolbar_value_t * valEntry = g_new0(ext_toolbar_value_t, 1); valEntry->value = g_strdup(content.left(pos).toUtf8().constData()); valEntry->display = g_strdup(content.right(content.size() - pos + 1).toUtf8().constData()); items = g_list_append(items, valEntry); } bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; ext_toolbar_update_data(item, items , silent); } void PluginIFDemo_Main::on_btnSendUpdateItem_clicked() { if ( ! _toolbar ) return; ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; QString cmbIndexText = ui->cmbEntryIndex->currentText(); QString displayValue = ui->txtUpdateDisplayValue->text(); if ( displayValue.length() == 0 ) return; bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; ext_toolbar_update_data_by_index(item, (gpointer) displayValue.toStdString().c_str(), (gpointer) cmbIndexText.toStdString().c_str(), silent ); } void PluginIFDemo_Main::on_lstItems_clicked(const QModelIndex &idx) { if ( ! _toolbar || ! idx.isValid() ) return; ext_toolbar_t * item = ext_toolbar_entry_by_label(_toolbar, ui->cmbElements->currentText().toStdString().c_str()); if ( ! item || item->item_type != EXT_TOOLBAR_SELECTOR ) return; bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; QString content = listModel->data(listModel->index(idx.row(), 0)).toString(); int pos = static_cast<int>(content.indexOf(":")); gchar * idxData = g_strdup(content.left(pos).toUtf8().constData() ); ext_toolbar_update_value(item, idxData, silent); g_free(idxData); } /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_main.h
/* pluginifdemo_main.h * * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef PLUGINIFDEMO_MAIN_H_ #define PLUGINIFDEMO_MAIN_H_ #include <QWidget> #include <QDialog> #include <QAbstractButton> #include <QListWidget> #include <QAbstractListModel> #include <QSortFilterProxyModel> #include <QStandardItemModel> #include <epan/plugin_if.h> namespace Ui { class PluginIFDemo_Main; } class PluginIfType { public: PluginIfType(const QString &label, const ext_toolbar_item_t &itemType); QString label() const; ext_toolbar_item_t itemType() const; private: QString m_label; ext_toolbar_item_t m_itemType; }; class PluginIfTypeModel : public QAbstractListModel { Q_OBJECT public: PluginIfTypeModel(QObject * parent = 0); void addPluginIfType(const PluginIfType & pluginIfType); int rowCount(const QModelIndex & parent = QModelIndex()) const; QVariant data(const QModelIndex & idx, int role = Qt::DisplayRole) const; private: QList<PluginIfType> m_pluginIfTypes; }; class PluginIfTypeSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: PluginIfTypeSortFilterProxyModel(QObject * parent = 0); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; void setFilterElement(ext_toolbar_item_t filterType); private: ext_toolbar_item_t m_filterType; }; class PluginIFDemo_Main : public QDialog { Q_OBJECT public: explicit PluginIFDemo_Main(QWidget *parent = 0); ~PluginIFDemo_Main(); void setToolbar(ext_toolbar_t * &toolbar); private slots: void on_buttonBox_clicked(QAbstractButton *button); void on_btnSendButtonText_clicked(); void on_btnSendText_clicked(); void on_btnSendUpdateItem_clicked(); void on_chkTestCheckbox_stateChanged(int newState); void on_tabInterfaceTypes_currentChanged(int newTab); void on_btnAddItem_clicked(); void on_btnRemoveItem_clicked(); void on_btnSendList_clicked(); void on_cmbElements_currentTextChanged(const QString & newText); void on_lstItems_clicked(const QModelIndex &idx); void on_btnEnable_clicked(); void on_btnDisable_clicked(); void logChanged(QString message); void closeDialog(); private: Ui::PluginIFDemo_Main *ui; PluginIfTypeModel * sourceModel; PluginIfTypeSortFilterProxyModel * proxyModel; QStandardItemModel * listModel; QStandardItemModel * indexModel; ext_toolbar_t * _toolbar; }; #endif /* PLUGINIFDEMO_MAIN_H_ */ /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
User Interface
wireshark/plugins/epan/pluginifdemo/ui/pluginifdemo_main.ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>PluginIFDemo_Main</class> <widget class="QDialog" name="PluginIFDemo_Main"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>500</width> <height>570</height> </rect> </property> <property name="minimumSize"> <size> <width>500</width> <height>570</height> </size> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QTabWidget" name="tabInterfaceTypes"> <property name="currentIndex"> <number>3</number> </property> <widget class="QWidget" name="tabBoolean"> <attribute name="title"> <string>Boolean</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QCheckBox" name="chkTestCheckbox"> <property name="text"> <string>Check the value in the toolbar checkbox</string> </property> </widget> </item> <item> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QWidget" name="tabButton"> <attribute name="title"> <string>Button</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_7"> <item> <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0"> <item> <widget class="QLineEdit" name="txtButtonName"> <property name="placeholderText"> <string>Text to be sent to toolbar</string> </property> </widget> </item> <item> <widget class="QPushButton" name="btnSendButtonText"> <property name="text"> <string>Send Text</string> </property> </widget> </item> </layout> </item> <item> <spacer name="verticalSpacer_4"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QWidget" name="tabString"> <attribute name="title"> <string>String</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_5"> <item> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0"> <item> <widget class="QLineEdit" name="txtEdit"> <property name="placeholderText"> <string>Text to be sent to toolbar</string> </property> </widget> </item> <item> <widget class="QPushButton" name="btnSendText"> <property name="text"> <string>Send Text</string> </property> </widget> </item> </layout> </item> <item> <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QWidget" name="tabSelector"> <attribute name="title"> <string>Selector</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QLabel" name="label_2"> <property name="text"> <string>Display:</string> </property> <property name="buddy"> <cstring>txtNewItemDisplay</cstring> </property> </widget> </item> <item> <widget class="QLineEdit" name="txtNewItemDisplay"> <property name="placeholderText"> <string>Enter display text</string> </property> </widget> </item> <item> <widget class="QLabel" name="label_3"> <property name="text"> <string>Value:</string> </property> <property name="buddy"> <cstring>txtNewItemValue</cstring> </property> </widget> </item> <item> <widget class="QLineEdit" name="txtNewItemValue"> <property name="placeholderText"> <string>Enter value text</string> </property> </widget> </item> <item> <widget class="QPushButton" name="btnAddItem"> <property name="text"> <string>Add</string> </property> </widget> </item> </layout> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> <widget class="QListView" name="lstItems"/> </item> <item> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QPushButton" name="btnRemoveItem"> <property name="text"> <string>Remove</string> </property> </widget> </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> <item> <widget class="QPushButton" name="btnSendList"> <property name="text"> <string>Send List</string> </property> </widget> </item> </layout> </item> </layout> </item> <item> <widget class="QCheckBox" name="chkAddRemoveImmediate"> <property name="text"> <string>Add and remove will immediately be send to interface</string> </property> <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> <widget class="QCheckBox" name="chkSendSelect"> <property name="text"> <string>Update interface with selection</string> </property> <property name="checked"> <bool>true</bool> </property> </widget> </item> <item> <widget class="Line" name="line_2"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_6"> <item> <widget class="QLabel" name="label_5"> <property name="text"> <string>Update</string> </property> <property name="buddy"> <cstring>cmbEntryIndex</cstring> </property> </widget> </item> <item> <widget class="QComboBox" name="cmbEntryIndex"/> </item> <item> <widget class="QLabel" name="label_4"> <property name="text"> <string>with</string> </property> <property name="buddy"> <cstring>txtUpdateDisplayValue</cstring> </property> </widget> </item> <item> <widget class="QLineEdit" name="txtUpdateDisplayValue"> <property name="placeholderText"> <string>Enter value text</string> </property> </widget> </item> <item> <widget class="QPushButton" name="btnSendUpdateItem"> <property name="text"> <string>Send</string> </property> </widget> </item> </layout> </item> </layout> </widget> </widget> </item> <item> <widget class="Line" name="line"> <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> <property name="lineWidth"> <number>1</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="text"> <string>Element to be updated</string> </property> <property name="buddy"> <cstring>cmbElements</cstring> </property> </widget> </item> <item row="1" column="0"> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>40</width> <height>20</height> </size> </property> </spacer> </item> <item row="1" column="1"> <widget class="QPushButton" name="btnEnable"> <property name="text"> <string>Enable element</string> </property> </widget> </item> <item row="1" column="2"> <widget class="QPushButton" name="btnDisable"> <property name="text"> <string>Disable element</string> </property> </widget> </item> <item row="0" column="1" colspan="2"> <widget class="QComboBox" name="cmbElements"/> </item> </layout> </item> <item> <widget class="QCheckBox" name="chkSilent"> <property name="text"> <string>Activate updates silently</string> </property> </widget> </item> <item> <widget class="QListView" name="logView"/> </item> <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="standardButtons"> <set>QDialogButtonBox::Close</set> </property> </widget> </item> </layout> </widget> <resources/> <connections/> </ui>
C++
wireshark/plugins/epan/pluginifdemo/ui/uiclasshandler.cpp
/* uiclasshandler.cpp * * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include <config.h> #include <glib.h> #include <QObject> #include <QApplication> #include <QMutex> #include <epan/plugin_if.h> #if defined(_WIN32) #define _WINSOCKAPI_ #endif #include <ui/qt/main_window.h> #include "uihandler.h" #include "pluginifdemo_main.h" #include "pluginifdemo_about.h" QMutex * GuiHandler::singletonMutex = new QMutex(); GuiHandler::GuiHandler() { } GuiHandler * GuiHandler::getInstance() { static GuiHandler * instance = 0; QMutexLocker locker(singletonMutex); if ( instance == 0 ) { instance = new GuiHandler(); } return instance; } void GuiHandler::showAboutDialog(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_) { PluginIFDemo_About * mainwindow = new PluginIFDemo_About(); executeDialog((QDialog*)mainwindow); } void GuiHandler::showMainDialog(ext_menubar_gui_type gui_type _U_, gpointer gui_data _U_) { PluginIFDemo_Main * mainwindow = new PluginIFDemo_Main(); mainwindow->setToolbar(_toolbar); executeDialog((QDialog*)mainwindow); } void GuiHandler::executeDialog(QDialog * dialog) { bool hasGuiApp = (qobject_cast<QApplication*>(QCoreApplication::instance())!=0); if ( ! hasGuiApp ) { /* Necessity for creating the correct app context */ int argc = 1; char * argv = (char *) "Test"; /* In Gtk there is no application context, must be created and displayed */ QApplication app(argc, &argv); dialog->show(); app.exec(); } else { /* With Wireshark Qt, an application context already exists, therefore just * displaying the dialog using show to have it non-modal */ dialog->show(); } } void GuiHandler::doReset() { emit reset(); } void GuiHandler::addLogMessage(QString message) { emit logChanged(message); } void GuiHandler::setToolbar(ext_toolbar_t * toolbar) { _toolbar = toolbar; } /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C++
wireshark/plugins/epan/pluginifdemo/ui/uihandler.cpp
/* uihandler.cpp * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include <config.h> #include <glib.h> #include <QObject> #include <QApplication> #include <epan/plugin_if.h> #include <epan/tap.h> #if defined(_WIN32) #define _WINSOCKAPI_ #endif #include <ui/qt/main_window.h> #include "uihandler.h" #include <ui/simple_dialog.h> static void reset_dialog(void *data _U_) { GuiHandler::getInstance()->doReset(); } void pluginifdemo_ui_main(ext_menubar_gui_type gui_type, gpointer gui_data) { /* ensures, that the dialog is closing, if scm udid is set or a filter is applied */ GString *error_string = register_tap_listener("frame", NULL, NULL, 0, reset_dialog, NULL, NULL, NULL); if (error_string != NULL) { fprintf(stderr, "%s ", error_string->str); g_string_free(error_string, TRUE); } GuiHandler::getInstance()->showMainDialog(gui_type, gui_data); } void pluginifdemo_ui_about(ext_menubar_gui_type gui_type, gpointer gui_data) { GuiHandler::getInstance()->showAboutDialog(gui_type, gui_data); } void pluginifdemo_toolbar_log(const gchar * message) { GuiHandler::getInstance()->addLogMessage(QString(message)); } void pluginifdemo_toolbar_register(ext_toolbar_t * toolbar) { GuiHandler::getInstance()->setToolbar(toolbar); } /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/pluginifdemo/ui/uihandler.h
/* uihandler.h * Author: Roland Knall <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef PLUGINIFDEMO_UI_UIHANDLER_H_ #define PLUGINIFDEMO_UI_UIHANDLER_H_ #ifdef __cplusplus #include <QObject> #include <QDialog> #include <QMutex> #include <epan/plugin_if.h> #include "ws_symbol_export.h" class GuiHandler : public QObject { Q_OBJECT public: static GuiHandler * getInstance(); void showAboutDialog(ext_menubar_gui_type gui_type, gpointer gui_data); void showMainDialog(ext_menubar_gui_type gui_type, gpointer gui_data); void doReset(); void addLogMessage(QString message); void setToolbar(ext_toolbar_t * toolbar); ext_toolbar_t * toolBar(); signals: void reset(); void logChanged(QString newEntry); protected: GuiHandler(); // Stop the compiler generating methods of "copy the object" GuiHandler(GuiHandler const& copy); // Not implemented GuiHandler& operator=(GuiHandler const& copy); // Not implemented private: static QMutex * singletonMutex; ext_toolbar_t * _toolbar; void executeDialog(QDialog * object); }; extern "C" { #endif extern void pluginifdemo_ui_about(ext_menubar_gui_type gui_type, gpointer gui_data); extern void pluginifdemo_ui_main(ext_menubar_gui_type gui_type, gpointer gui_data); extern void pluginifdemo_toolbar_log(const gchar * message); extern void pluginifdemo_toolbar_register(ext_toolbar_t * toolbar); #ifdef __cplusplus } #endif #endif /* BURANALYZER_UI_UIHANDLER_H_ */ /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
wireshark/plugins/epan/profinet/AUTHORS
Author : Ulf Lamping <[email protected]> Tobias Scholz <[email protected]> Birol Capa <[email protected]>
wireshark/plugins/epan/profinet/ChangeLog
Overview of changes in Art-Net Ethereal plugin: Version 0.0.0: * initial implementation Version 0.0.1: * some experiments Version 0.1.0: * first official plugin Version 0.1.1: * fixed some bugs in the PN-IO dissection found with fuzz-test.sh Version 0.1.2: * PN-DCP: dissection of "DHCP/DHCP client identifier" suboption was added Version 0.2.0: * PN-PTCP: add whole new Precision Time Control Protocol dissector Version 0.2.1: * PN-MRP and PN-MRRT: add new Media Redundancy Protocol and Media Redundacy for RealTime Protocol dissector Version 0.2.2: * PN-IO: RT class 3 packets and some more blocks
Text
wireshark/plugins/epan/profinet/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(profinet 0 2 4 0) set(DISSECTOR_SRC packet-dcerpc-pn-io.c packet-dcom-cba.c packet-dcom-cba-acco.c packet-pn-dcp.c packet-pn-mrp.c packet-pn-mrrt.c packet-pn-ptcp.c packet-pn-rt.c packet-pn-rtc-one.c packet-pn-rsi.c ) set(DISSECTOR_SUPPORT_SRC packet-pn.c ) set(PLUGIN_FILES plugin.c ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) add_wireshark_plugin_library(profinet epan) target_link_libraries(profinet epan) install_plugin(profinet epan) file(GLOB DISSECTOR_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME profinet SWITCHES --group dissectors-prohibited --group dissectors-restricted SOURCES ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ${DISSECTOR_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C
wireshark/plugins/epan/profinet/packet-dcerpc-pn-io.c
/* packet-dcerpc-pn-io.c * Routines for PROFINET IO dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* * The PN-IO protocol is a field bus protocol related to decentralized * periphery and is developed by the PROFIBUS Nutzerorganisation e.V. (PNO), * see: www.profibus.com * * * PN-IO is based on the common DCE-RPC and the "lightweight" PN-RT * (ethernet type 0x8892) protocols. * * The context manager (CM) part is handling context information * (like establishing, ...) and is using DCE-RPC as its underlying * protocol. * * The actual cyclic data transfer and acyclic notification uses the * "lightweight" PN-RT protocol. * * There are some other related PROFINET protocols (e.g. PN-DCP, which is * handling addressing topics). * * Please note: the PROFINET CBA protocol is independent of the PN-IO protocol! */ /* * Cyclic PNIO RTC1 Data Dissection: * * To dissect cyclic PNIO RTC1 frames, this plug-in has to collect important module * information out of "Ident OK", "Connect Request" and "Write Response" * frames first. This information will be used within "packet-pn-rtc-one.c" to * dissect PNIO and PROFIsafe RTC1 frames. * * The data of Stationname-, -type and -id will be gained out of * packet-pn-dcp.c. The header packet-pn.h will save those data. * * Overview for cyclic PNIO RTC1 data dissection functions: * -> dissect_IOCRBlockReq_block (Save amount of IODataObjects, IOCS) * -> dissect_DataDescription (Save important values for cyclic data) * -> dissect_ExpectedSubmoduleBlockReq_block (Get GSD information) * -> dissect_ModuleDiffBlock_block (Module has different ID) * -> dissect_ProfiSafeParameterRequest (Save PROFIsafe parameters) * -> dissect_RecordDataWrite (Call ProfiSafeParameterRequest) * -> pnio_rtc1_cleanup (Reset routine of saved RTC1 information) */ #include "config.h" #include <string.h> #include <glib.h> #include <epan/packet.h> #include <epan/to_str.h> #include <epan/wmem_scopes.h> #include <epan/dissectors/packet-dcerpc.h> #include <epan/expert.h> #include <epan/conversation_filter.h> #include <epan/proto_data.h> #include <wsutil/file_util.h> #include <epan/prefs.h> #include "packet-pn.h" #include <stdio.h> #include <stdlib.h> void proto_register_pn_io(void); void proto_reg_handoff_pn_io(void); #define MAX_NAMELENGTH 200 /* max. length of the given paths */ #define F_MESSAGE_TRAILER_4BYTE 4 /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte */ #define PN_INPUT_CR 1 /* PROFINET Input Connect Request value */ #define PN_INPUT_DATADESCRITPION 1 /* PROFINET Input Data Description value */ #define PA_PROFILE_API 0x9700u #define PA_PROFILE_DAP_MASK 0xFFFF0000u #define PA_PROFILE_DAP_IDENT 0x00FD0000u #define PA_PROFILE_BLOCK_DAP 0u #define PA_PROFILE_BLOCK_PB 1u #define PA_PROFILE_BLOCK_FB 2u #define PA_PROFILE_BLOCK_TB 3u #define PA_PROFILE_TB_PARENT_PRESSURE 1u #define PA_PROFILE_TB_PARENT_TEMPERATURE 2u #define PA_PROFILE_TB_PARENT_FLOW 3u #define PA_PROFILE_TB_PARENT_LEVEL 1u #define PA_PROFILE_TB_PARENT_ACTUATOR 1u #define PA_PROFILE_TB_PARENT_DISCRETE_IO 1u #define PA_PROFILE_TB_PARENT_LIQUID_ANALYZER 1u #define PA_PROFILE_TB_PARENT_GAS_ANALYZER 1u #define PA_PROFILE_TB_PARENT_ENUMERATED_IO 1u #define PA_PROFILE_TB_PARENT_BINARY_IO 1u static int proto_pn_io = -1; static int proto_pn_io_device = -1; static int proto_pn_io_controller = -1; static int proto_pn_io_supervisor = -1; static int proto_pn_io_parameterserver = -1; static int proto_pn_io_implicitar = -1; int proto_pn_io_apdu_status = -1; int proto_pn_io_time_aware_status = -1; static int hf_pn_io_opnum = -1; static int hf_pn_io_reserved16 = -1; static int hf_pn_io_array = -1; static int hf_pn_io_args_max = -1; static int hf_pn_io_args_len = -1; static int hf_pn_io_array_max_count = -1; static int hf_pn_io_array_offset = -1; static int hf_pn_io_array_act_count = -1; static int hf_pn_io_ar_type = -1; static int hf_pn_io_artype_req = -1; static int hf_pn_io_cminitiator_macadd = -1; static int hf_pn_io_cminitiator_objectuuid = -1; static int hf_pn_io_parameter_server_objectuuid = -1; static int hf_pn_io_ar_data = -1; static int hf_pn_io_ar_properties = -1; static int hf_pn_io_ar_properties_state = -1; static int hf_pn_io_ar_properties_supervisor_takeover_allowed = -1; static int hf_pn_io_ar_properties_parameterization_server = -1; /* removed within 2.3 static int hf_pn_io_ar_properties_data_rate = -1; */ static int hf_pn_io_ar_properties_reserved_1 = -1; static int hf_pn_io_ar_properties_device_access = -1; static int hf_pn_io_ar_properties_companion_ar = -1; static int hf_pn_io_ar_properties_achnowledge_companion_ar = -1; static int hf_pn_io_ar_properties_reserved = -1; static int hf_pn_io_ar_properties_time_aware_system = -1; static int hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode = -1; static int hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode = -1; static int hf_pn_io_ar_properties_pull_module_alarm_allowed = -1; static int hf_pn_RedundancyInfo = -1; static int hf_pn_RedundancyInfo_reserved = -1; static int hf_pn_io_number_of_ARDATAInfo = -1; static int hf_pn_io_cminitiator_activitytimeoutfactor = -1; static int hf_pn_io_cminitiator_udprtport = -1; static int hf_pn_io_station_name_length = -1; static int hf_pn_io_cminitiator_station_name = -1; /* static int hf_pn_io_responder_station_name = -1; */ static int hf_pn_io_arproperties_StartupMode = -1; static int hf_pn_io_parameter_server_station_name = -1; static int hf_pn_io_cmresponder_macadd = -1; static int hf_pn_io_cmresponder_udprtport = -1; static int hf_pn_io_number_of_iocrs = -1; static int hf_pn_io_iocr_tree = -1; static int hf_pn_io_iocr_type = -1; static int hf_pn_io_iocr_reference = -1; static int hf_pn_io_iocr_SubframeOffset = -1; static int hf_pn_io_iocr_SubframeData =-1; /* static int hf_pn_io_iocr_txports_port = -1; */ /* static int hf_pn_io_iocr_txports_redundantport = -1; */ static int hf_pn_io_sr_properties_Reserved_1 = -1; static int hf_pn_io_sr_properties_Mode = -1; static int hf_pn_io_sr_properties_Reserved_2 = -1; static int hf_pn_io_sr_properties_Reserved_3 = -1; static int hf_pn_io_RedundancyDataHoldFactor = -1; static int hf_pn_io_sr_properties = -1; static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0 = -1; static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1 = -1; static int hf_pn_io_arvendor_strucidentifier_if0_low = -1; static int hf_pn_io_arvendor_strucidentifier_if0_high = -1; static int hf_pn_io_arvendor_strucidentifier_if0_is8000= -1; static int hf_pn_io_arvendor_strucidentifier_not0 = -1; static int hf_pn_io_lt = -1; static int hf_pn_io_iocr_properties = -1; static int hf_pn_io_iocr_properties_rtclass = -1; static int hf_pn_io_iocr_properties_reserved_1 = -1; static int hf_pn_io_iocr_properties_media_redundancy = -1; static int hf_pn_io_iocr_properties_reserved_2 = -1; static int hf_pn_io_iocr_properties_reserved_3 = -1; static int hf_pn_io_iocr_properties_fast_forwarding_mac_adr = -1; static int hf_pn_io_iocr_properties_distributed_subframe_watchdog = -1; static int hf_pn_io_iocr_properties_full_subframe_structure = -1; static int hf_pn_io_data_length = -1; static int hf_pn_io_ir_frame_data = -1; static int hf_pn_io_frame_id = -1; static int hf_pn_io_send_clock_factor = -1; static int hf_pn_io_reduction_ratio = -1; static int hf_pn_io_phase = -1; static int hf_pn_io_sequence = -1; static int hf_pn_io_frame_send_offset = -1; static int hf_pn_io_frame_data_properties = -1; static int hf_pn_io_frame_data_properties_forwarding_Mode = -1; static int hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd = -1; static int hf_pn_io_frame_data_properties_FragmentMode = -1; static int hf_pn_io_frame_data_properties_reserved_1 = -1; static int hf_pn_io_frame_data_properties_reserved_2 = -1; static int hf_pn_io_watchdog_factor = -1; static int hf_pn_io_data_hold_factor = -1; static int hf_pn_io_iocr_tag_header = -1; static int hf_pn_io_iocr_multicast_mac_add = -1; static int hf_pn_io_number_of_apis = -1; static int hf_pn_io_number_of_io_data_objects = -1; static int hf_pn_io_io_data_object_frame_offset = -1; static int hf_pn_io_number_of_iocs = -1; static int hf_pn_io_iocs_frame_offset = -1; static int hf_pn_io_SFIOCRProperties = -1; static int hf_pn_io_DistributedWatchDogFactor = -1; static int hf_pn_io_RestartFactorForDistributedWD = -1; static int hf_pn_io_SFIOCRProperties_DFPmode = -1; static int hf_pn_io_SFIOCRProperties_reserved_1 = -1; static int hf_pn_io_SFIOCRProperties_reserved_2 = -1; static int hf_pn_io_SFIOCRProperties_DFPType =-1; static int hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout = -1; static int hf_pn_io_SFIOCRProperties_SFCRC16 = -1; static int hf_pn_io_subframe_data = -1; static int hf_pn_io_subframe_data_reserved1 = -1; static int hf_pn_io_subframe_data_reserved2 = -1; static int hf_pn_io_subframe_data_position = -1; static int hf_pn_io_subframe_reserved1 = -1; static int hf_pn_io_subframe_data_length = -1; static int hf_pn_io_subframe_reserved2 = -1; static int hf_pn_io_alarmcr_type = -1; static int hf_pn_io_alarmcr_properties = -1; static int hf_pn_io_alarmcr_properties_priority = -1; static int hf_pn_io_alarmcr_properties_transport = -1; static int hf_pn_io_alarmcr_properties_reserved = -1; static int hf_pn_io_rta_timeoutfactor = -1; static int hf_pn_io_rta_retries = -1; static int hf_pn_io_localalarmref = -1; static int hf_pn_io_remotealarmref = -1; static int hf_pn_io_maxalarmdatalength = -1; static int hf_pn_io_alarmcr_tagheaderhigh = -1; static int hf_pn_io_alarmcr_tagheaderlow = -1; static int hf_pn_io_IRData_uuid = -1; static int hf_pn_io_ar_uuid = -1; static int hf_pn_io_target_ar_uuid = -1; static int hf_pn_io_ar_discriminator = -1; static int hf_pn_io_ar_configid = -1; static int hf_pn_io_ar_arnumber = -1; static int hf_pn_io_ar_arresource = -1; static int hf_pn_io_ar_arreserved = -1; static int hf_pn_io_ar_selector = -1; static int hf_pn_io_api_tree = -1; static int hf_pn_io_module_tree = -1; static int hf_pn_io_submodule_tree = -1; static int hf_pn_io_io_data_object = -1; /* General module information */ static int hf_pn_io_io_cs = -1; static int hf_pn_io_substitutionmode = -1; static int hf_pn_io_api = -1; static int hf_pn_io_slot_nr = -1; static int hf_pn_io_subslot_nr = -1; static int hf_pn_io_index = -1; static int hf_pn_io_seq_number = -1; static int hf_pn_io_record_data_length = -1; static int hf_pn_io_add_val1 = -1; static int hf_pn_io_add_val2 = -1; static int hf_pn_io_block = -1; static int hf_pn_io_block_header = -1; static int hf_pn_io_block_type = -1; static int hf_pn_io_block_length = -1; static int hf_pn_io_block_version_high = -1; static int hf_pn_io_block_version_low = -1; static int hf_pn_io_sessionkey = -1; static int hf_pn_io_control_alarm_sequence_number = -1; static int hf_pn_io_control_command = -1; static int hf_pn_io_control_command_prmend = -1; static int hf_pn_io_control_command_applready = -1; static int hf_pn_io_control_command_release = -1; static int hf_pn_io_control_command_done = -1; static int hf_pn_io_control_command_ready_for_companion = -1; static int hf_pn_io_control_command_ready_for_rt_class3 = -1; static int hf_pn_io_control_command_prmbegin = -1; static int hf_pn_io_control_command_reserved_7_15 = -1; static int hf_pn_io_control_block_properties = -1; static int hf_pn_io_control_block_properties_applready = -1; static int hf_pn_io_control_block_properties_applready_bit0 = -1; static int hf_pn_io_control_block_properties_applready_bit1 = -1; static int hf_pn_io_control_block_properties_applready_otherbits = -1; /* static int hf_pn_io_AlarmSequenceNumber = -1; */ static int hf_pn_io_control_command_reserved = -1; static int hf_pn_io_SubmoduleListEntries = -1; static int hf_pn_io_alarm_type = -1; static int hf_pn_io_alarm_specifier = -1; static int hf_pn_io_alarm_specifier_sequence = -1; static int hf_pn_io_alarm_specifier_channel = -1; static int hf_pn_io_alarm_specifier_manufacturer = -1; static int hf_pn_io_alarm_specifier_submodule = -1; static int hf_pn_io_alarm_specifier_ardiagnosis = -1; static int hf_pn_io_alarm_dst_endpoint = -1; static int hf_pn_io_alarm_src_endpoint = -1; static int hf_pn_io_pdu_type = -1; static int hf_pn_io_pdu_type_type = -1; static int hf_pn_io_pdu_type_version = -1; static int hf_pn_io_add_flags = -1; static int hf_pn_io_window_size = -1; static int hf_pn_io_tack = -1; static int hf_pn_io_send_seq_num = -1; static int hf_pn_io_ack_seq_num = -1; static int hf_pn_io_var_part_len = -1; static int hf_pn_io_number_of_modules = -1; static int hf_pn_io_module_ident_number = -1; static int hf_pn_io_module_properties = -1; static int hf_pn_io_module_state = -1; static int hf_pn_io_number_of_submodules = -1; static int hf_pn_io_submodule_ident_number = -1; static int hf_pn_io_submodule_properties = -1; static int hf_pn_io_submodule_properties_type = -1; static int hf_pn_io_submodule_properties_shared_input = -1; static int hf_pn_io_submodule_properties_reduce_input_submodule_data_length = -1; static int hf_pn_io_submodule_properties_reduce_output_submodule_data_length = -1; static int hf_pn_io_submodule_properties_discard_ioxs = -1; static int hf_pn_io_submodule_properties_reserved = -1; static int hf_pn_io_submodule_state = -1; static int hf_pn_io_submodule_state_format_indicator = -1; static int hf_pn_io_submodule_state_add_info = -1; static int hf_pn_io_submodule_state_advice = -1; static int hf_pn_io_submodule_state_maintenance_required = -1; static int hf_pn_io_submodule_state_maintenance_demanded = -1; static int hf_pn_io_submodule_state_fault = -1; static int hf_pn_io_submodule_state_ar_info = -1; static int hf_pn_io_submodule_state_ident_info = -1; static int hf_pn_io_submodule_state_detail = -1; static int hf_pn_io_data_description_tree = -1; static int hf_pn_io_data_description = -1; static int hf_pn_io_submodule_data_length = -1; static int hf_pn_io_length_iocs = -1; static int hf_pn_io_length_iops = -1; static int hf_pn_io_iocs = -1; static int hf_pn_io_iops = -1; static int hf_pn_io_ioxs_extension = -1; static int hf_pn_io_ioxs_res14 = -1; static int hf_pn_io_ioxs_instance = -1; static int hf_pn_io_ioxs_datastate = -1; static int hf_pn_io_address_resolution_properties = -1; static int hf_pn_io_mci_timeout_factor = -1; static int hf_pn_io_provider_station_name = -1; static int hf_pn_io_user_structure_identifier = -1; static int hf_pn_io_user_structure_identifier_manf = -1; static int hf_pn_io_channel_number = -1; static int hf_pn_io_channel_properties = -1; static int hf_pn_io_channel_properties_type = -1; static int hf_pn_io_channel_properties_accumulative = -1; static int hf_pn_io_channel_properties_maintenance = -1; static int hf_pn_io_NumberOfSubframeBlocks = -1; static int hf_pn_io_channel_properties_specifier = -1; static int hf_pn_io_channel_properties_direction = -1; static int hf_pn_io_channel_error_type = -1; static int hf_pn_io_ext_channel_error_type0 = -1; static int hf_pn_io_ext_channel_error_type0x8000 = -1; static int hf_pn_io_ext_channel_error_type0x8001 = -1; static int hf_pn_io_ext_channel_error_type0x8002 = -1; static int hf_pn_io_ext_channel_error_type0x8003 = -1; static int hf_pn_io_ext_channel_error_type0x8004 = -1; static int hf_pn_io_ext_channel_error_type0x8005 = -1; static int hf_pn_io_ext_channel_error_type0x8007 = -1; static int hf_pn_io_ext_channel_error_type0x8008 = -1; static int hf_pn_io_ext_channel_error_type0x800A = -1; static int hf_pn_io_ext_channel_error_type0x800B = -1; static int hf_pn_io_ext_channel_error_type0x800C = -1; static int hf_pn_io_ext_channel_error_type0x8010 = -1; static int hf_pn_io_ext_channel_error_type = -1; static int hf_pn_io_ext_channel_add_value = -1; static int hf_pn_io_qualified_channel_qualifier = -1; static int hf_pn_io_ptcp_subdomain_id = -1; static int hf_pn_io_ir_data_id = -1; static int hf_pn_io_max_bridge_delay = -1; static int hf_pn_io_number_of_ports = -1; static int hf_pn_io_max_port_tx_delay = -1; static int hf_pn_io_max_port_rx_delay = -1; static int hf_pn_io_max_line_rx_delay = -1; static int hf_pn_io_yellowtime = -1; static int hf_pn_io_reserved_interval_begin = -1; static int hf_pn_io_reserved_interval_end = -1; static int hf_pn_io_pllwindow = -1; static int hf_pn_io_sync_send_factor = -1; static int hf_pn_io_sync_properties = -1; static int hf_pn_io_sync_frame_address = -1; static int hf_pn_io_ptcp_timeout_factor = -1; static int hf_pn_io_ptcp_takeover_timeout_factor = -1; static int hf_pn_io_ptcp_master_startup_time = -1; static int hf_pn_io_ptcp_master_priority_1 = -1; static int hf_pn_io_ptcp_master_priority_2 = -1; static int hf_pn_io_ptcp_length_subdomain_name = -1; static int hf_pn_io_ptcp_subdomain_name = -1; static int hf_pn_io_MultipleInterfaceMode_NameOfDevice = -1; static int hf_pn_io_MultipleInterfaceMode_reserved_1 = -1; static int hf_pn_io_MultipleInterfaceMode_reserved_2 = -1; /* added Portstatistics */ static int hf_pn_io_pdportstatistic_counter_status = -1; static int hf_pn_io_pdportstatistic_counter_status_ifInOctets = -1; static int hf_pn_io_pdportstatistic_counter_status_ifOutOctets = -1; static int hf_pn_io_pdportstatistic_counter_status_ifInDiscards = -1; static int hf_pn_io_pdportstatistic_counter_status_ifOutDiscards = -1; static int hf_pn_io_pdportstatistic_counter_status_ifInErrors = -1; static int hf_pn_io_pdportstatistic_counter_status_ifOutErrors = -1; static int hf_pn_io_pdportstatistic_counter_status_reserved = -1; static int hf_pn_io_pdportstatistic_ifInOctets = -1; static int hf_pn_io_pdportstatistic_ifOutOctets = -1; static int hf_pn_io_pdportstatistic_ifInDiscards = -1; static int hf_pn_io_pdportstatistic_ifOutDiscards = -1; static int hf_pn_io_pdportstatistic_ifInErrors = -1; static int hf_pn_io_pdportstatistic_ifOutErrors = -1; /* end of port statistics */ static int hf_pn_io_domain_boundary = -1; static int hf_pn_io_domain_boundary_ingress = -1; static int hf_pn_io_domain_boundary_egress = -1; static int hf_pn_io_multicast_boundary = -1; static int hf_pn_io_adjust_properties = -1; static int hf_pn_io_PreambleLength = -1; static int hf_pn_io_mau_type = -1; static int hf_pn_io_mau_type_mode = -1; static int hf_pn_io_port_state = -1; static int hf_pn_io_link_state_port = -1; static int hf_pn_io_link_state_link = -1; static int hf_pn_io_line_delay = -1; static int hf_pn_io_line_delay_value = -1; static int hf_pn_io_cable_delay_value = -1; static int hf_pn_io_line_delay_format_indicator = -1; static int hf_pn_io_number_of_peers = -1; static int hf_pn_io_length_peer_port_id = -1; static int hf_pn_io_peer_port_id = -1; static int hf_pn_io_length_peer_chassis_id = -1; static int hf_pn_io_peer_chassis_id = -1; static int hf_pn_io_neighbor = -1; static int hf_pn_io_length_peer_port_name = -1; static int hf_pn_io_peer_port_name = -1; static int hf_pn_io_length_peer_station_name = -1; static int hf_pn_io_peer_station_name = -1; static int hf_pn_io_length_own_port_id = -1; static int hf_pn_io_own_port_id = -1; static int hf_pn_io_peer_macadd = -1; static int hf_pn_io_media_type = -1; static int hf_pn_io_macadd = -1; static int hf_pn_io_length_own_chassis_id = -1; static int hf_pn_io_own_chassis_id = -1; static int hf_pn_io_rtclass3_port_status = -1; static int hf_pn_io_ethertype = -1; static int hf_pn_io_rx_port = -1; static int hf_pn_io_frame_details = -1; static int hf_pn_io_frame_details_sync_frame = -1; static int hf_pn_io_frame_details_meaning_frame_send_offset = -1; static int hf_pn_io_frame_details_reserved = -1; static int hf_pn_io_nr_of_tx_port_groups = -1; static int hf_pn_io_TxPortGroupProperties = -1; static int hf_pn_io_TxPortGroupProperties_bit0 = -1; static int hf_pn_io_TxPortGroupProperties_bit1 = -1; static int hf_pn_io_TxPortGroupProperties_bit2 = -1; static int hf_pn_io_TxPortGroupProperties_bit3 = -1; static int hf_pn_io_TxPortGroupProperties_bit4 = -1; static int hf_pn_io_TxPortGroupProperties_bit5 = -1; static int hf_pn_io_TxPortGroupProperties_bit6 = -1; static int hf_pn_io_TxPortGroupProperties_bit7 = -1; static int hf_pn_io_start_of_red_frame_id = -1; static int hf_pn_io_end_of_red_frame_id = -1; static int hf_pn_io_ir_begin_end_port = -1; static int hf_pn_io_number_of_assignments = -1; static int hf_pn_io_number_of_phases = -1; static int hf_pn_io_red_orange_period_begin_tx = -1; static int hf_pn_io_orange_period_begin_tx = -1; static int hf_pn_io_green_period_begin_tx = -1; static int hf_pn_io_red_orange_period_begin_rx = -1; static int hf_pn_io_orange_period_begin_rx = -1; static int hf_pn_io_green_period_begin_rx = -1; /* static int hf_pn_io_tx_phase_assignment = -1; */ static int hf_pn_ir_tx_phase_assignment = -1; static int hf_pn_ir_rx_phase_assignment = -1; static int hf_pn_io_tx_phase_assignment_begin_value = -1; static int hf_pn_io_tx_phase_assignment_orange_begin = -1; static int hf_pn_io_tx_phase_assignment_end_reserved = -1; static int hf_pn_io_tx_phase_assignment_reserved = -1; /* static int hf_pn_io_rx_phase_assignment = -1; */ static int hf_pn_io_slot = -1; static int hf_pn_io_subslot = -1; static int hf_pn_io_number_of_slots = -1; static int hf_pn_io_number_of_subslots = -1; /* static int hf_pn_io_maintenance_required_drop_budget = -1; */ /* static int hf_pn_io_maintenance_demanded_drop_budget = -1; */ /* static int hf_pn_io_error_drop_budget = -1; */ static int hf_pn_io_tsn_number_of_queues = -1; static int hf_pn_io_tsn_max_supported_record_size = -1; static int hf_pn_io_tsn_transfer_time_tx = -1; static int hf_pn_io_tsn_transfer_time_rx = -1; static int hf_pn_io_tsn_port_capabilities_time_aware = -1; static int hf_pn_io_tsn_port_capabilities_preemption = -1; static int hf_pn_io_tsn_port_capabilities_queue_masking = -1; static int hf_pn_io_tsn_port_capabilities_reserved = -1; static int hf_pn_io_tsn_forwarding_group = -1; static int hf_pn_io_tsn_forwarding_group_ingress = -1; static int hf_pn_io_tsn_forwarding_group_egress = -1; static int hf_pn_io_tsn_stream_class = -1; static int hf_pn_io_tsn_dependent_forwarding_delay = -1; static int hf_pn_io_tsn_independent_forwarding_delay = -1; static int hf_pn_io_tsn_forwarding_delay_block_number_of_entries = -1; static int hf_pn_io_tsn_expected_neighbor_block_number_of_entries = -1; static int hf_pn_io_tsn_port_id_block_number_of_entries = -1; static int hf_pn_io_tsn_nme_parameter_uuid = -1; static int hf_pn_io_tsn_domain_vid_config = -1; static int hf_pn_io_tsn_domain_vid_config_stream_high_vid = -1; static int hf_pn_io_tsn_domain_vid_config_stream_high_red_vid = -1; static int hf_pn_io_tsn_domain_vid_config_stream_low_vid = -1; static int hf_pn_io_tsn_domain_vid_config_stream_low_red_vid = -1; static int hf_pn_io_tsn_domain_vid_config_non_stream_vid = -1; static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_B = -1; static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_C = -1; static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_D = -1; static int hf_pn_io_tsn_domain_vid_config_reserved = -1; static int hf_pn_io_number_of_tsn_time_data_block_entries = -1; static int hf_pn_io_number_of_tsn_domain_queue_rate_limiter_entries = -1; static int hf_pn_io_number_of_tsn_domain_port_ingress_rate_limiter_entries = -1; static int hf_pn_io_number_of_tsn_domain_port_config_entries = -1; static int hf_pn_io_tsn_domain_port_config = -1; static int hf_pn_io_tsn_domain_port_config_preemption_enabled = -1; static int hf_pn_io_tsn_domain_port_config_boundary_port_config = -1; static int hf_pn_io_tsn_domain_port_config_reserved = -1; static int hf_pn_io_tsn_domain_port_ingress_rate_limiter = -1; static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_cir = -1; static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_cbs = -1; static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_envelope = -1; static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_rank = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_cir = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_cbs = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_envelope = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_rank = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_queue_id = -1; static int hf_pn_io_tsn_domain_queue_rate_limiter_reserved = -1; static int hf_pn_io_number_of_tsn_domain_queue_config_entries = -1; static int hf_pn_io_tsn_domain_queue_config = -1; static int hf_pn_io_tsn_domain_queue_config_queue_id = -1; static int hf_pn_io_tsn_domain_queue_config_tci_pcp = -1; static int hf_pn_io_tsn_domain_queue_config_shaper = -1; static int hf_pn_io_tsn_domain_queue_config_preemption_mode = -1; static int hf_pn_io_tsn_domain_queue_config_unmask_time_offset = -1; static int hf_pn_io_tsn_domain_queue_config_mask_time_offset = -1; static int hf_pn_io_network_deadline = -1; static int hf_pn_io_time_domain_number = -1; static int hf_pn_io_time_pll_window = -1; static int hf_pn_io_message_interval_factor = -1; static int hf_pn_io_message_timeout_factor = -1; static int hf_pn_io_time_sync_properties = -1; static int hf_pn_io_time_sync_properties_role = -1; static int hf_pn_io_time_sync_properties_reserved = -1; static int hf_pn_io_time_domain_uuid = -1; static int hf_pn_io_time_domain_name_length = -1; static int hf_pn_io_time_domain_name = -1; static int hf_pn_io_tsn_nme_name_uuid = -1; static int hf_pn_io_tsn_nme_name_length = -1; static int hf_pn_io_tsn_nme_name = -1; static int hf_pn_io_tsn_domain_uuid = -1; static int hf_pn_io_tsn_domain_name_length = -1; static int hf_pn_io_tsn_domain_name = -1; static int hf_pn_io_tsn_fdb_command = -1; static int hf_pn_io_tsn_dst_add = -1; static int hf_pn_io_number_of_tsn_domain_sync_tree_entries = -1; static int hf_pn_io_tsn_domain_sync_port_role = -1; static int hf_pn_io_tsn_domain_port_id = -1; static int hf_pn_io_maintenance_required_power_budget = -1; static int hf_pn_io_maintenance_demanded_power_budget = -1; static int hf_pn_io_error_power_budget = -1; static int hf_pn_io_fiber_optic_type = -1; static int hf_pn_io_fiber_optic_cable_type = -1; static int hf_pn_io_controller_appl_cycle_factor = -1; static int hf_pn_io_time_data_cycle = -1; static int hf_pn_io_time_io_input = -1; static int hf_pn_io_time_io_output = -1; static int hf_pn_io_time_io_input_valid = -1; static int hf_pn_io_time_io_output_valid = -1; static int hf_pn_io_maintenance_status = -1; static int hf_pn_io_maintenance_status_required = -1; static int hf_pn_io_maintenance_status_demanded = -1; static int hf_pn_io_vendor_id_high = -1; static int hf_pn_io_vendor_id_low = -1; static int hf_pn_io_vendor_block_type = -1; static int hf_pn_io_order_id = -1; static int hf_pn_io_im_serial_number = -1; static int hf_pn_io_im_hardware_revision = -1; static int hf_pn_io_im_revision_prefix = -1; static int hf_pn_io_im_sw_revision_functional_enhancement = -1; static int hf_pn_io_im_revision_bugfix = -1; static int hf_pn_io_im_sw_revision_internal_change = -1; static int hf_pn_io_im_revision_counter = -1; static int hf_pn_io_im_profile_id = -1; static int hf_pn_io_im_profile_specific_type = -1; static int hf_pn_io_im_version_major = -1; static int hf_pn_io_im_version_minor = -1; static int hf_pn_io_im_supported = -1; static int hf_pn_io_im_numberofentries = -1; static int hf_pn_io_im_annotation = -1; static int hf_pn_io_im_order_id = -1; static int hf_pn_io_number_of_ars = -1; static int hf_pn_io_cycle_counter = -1; static int hf_pn_io_data_status = -1; static int hf_pn_io_data_status_res67 = -1; static int hf_pn_io_data_status_ok = -1; static int hf_pn_io_data_status_operate = -1; static int hf_pn_io_data_status_res3 = -1; static int hf_pn_io_data_status_valid = -1; static int hf_pn_io_data_status_res1 = -1; static int hf_pn_io_data_status_primary = -1; static int hf_pn_io_transfer_status = -1; static int hf_pn_io_actual_local_time_stamp = -1; static int hf_pn_io_number_of_log_entries = -1; static int hf_pn_io_local_time_stamp = -1; static int hf_pn_io_entry_detail = -1; static int hf_pn_io_ip_address = -1; static int hf_pn_io_subnetmask = -1; static int hf_pn_io_standard_gateway = -1; static int hf_pn_io_mrp_domain_uuid = -1; static int hf_pn_io_mrp_role = -1; static int hf_pn_io_mrp_length_domain_name = -1; static int hf_pn_io_mrp_domain_name = -1; static int hf_pn_io_mrp_instances = -1; static int hf_pn_io_mrp_instance = -1; static int hf_pn_io_mrp_prio = -1; static int hf_pn_io_mrp_topchgt = -1; static int hf_pn_io_mrp_topnrmax = -1; static int hf_pn_io_mrp_tstshortt = -1; static int hf_pn_io_mrp_tstdefaultt = -1; static int hf_pn_io_mrp_tstnrmax = -1; static int hf_pn_io_mrp_check = -1; static int hf_pn_io_mrp_check_mrm = -1; static int hf_pn_io_mrp_check_mrpdomain = -1; static int hf_pn_io_mrp_check_reserved_1 = -1; static int hf_pn_io_mrp_check_reserved_2 = -1; static int hf_pn_io_mrp_rtmode = -1; static int hf_pn_io_mrp_rtmode_rtclass12 = -1; static int hf_pn_io_mrp_rtmode_rtclass3 = -1; static int hf_pn_io_mrp_rtmode_reserved1 = -1; static int hf_pn_io_mrp_rtmode_reserved2 = -1; static int hf_pn_io_mrp_lnkdownt = -1; static int hf_pn_io_mrp_lnkupt = -1; static int hf_pn_io_mrp_lnknrmax = -1; static int hf_pn_io_mrp_version = -1; static int hf_pn_io_substitute_active_flag = -1; static int hf_pn_io_length_data = -1; static int hf_pn_io_mrp_ring_state = -1; static int hf_pn_io_mrp_rt_state = -1; static int hf_pn_io_im_tag_function = -1; static int hf_pn_io_im_tag_location = -1; static int hf_pn_io_im_date = -1; static int hf_pn_io_im_descriptor = -1; static int hf_pn_io_fs_hello_mode = -1; static int hf_pn_io_fs_hello_interval = -1; static int hf_pn_io_fs_hello_retry = -1; static int hf_pn_io_fs_hello_delay = -1; static int hf_pn_io_fs_parameter_mode = -1; static int hf_pn_io_fs_parameter_uuid = -1; static int hf_pn_io_check_sync_mode = -1; static int hf_pn_io_check_sync_mode_reserved = -1; static int hf_pn_io_check_sync_mode_sync_master = -1; static int hf_pn_io_check_sync_mode_cable_delay = -1; /* PROFIsafe fParameters */ static int hf_pn_io_ps_f_prm_flag1 = -1; static int hf_pn_io_ps_f_prm_flag1_chck_seq = -1; static int hf_pn_io_ps_f_prm_flag1_chck_ipar = -1; static int hf_pn_io_ps_f_prm_flag1_sil = -1; static int hf_pn_io_ps_f_prm_flag1_crc_len = -1; static int hf_pn_io_ps_f_prm_flag1_crc_seed = -1; static int hf_pn_io_ps_f_prm_flag1_reserved = -1; static int hf_pn_io_ps_f_prm_flag2 = -1; static int hf_pn_io_ps_f_wd_time = -1; static int hf_pn_io_ps_f_ipar_crc = -1; static int hf_pn_io_ps_f_par_crc = -1; static int hf_pn_io_ps_f_src_adr = -1; static int hf_pn_io_ps_f_dest_adr = -1; static int hf_pn_io_ps_f_prm_flag2_reserved = -1; static int hf_pn_io_ps_f_prm_flag2_f_block_id = -1; static int hf_pn_io_ps_f_prm_flag2_f_par_version = -1; static int hf_pn_io_profidrive_request_reference = -1; static int hf_pn_io_profidrive_request_id = -1; static int hf_pn_io_profidrive_do_id = -1; static int hf_pn_io_profidrive_no_of_parameters = -1; static int hf_pn_io_profidrive_response_id = -1; static int hf_pn_io_profidrive_param_attribute = -1; static int hf_pn_io_profidrive_param_no_of_elems = -1; static int hf_pn_io_profidrive_param_number = -1; static int hf_pn_io_profidrive_param_subindex = -1; static int hf_pn_io_profidrive_param_format = -1; static int hf_pn_io_profidrive_param_no_of_values = -1; static int hf_pn_io_profidrive_param_value_byte = -1; static int hf_pn_io_profidrive_param_value_word = -1; static int hf_pn_io_profidrive_param_value_dword = -1; static int hf_pn_io_profidrive_param_value_float = -1; static int hf_pn_io_profidrive_param_value_string = -1; static int hf_pn_io_profidrive_param_value_error = -1; static int hf_pn_io_profidrive_param_value_error_sub = -1; /* Sequence of Events - Reporting System Alarm/Event Information */ static int hf_pn_io_rs_alarm_info_reserved_0_7 = -1; static int hf_pn_io_rs_alarm_info_reserved_8_15 = -1; static int hf_pn_io_rs_alarm_info = -1; static int hf_pn_io_rs_event_info = -1; static int hf_pn_io_rs_event_block = -1; static int hf_pn_io_rs_adjust_block = -1; static int hf_pn_io_rs_event_data_extension = -1; static int hf_pn_io_number_of_rs_event_info = -1; static int hf_pn_io_rs_block_type = -1; static int hf_pn_io_rs_block_length = -1; static int hf_pn_io_rs_specifier = -1; static int hf_pn_io_rs_specifier_sequence = -1; static int hf_pn_io_rs_specifier_reserved = -1; static int hf_pn_io_rs_specifier_specifier = -1; static int hf_pn_io_rs_time_stamp = -1; static int hf_pn_io_rs_time_stamp_status = -1; static int hf_pn_io_rs_time_stamp_value = -1; static int hf_pn_io_rs_minus_error = -1; static int hf_pn_io_rs_plus_error = -1; static int hf_pn_io_rs_extension_block_type = -1; static int hf_pn_io_rs_extension_block_length = -1; static int hf_pn_io_rs_reason_code = -1; static int hf_pn_io_rs_reason_code_reason = -1; static int hf_pn_io_rs_reason_code_detail = -1; static int hf_pn_io_rs_domain_identification = -1; static int hf_pn_io_rs_master_identification = -1; static int hf_pn_io_soe_digital_input_current_value = -1; static int hf_pn_io_soe_digital_input_current_value_value = -1; static int hf_pn_io_soe_digital_input_current_value_reserved = -1; static int hf_pn_io_am_device_identification = -1; static int hf_pn_io_am_device_identification_device_sub_id = -1; static int hf_pn_io_am_device_identification_device_id = -1; static int hf_pn_io_am_device_identification_vendor_id = -1; static int hf_pn_io_am_device_identification_organization = -1; static int hf_pn_io_rs_adjust_info = -1; static int hf_pn_io_soe_max_scan_delay = -1; static int hf_pn_io_soe_adjust_specifier = -1; static int hf_pn_io_soe_adjust_specifier_reserved = -1; static int hf_pn_io_soe_adjust_specifier_incident = -1; static int hf_pn_io_rs_properties = -1; static int hf_pn_io_rs_properties_alarm_transport = -1; static int hf_pn_io_rs_properties_reserved1 = -1; static int hf_pn_io_rs_properties_reserved2 = -1; static int hf_pn_io_asset_management_info = -1; static int hf_pn_io_number_of_asset_management_info = -1; static int hf_pn_io_im_uniqueidentifier = -1; static int hf_pn_io_am_location_structure = -1; static int hf_pn_io_am_location_level_0 = -1; static int hf_pn_io_am_location_level_1 = -1; static int hf_pn_io_am_location_level_2 = -1; static int hf_pn_io_am_location_level_3 = -1; static int hf_pn_io_am_location_level_4 = -1; static int hf_pn_io_am_location_level_5 = -1; static int hf_pn_io_am_location_level_6 = -1; static int hf_pn_io_am_location_level_7 = -1; static int hf_pn_io_am_location_level_8 = -1; static int hf_pn_io_am_location_level_9 = -1; static int hf_pn_io_am_location_level_10 = -1; static int hf_pn_io_am_location_level_11 = -1; static int hf_pn_io_am_location = -1; static int hf_pn_io_am_location_reserved1 = -1; static int hf_pn_io_am_location_reserved2 = -1; static int hf_pn_io_am_location_reserved3 = -1; static int hf_pn_io_am_location_reserved4 = -1; static int hf_pn_io_am_location_beginslotnum = -1; static int hf_pn_io_am_location_beginsubslotnum = -1; static int hf_pn_io_am_location_endslotnum = -1; static int hf_pn_io_am_location_endsubslotnum = -1; static int hf_pn_io_am_software_revision = -1; static int hf_pn_io_am_hardware_revision = -1; static int hf_pn_io_am_type_identification = -1; static int hf_pn_io_am_reserved = -1; static int hf_pn_io_dcp_boundary_value = -1; static int hf_pn_io_dcp_boundary_value_bit0 = -1; static int hf_pn_io_dcp_boundary_value_bit1 = -1; static int hf_pn_io_dcp_boundary_value_otherbits = -1; static int hf_pn_io_peer_to_peer_boundary_value = -1; static int hf_pn_io_peer_to_peer_boundary_value_bit0 = -1; static int hf_pn_io_peer_to_peer_boundary_value_bit1 = -1; static int hf_pn_io_peer_to_peer_boundary_value_bit2 = -1; static int hf_pn_io_peer_to_peer_boundary_value_otherbits = -1; static int hf_pn_io_mau_type_extension = -1; static int hf_pn_io_pe_operational_mode = -1; static int hf_pn_io_snmp_community_name_length = -1; static int hf_pn_io_snmp_community_name = -1; static int hf_pn_io_snmp_read_community_name = -1; static int hf_pn_io_snmp_write_community_name = -1; static int hf_pn_io_snmp_control = -1; /* static int hf_pn_io_packedframe_SFCRC = -1; */ static gint ett_pn_io = -1; static gint ett_pn_io_block = -1; static gint ett_pn_io_block_header = -1; static gint ett_pn_io_rtc = -1; static gint ett_pn_io_rta = -1; static gint ett_pn_io_pdu_type = -1; static gint ett_pn_io_add_flags = -1; static gint ett_pn_io_control_command = -1; static gint ett_pn_io_ioxs = -1; static gint ett_pn_io_api = -1; static gint ett_pn_io_data_description = -1; static gint ett_pn_io_module = -1; static gint ett_pn_io_submodule = -1; static gint ett_pn_io_io_data_object = -1; static gint ett_pn_io_io_cs = -1; static gint ett_pn_io_ar_properties = -1; static gint ett_pn_io_iocr_properties = -1; static gint ett_pn_io_submodule_properties = -1; static gint ett_pn_io_alarmcr_properties = -1; static gint ett_pn_io_submodule_state = -1; static gint ett_pn_io_channel_properties = -1; static gint ett_pn_io_slot = -1; static gint ett_pn_io_subslot = -1; static gint ett_pn_io_maintenance_status = -1; static gint ett_pn_io_data_status = -1; static gint ett_pn_io_iocr = -1; static gint ett_pn_io_mrp_rtmode = -1; static gint ett_pn_io_control_block_properties = -1; static gint ett_pn_io_check_sync_mode = -1; static gint ett_pn_io_ir_frame_data = -1; static gint ett_pn_FrameDataProperties = -1; static gint ett_pn_io_ar_info = -1; static gint ett_pn_io_ar_data = -1; static gint ett_pn_io_ir_begin_end_port = -1; static gint ett_pn_io_ir_tx_phase = -1; static gint ett_pn_io_ir_rx_phase = -1; static gint ett_pn_io_subframe_data =-1; static gint ett_pn_io_SFIOCRProperties = -1; static gint ett_pn_io_frame_defails = -1; static gint ett_pn_io_profisafe_f_parameter = -1; static gint ett_pn_io_profisafe_f_parameter_prm_flag1 = -1; static gint ett_pn_io_profisafe_f_parameter_prm_flag2 = -1; static gint ett_pn_io_profidrive_parameter_request = -1; static gint ett_pn_io_profidrive_parameter_response = -1; static gint ett_pn_io_profidrive_parameter_address = -1; static gint ett_pn_io_profidrive_parameter_value = -1; static gint ett_pn_io_rs_alarm_info = -1; static gint ett_pn_io_rs_event_info = -1; static gint ett_pn_io_rs_event_block = -1; static gint ett_pn_io_rs_adjust_block = -1; static gint ett_pn_io_rs_event_data_extension = -1; static gint ett_pn_io_rs_specifier = -1; static gint ett_pn_io_rs_time_stamp = -1; static gint ett_pn_io_am_device_identification = -1; static gint ett_pn_io_rs_reason_code = -1; static gint ett_pn_io_soe_digital_input_current_value = -1; static gint ett_pn_io_rs_adjust_info = -1; static gint ett_pn_io_soe_adjust_specifier = -1; static gint ett_pn_io_sr_properties = -1; static gint ett_pn_io_line_delay = -1; static gint ett_pn_io_counter_status = -1; static gint ett_pn_io_neighbor = -1; static gint ett_pn_io_GroupProperties = -1; static gint ett_pn_io_asset_management_info = -1; static gint ett_pn_io_asset_management_block = -1; static gint ett_pn_io_am_location = -1; static gint ett_pn_io_dcp_boundary = -1; static gint ett_pn_io_peer_to_peer_boundary = -1; static gint ett_pn_io_mau_type_extension = -1; static gint ett_pn_io_pe_operational_mode = -1; static gint ett_pn_io_tsn_domain_port_config = -1; static gint ett_pn_io_tsn_domain_port_ingress_rate_limiter = -1; static gint ett_pn_io_tsn_domain_queue_rate_limiter = -1; static gint ett_pn_io_tsn_domain_vid_config = -1; static gint ett_pn_io_tsn_domain_queue_config = -1; static gint ett_pn_io_time_sync_properties = -1; static gint ett_pn_io_tsn_domain_port_id = -1; static gint ett_pn_io_snmp_command_name = -1; #define PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH 4 #define PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH 2 #define PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH 4 static expert_field ei_pn_io_block_version = EI_INIT; static expert_field ei_pn_io_block_length = EI_INIT; static expert_field ei_pn_io_unsupported = EI_INIT; static expert_field ei_pn_io_localalarmref = EI_INIT; static expert_field ei_pn_io_mrp_instances = EI_INIT; static expert_field ei_pn_io_ar_info_not_found = EI_INIT; static expert_field ei_pn_io_iocr_type = EI_INIT; static expert_field ei_pn_io_frame_id = EI_INIT; static expert_field ei_pn_io_nr_of_tx_port_groups = EI_INIT; static expert_field ei_pn_io_max_recursion_depth_reached = EI_INIT; static e_guid_t uuid_pn_io_device = { 0xDEA00001, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } }; static guint16 ver_pn_io_device = 1; static e_guid_t uuid_pn_io_controller = { 0xDEA00002, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } }; static guint16 ver_pn_io_controller = 1; static e_guid_t uuid_pn_io_supervisor = { 0xDEA00003, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } }; static guint16 ver_pn_io_supervisor = 1; static e_guid_t uuid_pn_io_parameterserver = { 0xDEA00004, 0x6C97, 0x11D1, { 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D } }; static guint16 ver_pn_io_parameterserver = 1; /* According to specification: * Value(UUID): 00000000-0000-0000-0000-000000000000 * Meaning: Reserved * Use: The value NIL indicates the usage of the implicit AR. */ static e_guid_t uuid_pn_io_implicitar = { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; static guint16 ver_pn_io_implicitar = 1; /* PNIO Preference Variables */ gboolean pnio_ps_selection = TRUE; static const char *pnio_ps_networkpath = ""; wmem_list_t *aruuid_frame_setup_list = NULL; static wmem_map_t *pnio_time_aware_frame_map = NULL; /* Allow heuristic dissection */ static heur_dissector_list_t heur_pn_subdissector_list; static const value_string pn_io_block_type[] = { { 0x0000, "Reserved" }, { 0x0001, "Alarm Notification High"}, { 0x8001, "Alarm Ack High"}, { 0x0002, "Alarm Notification Low"}, { 0x8002, "Alarm Ack Low"}, { 0x0008, "IODWriteReqHeader"}, { 0x8008, "IODWriteResHeader"}, { 0x0009, "IODReadReqHeader"}, { 0x8009, "IODReadResHeader"}, { 0x0010, "DiagnosisData"}, { 0x0011, "Reserved"}, { 0x0012, "ExpectedIdentificationData"}, { 0x0013, "RealIdentificationData"}, { 0x0014, "SubstituteValue"}, { 0x0015, "RecordInputDataObjectElement"}, { 0x0016, "RecordOutputDataObjectElement"}, { 0x0017, "reserved"}, { 0x0018, "ARData"}, { 0x0019, "LogData"}, { 0x001A, "APIData"}, { 0x001b, "SRLData"}, { 0x0020, "I&M0"}, { 0x0021, "I&M1"}, { 0x0022, "I&M2"}, { 0x0023, "I&M3"}, { 0x0024, "I&M4"}, { 0x0025, "I&M5"}, { 0x0026, "I&M6"}, { 0x0027, "I&M7"}, { 0x0028, "I&M8"}, { 0x0029, "I&M9"}, { 0x002A, "I&M10"}, { 0x002B, "I&M11"}, { 0x002C, "I&M12"}, { 0x002D, "I&M13"}, { 0x002E, "I&M14"}, { 0x002F, "I&M15"}, { 0x0030, "I&M0FilterDataSubmodul"}, { 0x0031, "I&M0FilterDataModul"}, { 0x0032, "I&M0FilterDataDevice"}, { 0x0033, "Reserved" }, { 0x0034, "I&M5Data"}, { 0x0035, "AssetManagementData"}, { 0x0036, "AM_FullInformation"}, { 0x0037, "AM_HardwareOnlyInformation"}, { 0x0038, "AM_FirmwareOnlyInformation" }, { 0x8001, "Alarm Ack High"}, { 0x8002, "Alarm Ack Low"}, { 0x0101, "ARBlockReq"}, { 0x8101, "ARBlockRes"}, { 0x0102, "IOCRBlockReq"}, { 0x8102, "IOCRBlockRes"}, { 0x0103, "AlarmCRBlockReq"}, { 0x8103, "AlarmCRBlockRes"}, { 0x0104, "ExpectedSubmoduleBlockReq"}, { 0x8104, "ModuleDiffBlock"}, { 0x0105, "PrmServerBlockReq"}, { 0x8105, "PrmServerBlockRes"}, { 0x0106, "MCRBlockReq"}, { 0x8106, "ARServerBlockRes"}, { 0x0107, "SubFrameBlock"}, { 0x8107, "ARRPCBlockRes"}, { 0x0108, "ARVendorBlockReq"}, { 0x8108, "ARVendorBlockRes"}, { 0x0109, "IRInfoBlock"}, { 0x010A, "SRInfoBlock"}, { 0x010B, "ARFSUBlock"}, { 0x010C, "RSInfoBlock"}, { 0x0110, "IODControlReq Prm End.req"}, { 0x8110, "IODControlRes Prm End.rsp"}, { 0x0111, "IODControlReq Plug Prm End.req"}, { 0x8111, "IODControlRes Plug Prm End.rsp"}, { 0x0112, "IOXBlockReq Application Ready.req"}, { 0x8112, "IOXBlockRes Application Ready.rsp"}, { 0x0113, "IOXBlockReq Plug Application Ready.req"}, { 0x8113, "IOXBlockRes Plug Application Ready.rsp"}, { 0x0114, "IODReleaseReq"}, { 0x8114, "IODReleaseRes"}, { 0x0115, "ARRPCServerBlockReq"}, { 0x8115, "ARRPCServerBlockRes"}, { 0x0116, "IOXControlReq Ready for Companion.req"}, { 0x8116, "IOXControlRes Ready for Companion.rsp"}, { 0x0117, "IOXControlReq Ready for RT_CLASS_3.req"}, { 0x8117, "IOXControlRes Ready for RT_CLASS_3.rsp"}, { 0x0118, "PrmBeginReq"}, { 0x8118, "PrmBeginRes"}, { 0x0119, "SubmoduleListBlock"}, { 0x0200, "PDPortDataCheck"}, { 0x0201, "PDevData"}, { 0x0202, "PDPortDataAdjust"}, { 0x0203, "PDSyncData"}, { 0x0204, "IsochronousModeData"}, { 0x0205, "PDIRData"}, { 0x0206, "PDIRGlobalData"}, { 0x0207, "PDIRFrameData"}, { 0x0208, "PDIRBeginEndData"}, { 0x0209, "AdjustDomainBoundary"}, { 0x020A, "CheckPeers"}, { 0x020B, "CheckLineDelay"}, { 0x020C, "Checking MAUType"}, { 0x020E, "Adjusting MAUType"}, { 0x020F, "PDPortDataReal"}, { 0x0210, "AdjustMulticastBoundary"}, { 0x0211, "PDInterfaceMrpDataAdjust"}, { 0x0212, "PDInterfaceMrpDataReal"}, { 0x0213, "PDInterfaceMrpDataCheck"}, { 0x0214, "PDPortMrpDataAdjust"}, { 0x0215, "PDPortMrpDataReal"}, { 0x0216, "Media redundancy manager parameters"}, { 0x0217, "Media redundancy client parameters"}, { 0x0218, "Media redundancy RT mode for manager"}, { 0x0219, "Media redundancy ring state data"}, { 0x021A, "Media redundancy RT ring state data"}, { 0x021B, "Adjust LinkState"}, { 0x021C, "Checking LinkState"}, { 0x021D, "Media redundancy RT mode for clients"}, { 0x021E, "CheckSyncDifference"}, { 0x021F, "CheckMAUTypeDifference"}, { 0x0220, "PDPortFODataReal"}, { 0x0221, "Reading real fiber optic manufacturerspecific data"}, { 0x0222, "PDPortFODataAdjust"}, { 0x0223, "PDPortFODataCheck"}, { 0x0224, "Adjust PeerToPeerBoundary"}, { 0x0225, "Adjust DCPBoundary"}, { 0x0226, "Adjust PreambleLength"}, { 0x0227, "CheckMAUType-Extension"}, { 0x0228, "Reading real fiber optic diagnosis data"}, { 0x0229, "AdjustMAUType-Extension"}, { 0x022A, "PDIRSubframeData"}, { 0x022B, "SubframeBlock"}, { 0x022C, "PDPortDataRealExtended"}, { 0x022D, "PDTimeData"}, { 0x022E, "PDPortSFPDataCheck"}, { 0x0230, "PDNCDataCheck"}, { 0x0231, "MrpInstanceDataAdjust"}, { 0x0232, "MrpInstanceDataReal"}, { 0x0233, "MrpInstanceDataCheck"}, { 0x0234, "PDPortMrpIcDataAdjust"}, { 0x0235, "PDPortMrpIcDataCheck"}, { 0x0236, "PDPortMrpIcDataReal"}, { 0x0240, "PDInterfaceDataReal"}, { 0x0241, "PDRsiInstances"}, { 0x0250, "PDInterfaceAdjust"}, { 0x0251, "PDPortStatistic"}, { 0x0260, "OwnPort"}, { 0x0261, "Neighbors"}, { 0x0270, "TSNNetworkControlDataReal"}, { 0x0271, "TSNNetworkControlDataAdjust"}, { 0x0272, "TSNDomainPortConfigBlock"}, { 0x0273, "TSNDomainQueueConfigBlock"}, { 0x0274, "TSNTimeDataBlock"}, { 0x0275, "TSNStreamPathData"}, { 0x0276, "TSNSyncTreeData"}, { 0x0277, "TSNUploadNetworkAttributes"}, { 0x0278, "ForwardingDelayBlock"}, { 0x0279, "TSNExpectedNetworkAttributes"}, { 0x027A, "TSNStreamPathDataReal"}, { 0x027B, "TSNDomainPortIngressRateLimiterBlock"}, { 0x027C, "TSNDomainQueueRateLimiterBlock"}, { 0x027D, "TSNPortIDBlock"}, { 0x027E, "TSNExpectedNeighborBlock" }, { 0x0300, "CIMSNMPAdjust"}, { 0x0400, "MultipleBlockHeader"}, { 0x0401, "COContainerContent"}, { 0x0500, "RecordDataReadQuery"}, { 0x0501, "TSNAddStreamReq"}, { 0x0502, "TSNAddStreamRsp"}, { 0x0503, "TSNRemoveStreamReq"}, { 0x0504, "TSNRemoveStreamRsp"}, { 0x0505, "TSNRenewStreamReq"}, { 0x0506, "TSNRenewStreamRsp"}, { 0x0600, "FSHelloBlock"}, { 0x0601, "FSParameterBlock"}, { 0x0602, "FastStartUpBlock"}, { 0x0608, "PDInterfaceFSUDataAdjust"}, { 0x0609, "ARFSUDataAdjust"}, { 0x0700, "AutoConfiguration"}, { 0x0701, "AutoConfiguration Communication"}, { 0x0702, "AutoConfiguration Configuration"}, { 0x0703, "AutoConfiguration Isochronous"}, { 0x0810, "PE_EntityFilterData"}, { 0x0811, "PE_EntityStatusData"}, { 0x0900, "RS_AdjustObserver" }, { 0x0901, "RS_GetEvent" }, { 0x0902, "RS_AckEvent" }, { 0x0A00, "Upload BLOB Query" }, { 0x0A01, "Upload BLOB" }, { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" }, { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" }, { 0xB060, "EDD Trace Unit (EDD)" }, { 0xB061, "EDD Trace Unit (EDD)" }, { 0xB070, "OHA Info (OHA)" }, { 0x0F00, "MaintenanceItem"}, { 0x0F01, "Upload selected Records within Upload&RetrievalItem"}, { 0x0F02, "iParameterItem"}, { 0x0F03, "Retrieve selected Records within Upload&RetrievalItem"}, { 0x0F04, "Retrieve all Records within Upload&RetrievalItem"}, { 0x0F05, "Signal a PE_OperationalMode change within PE_EnergySavingStatus" }, { 0, NULL } }; static const value_string pn_io_alarm_type[] = { { 0x0000, "Reserved" }, { 0x0001, "Diagnosis" }, { 0x0002, "Process" }, { 0x0003, "Pull" }, { 0x0004, "Plug" }, { 0x0005, "Status" }, { 0x0006, "Update" }, { 0x0007, "Redundancy" }, { 0x0008, "Controlled by supervisor" }, { 0x0009, "Released" }, { 0x000A, "Plug wrong submodule" }, { 0x000B, "Return of submodule" }, { 0x000C, "Diagnosis disappears" }, { 0x000D, "Multicast communication mismatch notification" }, { 0x000E, "Port data change notification" }, { 0x000F, "Sync data changed notification" }, { 0x0010, "Isochronous mode problem notification" }, { 0x0011, "Network component problem notification" }, { 0x0012, "Time data changed notification" }, { 0x0013, "Dynamic Frame Packing problem notification" }, /*0x0014 - 0x001D reserved */ { 0x001E, "Upload and retrieval notification" }, { 0x001F, "Pull module" }, /*0x0020 - 0x007F manufacturer specific */ /*0x0080 - 0x00FF reserved for profiles */ /*0x0100 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_pdu_type[] = { { 0x01, "Data-RTA-PDU" }, { 0x02, "NACK-RTA-PDU" }, { 0x03, "ACK-RTA-PDU" }, { 0x04, "ERR-RTA-PDU" }, { 0, NULL } }; static const value_string hf_pn_io_frame_data_properties_forwardingMode[] = { { 0x00, "absolute mode" }, { 0x01, "relative mode"}, { 0, NULL } }; static const value_string hf_pn_io_frame_data_properties_FFMulticastMACAdd[] = { { 0x00, "Use interface MAC destination unicast address" }, { 0x01, "Use RT_CLASS_3 destination multicast address"}, { 0x02, "Use FastForwardingMulticastMACAdd"}, { 0x03, "reserved"}, { 0, NULL }}; static const value_string hf_pn_io_frame_data_properties_FragMode[] = { { 0x00, "No fragmentation" }, { 0x01, "Fragmentation enabled maximum size for static fragmentation 128 bytes"}, { 0x02, "Fragmentation enabled maximum size for static fragmentation 256 bytes"}, { 0x03, "reserved"}, { 0, NULL }}; static const value_string pn_io_SFIOCRProperties_DFPType_vals[] = { { 0x00, "DFP_INBOUND" }, { 0x01, "DFP_OUTBOUND" }, { 0, NULL } }; static const value_string pn_io_DFPRedundantPathLayout_decode[] = { { 0x00, "The Frame for the redundant path contains the ordering shown by SubframeData" }, { 0x01, "The Frame for the redundant path contains the inverse ordering shown by SubframeData" }, { 0, NULL } }; static const value_string pn_io_SFCRC16_Decode[] = { { 0x00, "SFCRC16 and SFCycleCounter shall be created or set to zero by the sender and not checked by the receiver" }, { 0x01, "SFCRC16 and SFCycleCounter shall be created by the sender and checked by the receiver." }, { 0, NULL } }; static const value_string pn_io_txgroup_state[] = { { 0x00, "Transmission off" }, { 0x01, "Transmission on " }, { 0, NULL } }; static const value_string pn_io_ioxs[] = { { 0x00 /* 0*/, "detected by subslot" }, { 0x01 /* 1*/, "detected by slot" }, { 0x02 /* 2*/, "detected by IO device" }, { 0x03 /* 3*/, "detected by IO controller" }, { 0, NULL } }; static const value_string pn_io_ar_type[] = { { 0x0000, "reserved" }, { 0x0001, "IO Controller AR"}, { 0x0002, "reserved" }, { 0x0003, "IOCARCIR" }, { 0x0004, "reserved" }, { 0x0005, "reserved" }, { 0x0006, "IO Supervisor AR / DeviceAccess AR" }, /*0x0007 - 0x000F reserved */ { 0x0010, "IO Controller AR (RT_CLASS_3)" }, /*0x0011 - 0x001F reserved */ { 0x0020, "IO Controller AR (sysred/CiR)" }, /*0x0007 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_iocr_type[] = { { 0x0000, "reserved" }, { 0x0001, "Input CR" }, { 0x0002, "Output CR" }, { 0x0003, "Multicast Provider CR" }, { 0x0004, "Multicast Consumer CR" }, /*0x0005 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_data_description[] = { { 0x0000, "reserved" }, { 0x0001, "Input" }, { 0x0002, "Output" }, { 0x0003, "reserved" }, /*0x0004 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_module_state[] = { { 0x0000, "no module" }, { 0x0001, "wrong module" }, { 0x0002, "proper module" }, { 0x0003, "substitute" }, /*0x0004 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_arproperties_state[] = { { 0x00000000, "Reserved" }, { 0x00000001, "Active" }, { 0x00000002, "reserved" }, { 0x00000003, "reserved" }, { 0x00000004, "reserved" }, { 0x00000005, "reserved" }, { 0x00000006, "reserved" }, { 0x00000007, "reserved" }, { 0, NULL } }; static const value_string pn_io_arproperties_supervisor_takeover_allowed[] = { { 0x00000000, "not allowed" }, { 0x00000001, "allowed" }, { 0, NULL } }; static const value_string pn_io_arproperties_parameterization_server[] = { { 0x00000000, "External PrmServer" }, { 0x00000001, "CM Initiator" }, { 0, NULL } }; /* BIT 8 */ static const value_string pn_io_arproperties_DeviceAccess[] = { { 0x00000000, "Only the submodules from the ExpectedSubmoduleBlock are accessible" }, { 0x00000001, "Submodule access is controlled by IO device application" }, { 0, NULL } }; /* Bit 9 - 10 */ static const value_string pn_io_arproperties_companion_ar[] = { { 0x00000000, "Single AR" }, { 0x00000001, "First AR of a companion pair and a companion AR shall follow" }, { 0x00000002, "Companion AR" }, { 0x00000003, "Reserved" }, { 0, NULL } }; /* REMOVED with 2.3 static const value_string pn_io_arproperties_data_rate[] = { { 0x00000000, "at least 100 MB/s or more" }, { 0x00000001, "100 MB/s" }, { 0x00000002, "1 GB/s" }, { 0x00000003, "10 GB/s" }, { 0, NULL } }; */ /* BIT 11 */ static const value_string pn_io_arproperties_acknowldege_companion_ar[] = { { 0x00000000, "No companion AR or no acknowledge for the companion AR required" }, { 0x00000001, "Companion AR with acknowledge" }, { 0, NULL } }; /* Bit 28 */ static const value_string pn_io_arproperties_time_aware_system[] = { { 0x00000000, "NonTimeAware" }, { 0x00000001, "TimeAware" }, { 0, NULL } }; /* bit 29 for legacy startup mode*/ static const value_string pn_io_arproperties_combined_object_container_with_legacy_startupmode[] = { { 0x00000000, "CombinedObjectContainer not used" }, { 0x00000001, "Reserved" }, { 0, NULL } }; /* bit 29 for advanced statup mode*/ static const value_string pn_io_arproperties_combined_object_container_with_advanced_startupmode[] = { { 0x00000000, "CombinedObjectContainer not used" }, { 0x00000001, "Usage of CombinedObjectContainer required" }, { 0, NULL } }; /* bit 30 */ static const value_string pn_io_arpropertiesStartupMode[] = { { 0x00000000, "Legacy" }, { 0x00000001, "Advanced" }, { 0, NULL } }; /* bit 31 */ static const value_string pn_io_arproperties_pull_module_alarm_allowed[] = { { 0x00000000, "AlarmType(=Pull) shall signal pulling of submodule and module" }, { 0x00000001, "AlarmType(=Pull) shall signal pulling of submodule" }, { 0, NULL } }; static const value_string pn_io_RedundancyInfo[] = { { 0x00000000, "Reserved" }, { 0x00000001, "The delivering node is the left or below one" }, { 0x00000002, "The delivering node is the right or above one" }, { 0x00000003, "Reserved" }, { 0, NULL } }; static const value_string pn_io_iocr_properties_rtclass[] = { { 0x00000000, "reserved" }, { 0x00000001, "RT_CLASS_1" }, { 0x00000002, "RT_CLASS_2" }, { 0x00000003, "RT_CLASS_3" }, { 0x00000004, "RT_CLASS_UDP" }, /*0x00000005 - 0x00000007 reserved */ { 0, NULL } }; static const value_string pn_io_MultipleInterfaceMode_NameOfDevice[] = { { 0x00000000, "PortID of LLDP contains name of port (Default)" }, { 0x00000001, "PortID of LLDP contains name of port and NameOfStation" }, { 0, NULL } }; static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0 = { "The device shall deliver valid input data", "The IO controller shall not evaluate the input data." }; static const true_false_string tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1 = { "The device shall deliver valid input data", "The IO device shall mark the data as invalid using APDU_Status.DataStatus.DataValid == Invalid." }; static const true_false_string tfs_pn_io_sr_properties_Mode = { "Default The IO device shall use APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid.", "The IO controller do not support APDU_Status.DataStatus.DataValid == Invalid if input data is request as not valid." }; static const true_false_string tfs_pn_io_sr_properties_Reserved1 = { "Legacy mode", "Shall be set to zero for this standard." }; static const value_string pn_io_iocr_properties_media_redundancy[] = { { 0x00000000, "No media redundant frame transfer" }, { 0x00000001, "Media redundant frame transfer" }, { 0, NULL } }; static const value_string pn_io_submodule_properties_type[] = { { 0x0000, "no input and no output data" }, { 0x0001, "input data" }, { 0x0002, "output data" }, { 0x0003, "input and output data" }, { 0, NULL } }; static const value_string pn_io_submodule_properties_shared_input[] = { { 0x0000, "IO controller" }, { 0x0001, "IO controller shared" }, { 0, NULL } }; static const value_string pn_io_submodule_properties_reduce_input_submodule_data_length[] = { { 0x0000, "Expected" }, { 0x0001, "Zero" }, { 0, NULL } }; static const value_string pn_io_submodule_properties_reduce_output_submodule_data_length[] = { { 0x0000, "Expected" }, { 0x0001, "Zero" }, { 0, NULL } }; static const value_string pn_io_submodule_properties_discard_ioxs[] = { { 0x0000, "Expected" }, { 0x0001, "Zero" }, { 0, NULL } }; static const value_string pn_io_alarmcr_properties_priority[] = { { 0x0000, "user priority (default)" }, { 0x0001, "use only low priority" }, { 0, NULL } }; static const value_string pn_io_alarmcr_properties_transport[] = { { 0x0000, "RTA_CLASS_1" }, { 0x0001, "RTA_CLASS_UDP" }, { 0, NULL } }; static const value_string pn_io_submodule_state_format_indicator[] = { { 0x0000, "Coding uses Detail" }, { 0x0001, "Coding uses .IdentInfo, ..." }, { 0, NULL } }; static const value_string pn_io_submodule_state_add_info[] = { { 0x0000, "None" }, { 0x0001, "Takeover not allowed" }, /*0x0002 - 0x0007 reserved */ { 0, NULL } }; static const value_string pn_io_submodule_state_advice[] = { { 0x0000, "No Advice available" }, { 0x0001, "Advice available" }, { 0, NULL } }; static const value_string pn_io_submodule_state_maintenance_required[] = { { 0x0000, "No MaintenanceRequired available" }, { 0x0001, "MaintenanceRequired available" }, { 0, NULL } }; static const value_string pn_io_submodule_state_maintenance_demanded[] = { { 0x0000, "No MaintenanceDemanded available" }, { 0x0001, "MaintenanceDemanded available" }, { 0, NULL } }; static const value_string pn_io_submodule_state_fault[] = { { 0x0000, "No Fault available" }, { 0x0001, "Fault available" }, { 0, NULL } }; static const value_string pn_io_submodule_state_ar_info[] = { { 0x0000, "Own" }, { 0x0001, "ApplicationReadyPending (ARP)" }, { 0x0002, "Superordinated Locked (SO)" }, { 0x0003, "Locked By IO Controller (IOC)" }, { 0x0004, "Locked By IO Supervisor (IOS)" }, /*0x0005 - 0x000F reserved */ { 0, NULL } }; static const value_string pn_io_submodule_state_ident_info[] = { { 0x0000, "OK" }, { 0x0001, "Substitute (SU)" }, { 0x0002, "Wrong (WR)" }, { 0x0003, "NoSubmodule (NO)" }, /*0x0004 - 0x000F reserved */ { 0, NULL } }; static const value_string pn_io_submodule_state_detail[] = { { 0x0000, "no submodule" }, { 0x0001, "wrong submodule" }, { 0x0002, "locked by IO controller" }, { 0x0003, "reserved" }, { 0x0004, "application ready pending" }, { 0x0005, "reserved" }, { 0x0006, "reserved" }, { 0x0007, "Substitute" }, /*0x0008 - 0x7FFF reserved */ { 0, NULL } }; static const value_string pn_io_substitutionmode[] = { { 0x0000, "ZERO" }, { 0x0001, "Last value" }, { 0x0002, "Replacement value" }, /*0x0003 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_index[] = { /*0x0008 - 0x7FFF user specific */ /* PROFISafe */ { 0x0100, "PROFISafe" }, /* subslot specific */ { 0x8000, "ExpectedIdentificationData for one subslot" }, { 0x8001, "RealIdentificationData for one subslot" }, /*0x8002 - 0x8009 reserved */ { 0x800A, "Diagnosis in channel coding for one subslot" }, { 0x800B, "Diagnosis in all codings for one subslot" }, { 0x800C, "Diagnosis, Maintenance, Qualified and Status for one subslot" }, /*0x800D - 0x800F reserved */ { 0x8010, "Maintenance required in channel coding for one subslot" }, { 0x8011, "Maintenance demanded in channel coding for one subslot" }, { 0x8012, "Maintenance required in all codings for one subslot" }, { 0x8013, "Maintenance demanded in all codings for one subslot" }, /*0x8014 - 0x801D reserved */ { 0x801E, "SubstituteValues for one subslot" }, /*0x801F reserved */ { 0x8020, "PDIRSubframeData for one subslot" }, /*0x8021 - 0x8026 reserved */ { 0x8027, "PDPortDataRealExtended for one subslot" }, { 0x8028, "RecordInputDataObjectElement for one subslot" }, { 0x8029, "RecordOutputDataObjectElement for one subslot" }, { 0x802A, "PDPortDataReal for one subslot" }, { 0x802B, "PDPortDataCheck for one subslot" }, { 0x802C, "PDIRData for one subslot" }, { 0x802D, "PDSyncData for one subslot with SyncID value 0" }, /*0x802E reserved */ { 0x802F, "PDPortDataAdjust for one subslot" }, { 0x8030, "IsochronousModeData for one subslot" }, { 0x8031, "PDTimeData for one subslot" }, /*0x8032 - 0x804F reserved */ { 0x8050, "PDInterfaceMrpDataReal for one subslot" }, { 0x8051, "PDInterfaceMrpDataCheck for one subslot" }, { 0x8052, "PDInterfaceMrpDataAdjust for one subslot" }, { 0x8053, "PDPortMrpDataAdjust for one subslot" }, { 0x8054, "PDPortMrpDataReal for one subslot" }, { 0x8055, "PDPortMrpIcDataAdjust for one subslot" }, { 0x8056, "PDPortMrpIcDataCheck for one subslot" }, { 0x8057, "PDPortMrpIcDataReal for one subslot" }, /*0x8058 - 0x805F reserved */ { 0x8060, "PDPortFODataReal for one subslot" }, { 0x8061, "PDPortFODataCheck for one subslot" }, { 0x8062, "PDPortFODataAdjust for one subslot" }, { 0x8063, "PDPortSFPDataCheck for one subslot" }, /*0x8064 - 0x806F reserved */ { 0x8070, "PDNCDataCheck for one subslot" }, { 0x8071, "PDInterfaceAdjust for one subslot" }, { 0x8072, "PDPortStatistic for one subslot" }, /*0x8071 - 0x807F reserved */ { 0x8080, "PDInterfaceDataReal" }, /*0x8081 - 0x808F reserved */ { 0x8090, "PDInterfaceFSUDataAdjust" }, /*0x8091 - 0x809F reserved */ { 0x80A0, "Profiles covering energy saving - Record_0" }, /*0x80A1 - 0x80AE reserved */ { 0x80AF, "PE_EntityStatusData for one subslot" }, { 0x80B0, "CombinedObjectContainer" }, /*0x80B1 - 0x80CE reserved */ { 0x80CF, "RS_AdjustObserver" }, { 0x80D0, "Profiles covering condition monitoring - Record_0" }, /*0x80D1 - 0x80DF reserved */ { 0x80F0, "TSNNetworkControlDataReal" }, { 0x80F1, "TSNStreamPathData" }, { 0x80F2, "TSNSyncTreeData" }, { 0x80F3, "TSNUploadNetworkAttributes" }, { 0x80F4, "TSNExpectedNetworkAttributes" }, { 0x80F5, "TSNNetworkControlDataAdjust" }, { 0x80F6, "TSNStreamPathDataReal for stream class High" }, { 0x80F7, "TSNStreamPathDataReal for stream class High Redundant" }, { 0x80F8, "TSNStreamPathDataReal for stream class Low" }, { 0x80F9, "TSNStreamPathDataReal for stream class Low Redundant" }, /*0x80FA - 0x80FF reserved for CIM data */ /*0x8100 - 0x81FF reserved */ { 0x8200, "CIMSNMPAdjust" }, /*0x8201 - 0xAFEF reserved */ { 0xAFF0, "I&M0" }, { 0xAFF1, "I&M1" }, { 0xAFF2, "I&M2" }, { 0xAFF3, "I&M3" }, { 0xAFF4, "I&M4" }, { 0xAFF5, "I&M5" }, { 0xAFF6, "I&M6" }, { 0xAFF7, "I&M7" }, { 0xAFF8, "I&M8" }, { 0xAFF9, "I&M9" }, { 0xAFFA, "I&M10" }, { 0xAFFB, "I&M11" }, { 0xAFFC, "I&M12" }, { 0xAFFD, "I&M13" }, { 0xAFFE, "I&M14" }, { 0xAFFF, "I&M15" }, /*0xB000 - 0xB02D reserved for profiles */ { 0xB000, "Sync-Log / RTA SyncID 0 (GSY)" }, { 0xB001, "Sync-Log / RTA SyncID 1 (GSY)" }, { 0xB002, "reserved for profiles" }, { 0xB003, "reserved for profiles" }, { 0xB004, "reserved for profiles" }, { 0xB005, "reserved for profiles" }, { 0xB006, "reserved for profiles" }, { 0xB007, "reserved for profiles" }, { 0xB008, "reserved for profiles" }, { 0xB009, "reserved for profiles" }, { 0xB00A, "reserved for profiles" }, { 0xB00B, "reserved for profiles" }, { 0xB00C, "reserved for profiles" }, { 0xB00D, "reserved for profiles" }, { 0xB00E, "reserved for profiles" }, { 0xB00F, "reserved for profiles" }, { 0xB010, "reserved for profiles" }, { 0xB011, "reserved for profiles" }, { 0xB012, "reserved for profiles" }, { 0xB013, "reserved for profiles" }, { 0xB014, "reserved for profiles" }, { 0xB015, "reserved for profiles" }, { 0xB016, "reserved for profiles" }, { 0xB017, "reserved for profiles" }, { 0xB018, "reserved for profiles" }, { 0xB019, "reserved for profiles" }, { 0xB01A, "reserved for profiles" }, { 0xB01B, "reserved for profiles" }, { 0xB01C, "reserved for profiles" }, { 0xB01D, "reserved for profiles" }, { 0xB01E, "reserved for profiles" }, { 0xB01F, "reserved for profiles" }, { 0xB020, "reserved for profiles" }, { 0xB021, "reserved for profiles" }, { 0xB022, "reserved for profiles" }, { 0xB023, "reserved for profiles" }, { 0xB024, "reserved for profiles" }, { 0xB025, "reserved for profiles" }, { 0xB026, "reserved for profiles" }, { 0xB027, "reserved for profiles" }, { 0xB028, "reserved for profiles" }, { 0xB029, "reserved for profiles" }, { 0xB02A, "reserved for profiles" }, { 0xB02B, "reserved for profiles" }, { 0xB02C, "reserved for profiles" }, { 0xB02D, "reserved for profiles" }, /* PROFIDrive */ { 0xB02E, "PROFIDrive Parameter Access - Local"}, { 0xB02F, "PROFIDrive Parameter Access - Global"}, /*0xB030 - 0xBFFF reserved for profiles */ { 0xB050, "Ext-PLL Control / RTC+RTA SyncID 0 (EDD)" }, { 0xB051, "Ext-PLL Control / RTA SyncID 1 (GSY)" }, { 0xB060, "EDD Trace Unit (EDD" }, { 0xB061, "EDD Trace Unit (EDD" }, { 0xB070, "OHA Info (OHA)" }, /* slot specific */ { 0xC000, "ExpectedIdentificationData for one slot" }, { 0xC001, "RealIdentificationData for one slot" }, /*0xC002 - 0xC009 reserved */ { 0xC00A, "Diagnosis in channel coding for one slot" }, { 0xC00B, "Diagnosis in all codings for one slot" }, { 0xC00C, "Diagnosis, Maintenance, Qualified and Status for one slot" }, /*0xC00D - 0xC00F reserved */ { 0xC010, "Maintenance required in channel coding for one slot" }, { 0xC011, "Maintenance demanded in channel coding for one slot" }, { 0xC012, "Maintenance required in all codings for one slot" }, { 0xC013, "Maintenance demanded in all codings for one slot" }, /*0xC014 - 0xCFFF reserved */ /*0xD000 - 0xDFFF reserved for profiles */ /* AR specific */ { 0xE000, "ExpectedIdentificationData for one AR" }, { 0xE001, "RealIdentificationData for one AR" }, { 0xE002, "ModuleDiffBlock for one AR" }, /*0xE003 - 0xE009 reserved */ { 0xE00A, "Diagnosis in channel coding for one AR" }, { 0xE00B, "Diagnosis in all codings for one AR" }, { 0xE00C, "Diagnosis, Maintenance, Qualified and Status for one AR" }, /*0xE00D - 0xE00F reserved */ { 0xE010, "Maintenance required in channel coding for one AR" }, { 0xE011, "Maintenance demanded in channel coding for one AR" }, { 0xE012, "Maintenance required in all codings for one AR" }, { 0xE013, "Maintenance demanded in all codings for one AR" }, /*0xE014 - 0xE02F reserved */ { 0xE030, "PE_EntityFilterData for one AR" }, { 0xE031, "PE_EntityStatusData for one AR" }, /*0xE032 - 0xE03F reserved */ { 0xE040, "MultipleWrite" }, { 0xE041, "ApplicationReadyBlock" }, /*0xE042 - 0xE04F reserved */ { 0xE050, "ARFSUDataAdjust data for one AR" }, /*0xE051 - 0xE05F reserved */ { 0xE060, "RS_GetEvent (using RecordDataRead service)" }, { 0xE061, "RS_AckEvent (using RecordDataWrite service)" }, /*0xEC00 - 0xEFFF reserved */ /* API specific */ { 0xF000, "RealIdentificationData for one API" }, /*0xF001 - 0xF009 reserved */ { 0xF00A, "Diagnosis in channel coding for one API" }, { 0xF00B, "Diagnosis in all codings for one API" }, { 0xF00C, "Diagnosis, Maintenance, Qualified and Status for one API" }, /*0xF00D - 0xF00F reserved */ { 0xF010, "Maintenance required in channel coding for one API" }, { 0xF011, "Maintenance demanded in channel coding for one API" }, { 0xF012, "Maintenance required in all codings for one API" }, { 0xF013, "Maintenance demanded in all codings for one API" }, /*0xF014 - 0xF01F reserved */ { 0xF020, "ARData for one API" }, /*0xF021 - 0xF3FF reserved */ /*0xF400 - 0xF7FF reserved */ /* device specific */ /*0xF800 - 0xF80B reserved */ { 0xF80C, "Diagnosis, Maintenance, Qualified and Status for one device" }, /*0xF80D - 0xF81F reserved */ { 0xF820, "ARData" }, { 0xF821, "APIData" }, /*0xF822 - 0xF82F reserved */ { 0xF830, "LogData" }, { 0xF831, "PDevData" }, /*0xF832 - 0xF83F reserved */ { 0xF840, "I&M0FilterData" }, { 0xF841, "PDRealData" }, { 0xF842, "PDExpectedData" }, /*0xF843 - 0xF84F reserved */ { 0xF850, "AutoConfiguration" }, { 0xF860, "GSD upload using UploadBLOBQuery and UploadBLOB" }, { 0xF870, "PE_EntityFilterData" }, { 0xF871, "PE_EntityStatusData" }, { 0xF880, "AssetManagementData - contains all or first chunk of complete assets" }, { 0xF881, "AssetManagementData - second chunk" }, { 0xF882, "AssetManagementData - third chunk" }, { 0xF883, "AssetManagementData - fourth chunk" }, { 0xF884, "AssetManagementData - fifth chunk" }, { 0xF885, "AssetManagementData - sixth chunk" }, { 0xF886, "AssetManagementData - seventh chunk" }, { 0xF887, "AssetManagementData - eighth chunk" }, { 0xF888, "AssetManagementData - ninth chunk" }, { 0xF889, "AssetManagementData - tenth chunk" }, { 0xF8F0, "Stream Add using TSNAddStreamReq and TSNAddStreamRsp" }, { 0xF8F1, "PDRsiInstances" }, { 0xF8F2, "Stream Remove using TSNRemoveStreamReq and TSNRemoveStreamRsp" }, { 0xF8F3, "Stream Renew using TSNRenewStreamReq and TSNRenewStreamRsp" }, { 0xFBFF, "Trigger index for RPC connection monitoring" }, /*0xFC00 - 0xFFFF reserved for profiles */ { 0, NULL } }; static const value_string pn_io_user_structure_identifier[] = { /*0x0000 - 0x7FFF manufacturer specific */ { 0x8000, "ChannelDiagnosis" }, { 0x8001, "Multiple" }, { 0x8002, "ExtChannelDiagnosis" }, { 0x8003, "QualifiedChannelDiagnosis" }, /*0x8004 - 0x80FF reserved */ { 0x8100, "Maintenance" }, /*0x8101 - 0x8FFF reserved except 8200, 8201, 8300, 8301, 8302, 8303, 8310, 8320 */ { 0x8200, "Upload&Retrieval" }, { 0x8201, "iParameter" }, { 0x8300, "Reporting system RS_LowWatermark" }, { 0x8301, "Reporting system RS_Timeout" }, { 0x8302, "Reporting system RS_Overflow" }, { 0x8303, "Reporting system RS_Event" }, { 0x8310, "PE_EnergySavingStatus" }, { 0x8320, "Channel related Process Alarm reasons" }, /*0x9000 - 0x9FFF reserved for profiles */ /*0xA000 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_channel_error_type[] = { { 0x0000, "reserved" }, { 0x0001, "short circuit" }, { 0x0002, "Undervoltage" }, { 0x0003, "Overvoltage" }, { 0x0004, "Overload" }, { 0x0005, "Overtemperature" }, { 0x0006, "Wire break" }, { 0x0007, "Upper limit value exceeded" }, { 0x0008, "Lower limit value exceeded" }, { 0x0009, "Error" }, { 0x000A, "Simulation active" }, /*0x000B - 0x000E reserved */ { 0x000F, "Parameter missing" }, { 0x0010, "Parameterization fault" }, { 0x0011, "Power supply fault" }, { 0x0012, "Fuse blown / open" }, { 0x0013, "Manufacturer specific" }, { 0x0014, "Ground fault" }, { 0x0015, "Reference point lost" }, { 0x0016, "Process event lost / sampling error" }, { 0x0017, "Threshold warning" }, { 0x0018, "Output disabled" }, { 0x0019, "FunctionalSafety event" }, { 0x001A, "External fault" }, /*0x001B - 0x001F manufacturer specific */ { 0x001F, "Temporary fault" }, /*0x0020 - 0x00FF reserved for common profiles */ { 0x0040, "Mismatch of safety destination address" }, { 0x0041, "Safety destination address not valid" }, { 0x0042, "Safety source address not valid" }, { 0x0043, "Safety watchdog time value is 0ms" }, { 0x0044, "Parameter F_SIL exceeds SIL of specific application" }, { 0x0045, "Parameter F_CRC_Length does not match generated values" }, { 0x0046, "Version of F-Parameter set incorrect" }, { 0x0047, "Data inconsistent in received F-Parameter block (CRC1 error)" }, { 0x0048, "Device specific or unspecific diagnosis information, see manual" }, { 0x0049, "Save iParameter watchdog time exceeded" }, { 0x004A, "Restore iParameter watchdog time exceeded" }, { 0x004B, "Inconsistent iParameters (iParCRC error)" }, { 0x004C, "F_Block_ID not supported" }, { 0x004D, "Transmission error: data inconsistent (CRC2 error)" }, { 0x004E, "Transmission error: timeout" }, { 0x004F, "Acknowledge needed to enable the channel(s)" }, /*0x0100 - 0x7FFF manufacturer specific */ { 0x8000, "Data transmission impossible" }, { 0x8001, "Remote mismatch" }, { 0x8002, "Media redundancy mismatch - Ring" }, { 0x8003, "Sync mismatch" }, { 0x8004, "IsochronousMode mismatch" }, { 0x8005, "Multicast CR mismatch" }, { 0x8006, "reserved" }, { 0x8007, "Fiber optic mismatch" }, { 0x8008, "Network component function mismatch" }, { 0x8009, "Time mismatch" }, /* added values for IEC version 2.3: */ { 0x800A, "Dynamic frame packing function mismatch" }, { 0x800B, "Media redundancy with planned duplication mismatch"}, { 0x800C, "System redundancy mismatch"}, { 0x800D, "Multiple interface mismatch"}, { 0x8010, "Power failure over Single Pair Ethernet"}, /* ends */ /*0x800D - 0x8FFF reserved */ /*0x9000 - 0x9FFF reserved for profile */ /*0x9000 - 0x902F NE107 common (PA Profile 4.02) */ { 0x9000, "Sensor element exciter faulty" }, { 0x9001, "Error in evaluation electronics" }, { 0x9002, "Error in internal energy supply" }, { 0x9003, "Error in sensor element" }, { 0x9004, "Error in actuator element" }, { 0x9005, "Faulty installation e.g. dead space" }, { 0x9006, "Parameter setting error" }, { 0x9008, "Overloading" }, { 0x9009, "Wrong polarity of aux power" }, { 0x900A, "Maximum line length exceeded" }, { 0x900B, "Corrosion/abrasion by medium" }, { 0x900C, "Fouling on sensor element" }, { 0x900D, "Auxil medium missing or insufficient" }, { 0x900E, "Wear reserve used up (operation)" }, { 0x900F, "Wear reserve used up (wear)" }, { 0x9010, "Error in peripherals" }, { 0x9011, "Electromag interference too high" }, { 0x9012, "Temperature of medium too high" }, { 0x9013, "Ambient temperature too high" }, { 0x9014, "Vibration/Impact load too high" }, { 0x9015, "Auxiliary power range off-spec" }, { 0x9016, "Auxiliary medium missing" }, { 0x9017, "Excessive temperature shock" }, { 0x9018, "Deviation from measurement" }, { 0x9019, "Humidity in electronics area" }, { 0x901A, "Medium in electronics area" }, { 0x901B, "Mechanical damage" }, { 0x901C, "Communication error" }, { 0x901D, "Foreign material in electro area" }, /*0x9030 - 0x906F NE107 contact thermometer (PA Profile 4.02) */ { 0x9030, "Immersion depth too limited" }, { 0x9031, "Unequate medium around sensor" }, { 0x9032, "Temp distrib not representative" }, { 0x9033, "Inadequate thermal contact" }, { 0x9034, "Sensor close to heat source/sink" }, { 0x9035, "External temperature influence" }, { 0x9036, "Insufficient thermocoupling" }, { 0x9037, "Thermocoupling too high" }, { 0x9038, "Friction heat by flowing gases" }, { 0x9039, "Thermalcapac of sensor too high" }, { 0x903A, "Deposits" }, { 0x903B, "Systemrelated resonant vibration" }, { 0x903C, "Resonantvibrat excited by flow" }, { 0x903D, "Leakage" }, { 0x903E, "Abrasion" }, { 0x903F, "Corrosion" }, { 0x9040, "Flow approach speed too high" }, { 0x9041, "Insulation to ground too low" }, { 0x9042, "Insulation betw. lines too low" }, { 0x9043, "Parasitic thermal elements" }, { 0x9044, "Parasitic galvanic elements" }, { 0x9045, "Short circuit" }, { 0x9046, "Shorted coil and break" }, { 0x9047, "Line/contact resistance too high" }, { 0x9048, "Compression spring failure" }, { 0x9049, "Drift of sensor charact curve" }, { 0x904A, "Insuff contact of meas insert" }, { 0x904B, "Meas insert mechanical seized" }, { 0x904C, "Measuring insert in thermowell" }, { 0x904D, "Measuring insert too short" }, { 0x904E, "Resistance wire abrasion" }, { 0x904F, "Mechanic stress character curve" }, { 0x9050, "Thermal stress character curve" }, { 0x9051, "Intrinsic heating too severe" }, { 0x9052, "EMI on measuring circuit" }, { 0x9053, "Faulty linearisation" }, { 0x9054, "Incorrect sensor position" }, { 0x9055, "Faulty comparative point temp" }, { 0x9056, "Faulty compar of line resistance" }, { 0x9057, "Unsymmet supply line resistance" }, { 0x9058, "Wrong material of compens line" }, { 0x9059, "Damage to supply lines" }, { 0x905A, "Capacitive feedback" }, { 0x905B, "Potential transfer" }, { 0x905C, "Potential differences exceeded" }, { 0x905D, "Impermiss mix of wire systems" }, { 0x905E, "Reverse polarity of lines" }, { 0x905F, "Reverse polarity of lines" }, /*0x9070 - 0x90A7 NE107 pressure (PA Profile 4.02) */ { 0x9070, "Pressure peaks outside range" }, { 0x9071, "Deposits on the seal diaphragm" }, { 0x9072, "Characteristic curve change" }, { 0x9073, "Inc. measuring err. (turn down)" }, { 0x9074, "Wear on the seal diaphragm" }, { 0x9075, "Process seal at flush diaphragm" }, { 0x9076, "Offset error due to inst. pos." }, { 0x9077, "Seal diaphragm deformation" }, { 0x9078, "Hydrogen penetration" }, { 0x9079, "Mean value deviation" }, { 0x907A, "Pressure sensor system leakage" }, { 0x907B, "Hydrostatic offset" }, { 0x907C, "Gas seepage from pressure sensor" }, { 0x907D, "Add. measuring err. due to temp." }, { 0x907E, "Delta T in capillary tubing" }, { 0x907F, "Increase in compensation times" }, { 0x9080, "Oleic acid leak" }, { 0x9081, "Pulse lines blocked" }, { 0x9082, "Gas inclusion in liquid medium" }, { 0x9083, "Delta T in pulse lines" }, { 0x9084, "Liquid inclusion in gas" }, { 0x9088, "Sedimentation on sensor" }, { 0x9089, "Change of density" }, { 0x908A, "Wrong height / wrong adjustment" }, { 0x908B, "Clogged membrane" }, { 0x908C, "Error with pulse line" }, { 0x908D, "Internal tank pressure influence" }, { 0x908E, "Influence of temperature" }, { 0x908F, "Hydrogen diffusion" }, { 0x9090, "Absence of bubble gas" }, { 0x9091, "Air-bubble feed line blocked" }, { 0x9092, "Wear and tear of diaphragm" }, { 0x9093, "Gas seepage" }, { 0x9094, "Pressure rise at rel. of bubbles" }, { 0x9095, "Pressure sensor overload" }, { 0x9096, "Flow rate of bubble gas too high" }, /*0x90F8 - 0x910F NE107 coriolis (PA Profile 4.02) */ { 0x90F8, "Gas bubbles in the liquid" }, { 0x90F9, "Fouling, clogging" }, { 0x90FA, "Erosion, corrosion" }, { 0x90FB, "Faulty mounting" }, { 0x90FC, "Asymmetry of measuring tubes" }, { 0x90FD, "External vibrations" }, { 0x90FE, "Pulsating flow" }, { 0x90FF, "Incomplete filling" }, /*0x9110 - 0x9127 NE107 EMF (PA Profile 4.02) */ { 0x9110, "Gas bubbles in the liquid" }, { 0x9111, "Corrosion of electrodes" }, { 0x9112, "Electrical conductivity too low" }, { 0x9113, "Liner damage" }, { 0x9114, "Electrode fouling" }, { 0x9115, "External magnetic fields" }, { 0x9116, "Electrode short circuit" }, { 0x9117, "Incomplete filling" }, /*0x9128 - 0x913F NE107 thermal mass (PA Profile 4.02) */ /* empty */ /*0x9140 - 0x915F NE107 ultrasonic (PA Profile 4.02) */ { 0x9140, "Particle inclusions Check process" }, { 0x9141, "Gas bubbles in the liquid" }, { 0x9142, "Body fouling" }, { 0x9143, "External ultrasonic waves" }, { 0x9144, "Sensor fouling" }, { 0x9145, "Erosion" }, { 0x9146, "Faulty mounting (clamp on)" }, { 0x9147, "Pulsating flow" }, { 0x9148, "Sound conductivity" }, { 0x9149, "Signal lost due to overrange" }, { 0x914A, "Flow profile disturbance" }, { 0x914B, "Incomplete filling" }, /*0x9160 - 0x9177 NE107 variable area (PA Profile 4.02) */ { 0x9160, "Blocked float" }, { 0x9161, "Fouling" }, { 0x9162, "Erosion, corrosion" }, { 0x9163, "Gas bubbles in the liquid" }, { 0x9164, "Pulsating flow" }, { 0x9165, "External magnetic fields" }, /*0x9178 - 0x9197 NE107 vortex (PA Profile 4.02) */ { 0x9178, "Gas bubbles in the liquid" }, { 0x9179, "External vibrations" }, { 0x917A, "Pulsating flow" }, { 0x917B, "Two phase flow" }, { 0x917C, "Cavitation in device" }, { 0x917D, "Out of linear range" }, { 0x917E, "Sensor fouling" }, { 0x917F, "Solid particles" }, { 0x9180, "Flow profile disturbance" }, { 0x9181, "Incomplete filling" }, { 0x9182, "Bluff body fouling" }, /*0x9198 - 0x91B7 NE107 buoyancy (PA Profile 4.02) */ { 0x9198, "Gas density change above liquid" }, { 0x9199, "Vibration/strokes from outside" }, { 0x919A, "Displacer partly inside compartm" }, { 0x919B, "Displacer too heavy/too light" }, { 0x919C, "Density change or displac config" }, { 0x919D, "Sticking of torque or spring" }, { 0x919E, "Displacer swinging freedomly" }, { 0x919F, "Displac mounting faulty" }, { 0x91A0, "Displacer blocked or bended" }, { 0x91A1, "Displacer too light, corrosion" }, { 0x91A2, "Displacer leakage" }, { 0x91A3, "Force sensor broken" }, /*0x91B8 - 0x91FF NE107 radar (PA Profile 4.02) */ { 0x91B8, "Change of running time, encrust?" }, { 0x91B9, "False echoes, encrustation?" }, { 0x91BA, "Wrong/no indication, foam" }, { 0x91BB, "Poor reflection" }, { 0x91BC, "Problems with tank wall" }, { 0x91BD, "Surge tube or vent blocked" }, { 0x91BE, "Nozzle too long/high" }, { 0x91BF, "No metallic reflecting surface" }, { 0x91C0, "Blocking distance underrun" }, { 0x91C1, "Mechanical overloading of probe" }, { 0x91C2, "Probe lost or torn off" }, { 0x91C3, "Overload by external power" }, { 0x91C4, "Product or moisture in coupler" }, { 0x91C5, "Change of microwave speed" }, { 0x91C6, "Corr,abras, coating detachment" }, { 0x91C7, "Probe in filling flow" }, { 0x91D8, "No clear interface Emulsion?" }, { 0x91D9, "Wrong indication param setting" }, { 0x91DA, "Diff dielecon too small" }, { 0x91DB, "More than one interface" }, { 0x91DC, "First phase thickness too small" }, { 0x91E0, "Attenuation due to deposits" }, { 0x91E1, "False echoes due to deposits" }, { 0x91E2, "Corrosion surge tube (inside)" }, { 0x91E3, "Impurity in wave coupler area" }, { 0x91E4, "Antenna immersed in product" }, { 0x91E5, "Wrong signal due to foam" }, { 0x91E6, "Strong signal attenuation" }, { 0x91E7, "Shift of radar signal speed" }, { 0x91E8, "Reflection" }, { 0x91E9, "False interpretation of the echo" }, { 0x91EA, "Bad polarization of the signal" }, { 0x91EB, "Surge tube or vent blocked" }, { 0x91EC, "Nozzle too long for antenna" }, { 0x91ED, "Wall clearance, not vertical" }, { 0x91EE, "Corrosion on antenna" }, { 0x91EF, "Attenuation due to fog or dust" }, { 0x91F0, "Antenna signal blocked" }, { 0x91F1, "Blocking distance under-run" }, { 0x91F2, "Echo too strong (overmodulation)" }, /*0x9208 - 0x9257 NE107 electro (PA Profile 4.02) */ { 0x9208, "Faulty torque monitoring" }, { 0x9209, "Worn gear/spindle" }, { 0x920A, "Drive torque off-spec" }, { 0x920B, "Device temperature too high" }, { 0x920C, "Faulty limit position monitoring" }, { 0x920D, "Motor overload" }, { 0x920E, "Oil quality off-spec" }, { 0x920F, "Oil loss" }, { 0x9210, "Blocked drive" }, { 0x9211, "Off-spec seat/plug leakage" }, { 0x9212, "Off-spec spindle/shaft seal leak" }, { 0x9213, "Alteration and wear on spindle" }, { 0x9214, "Altered friction" }, { 0x9215, "Wear in the valve" }, { 0x9216, "Blocked valve" }, { 0x9217, "Change in valve move performance" }, { 0x9218, "Changed breakaway moment" }, { 0x9219, "Spindle deformation" }, { 0x921A, "Plug torn off" }, { 0x921B, "Off-spec valve temperature" }, { 0x921C, "Off-spec characteristic line" }, { 0x921E, "Incorrect position sensing" }, { 0x921F, "Input signal off-spec" }, { 0x9220, "Vibration off-spec" }, { 0x9221, "Temp in positioner too high/low" }, { 0x9222, "Moisture in positioner" }, { 0x9223, "Additional IO module defect" }, { 0x9224, "Signal without end position" }, { 0x9225, "No signal in end position" }, { 0x9226, "Control loop oscillation" }, { 0x9227, "Hysteresis" }, { 0x9228, "Changed friction" }, { 0x9229, "Backlash between drive and valve" }, { 0x922A, "Persistent deviation of control" }, { 0x922B, "Inadmissible dynamic stress" }, { 0x922C, "Faulty mounting" }, { 0x922D, "Faulty mount positioner to motor" }, { 0x922E, "Leak in piping" }, { 0x922F, "Insufficient drive power" }, { 0x9231, "Operator error during operation" }, { 0x9232, "Inadmissible static stress" }, { 0x9233, "Recording of pers. control dev." }, { 0x9234, "Parameter plausibility check" }, { 0x9235, "Status report on operating mode" }, { 0x9236, "Histogram for valve positions" }, { 0x9237, "Zero point and endpoint shift" }, { 0x9238, "Running time monitoring" }, { 0x9239, "Evaluation of internal signals" }, { 0x923A, "Operating hours counter" }, { 0x923B, "Pressure-displacement diagram" }, { 0x923C, "Total valve travel" }, { 0x923D, "Step response diagnostics" }, { 0x923E, "Internal temperature monitoring" }, { 0x923F, "Counter for direction changes" }, { 0x9240, "Operating archive" }, { 0x9241, "Report archive" }, { 0x9242, "Status reports on access control" }, { 0x9243, "Cavitation / flashing" }, { 0x9244, "Partial stroke test" }, { 0x9245, "P dif measurement across valve" }, { 0x9246, "Noise level measurement" }, /*0x9258 - 0x92A7 NE107 electro pneumatic (PA Profile 4.02) */ { 0x9258, "Minor drive leakage" }, { 0x9259, "High friction" }, { 0x925A, "Feed air pressure off-spec" }, { 0x925B, "Vent blockage" }, { 0x925C, "Diaphragm damage" }, { 0x925D, "Broken spring" }, { 0x925E, "Moist air in spring chamber" }, { 0x925F, "Blocked drive" }, { 0x9260, "Drive leakage too big" }, { 0x9261, "Off-spec seat/plug leakage" }, { 0x9262, "Off-spec spindle/shaft seal leak" }, { 0x9263, "Alteration and wear on spindle" }, { 0x9264, "Altered friction" }, { 0x9265, "Wear in the valve" }, { 0x9266, "Blocked valve" }, { 0x9267, "Change in valve move performance" }, { 0x9268, "Changed breakaway moment" }, { 0x9269, "Spindle deformation" }, { 0x926A, "Plug torn off" }, { 0x926B, "Off-spec valve temperature" }, { 0x926C, "Off-spec characteristic line" }, { 0x926D, "Fault in the pneumatic unit" }, { 0x926E, "Incorrect position sensing" }, { 0x926F, "Input signal off-spec" }, { 0x9270, "Vibration off-spec" }, { 0x9271, "Temp in positioner too high/low" }, { 0x9272, "Moisture in positioner" }, { 0x9273, "Additional IO module defect" }, { 0x9274, "Signal without end position" }, { 0x9275, "No signal in end position" }, { 0x9276, "Control loop oscillation" }, { 0x9277, "Hysteresis" }, { 0x9278, "Changed friction" }, { 0x9279, "Backlash between drive and valve" }, { 0x927A, "Persistent deviation of control" }, { 0x927B, "Inadmissible dynamic stress" }, { 0x927C, "Faulty mounting" }, { 0x927D, "Faulty mount positioner to drive" }, { 0x927E, "Leak in piping" }, { 0x927F, "Insufficient drive power" }, { 0x9280, "Quality of feed air off-spec" }, { 0x9281, "Operator error during operation" }, { 0x9282, "Inadmissible static stress" }, { 0x9283, "Recording of pers. control dev." }, { 0x9284, "Parameter plausibility check" }, { 0x9285, "Status report on operating mode" }, { 0x9286, "Histogram for valve positions" }, { 0x9287, "Zero point and endpoint shift" }, { 0x9288, "Running time monitoring" }, { 0x9289, "Evaluation of internal signals" }, { 0x928A, "Operating hours counter" }, { 0x928B, "Pressure-displacement diagram" }, { 0x928C, "Total valve travel" }, { 0x928D, "Step response diagnostics" }, { 0x928E, "Internal temperature monitoring" }, { 0x928F, "Counter for direction changes" }, { 0x9290, "Operating archive" }, { 0x9291, "Report archive" }, { 0x9292, "Status reports on access control" }, { 0x9293, "Cavitation / flashing" }, { 0x9294, "Partial stroke test" }, { 0x9295, "P dif measurement across valve" }, { 0x9296, "Noise level measurement" }, /*0x92A8 - 0x92BF NE107 sol valve (PA Profile 4.02) */ { 0x92A8, "Failure to reach safe position" }, { 0x92A9, "Failure to reach operat position" }, { 0x92AA, "High temperature in coil" }, { 0x92AB, "Moisture, humidity" }, { 0x92AC, "Signal outside of endposition" }, { 0x92AD, "No signal at endposition" }, /*0x92C0 - 0x92DF Physical block (PA Profile 4.02) */ { 0x92CD, "Maintenance" }, { 0x92D0, "Maintenance alarm" }, { 0x92D1, "Maintenance demanded" }, { 0x92D2, "Function check" }, { 0x92D3, "Out of spec." }, { 0x92D4, "Update event" }, /*0xA000 - 0xFFFF reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType 0 - 0x7FFF */ static const value_string pn_io_ext_channel_error_type0[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Accumulative Info"}, /* 0x8001 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Data transmission impossible" */ static const value_string pn_io_ext_channel_error_type0x8000[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Link State mismatch - Link down"}, { 0x8001, "MAUType mismatch"}, { 0x8002, "Line Delay mismatch"}, /* 0x8003 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Remote mismatch" */ static const value_string pn_io_ext_channel_error_type0x8001[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Peer name of station mismatch"}, { 0x8001, "Peer name of port mismatch"}, { 0x8002, "Peer RT_CLASS_3 mismatch a"}, { 0x8003, "Peer MAUType mismatch"}, { 0x8004, "Peer MRP domain mismatch"}, { 0x8005, "No peer detected"}, { 0x8006, "Reserved"}, { 0x8007, "Peer Line Delay mismatch"}, { 0x8008, "Peer PTCP mismatch b"}, { 0x8009, "Peer Preamble Length mismatch"}, { 0x800A, "Peer Fragmentation mismatch"}, { 0x800B, "Peer MRP Interconnection domain mismatch"}, /* 0x800C - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Media redundancy mismatch" 0x8002 */ static const value_string pn_io_ext_channel_error_type0x8002[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Manager role fail MRP-instance 1"}, { 0x8001, "MRP-instance 1 ring open"}, { 0x8002, "Reserved"}, { 0x8003, "Multiple manager MRP-instance 1"}, { 0x8010, "Manager role fail MRP-instance 2"}, { 0x8011, "MRP-instance 2 ring open"}, { 0x8012, "Reserved"}, { 0x8013, "Multiple manager MRP-instance 2"}, { 0x8020, "Manager role fail MRP-instance 3"}, { 0x8021, "MRP-instance 3 ring open"}, { 0x8023, "Multiple manager MRP-instance 3"}, { 0x8030, "Manager role fail MRP-instance 4"}, { 0x8031, "MRP-instance 4 ring open"}, { 0x8033, "Multiple manager MRP-instance 4"}, { 0x8040, "Manager role fail MRP-instance 5"}, { 0x8041, "MRP-instance 5 ring open"}, { 0x8043, "Multiple manager MRP-instance 5"}, { 0x8050, "Manager role fail MRP-instance 6"}, { 0x8051, "MRP-instance 6 ring open"}, { 0x8053, "Multiple manager MRP-instance 6"}, { 0x8060, "Manager role fail MRP-instance 7"}, { 0x8061, "MRP-instance 7 ring open"}, { 0x8063, "Multiple manager MRP-instance 7"}, { 0x8070, "Manager role fail MRP-instance 8"}, { 0x8071, "MRP-instance 8 ring open"}, { 0x8073, "Multiple manager MRP-instance 8"}, { 0x8080, "Manager role fail MRP-instance 9"}, { 0x8081, "MRP-instance 9 ring open"}, { 0x8083, "Multiple manager MRP-instance 9"}, { 0x8090, "Manager role fail MRP-instance 10"}, { 0x8091, "MRP-instance 10 ring open"}, { 0x8093, "Multiple manager MRP-instance 10"}, { 0x80A0, "Manager role fail MRP-instance 11"}, { 0x80A1, "MRP-instance 11 ring open"}, { 0x80A3, "Multiple manager MRP-instance 11"}, { 0x80B0, "Manager role fail MRP-instance 12"}, { 0x80B1, "MRP-instance 12 ring open"}, { 0x80B3, "Multiple manager MRP-instance 12"}, { 0x80C0, "Manager role fail MRP-instance 13"}, { 0x80C1, "MRP-instance 13 ring open"}, { 0x80C3, "Multiple manager MRP-instance 13"}, { 0x80D0, "Manager role fail MRP-instance 14"}, { 0x80D1, "MRP-instance 14 ring open"}, { 0x80D3, "Multiple manager MRP-instance 14"}, { 0x80E0, "Manager role fail MRP-instance 15"}, { 0x80E1, "MRP-instance 15 ring open"}, { 0x80E3, "Multiple manager MRP-instance 15"}, { 0x80F0, "Manager role fail MRP-instance 16"}, { 0x80F1, "MRP-instance 16 ring open"}, { 0x80F3, "Multiple manager MRP-instance 16"}, /* 0x8004 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Sync mismatch" and for ChannelErrorType "Time mismatch" 0x8003 and 0x8009*/ static const value_string pn_io_ext_channel_error_type0x8003[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "No sync message received"}, { 0x8001, "- 0x8002 Reserved"}, { 0x8003, "Jitter out of boundary"}, /* 0x8004 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /*ExtChannelErrorType for ChannelErrorType "Isochronous mode mismatch" 0x8004 */ static const value_string pn_io_ext_channel_error_type0x8004[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Output Time Failure - Output update missing or out of order"}, { 0x8001, "Input Time Failure"}, { 0x8002, "Master Life Sign Failure - Error in MLS update detected"}, /* 0x8003 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Multicast CR mismatch" 0x8005 */ static const value_string pn_io_ext_channel_error_type0x8005[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Multicast Consumer CR timed out"}, { 0x8001, "Address resolution failed"}, /* 0x8002 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Fiber optic mismatch" 0x8007*/ static const value_string pn_io_ext_channel_error_type0x8007[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Power Budget"}, { 0x8001, "SFP - Temperature threshold violation (High)"}, { 0x8002, "SFP - TX Bias threshold violation (High)"}, { 0x8003, "SFP - TX Bias threshold violation (Low)"}, { 0x8004, "SFP - TX Power threshold violation (High)"}, { 0x8005, "SFP - TX Power threshold violation (Low)"}, { 0x8006, "SFP - RX Power threshold violation (High)"}, { 0x8007, "SFP - RX Power threshold violation (Low)"}, { 0x8008, "SFP - TX Fault State indication"}, { 0x8009, "SFP - RX Loss State indication"}, /* 0x800A - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Network component function mismatch" 0x8008 */ static const value_string pn_io_ext_channel_error_type0x8008[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Frame dropped - no resource"}, /* 0x8001 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Dynamic Frame Packing function mismatch" 0x800A */ static const value_string pn_io_ext_channel_error_type0x800A[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ /* 0x8000 - 0x80FF Reserved */ { 0x8100, "Frame late error for FrameID (0x0100)"}, /* 0x8101 + 0x8FFE See Equation (56) */ { 0x8FFF, "Frame late error for FrameID (0x0FFF)"}, /* 0x8001 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Media redundancy with planned duplication mismatch" 0x800B */ static const value_string pn_io_ext_channel_error_type0x800B[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ /* 0x8000 - 0x86FF Reserved */ { 0x8700, "MRPD duplication void for FrameID (0x0700)"}, /* 0x8701 + 0x8FFE See Equation (57) */ { 0x8FFF, "MRPD duplication void for FrameID (0x0FFF)"}, /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "System redundancy mismatch" 0x800C */ static const value_string pn_io_ext_channel_error_type0x800C[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "System redundancy event"}, /* 0x8001 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* ExtChannelErrorType for ChannelErrorType "Power failure over Single Pair Ethernet" 0x8010 */ static const value_string pn_io_ext_channel_error_type0x8010[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "SPE power supply - Short circuit"}, { 0x8001, "SPE power supply - Open circuit"}, { 0x8002, "SPE power supply - Voltage level"}, { 0x8003, "SPE power supply - Current level"}, /* 0x8004 - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } }; /* QualifiedChannelQualifier */ static const value_string pn_io_qualified_channel_qualifier[] = { {0x00000001, "Reserved"}, {0x00000002, "Reserved"}, {0x00000004, "Reserved"}, {0x00000008, "Qualifier_3 (Advice)"}, {0x00000010, "Qualifier_4 (Advice, PA: UpdateEvent)"}, {0x00000020, "Qualifier_5 (Advice, PA: OutOfSpecification)"}, {0x00000040, "Qualifier_6 (Advice)"}, {0x00000080, "Qualifier_7 (MaintenanceRequired)"}, {0x00000100, "Qualifier_8 (MaintenanceRequired)"}, {0x00000200, "Qualifier_9 (MaintenanceRequired)"}, {0x00000400, "Qualifier_10 (MaintenanceRequired)"}, {0x00000800, "Qualifier_11 (MaintenanceRequired)"}, {0x00001000, "Qualifier_12 (MaintenanceRequired, PA: MaintenanceRequired)"}, {0x00002000, "Qualifier_13 (MaintenanceRequired)"}, {0x00004000, "Qualifier_14 (MaintenanceRequired)"}, {0x00008000, "Qualifier_15 (MaintenanceRequired)"}, {0x00010000, "Qualifier_16 (MaintenanceRequired)"}, {0x00020000, "Qualifier_17 (MaintenanceDemanded)"}, {0x00040000, "Qualifier_18 (MaintenanceDemanded)"}, {0x00080000, "Qualifier_19 (MaintenanceDemanded)"}, {0x00100000, "Qualifier_20 (MaintenanceDemanded)"}, {0x00200000, "Qualifier_21 (MaintenanceDemanded)"}, {0x00400000, "Qualifier_22 (MaintenanceDemanded, PA: MaintenanceDemanded)"}, {0x00800000, "Qualifier_23 (MaintenanceDemanded)"}, {0x01000000, "Qualifier_24 (MaintenanceDemanded, PA: FunctionCheck)"}, {0x02000000, "Qualifier_25 (MaintenanceDemanded)"}, {0x04000000, "Qualifier_26 (MaintenanceDemanded)"}, {0x08000000, "Qualifier_27 (Fault)"}, {0x10000000, "Qualifier_28 (Fault)"}, {0x20000000, "Qualifier_29 (Fault)"}, {0x40000000, "Qualifier_30 (Fault, PA: Fault)"}, {0x80000000, "Qualifier_31 (Fault)"}, {0, NULL}}; static const value_string pn_io_channel_properties_type[] = { { 0x0000, "submodule or unspecified" }, { 0x0001, "1 Bit" }, { 0x0002, "2 Bit" }, { 0x0003, "4 Bit" }, { 0x0004, "8 Bit" }, { 0x0005, "16 Bit" }, { 0x0006, "32 Bit" }, { 0x0007, "64 Bit" }, /*0x0008 - 0x00FF reserved */ { 0, NULL } }; static const value_string pn_io_channel_properties_accumulative_vals[] = { { 0x0000, "Channel" }, { 0x0001, "ChannelGroup" }, { 0, NULL } }; /* We are reading this as a two bit value, but the spec specifies each bit * separately. Beware endianness when reading spec */ static const value_string pn_io_channel_properties_maintenance[] = { { 0x0000, "Failure" }, { 0x0001, "Maintenance required" }, { 0x0002, "Maintenance demanded" }, { 0x0003, "see QualifiedChannelQualifier" }, { 0, NULL } }; static const value_string pn_io_channel_properties_specifier[] = { { 0x0000, "All subsequent disappears" }, { 0x0001, "Appears" }, { 0x0002, "Disappears" }, { 0x0003, "Disappears but others remain" }, { 0, NULL } }; static const value_string pn_io_channel_properties_direction[] = { { 0x0000, "Manufacturer-specific" }, { 0x0001, "Input" }, { 0x0002, "Output" }, { 0x0003, "Input/Output" }, /*0x0004 - 0x0007 reserved */ { 0, NULL } }; static const value_string pn_io_alarmcr_type[] = { { 0x0000, "reserved" }, { 0x0001, "Alarm CR" }, /*0x0002 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_mau_type[] = { /*0x0000 - 0x0004 reserved */ { 0x0005, "10BASET" }, /*0x0006 - 0x0009 reserved */ { 0x000A, "10BASETXHD" }, { 0x000B, "10BASETXFD" }, { 0x000C, "10BASEFLHD" }, { 0x000D, "10BASEFLFD" }, { 0x000F, "100BASETXHD" }, { 0x0010, "100BASETXFD" }, { 0x0011, "100BASEFXHD" }, { 0x0012, "100BASEFXFD" }, /*0x0013 - 0x0014 reserved */ { 0x0015, "1000BASEXHD" }, { 0x0016, "1000BASEXFD" }, { 0x0017, "1000BASELXHD" }, { 0x0018, "1000BASELXFD" }, { 0x0019, "1000BASESXHD" }, { 0x001A, "1000BASESXFD" }, /*0x001B - 0x001C reserved */ { 0x001D, "1000BASETHD" }, { 0x001E, "1000BASETFD" }, { 0x001F, "10GigBASEFX" }, /*0x0020 - 0x002D reserved */ { 0x002E, "100BASELX10" }, /*0x002F - 0x0035 reserved */ { 0x0036, "100BASEPXFD" }, /*0x0037 - 0x008C reserved */ { 0x008D, "10BASET1L" }, /*0x008E - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_preamble_length[] = { { 0x0000, "Seven octets Preamble shall be used" }, { 0x0001, "One octet Preamble shall be used" }, /*0x0002 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_mau_type_mode[] = { { 0x0000, "OFF" }, { 0x0001, "ON" }, /*0x0002 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_dcp_boundary_value_bit0[] = { { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-00" }, { 0x01, "Block an outgoing DCP_Identify frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-00" }, { 0, NULL } }; static const value_string pn_io_dcp_boundary_value_bit1[] = { { 0x00, "Do not block the multicast MAC address 01-0E-CF-00-00-01" }, { 0x01, "Block an outgoing DCP_Hello frame (egress filter) with the multicast MAC address 01-0E-CF-00-00-01" }, { 0, NULL } }; static const value_string pn_io_peer_to_peer_boundary_value_bit0[] = { { 0x00, "The LLDP agent shall send LLDP frames for this port." }, { 0x01, "The LLDP agent shall not send LLDP frames (egress filter)." }, { 0, NULL } }; static const value_string pn_io_peer_to_peer_boundary_value_bit1[] = { { 0x00, "The PTCP ASE shall send PTCP_DELAY request frames for this port." }, { 0x01, "The PTCP ASE shall not send PTCP_DELAY request frames (egress filter)." }, { 0, NULL } }; static const value_string pn_io_peer_to_peer_boundary_value_bit2[] = { { 0x00, "The Time ASE shall send PATH_DELAY request frames for this port." }, { 0x01, "The Time ASE shall not send PATH_DELAY request frames (egress filter)." }, { 0, NULL } }; static const range_string pn_io_mau_type_extension[] = { { 0x0000, 0x0000, "No SubMAUType" }, { 0x0001, 0x00FF, "Reserved" }, { 0x0100, 0x0100, "POF" }, { 0x0101, 0x01FF, "Reserved for SubMAUType" }, { 0x0200, 0x0200, "APL" }, { 0x0201, 0xFFEF, "Reserved for SubMAUType" }, { 0xFFF0, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_io_pe_operational_mode[] = { { 0x00, 0x00, "PE_PowerOff" }, { 0x01, 0x1F, "PE_EnergySavingMode" }, { 0x20, 0xEF, "Reserved" }, { 0xF0, 0xF0, "PE_Operate" }, { 0xF1, 0xFD, "Reserved" }, { 0xFE, 0xFE, "PE_SleepModeWOL" }, { 0xFF, 0xFF, "PE_ReadyToOperate" }, { 0, 0, NULL } }; static const value_string pn_io_port_state[] = { { 0x0000, "reserved" }, { 0x0001, "up" }, { 0x0002, "down" }, { 0x0003, "testing" }, { 0x0004, "unknown" }, /*0x0005 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_link_state_port[] = { { 0x00, "unknown" }, { 0x01, "disabled/discarding" }, { 0x02, "blocking" }, { 0x03, "listening" }, { 0x04, "learning" }, { 0x05, "forwarding" }, { 0x06, "broken" }, /*0x07 - 0xFF reserved */ { 0, NULL } }; static const value_string pn_io_link_state_link[] = { { 0x00, "reserved" }, { 0x01, "up" }, { 0x02, "down" }, { 0x03, "testing" }, { 0x04, "unknown" }, { 0x05, "dormant" }, { 0x06, "notpresent" }, { 0x07, "lowerlayerdown" }, /*0x08 - 0xFF reserved */ { 0, NULL } }; static const value_string pn_io_media_type[] = { { 0x0000, "Unknown" }, { 0x0001, "Copper cable" }, { 0x0002, "Fiber optic cable" }, { 0x0003, "Radio communication" }, /*0x0004 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_fiber_optic_type[] = { { 0x0000, "No fiber type adjusted" }, { 0x0001, "9 um single mode fiber" }, { 0x0002, "50 um multi mode fiber" }, { 0x0003, "62,5 um multi mode fiber" }, { 0x0004, "SI-POF, NA=0.5" }, { 0x0005, "SI-PCF, NA=0.36" }, { 0x0006, "LowNA-POF, NA=0.3" }, { 0x0007, "GI-POF" }, /*0x0008 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_fiber_optic_cable_type[] = { { 0x0000, "No cable specified" }, { 0x0001, "Inside/outside cable, fixed installation" }, { 0x0002, "Inside/outside cable, flexible installation" }, { 0x0003, "Outdoor cable, fixed installation" }, /*0x0004 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_im_revision_prefix_vals[] = { { 'V', "V - Officially released version" }, { 'R', "R - Revision" }, { 'P', "P - Prototype" }, { 'U', "U - Under Test (Field Test)" }, { 'T', "T - Test Device" }, /*all others reserved */ { 0, NULL } }; static const value_string pn_io_mrp_role_vals[] = { { 0x0000, "Media Redundancy disabled" }, { 0x0001, "Media Redundancy Client" }, { 0x0002, "Media Redundancy Manager" }, /*all others reserved */ { 0, NULL } }; static const value_string pn_io_mrp_instance_no[] = { { 0x0000, "MRP_Instance 1" }, { 0x0001, "MRP_Instance 2" }, { 0x0002, "MRP_Instance 3" }, { 0x0003, "MRP_Instance 4" }, { 0x0004, "MRP_Instance 5" }, { 0x0005, "MRP_Instance 6" }, { 0x0006, "MRP_Instance 7" }, { 0x0007, "MRP_Instance 8" }, { 0x0008, "MRP_Instance 9" }, { 0x0009, "MRP_Instance 10" }, { 0x000A, "MRP_Instance 11" }, { 0x000B, "MRP_Instance 12" }, { 0x000C, "MRP_Instance 13" }, { 0x000D, "MRP_Instance 14" }, { 0x000E, "MRP_Instance 15" }, { 0x000F, "MRP_Instance 16" }, /*all others reserved */ { 0, NULL } }; static const value_string pn_io_mrp_mrm_on[] = { { 0x0000, "Disable MediaRedundancyManager diagnosis" }, { 0x0001, "Enable MediaRedundancyManager diagnosis"}, { 0, NULL } }; static const value_string pn_io_mrp_checkUUID[] = { { 0x0000, "Disable the check of the MRP_DomainUUID" }, { 0x0001, "Enable the check of the MRP_DomainUUID"}, { 0, NULL } }; static const value_string pn_io_mrp_prio_vals[] = { { 0x0000, "Highest priority redundancy manager" }, /* 0x1000 - 0x7000 High priorities */ { 0x8000, "Default priority for redundancy manager" }, /* 0x9000 - 0xE000 Low priorities */ { 0xF000, "Lowest priority redundancy manager" }, /*all others reserved */ { 0, NULL } }; static const value_string pn_io_mrp_rtmode_rtclass12_vals[] = { { 0x0000, "RT_CLASS_1 and RT_CLASS_2 redundancy mode deactivated" }, { 0x0001, "RT_CLASS_1 and RT_CLASS_2 redundancy mode activated" }, { 0, NULL } }; static const value_string pn_io_mrp_rtmode_rtclass3_vals[] = { { 0x0000, "RT_CLASS_3 redundancy mode deactivated" }, { 0x0001, "RT_CLASS_3 redundancy mode activated" }, { 0, NULL } }; static const value_string pn_io_mrp_ring_state_vals[] = { { 0x0000, "Ring open" }, { 0x0001, "Ring closed" }, { 0, NULL } }; static const value_string pn_io_mrp_rt_state_vals[] = { { 0x0000, "RT media redundancy lost" }, { 0x0001, "RT media redundancy available" }, { 0, NULL } }; static const value_string pn_io_control_properties_vals[] = { { 0x0000, "Reserved" }, { 0, NULL } }; static const value_string pn_io_control_properties_prmbegin_vals[] = { { 0x0000, "No PrmBegin" }, { 0x0001, "The IO controller starts the transmission of the stored start-up parameter" }, { 0, NULL } }; static const value_string pn_io_control_properties_application_ready_bit0_vals[] = { { 0x0000, "Wait for explicit ControlCommand.ReadyForCompanion" }, { 0x0001, "Implicit ControlCommand.ReadyForCompanion" }, { 0, NULL } }; static const value_string pn_io_control_properties_application_ready_bit1_vals[] = { { 0x0000, "Wait for explicit ControlCommand.ReadyForRT_CLASS_3" }, { 0x0001, "Implicit ControlCommand.ReadyForRT_CLASS_3" }, { 0, NULL } }; static const value_string pn_io_fs_hello_mode_vals[] = { { 0x0000, "OFF" }, { 0x0001, "Send req on LinkUp" }, { 0x0002, "Send req on LinkUp after HelloDelay" }, { 0, NULL } }; static const value_string pn_io_fs_parameter_mode_vals[] = { { 0x0000, "OFF" }, { 0x0001, "ON" }, { 0x0002, "Reserved" }, { 0x0003, "Reserved" }, { 0, NULL } }; static const value_string pn_io_frame_details_sync_master_vals[] = { { 0x0000, "No Sync Frame" }, { 0x0001, "Primary sync frame" }, { 0x0002, "Secondary sync frame" }, { 0x0003, "Reserved" }, { 0, NULL } }; static const value_string pn_io_frame_details_meaning_frame_send_offset_vals[] = { { 0x0000, "Field FrameSendOffset specifies the point of time for receiving or transmitting a frame " }, { 0x0001, "Field FrameSendOffset specifies the beginning of the RT_CLASS_3 interval within a phase" }, { 0x0002, "Field FrameSendOffset specifies the ending of the RT_CLASS_3 interval within a phase" }, { 0x0003, "Reserved" }, { 0, NULL } }; static const value_string pn_io_f_check_seqnr[] = { { 0x00, "consecutive number not included in crc" }, { 0x01, "consecutive number included in crc" }, { 0, NULL } }; static const value_string pn_io_f_check_ipar[] = { { 0x00, "no check" }, { 0x01, "check" }, { 0, NULL } }; static const value_string pn_io_f_sil[] = { { 0x00, "SIL1" }, { 0x01, "SIL2" }, { 0x02, "SIL3" }, { 0x03, "NoSIL" }, { 0, NULL } }; static const value_string pn_io_f_crc_len[] = { { 0x00, "3 octet CRC" }, { 0x01, "2 octet CRC" }, { 0x02, "4 octet CRC" }, { 0x03, "reserved" }, { 0, NULL } }; static const value_string pn_io_f_crc_seed[] = { { 0x00, "CRC-FP as seed value and counter" }, { 0x01, "'1' as seed value and CRC-FP+/MNR" }, { 0, NULL } }; /* F_Block_ID dissection due to ver2.6 specifikation of PI */ static const value_string pn_io_f_block_id[] = { { 0x00, "No F_WD_Time_2, no F_iPar_CRC" }, { 0x01, "No F_WD_Time_2, F_iPar_CRC" }, { 0x02, "F_WD_Time_2, no F_iPar_CRC" }, { 0x03, "F_WD_Time_2, F_iPar_CRC" }, /* 0x04..0x07 reserved */ /* { 0x00, "Parameter set for F-Host/F-Device relationship" }, */ /* { 0x01, "Additional F_Address parameter block" }, */ /* 0x02..0x07 reserved */ { 0, NULL } }; static const value_string pn_io_f_par_version[] = { { 0x00, "Valid for V1-mode" }, { 0x01, "Valid for V2-mode" }, /* 0x02..0x03 reserved */ { 0, NULL } }; static const value_string pn_io_profidrive_request_id_vals[] = { { 0x00, "Reserved" }, { 0x01, "Read request" }, { 0x02, "Change request" }, { 0, NULL } }; static const value_string pn_io_profidrive_response_id_vals[] = { { 0x00, "Reserved" }, { 0x01, "Positive read response" }, { 0x02, "Positive change response" }, { 0x81, "Negative read response" }, { 0x82, "Negative change response" }, { 0, NULL } }; static const value_string pn_io_profidrive_attribute_vals[] = { { 0x00, "Reserved" }, { 0x10, "Value" }, { 0x20, "Description" }, { 0x30, "Text" }, { 0, NULL } }; static const value_string pn_io_profidrive_format_vals[] = { {0x0, "Zero"}, {0x01, "Boolean" }, {0x02, "Integer8" }, {0x03, "Integer16" }, {0x04, "Integer32" }, {0x05, "Unsigned8" }, {0x06, "Unsigned16" }, {0x07, "Unsigned32" }, {0x08, "Float32" }, {0x09, "VisibleString" }, {0x0A, "OctetString" }, {0x0B, "Binary Date"}, {0x0C, "TimeOfDay" }, {0x0D, "TimeDifference" }, {0x0E, "BitString"}, {0x0F, "Float64"}, {0x10, "UniversalTime"}, {0x11, "FieldbusTime"}, {0x15, "Time Value"}, {0x16, "Bitstring8"}, {0x17, "Bitstring16"}, {0x18, "Bitstring32"}, {0x19, "VisibleString1"}, {0x1A, "VisibleString2"}, {0x1B, "VisibleString4"}, {0x1C, "VisibleString8"}, {0x1D, "VisibleString16"}, {0x1E, "OctetString1"}, {0x1F, "OctetString2"}, {0x20, "OctetString4"}, {0x21, "OctetString8"}, {0x22, "OctetString16"}, {0x23, "BCD"}, {0x24, "UNICODE char"}, {0x25, "CompactBoolean-Array"}, {0x26, "CompactBCDArray"}, {0x27, "UNICODEString"}, {0x28, "BinaryTime0"}, {0x29, "BinaryTime1"}, {0x2A, "BinaryTime2"}, {0x2B, "BinaryTime3"}, {0x2C, "BinaryTime4"}, {0x2D, "BinaryTime5"}, {0x2E, "BinaryTime6"}, {0x2F, "BinaryTime7"}, {0x30, "BinaryTime8"}, {0x31, "BinaryTime9"}, {0x32, "Date"}, {0x33, "BinaryDate2000"}, {0x34, "TimeOfDay without date indication"}, {0x35, "TimeDifference with date indication"}, {0x36, "TimeDifference without date indication"}, {0x37, "Integer64"}, {0x38, "Unsigned64"}, {0x39, "BitString64"}, {0x3A, "NetworkTime"}, {0x3B, "NetworkTime-Difference"}, {0x40, "Zero" }, {0x41, "Byte" }, {0x42, "Word" }, {0x43, "Dword" }, {0x44, "Error Type" }, {0x65, "Float32+Unsigned8"}, {0x66, "Unsigned8+Unsigned8"}, {0x67, "OctetString2+Unsigned8"}, {0x68, "Unsigned16_S"}, {0x69, "Integer16_S"}, {0x6A, "Unsigned8_S"}, {0x6B, "OctetString_S"}, {0x6E, "F message trailer with 4 octets"}, {0x6F, "F message trailer with 5 octets"}, {0x70, "F message trailer with 6 octets"}, {0x71, "N2 Normalized value (16 bit)"}, {0x72, "N4 Normalized value (32 bit)"}, {0x73, "V2 Bit sequence" }, {0x74, "L2 Nibble"}, {0x75, "R2 Reciprocal time constant"}, {0x76, "T2 Time constant (16 bit)"}, {0x77, "T4 Time constant (32 bit)"}, {0x78, "D2 Time constant"}, {0x79, "E2 Fixed point value (16 bit)"}, {0x7A, "C4 Fixed point value (32 bit)"}, {0x7B, "X2 Normalized value, variable (16bit)"}, {0x7C, "X4 Normalized value, variables (32bit)"}, { 0, NULL } }; static const value_string pn_io_profidrive_parameter_resp_errors[] = { {0x0, "Disallowed parameter number" }, {0x1, "The parameter value cannot be changed" }, {0x2, "Exceed the upper or lower limit" }, {0x3, "Sub-index error" }, {0x4, "Non-array" }, {0x5, "Incorrect data type" }, {0x6, "Setting is not allowed (can only be reset)" }, {0x7, "The description element cannot be modified" }, {0x8, "Reserved" }, {0x9, "Descriptive data does not exist" }, {0xA, "Reserved" }, {0xB, "No operation priority" }, {0xC, "Reserved" }, {0xD, "Reserved" }, {0xE, "Reserved" }, {0xF, "The text array does not save right" }, {0x11, "The request cannot be executed because of the working status" }, {0x12, "Reserved" }, {0x13, "Reserved" }, {0x14, "Value is not allowed" }, {0x15, "Response timeout" }, {0x16, "Illegal parameter address" }, {0x17, "Illegal parameter format" }, {0x18, "The number of values is inconsistent" }, {0x19, "Axis/DO does not exist" }, {0x20, "The parameter text element cannot be changed" }, {0x21, "No support service" }, {0x22, "Too many parameter requests" }, {0x23, "Only support single parameter access" }, { 0, NULL } }; static const range_string pn_io_rs_block_type[] = { /* Following ranges are used for events */ { 0x0000, 0x0000, "reserved" }, { 0x0001, 0x3FFF, "Manufacturer specific" }, { 0x4000, 0x4000, "Stop observer - Observer Status Observer" }, { 0x4001, 0x4001, "Buffer observer - RS_BufferObserver" }, { 0x4002, 0x4002, "Time status observer - RS_TimeStatus" }, { 0x4003, 0x4003, "System redundancy layer observer - RS_SRLObserver" }, { 0x4004, 0x4004, "Source identification observer - RS_SourceIdentification" }, { 0x4005, 0x400F, "reserved" }, { 0x4010, 0x4010, "Digital input observer - SoE_DigitalInputObserver" }, { 0x4011, 0x6FFF, "Reserved for normative usage" }, { 0x7000, 0x7FFF, "Reserved for profile usage" }, /* Following ranges are used for adjust */ { 0x8000, 0x8000, "reserved" }, { 0x8001, 0xBFFF, "Manufacturer specific" }, { 0xC000, 0xC00F, "Reserved for normative usage" }, { 0xC010, 0xC010, "Digital input observer - SoE_DigitalInputObserver" }, { 0xC011, 0xEFFF, "Reserved for normative usage"}, { 0xF000, 0xFFFF, "Reserved for profile usage"}, { 0, 0, NULL } }; static const value_string pn_io_rs_specifier_specifier[] = { { 0x0, "Current value" }, { 0x1, "Appears" }, { 0x2, "Disappears" }, { 0x3, "Reserved" }, { 0, NULL } }; static const value_string pn_io_rs_time_stamp_status[] = { { 0x0, "TimeStamp related to global synchronized time" }, { 0x1, "TimeStamp related to local time" }, { 0x2, "TimeStamp related to local (arbitrary timescale) time" }, { 0, NULL } }; static const value_string pn_io_rs_reason_code_reason[] = { { 0x00000000, "Reserved" }, { 0x00000001, "Observed data status unclear" }, { 0x00000002, "Buffer overrun" }, /* 0x0003 - 0xFFFF Reserved */ { 0, NULL } }; static const value_string pn_io_rs_reason_code_detail[] = { { 0x00000000, "No Detail" }, /* 0x0001 - 0xFFFF Reserved */ { 0, NULL } }; static const value_string pn_io_soe_digital_input_current_value_value[] = { { 0x0, "Digital input is zero" }, { 0x1, "Digital input is one" }, { 0, NULL } }; static const value_string pn_io_soe_adjust_specifier_incident[] = { { 0x00, "Reserved" }, { 0x01, "Rising edge" }, { 0x02, "Falling edge" }, { 0x03, "Reserved" }, { 0, NULL } }; static const value_string pn_io_rs_properties_alarm_transport[] = { { 0x00000000, "Default Reporting system events need to be read by record " }, { 0x00000001, "Reporting system events shall be forwarded to the IOC using the alarm transport" }, { 0, NULL } }; static const value_string pn_io_am_location_structure_vals[] = { { 0x00, "Reserved" }, { 0x01, "Twelve level tree format" }, { 0x02, "Slot - and SubslotNumber format" }, { 0, NULL } }; static const range_string pn_io_am_location_level_vals[] = { { 0x0000, 0x03FE, "Address information to identify a reported node" }, { 0x03FF, 0x03FF, "Level not used" }, { 0, 0, NULL } }; static const value_string pn_io_am_location_reserved_vals[] = { { 0x00, "Reserved" }, { 0, NULL } }; static const range_string pn_io_RedundancyDataHoldFactor[] = { { 0x0000, 0x0002, "Reserved" }, { 0x0003, 0x00C7, "Optional - An expiration of the time leads to an AR termination." }, { 0x00C8, 0xFFFF, "Mandatory - An expiration of the time leads to an AR termination." }, { 0, 0, NULL } }; static const value_string pn_io_ar_arnumber[] = { { 0x0000, "reserved" }, { 0x0001, "1st AR of an ARset" }, { 0x0002, "2nd AR of an ARset" }, { 0x0003, "3rd AR of an ARset" }, { 0x0004, "4th AR of an ARset" }, /*0x0005 - 0xFFFF reserved */ { 0, NULL } }; static const value_string pn_io_ar_arresource[] = { { 0x0000, "reserved" }, { 0x0002, "Communication endpoint shall allocate two ARs for the ARset" }, /*0x0001 and 0x0003 - 0xFFFF reserved */ { 0, NULL } }; static const range_string pn_io_line_delay_value[] = { { 0x00000000, 0x00000000, "Line delay and cable delay unknown" }, { 0x00000001, 0x7FFFFFFF, "Line delay in nanoseconds" }, { 0, 0, NULL } }; static const range_string pn_io_cable_delay_value[] = { { 0x00000000, 0x00000000, "Reserved" }, { 0x00000001, 0x7FFFFFFF, "Cable delay in nanoseconds" }, { 0, 0, NULL } }; static const true_false_string pn_io_pdportstatistic_counter_status_contents = { "The contents of the field are invalid. They shall be set to zero.", "The contents of the field are valid" }; static const value_string pn_io_pdportstatistic_counter_status_reserved[] = { { 0x00, "Reserved" }, { 0, NULL } }; static const value_string pn_io_tsn_domain_vid_config_vals[] = { { 0x00, "Reserved" }, { 0x64, "NonStreamVID-Default" }, { 0x65, "StreamHighVID-Default" }, { 0x66, "StreamHighRedVID-Default" }, { 0x67, "StreamLowVID-Default" }, { 0x68, "StreamLowRedVID-Default" }, { 0x69, "NonStreamVIDB-Default" }, { 0x6A, "NonStreamVIDC-Default" }, { 0x6B, "NonStreamVIDD-Default" }, { 0, NULL } }; static const value_string pn_io_tsn_domain_port_config_preemption_enabled_vals[] = { { 0x00, "Preemption support is disabled for this port" }, { 0x01, "Preemption support is enabled for this port" }, { 0, NULL } }; static const value_string pn_io_tsn_domain_port_config_boundary_port_config_vals[] = { { 0x00, "No boundary port" }, { 0x01, "Boundary port with Remapping1" }, { 0x02, "Boundary port with Remapping2" }, { 0, NULL } }; static const range_string pn_io_tsn_domain_port_ingress_rate_limiter_cir[] = { { 0x0000, 0x0000, "No Boundary Port" }, { 0x0001, 0xFFFF, "Committed information rate in 0,1 Mbit/s"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_port_ingress_rate_limiter_cbs[] = { { 0x0000, 0x0000, "No Boundary Port" }, { 0x0001, 0xFFFF, "Committed burst size in octets"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_port_ingress_rate_limiter_envelope[] = { { 0x0000, 0x0000, "No Boundary Port" }, { 0x0001, 0x0001, "Best effort envelope"}, { 0x0002, 0x0002, "RT_CLASS_X, RTA_CLASS_X envelope"}, { 0x0003, 0xFFFF, "Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_port_ingress_rate_limiter_rank[] = { { 0x0000, 0x0000, "No Boundary Port" }, { 0x0001, 0x0001, "CF1"}, { 0x0002, 0x0002, "CF2"}, { 0x0003, 0x0003, "CF3"}, { 0x0004, 0x0004, "CF4"}, { 0x0005, 0x0005, "CF5"}, { 0x0006, 0xFFFF, "Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_cir[] = { { 0x0000, 0x0000, "Used in case of no rate limiter" }, { 0x0001, 0xFFFF, "Committed information rate in 0,1 Mbit/s"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_cbs[] = { { 0x0000, 0x0000, "Used in case of no rate limiter" }, { 0x0001, 0xFFFF, "Committed burst size in octets"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_envelope[] = { { 0x00, 0x00, "Used in case of no rate limiter" }, { 0x01, 0x01, "Best effort envelope"}, { 0x02, 0xFF, "Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_rank[] = { { 0x00, 0x00, "Used in case of no boundary port" }, { 0x01, 0x01, "CF1"}, { 0x02, 0x02, "CF2"}, { 0x03, 0x03, "CF3"}, { 0x04, 0x04, "CF4"}, { 0x05, 0x05, "CF5"}, { 0x06, 0xFF, "Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_queue_id[] = { { 0x00, 0x07, "Identifier of the queue" }, { 0x08, 0xFF, "Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_queue_rate_limiter_reserved[] = { { 0x00, 0xFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_io_network_domain[] = { { 0x00000000, 0x00000000, "No Deadline" }, { 0x00000001, 0xFFFFFFFF, "The Deadline in Microseconds"}, { 0, 0, NULL } }; static const value_string pn_io_time_domain_number_vals[] = { { 0x0000, "Global Time" }, { 0x0001, "Global Time Redundant" }, { 0x0020, "Working Clock" }, { 0x0021, "Working Clock Redundant" }, { 0, NULL } }; static const value_string pn_io_time_pll_window_vals[] = { { 0x00000000, "Disabled" }, { 0x000003E8, "Default" }, { 0x00002710, "Default" }, { 0x000186A0, "Default" }, { 0x000F4240, "Default" }, { 0x00989680, "Default" }, { 0, NULL } }; static const value_string pn_io_message_interval_factor_vals[] = { { 0x0000, "Reserved" }, { 0x03E8, "Default" }, { 0x0FA0, "Default" }, { 0, NULL } }; static const range_string pn_io_message_timeout_factor[] = { { 0x0000, 0x0000, "Disabled" }, { 0x0001, 0x0002, "Optional" }, { 0x0003, 0x0005, "Mandatory" }, { 0x0006, 0x0006, "Default, mandatory" }, { 0x0007, 0x000F, "Mandatory" }, { 0x0010, 0x01FF, "Optional" }, { 0x0200, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; static const value_string pn_io_time_sync_properties_vals[] = { { 0x00, "Reserved" }, { 0x01, "External Sync" }, { 0x02, "Internal Sync" }, { 0x03, "Reserved" }, { 0, NULL } }; static const range_string pn_io_tsn_domain_queue_config_shaper[] = { { 0x00, 0x00, "Reserved" }, { 0x01, 0x01, "Strict Priority" }, { 0x02, 0xFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_io_tsn_domain_sync_port_role_vals[] = { { 0x00,0x00, "The port is not part of the sync tree for this sync domain" }, { 0x01,0x01, "Sync egress port for this sync domain" }, { 0x02,0x02, "Sync ingress port for this sync domain" }, { 0x02,0XFF, "Reserved" }, { 0, 0, NULL } }; static const value_string pn_io_tsn_fdb_command[] = { { 0x01, "AddStreamEntry" }, { 0x02, "RemoveStreamEntry" }, { 0x03, "RemoveAllStreamEntries" }, /* all others reserved */ { 0, NULL } }; static const range_string pn_io_tsn_transfer_time_tx_vals[] = { { 0x00000000, 0x00000000, "Reserved" }, { 0x00000001, 0x05F5E100, "Egress transfer time for the local interface of an endstation" }, { 0x05F5E101, 0xFFFFFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_io_tsn_transfer_time_rx_vals[] = { { 0x00000000, 0x00000000, "Reserved" }, { 0x00000001, 0x05F5E100, "Ingress transfer time for the local interface of an endstation" }, { 0x05F5E101, 0xFFFFFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_io_tsn_max_supported_record_size_vals[] = { { 0x00000000,0x00000FE3, "Reserved" }, { 0x00000FE4,0x0000FFFF, "Describes the maximum supported size of RecordDataWrite." }, {0x00010000,0xFFFFFFFF,"Reserved"}, { 0, 0, NULL } }; static const range_string pn_io_tsn_forwarding_group_vals[] = { { 0x00,0x00, "Reserved" }, { 0x01,0xFF, "Identifier of logical port grouping. Identifies ports with equal forwarding delay values." }, { 0, 0, NULL } }; static const value_string pn_io_tsn_stream_class_vals[] = { /*other reserved */ { 0x01, "High" }, { 0x02, "High Redundant" }, { 0x03, "Low" }, { 0x04, "Low Redundant" }, { 0, NULL } }; static const range_string pn_io_tsn_independent_forwarding_delay_vals[] = { { 0x00000000, 0x00000000, "Reserved" }, { 0x00000001, 0x000F4240, "Independent bridge delay value used for calculation" }, { 0, 0, NULL } }; static const range_string pn_io_tsn_dependent_forwarding_delay_vals[] = { { 0x00000000, 0x00000000, "Reserved" }, { 0x00000001, 0x000C3500, "Octet size dependent bridge delay value used for calculation" }, { 0, 0, NULL } }; static const value_string pn_io_tsn_number_of_queues_vals[] = { { 0x06, "The bridge supports six transmit queues at the port" }, { 0x08, "The bridge supports eight transmit queues at the port" }, { 0, NULL } }; static const value_string pn_io_tsn_port_capabilities_time_aware_vals[] = { { 0x00, "This port is not usable within a Time Aware System"}, { 0x01, "This port is usable within a Time Aware System" }, { 0, NULL } }; static const value_string pn_io_tsn_port_capabilities_preemption_vals[] = { { 0x00, "Preemption is not supported at this port" }, { 0x01, "Preemption is supported at this port"}, { 0, NULL } }; static const value_string pn_io_tsn_port_capabilities_queue_masking_vals[] = { { 0x00, "Queue Masking is not supported at this port"}, { 0x01, "Queue Masking is supported at this port" }, { 0, NULL } }; /* Format of submodule ident number as per PA Profile 4.02 specification: [VariantOfSubmodule, Block_object, Parent_Class, Class] */ static const value_string pn_io_pa_profile_block_object_vals[] = { { 0, "DAP" }, { 1, "PB" }, { 2, "FB" }, { 3, "TB" }, { 0, NULL } }; static const value_string pn_io_pa_profile_dap_submodule_vals[] = { { 1, "DAP" }, { 2, "Device Management" }, { 0, NULL } }; static const value_string pn_io_pa_profile_physical_block_parent_class_vals[] = { { 1, "Transmitter" }, { 2, "Actuator" }, { 3, "Discrete I/O" }, { 4, "Controller" }, { 5, "Analyzer" }, { 6, "Lab Device" }, { 0, NULL } }; static const value_string pn_io_pa_profile_function_block_class_vals[] = { { 1, "Input" }, { 2, "Output" }, { 3, "Further Input" }, { 4, "Further Output" }, { 128, "Manuf. specific Input" }, { 129, "Manuf. specific Output" }, { 0, NULL } }; static const value_string pn_io_pa_profile_function_block_parent_class_vals[] = { {0, "Analog Temperature" }, {1, "Analog Temperature Difference"}, {2, "Analog Average Temperature"}, {3, "Analog Electronics Temperature"}, {4, "Analog Transmitter Temperature"}, {5, "Analog Sensor Temperature"}, {6, "Analog Frame Temperature"}, {7, "Analog Auxiliary Temperature"}, {8, "Analog Energy Supply Temperature"}, {9, "Analog Energy Return Temperature"}, {20, "Analog Pressure"}, {21, "Analog Absolute Pressure"}, {22, "Analog Gauge Pressure"}, {23, "Analog Differential Pressure"}, {30, "Analog Level"}, {31, "Analog Distance"}, {32, "Analog Interface Level"}, {33, "Analog Interface Distance"}, {40, "Analog Volume"}, {41, "Analog Ullage"}, {42, "Analog Interface Volume"}, {43, "Analog Standard Volume"}, {44, "Analog Fraction Substance 1 Volume"}, {45, "Analog Fraction Substance 2 Volume"}, {46, "Analog Fraction Substance 1 Std Volume"}, {47, "Analog Fraction Substance 2 Std Volume"}, {50, "Analog Mass"}, {51, "Analog Net Mass"}, {52, "Analog Fraction Substance 1 Mass"}, {53, "Analog Fraction Substance 2 Mass"}, {60, "Analog Volume Flow"}, {61, "Analog Standard Volume Flow"}, {62, "Analog Fraction Substance 1 Volume Flow"}, {63, "Analog Fraction Substance 2 Volume Flow"}, {70, "Analog Mass Flow"}, {71, "Analog Fraction Substance 1 Mass Flow"}, {72, "Analog Fraction Substance 2 Mass Flow"}, {80, "Analog Density"}, {81, "Analog Standard Density"}, {82, "Analog Analog Api Gravity"}, {83, "Analog Standard Api Gravity"}, {84, "Analog Specific Gravity"}, {85, "Analog Standard Specific Gravity"}, {90, "Analog Flow Velocity"}, {91, "Analog Sound Velocity"}, {92, "Analog Rate Of Change"}, {100, "Analog Kinematic Viscosity"}, {101, "Analog Dynamic Viscosity"}, {110, "Analog Energy"}, {111, "Analog Power"}, {120, "Analog Vortex Frequency"}, {130, "Analog Concentration"}, {131, "Analog Energy Efficiency Rating"}, {132, "Analog Coefficient Of Performance"}, {133, "Analog Fraction Substance 1%"}, {134, "Analog Fraction Substance 2%"}, {140, "Analog pH"}, {141, "Analog Conductivity"}, {142, "Analog Resistivity"}, {143, "Analog Gas Concentration"}, {149, "Flexible AI"}, {150, "Totalizer"}, {160, "Actuator"}, {170, "Discrete"}, {180, "Enumerated"}, {190, "Binary(8 Bit)"}, {191, "Binary(16 Bit)"}, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_parent_class_vals[] = { { 1, "Pressure" }, { 2, "Temperature" }, { 3, "Flow" }, { 4, "Level" }, { 5, "Actuator" }, { 6, "Discrete I/O" }, { 7, "Liquid analyzer" }, { 8, "Gas analyzer" }, { 10, "Enumerated I/O" }, { 11, "Binary I/O" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_pressure_class_vals[] = { { 1, "Pressure" }, { 2, "Pressure + level" }, { 3, "Pressure + flow" }, { 4, "Pressure + level + flow" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_temperature_class_vals[] = { { 1, "Thermocouple (TC)" }, { 2, "Resistance thermometer (RTD)" }, { 3, "Pyrometer" }, { 16, "TC + DC U (DC Voltage)" }, { 17, "RTD + R (R-Resistance)" }, { 18, "TC+RTD+r+DC U" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_flow_class_vals[] = { { 1, "Electromagnetic" }, { 2, "Vortex" }, { 3, "Coriolis" }, { 4, "Thermal mass" }, { 5, "Ultrasonic" }, { 6, "Variable area" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_level_class_vals[] = { { 1, "Hydrostatic" }, { 2, "Ultrasonic" }, { 3, "Radiometric" }, { 4, "Capacitance" }, { 5, "Displacer" }, { 6, "Float" }, { 7, "Radar" }, { 8, "Buoyancy" }, { 9, "Air bubble system" }, { 10, "Gravimetric" }, { 11, "Optical" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_actuator_class_vals[] = { { 1, "Electric" }, { 2, "Electro-pneumatic" }, { 3, "Electro-hydraulic" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_discrete_io_class_vals[] = { { 1, "Input" }, { 2, "Output" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_liquid_analyzer_class_vals[] = { { 1, "pH" }, { 2, "Conductivity" }, { 3, "Oxygen" }, { 4, "Chlorine" }, { 5, "Resistivity" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_gas_analyzer_class_vals[] = { { 1, "Standard" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_enumerated_io_class_vals[] = { { 1, "Input" }, { 2, "Output" }, { 0, NULL } }; static const value_string pn_io_pa_profile_transducer_block_binary_io_class_vals[] = { { 2, "8 Bit output" }, { 3, "8 Bit input" }, { 4, "16 Bit output" }, { 5, "16 Bit input" }, { 0, NULL } }; static const value_string* pn_io_pa_profile_transducer_block_class_vals[] = { NULL, pn_io_pa_profile_transducer_block_pressure_class_vals, pn_io_pa_profile_transducer_block_temperature_class_vals, pn_io_pa_profile_transducer_block_flow_class_vals, pn_io_pa_profile_transducer_block_level_class_vals, pn_io_pa_profile_transducer_block_actuator_class_vals, pn_io_pa_profile_transducer_block_discrete_io_class_vals, pn_io_pa_profile_transducer_block_liquid_analyzer_class_vals, pn_io_pa_profile_transducer_block_gas_analyzer_class_vals, NULL, pn_io_pa_profile_transducer_block_enumerated_io_class_vals, pn_io_pa_profile_transducer_block_binary_io_class_vals }; static const value_string pn_io_snmp_control[] = { { 0x00, "Disable SNMP" }, { 0x01, "Enable SNMP read only" }, { 0x02, "Enable SNMP read/write" }, { 0x03, "Reserved" }, { 0, NULL } }; static int dissect_profidrive_value(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint8 format_val) { guint32 value32; guint16 value16; guint8 value8; switch(format_val) { case 1: case 2: case 5: case 0x0A: case 0x41: offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_profidrive_param_value_byte, &value8); break; case 3: case 6: case 0x42: case 0x73: offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_profidrive_param_value_word, &value16); break; case 4: case 7: case 0x43: offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_profidrive_param_value_dword, &value32); break; case 8: offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_profidrive_param_value_float, &value32); break; case 9: { gint sLen; sLen = (gint)tvb_strnlen( tvb, offset, -1); proto_tree_add_item(tree, hf_pn_io_profidrive_param_value_string, tvb, offset, sLen, ENC_ASCII); offset = (offset + sLen); break; } default: offset = offset + 1; expert_add_info_format(pinfo, tree, &ei_pn_io_unsupported, "Not supported or invalid format %u!", format_val); break; } return(offset); } static GList *pnio_ars; typedef struct pnio_ar_s { /* generic */ e_guid_t aruuid; guint16 inputframeid; guint16 outputframeid; /* controller only */ /*const char controllername[33];*/ guint8 controllermac[6]; guint16 controlleralarmref; /* device only */ guint8 devicemac[6]; guint16 devicealarmref; guint16 arType; } pnio_ar_t; static void pnio_ar_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pnio_ar_t *ar) { p_add_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0, ar ); p_add_proto_data(pinfo->pool, pinfo, proto_pn_io, 0, GUINT_TO_POINTER(10)); if (tree) { proto_item *item; proto_item *sub_item; proto_tree *sub_tree; address controllermac_addr, devicemac_addr; set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac); set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac); sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_pn_io_ar_info, &sub_item, "ARUUID:%s ContrMAC:%s ContrAlRef:0x%x DevMAC:%s DevAlRef:0x%x InCR:0x%x OutCR=0x%x", guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid), address_to_str(pinfo->pool, &controllermac_addr), ar->controlleralarmref, address_to_str(pinfo->pool, &devicemac_addr), ar->devicealarmref, ar->inputframeid, ar->outputframeid); proto_item_set_generated(sub_item); item = proto_tree_add_guid(sub_tree, hf_pn_io_ar_uuid, tvb, 0, 0, (e_guid_t *) &ar->aruuid); proto_item_set_generated(item); item = proto_tree_add_ether(sub_tree, hf_pn_io_cminitiator_macadd, tvb, 0, 0, ar->controllermac); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->controlleralarmref); proto_item_set_generated(item); item = proto_tree_add_ether(sub_tree, hf_pn_io_cmresponder_macadd, tvb, 0, 0, ar->devicemac); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_pn_io_localalarmref, tvb, 0, 0, ar->devicealarmref); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->inputframeid); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_pn_io_frame_id, tvb, 0, 0, ar->outputframeid); proto_item_set_generated(item); } } static int dissect_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar); static int dissect_a_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep); static int dissect_PNIO_IOxS(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hfindex); static pnio_ar_t * pnio_ar_find_by_aruuid(packet_info *pinfo _U_, e_guid_t *aruuid) { GList *ars; pnio_ar_t *ar; /* find pdev */ for(ars = pnio_ars; ars != NULL; ars = g_list_next(ars)) { ar = (pnio_ar_t *)ars->data; if (memcmp(&ar->aruuid, aruuid, sizeof(e_guid_t)) == 0) { return ar; } } return NULL; } static pnio_ar_t * pnio_ar_new(e_guid_t *aruuid) { pnio_ar_t *ar; ar = wmem_new0(wmem_file_scope(), pnio_ar_t); memcpy(&ar->aruuid, aruuid, sizeof(e_guid_t)); ar->controlleralarmref = 0xffff; ar->devicealarmref = 0xffff; pnio_ars = g_list_append(pnio_ars, ar); return ar; } /* dissect the alarm specifier */ static int dissect_Alarm_specifier(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16AlarmSpecifierSequence; guint16 u16AlarmSpecifierChannel; guint16 u16AlarmSpecifierManufacturer; guint16 u16AlarmSpecifierSubmodule; guint16 u16AlarmSpecifierAR; proto_item *sub_item; proto_tree *sub_tree; /* alarm specifier */ sub_item = proto_tree_add_item(tree, hf_pn_io_alarm_specifier, tvb, offset, 2, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarm_specifier_sequence, &u16AlarmSpecifierSequence); u16AlarmSpecifierSequence &= 0x07FF; dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarm_specifier_channel, &u16AlarmSpecifierChannel); u16AlarmSpecifierChannel = (u16AlarmSpecifierChannel &0x0800) >> 11; dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarm_specifier_manufacturer, &u16AlarmSpecifierManufacturer); u16AlarmSpecifierManufacturer = (u16AlarmSpecifierManufacturer &0x1000) >> 12; dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarm_specifier_submodule, &u16AlarmSpecifierSubmodule); u16AlarmSpecifierSubmodule = (u16AlarmSpecifierSubmodule & 0x2000) >> 13; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarm_specifier_ardiagnosis, &u16AlarmSpecifierAR); u16AlarmSpecifierAR = (u16AlarmSpecifierAR & 0x8000) >> 15; proto_item_append_text(sub_item, ", Sequence: %u, Channel: %u, Manuf: %u, Submodule: %u AR: %u", u16AlarmSpecifierSequence, u16AlarmSpecifierChannel, u16AlarmSpecifierManufacturer, u16AlarmSpecifierSubmodule, u16AlarmSpecifierAR); return offset; } /* dissect the alarm header */ static int dissect_Alarm_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep) { guint16 u16AlarmType; guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_alarm_type, &u16AlarmType); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ", %s, API:%u, Slot:0x%x/0x%x", val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"), u32Api, u16SlotNr, u16SubslotNr); col_append_fstr(pinfo->cinfo, COL_INFO, ", %s, Slot: 0x%x/0x%x", val_to_str(u16AlarmType, pn_io_alarm_type, "(0x%x)"), u16SlotNr, u16SubslotNr); return offset; } static int dissect_ChannelProperties(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16ChannelProperties; sub_item = proto_tree_add_item(tree, hf_pn_io_channel_properties, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_channel_properties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_channel_properties_direction, &u16ChannelProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_channel_properties_specifier, &u16ChannelProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_channel_properties_maintenance, &u16ChannelProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_channel_properties_accumulative, &u16ChannelProperties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_channel_properties_type, &u16ChannelProperties); return offset; } /* dissect the RS_BlockHeader */ static int dissect_RS_BlockHeader(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep, guint16 *u16RSBodyLength, guint16 *u16RSBlockType) { guint16 u16RSBlockLength; guint8 u8BlockVersionHigh; guint8 u8BlockVersionLow; /* u16RSBlockType is needed for further dissection */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_block_type, u16RSBlockType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_block_length, &u16RSBlockLength); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_block_version_high, &u8BlockVersionHigh); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_block_version_low, &u8BlockVersionLow); proto_item_append_text(item, ": Type=%s, Length=%u(+4), Version=%u.%u", rval_to_str(*u16RSBlockType, pn_io_rs_block_type, "Unknown (0x%04x)"), u16RSBlockLength, u8BlockVersionHigh, u8BlockVersionLow); /* Block length is without type and length fields, but with version field */ /* as it's already dissected, remove it */ *u16RSBodyLength = u16RSBlockLength - 2; /* Padding 2 + 2 + 1 + 1 = 6 */ /* Therefore we need 2 byte padding to make the block u32 aligned */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* remove padding */ *u16RSBodyLength -= 2; return offset; } static int dissect_RS_AddressInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength) { e_guid_t IM_UniqueIdentifier; guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16ChannelNumber; /* IM_UniqueIdentifier */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &IM_UniqueIdentifier); *u16RSBodyLength -= 16; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); *u16RSBodyLength -= 4; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); *u16RSBodyLength -= 2; /* SubSlotNumber*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); *u16RSBodyLength -= 2; /* Channel Number*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_channel_number, &u16ChannelNumber); *u16RSBodyLength -= 2; return offset; } /* dissect the RS_EventDataCommon */ static int dissect_RS_EventDataCommon(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength) { guint16 u16RSSpecifierSequenceNumber; guint16 u16RSSpecifierReserved; guint16 u16RSSpecifierSpecifier; guint16 u16RSMinorError; guint16 u16RSPlusError; proto_item *sub_item; proto_tree *sub_tree; proto_item *sub_item_time_stamp; proto_tree *sub_tree_time_stamp; nstime_t timestamp; guint16 u16RSTimeStampStatus; /* RS_AddressInfo */ offset = dissect_RS_AddressInfo(tvb, offset, pinfo, tree, drep, u16RSBodyLength); /* RS_Specifier */ sub_item = proto_tree_add_item(tree, hf_pn_io_rs_specifier, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_specifier); /* RS_Specifier.SequenceNumber */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber); /* RS_Specifier.Reserved */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_specifier_reserved, &u16RSSpecifierReserved); /* RS_Specifier.Specifier */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_specifier_specifier, &u16RSSpecifierSpecifier); *u16RSBodyLength -= 2; /* RS_TimeStamp */ sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA); sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp); /* RS_TimeStamp.Status */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep, hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus); /* RS_TimeStamp.TimeStamp */ /* Start after from 2 bytes Status */ timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2); /* Start after from 4 bytes timestamp.secs */ timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8); /* Start after from 2 bytes Status and get all 10 bytes */ proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp); *u16RSBodyLength -= 12; offset += 12; /* RS_MinusError */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_minus_error, &u16RSMinorError); *u16RSBodyLength -= 2; /* RS_PlusError */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_plus_error, &u16RSPlusError); *u16RSBodyLength -= 2; return offset; } /* dissect the RS_IdentificationInfo */ static int dissect_RS_IdentificationInfo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value dcv; /* fake dcerpc_call_value struct */ guint64 u64AMDeviceIdentificationDeviceSubID; guint64 u64AMDeviceIdentificationDeviceID; guint64 u64AMDeviceIdentificationVendorID; guint64 u64AM_DeviceIdentificationOrganization; proto_item *sub_item; proto_tree *sub_tree; di.call_data = &dcv; sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification); /* AM_DeviceIdentification */ dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID); offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization); /* IM_Tag_Function [32] */ proto_tree_add_item(tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII); offset += 32; /* IM_Tag_Location [22] */ proto_tree_add_item(tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII); offset += 22; return offset; } /* dissect the RS_EventDataExtension_Data */ static int dissect_RS_EventDataExtension_Data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint8 *u8RSExtensionBlockLength, guint16 *u16RSBlockType) { guint32 u32RSReasonCodeReason; guint32 u32RSReasonCodeDetail; guint8 u8LengthRSDomainIdentification = 16; guint8 u8LengthRSMasterIdentification = 8; guint16 u16SoE_DigitalInputCurrentValueValue; guint16 u16SoE_DigitalInputCurrentValueReserved; proto_item *sub_item; proto_tree *sub_tree; nstime_t timestamp; guint16 u16RSTimeStampStatus; proto_item *sub_item_time_stamp; proto_tree *sub_tree_time_stamp; switch (*u16RSBlockType) { case(0x4000): /* RS_StopObserver */ /* RS_BlockType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_block_type, u16RSBlockType); /* RS_ReasonCode */ sub_item = proto_tree_add_item(tree, hf_pn_io_rs_reason_code, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_reason_code); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_reason_code_reason, &u32RSReasonCodeReason); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_reason_code_detail, &u32RSReasonCodeDetail); *u8RSExtensionBlockLength -= 6; break; case(0x4001): /* RS_BufferObserver */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData"); *u8RSExtensionBlockLength = 0; break; case(0x4002): /* RS_TimeStatus */ /* Padding 1 + 1 + 16 + 8 = 26 or 1 + 1 + 16 + 8 + 12 = 38 */ /* Therefore we need 2 byte padding to make the block u32 aligned */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); *u8RSExtensionBlockLength -= 2; /* RS_DomainIdentification */ proto_tree_add_item(tree, hf_pn_io_rs_domain_identification, tvb, offset, u8LengthRSDomainIdentification, ENC_NA); offset += u8LengthRSDomainIdentification; *u8RSExtensionBlockLength -= 16; /* RS_MasterIdentification */ proto_tree_add_item(tree, hf_pn_io_rs_master_identification, tvb, offset, u8LengthRSMasterIdentification, ENC_NA); offset += u8LengthRSMasterIdentification; *u8RSExtensionBlockLength -= 8; if (*u8RSExtensionBlockLength > 2) { /* RS_TimeStamp */ sub_item_time_stamp = proto_tree_add_item(tree, hf_pn_io_rs_time_stamp, tvb, offset, 12, ENC_NA); sub_tree_time_stamp = proto_item_add_subtree(sub_item_time_stamp, ett_pn_io_rs_time_stamp); /* RS_TimeStamp.Status */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_time_stamp, drep, hf_pn_io_rs_time_stamp_status, &u16RSTimeStampStatus); /* RS_TimeStamp.TimeStamp */ timestamp.secs = (time_t)tvb_get_ntoh48(tvb, offset + 2); // Start after from 2 bytes Status timestamp.nsecs = (int)tvb_get_ntohl(tvb, offset + 8); // Start after from 4 bytes timestamp.secs // Start after from 2 bytes Status and get all 10 bytes proto_tree_add_time(sub_tree_time_stamp, hf_pn_io_rs_time_stamp_value, tvb, offset + 2, 10, &timestamp); offset += 12; } break; case(0x4003): /* RS_SRLObserver */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData"); *u8RSExtensionBlockLength = 0; break; case(0x4004): /* RS_SourceIdentification */ offset = dissect_RS_IdentificationInfo(tvb, offset, pinfo, tree, drep); *u8RSExtensionBlockLength = 0; break; case(0x4010): /* SoE_DigitalInputObserver */ /* SoE_DigitalInputCurrentValue */ sub_item = proto_tree_add_item(tree, hf_pn_io_soe_digital_input_current_value, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_digital_input_current_value); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_soe_digital_input_current_value_value, &u16SoE_DigitalInputCurrentValueValue); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_soe_digital_input_current_value_reserved, &u16SoE_DigitalInputCurrentValueReserved); *u8RSExtensionBlockLength -= 2; break; default: offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u8RSExtensionBlockLength, "UserData"); *u8RSExtensionBlockLength = 0; break; } return offset; } /* dissect the RS_EventDataExtension */ static int dissect_RS_EventDataExtension(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBlockLength, guint16 *u16RSBlockType) { guint8 u8RSExtensionBlockType; guint8 u8RSExtensionBlockLength; /* RS_ExtensionBlockType */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_extension_block_type, &u8RSExtensionBlockType); *u16RSBlockLength -= 1; /* RS_ExtensionBlockLength */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_extension_block_length, &u8RSExtensionBlockLength); *u16RSBlockLength -= 1; /* Data*[Padding] * a*/ while (u8RSExtensionBlockLength) { *u16RSBlockLength -= u8RSExtensionBlockLength; offset = dissect_RS_EventDataExtension_Data(tvb, offset, pinfo, tree, drep, &u8RSExtensionBlockLength, u16RSBlockType); } return offset; } /* dissect the RS_EventData */ static int dissect_RS_EventData(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength, guint16 *u16RSBlockType) { proto_item *sub_item; proto_tree *sub_tree; /* RS_EventDataCommon */ offset = dissect_RS_EventDataCommon(tvb, offset, pinfo, tree, drep, u16RSBodyLength); /* optional: RS_EventDataExtension */ while (*u16RSBodyLength > 0) { sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_data_extension, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_data_extension); offset = dissect_RS_EventDataExtension(tvb, offset, pinfo, sub_tree, drep, u16RSBodyLength, u16RSBlockType); } return offset; } /* dissect the RS_EventBlock */ static int dissect_RS_EventBlock(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16RSBodyLength; guint16 u16RSBlockType; sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_block); /* RS_BlockHeader */ offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep, &u16RSBodyLength, &u16RSBlockType); /* RS_EventData */ offset = dissect_RS_EventData(tvb, offset, pinfo, sub_tree, drep, &u16RSBodyLength, &u16RSBlockType); return offset; } /* dissect the RS_AlarmInfo */ static int dissect_RS_AlarmInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16RSAlarmInfo; sub_item = proto_tree_add_item(tree, hf_pn_io_rs_alarm_info, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_alarm_info); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_alarm_info_reserved_0_7, &u16RSAlarmInfo); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_rs_alarm_info_reserved_8_15, &u16RSAlarmInfo); return offset; } /* dissect the RS_EventInfo */ static int dissect_RS_EventInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16NumberofEntries; sub_item = proto_tree_add_item(tree, hf_pn_io_rs_event_info, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_event_info); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_number_of_rs_event_info, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; offset = dissect_RS_EventBlock(tvb, offset, pinfo, sub_tree, drep); } return offset; } static int dissect_Diagnosis(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep, guint16 u16UserStructureIdentifier) { guint16 u16ChannelNumber; guint16 u16ChannelErrorType; guint16 u16ExtChannelErrorType; guint32 u32ExtChannelAddValue; guint32 u32QualifiedChannelQualifier; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_channel_number, &u16ChannelNumber); offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_channel_error_type, &u16ChannelErrorType); if (u16UserStructureIdentifier == 0x8000) /* ChannelDiagnosisData */ { return offset; } if (u16ChannelErrorType < 0x7fff) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8000) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8000, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8001) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8001, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8002) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8002, &u16ExtChannelErrorType); } else if ((u16ChannelErrorType == 0x8003)||(u16ChannelErrorType == 0x8009)) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8003, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8004) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8004, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8005) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8005, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8007) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8007, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8008) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8008, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x800A) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x800A, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x800B) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x800B, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x800C) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x800C, &u16ExtChannelErrorType); } else if (u16ChannelErrorType == 0x8010) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type0x8010, &u16ExtChannelErrorType); } else { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_error_type, &u16ExtChannelErrorType); } offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_ext_channel_add_value, &u32ExtChannelAddValue); if (u16UserStructureIdentifier == 0x8002) /* ExtChannelDiagnosisData */ { return offset; } offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_qualified_channel_qualifier, &u32QualifiedChannelQualifier); /* QualifiedChannelDiagnosisData */ return offset; } static int dissect_AlarmUserStructure(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint16 *body_length, guint16 u16UserStructureIdentifier) { guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; switch (u16UserStructureIdentifier) { case(0x8000): /* ChannelDiagnosisData */ offset = dissect_Diagnosis(tvb, offset, pinfo, tree, item, drep, u16UserStructureIdentifier); *body_length -= 6; break; case(0x8002): /* ExtChannelDiagnosisData */ offset = dissect_Diagnosis(tvb, offset, pinfo, tree, item, drep, u16UserStructureIdentifier); *body_length -= 12; break; case (0x8003): /* QualifiedChannelDiagnosisData */ offset = dissect_Diagnosis(tvb, offset, pinfo, tree, item, drep, u16UserStructureIdentifier); *body_length -= 16; break; case(0x8100): /* MaintenanceItem */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); *body_length -= 12; break; case(0x8300): /* RS_AlarmInfo (Reporting System Alarm Information) */ case(0x8301): /* RS_AlarmInfo */ case(0x8302): /* RS_AlarmInfo */ offset = dissect_RS_AlarmInfo(tvb, offset, pinfo, tree, drep); *body_length = 0; break; case(0x8303): /* RS_EventInfo (Reporting System Event Information) */ offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep); *body_length = 0; break; case(0x8310): /* PE_EnergySavingStatus */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); *body_length = 0; break; /* XXX - dissect remaining user structures of [AlarmItem] */ case(0x8001): /* DiagnosisData */ default: if (u16UserStructureIdentifier >= 0x8000) { offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, *body_length); } else { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *body_length, "UserData"); } *body_length = 0; } return offset; } /* dissect the alarm notification block */ static int dissect_AlarmNotification_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 body_length) { guint32 u32ModuleIdentNumber; guint32 u32SubmoduleIdentNumber; guint16 u16UserStructureIdentifier; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep); proto_item_append_text(item, ", Ident:0x%x, SubIdent:0x%x", u32ModuleIdentNumber, u32SubmoduleIdentNumber); body_length -= 20; /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */ while (body_length) { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier); proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier); body_length -= 2; offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep, &body_length, u16UserStructureIdentifier); } return offset; } static int dissect_IandM0_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8VendorIDHigh; guint8 u8VendorIDLow; guint16 u16IMHardwareRevision; guint8 u8SWRevisionPrefix; guint8 u8IMSWRevisionFunctionalEnhancement; guint8 u8IMSWRevisionBugFix; guint8 u8IMSWRevisionInternalChange; guint16 u16IMRevisionCounter; guint16 u16IMProfileID; guint16 u16IMProfileSpecificType; guint8 u8IMVersionMajor; guint8 u8IMVersionMinor; guint16 u16IMSupported; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* x8 VendorIDHigh */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_high, &u8VendorIDHigh); /* x8 VendorIDLow */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_low, &u8VendorIDLow); /* c8[20] OrderID */ proto_tree_add_item (tree, hf_pn_io_order_id, tvb, offset, 20, ENC_ASCII); offset += 20; /* c8[16] IM_Serial_Number */ proto_tree_add_item (tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* x16 IM_Hardware_Revision */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_hardware_revision, &u16IMHardwareRevision); /* c8 SWRevisionPrefix */ offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix); /* x8 IM_SWRevision_Functional_Enhancement */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement); /* x8 IM_SWRevision_Bug_Fix */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix); /* x8 IM_SWRevision_Internal_Change */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange); /* x16 IM_Revision_Counter */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_counter, &u16IMRevisionCounter); /* x16 IM_Profile_ID */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_profile_id, &u16IMProfileID); /* x16 IM_Profile_Specific_Type */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_profile_specific_type, &u16IMProfileSpecificType); /* x8 IM_Version_Major (values) */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_version_major, &u8IMVersionMajor); /* x8 IM_Version_Minor (values) */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_version_minor, &u8IMVersionMinor); /* x16 IM_Supported (bitfield) */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_supported, &u16IMSupported); return offset; } static int dissect_IandM1_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { char *pTagFunction; char *pTagLocation; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* IM_Tag_Function [32] */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII, pinfo->pool, &pTagFunction); offset += 32; /* IM_Tag_Location [22] */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII, pinfo->pool, &pTagLocation); offset += 22; proto_item_append_text(item, ": TagFunction:\"%s\", TagLocation:\"%s\"", pTagFunction, pTagLocation); return offset; } static int dissect_IandM2_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { char *pDate; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* IM_Date [16] */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_date, tvb, offset, 16, ENC_ASCII, pinfo->pool, &pDate); offset += 16; proto_item_append_text(item, ": Date:\"%s\"", pDate); return offset; } static int dissect_IandM3_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { char *pDescriptor; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* IM_Descriptor [54] */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_descriptor, tvb, offset, 54, ENC_ASCII, pinfo->pool, &pDescriptor); offset += 54; proto_item_append_text(item, ": Descriptor:\"%s\"", pDescriptor); return offset; } static int dissect_IandM4_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } dissect_pn_user_data(tvb, offset, pinfo, tree, 54, "IM Signature"); return offset; } static int dissect_IandM5_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_numberofentries, &u16NumberofEntries); while(u16NumberofEntries > 0) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); u16NumberofEntries--; } return offset; } static int dissect_IandM0FilterData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16NumberOfModules; guint16 u16SlotNr; guint32 u32ModuleIdentNumber; guint16 u16NumberOfSubmodules; guint16 u16SubslotNr; guint32 u32SubmoduleIdentNumber; proto_item *subslot_item; proto_tree *subslot_tree; proto_item *module_item; proto_tree *module_tree; guint32 u32ModuleStart; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); while (u16NumberOfAPIs--) { /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); /* NumberOfModules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_modules, &u16NumberOfModules); while (u16NumberOfModules--) { module_item = proto_tree_add_item(tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA); module_tree = proto_item_add_subtree(module_item, ett_pn_io_module); u32ModuleStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* ModuleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); /* NumberOfSubmodules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_number_of_submodules, &u16NumberOfSubmodules); proto_item_append_text(module_item, ": Slot:%u, Ident:0x%x Submodules:%u", u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubmodules); while (u16NumberOfSubmodules--) { subslot_item = proto_tree_add_item(module_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA); subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot); /* SubslotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* SubmoduleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x", u16SubslotNr, u32SubmoduleIdentNumber); } proto_item_set_len(module_item, offset-u32ModuleStart); } } return offset; } static int dissect_IandM5Data_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep) { guint8 u8VendorIDHigh; guint8 u8VendorIDLow; guint16 u16IMHardwareRevision; guint8 u8SWRevisionPrefix; guint8 u8IMSWRevisionFunctionalEnhancement; guint8 u8IMSWRevisionBugFix; guint8 u8IMSWRevisionInternalChange; /* c8[64] IM Annotation */ proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII); offset += 64; /* c8[64] IM Order ID */ proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII); offset += 64; /* x8 VendorIDHigh */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_high, &u8VendorIDHigh); /* x8 VendorIDLow */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_low, &u8VendorIDLow); /* c8[16] IM Serial Number */ proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* x16 IM_Hardware_Revision */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_hardware_revision, &u16IMHardwareRevision); /* c8 SWRevisionPrefix */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix); /* x8 IM_SWRevision_Functional_Enhancement */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement); /* x8 IM_SWRevision_Bug_Fix */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix); /* x8 IM_SWRevision_Internal_Change */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange); return offset; } static int dissect_AM_Location(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint8 am_location_structtype; int bit_offset; guint8 am_location_reserved1; guint16 am_location_begin_slot_number; guint16 am_location_begin_subslot_number; guint16 am_location_end_slot_number; guint16 am_location_end_subslot_number; guint16 am_location_reserved2; guint16 am_location_reserved3; guint16 am_location_reserved4; sub_item = proto_tree_add_item(tree, hf_pn_io_am_location, tvb, offset, 16, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_location); am_location_structtype = tvb_get_guint8(tvb, offset+15); bit_offset = offset << 3; switch (am_location_structtype) { case (0x01): /* level 11 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_11, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 10 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_10, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 9 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_9, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 8 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_8, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 7 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_7, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 6 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_6, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 5 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_5, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 4 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_4, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 3 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_3, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 2 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_2, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 1 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_1, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 0 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_level_0, tvb, bit_offset, 10, ENC_BIG_ENDIAN); bit_offset += 10; /* level 0 */ proto_tree_add_bits_item(sub_tree, hf_pn_io_am_location_structure, tvb, bit_offset, 8, ENC_BIG_ENDIAN); offset += 16; break; case (0x02): /* Reserved 4 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_reserved4, &am_location_reserved4); /* Reserved 3 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_reserved3, &am_location_reserved3); /* Reserved 2 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_reserved2, &am_location_reserved2); /* EndSubSlotNumber*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_endsubslotnum, &am_location_end_subslot_number); /* EndSlotNumber*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_endslotnum, &am_location_end_slot_number); /* BeginSubslotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_beginsubslotnum, &am_location_begin_subslot_number); /* BeginSlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_beginslotnum, &am_location_begin_slot_number); /* Reserved1 */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_reserved1, &am_location_reserved1); /* Structure */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_am_location_structure, &am_location_structtype); break; default: /* will not execute because of the line preceding the switch */ offset += 16; break; } return offset; } static int dissect_IM_software_revision(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint8 u8SWRevisionPrefix; guint8 u8IMSWRevisionFunctionalEnhancement; guint8 u8IMSWRevisionBugFix; guint8 u8IMSWRevisionInternalChange; /* SWRevisionPrefix */ offset = dissect_dcerpc_char(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix); /* IM_SWRevision_Functional_Enhancement */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement); /* IM_SWRevision_Bug_Fix */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix); /* IM_SWRevision_Internal_Change */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange); return offset; } static int dissect_AM_device_identification(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value dcv; /* fake dcerpc_call_value struct */ guint64 u64AMDeviceIdentificationDeviceSubID; guint64 u64AMDeviceIdentificationDeviceID; guint64 u64AMDeviceIdentificationVendorID; guint64 u64AM_DeviceIdentificationOrganization; proto_item *sub_item; proto_tree *sub_tree; di.call_data = &dcv; sub_item = proto_tree_add_item(tree, hf_pn_io_am_device_identification, tvb, offset, 8, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_am_device_identification); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_device_sub_id, &u64AMDeviceIdentificationDeviceSubID); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_device_id, &u64AMDeviceIdentificationDeviceID); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_vendor_id, &u64AMDeviceIdentificationVendorID); offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_am_device_identification_organization, &u64AM_DeviceIdentificationOrganization); return offset; } static int dissect_AM_FullInformation_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t IM_UniqueIdentifier; guint16 u16AM_TypeIdentification; guint16 u16IMHardwareRevision; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* align padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* IM_UniqueIdentifier */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier); /* AM_Location */ offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep); /* IM_Annotation */ proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII); offset += 64; /* IM_OrderID */ proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII); offset += 64; /* AM_SoftwareRevision */ proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII); offset += 64; /* AM_HardwareRevision */ proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII); offset += 64; /* IM_Serial_Number */ proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* IM_Software_Revision */ offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep); /* AM_DeviceIdentification */ offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep); /* AM_TypeIdentification */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_am_type_identification, &u16AM_TypeIdentification); /* IM_Hardware_Revision */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_hardware_revision, &u16IMHardwareRevision); return offset; } static int dissect_AM_HardwareOnlyInformation_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t IM_UniqueIdentifier; guint16 u16AM_TypeIdentification; guint16 u16IMHardwareRevision; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* align padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* IM_UniqueIdentifier */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier); /* AM_Location */ offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep); /* IM_Annotation */ proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* IM_OrderID */ proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* AM_HardwareRevision */ proto_tree_add_item(tree, hf_pn_io_am_hardware_revision, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* IM_Serial_Number */ proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA); offset += 16; /* AM_DeviceIdentification */ offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep); /* AM_TypeIdentification */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_am_type_identification, &u16AM_TypeIdentification); /* IM_Hardware_Revision */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_hardware_revision, &u16IMHardwareRevision); return offset; } static int dissect_AM_FirmwareOnlyInformation_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t IM_UniqueIdentifier; guint16 u16AM_TypeIdentification; guint16 u16AM_Reserved; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* IM_UniqueIdentifier */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_im_uniqueidentifier, &IM_UniqueIdentifier); /* AM_Location */ offset = dissect_AM_Location(tvb, offset, pinfo, tree, drep); /* IM_Annotation */ proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* IM_OrderID */ proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* AM_SoftwareRevision */ proto_tree_add_item(tree, hf_pn_io_am_software_revision, tvb, offset, 64, ENC_ASCII | ENC_NA); offset += 64; /* IM_Serial_Number */ proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII | ENC_NA); offset += 16; /* IM_Software_Revision */ offset = dissect_IM_software_revision(tvb, offset, pinfo, tree, drep); /* AM_DeviceIdentification */ offset = dissect_AM_device_identification(tvb, offset, pinfo, tree, drep); /* AM_TypeIdentification */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_am_type_identification, &u16AM_TypeIdentification); /* AM_Reserved */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_am_reserved, &u16AM_Reserved); return offset; } /* dissect the AssetManagementInfo */ static int dissect_AssetManagementInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16NumberofEntries; sub_item = proto_tree_add_item(tree, hf_pn_io_asset_management_info, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_asset_management_info); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_number_of_asset_management_info, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; offset = dissect_a_block(tvb, offset, pinfo, sub_tree, drep); } return offset; } /* dissect the AssetManagementData block */ static int dissect_AssetManagementData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_AssetManagementInfo(tvb, offset, pinfo, tree, drep); return offset; } /* dissect the IdentificationData block */ static int dissect_IdentificationData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs = 1; guint32 u32Api; guint16 u16NumberOfSlots; guint16 u16SlotNr; guint32 u32ModuleIdentNumber; guint16 u16NumberOfSubslots; guint32 u32SubmoduleIdentNumber; guint16 u16SubslotNr; proto_item *slot_item; proto_tree *slot_tree; guint32 u32SlotStart; proto_item *subslot_item; proto_tree *subslot_tree; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow == 1) { /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); } proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs); while (u16NumberOfAPIs--) { if (u8BlockVersionLow == 1) { /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); } /* NumberOfSlots */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_slots, &u16NumberOfSlots); proto_item_append_text(item, ", Slots:%u", u16NumberOfSlots); while (u16NumberOfSlots--) { slot_item = proto_tree_add_item(tree, hf_pn_io_slot, tvb, offset, 0, ENC_NA); slot_tree = proto_item_add_subtree(slot_item, ett_pn_io_slot); u32SlotStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* ModuleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, slot_tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); /* NumberOfSubslots */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, slot_tree, drep, hf_pn_io_number_of_subslots, &u16NumberOfSubslots); proto_item_append_text(slot_item, ": SlotNr:%u Ident:0x%x Subslots:%u", u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubslots); while (u16NumberOfSubslots--) { subslot_item = proto_tree_add_item(slot_tree, hf_pn_io_subslot, tvb, offset, 6, ENC_NA); subslot_tree = proto_item_add_subtree(subslot_item, ett_pn_io_subslot); /* SubslotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, subslot_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* SubmoduleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, subslot_tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); proto_item_append_text(subslot_item, ": Number:0x%x, Ident:0x%x", u16SubslotNr, u32SubmoduleIdentNumber); } proto_item_set_len(slot_item, offset-u32SlotStart); } } return offset; } /* dissect the substitute value block */ static int dissect_SubstituteValue_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16SubstitutionMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* SubstitutionMode */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_substitutionmode, &u16SubstitutionMode); /* SubstituteDataItem */ /* IOCS */ offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs); u16BodyLength -= 3; /* SubstituteDataObjectElement */ dissect_pn_user_data_bytes(tvb, offset, pinfo, tree, u16BodyLength, SUBST_DATA); return offset; } /* dissect the RecordInputDataObjectElement block */ static int dissect_RecordInputDataObjectElement_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8LengthIOCS; guint8 u8LengthIOPS; guint16 u16LengthData; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* LengthIOCS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_iocs, &u8LengthIOCS); /* IOCS */ offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs); /* LengthIOPS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_iops, &u8LengthIOPS); /* IOPS */ offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops); /* LengthData */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_length_data, &u16LengthData); /* Data */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data"); return offset; } /* dissect the RecordOutputDataObjectElement block */ static int dissect_RecordOutputDataObjectElement_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16SubstituteActiveFlag; guint8 u8LengthIOCS; guint8 u8LengthIOPS; guint16 u16LengthData; guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* SubstituteActiveFlag */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_substitute_active_flag, &u16SubstituteActiveFlag); /* LengthIOCS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_iocs, &u8LengthIOCS); /* LengthIOPS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_iops, &u8LengthIOPS); /* LengthData */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_length_data, &u16LengthData); /* DataItem (IOCS, Data, IOPS) */ offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iocs); offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16LengthData, "Data"); offset = dissect_PNIO_IOxS(tvb, offset, pinfo, tree, drep, hf_pn_io_iops); /* SubstituteValue */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); return offset; } /* dissect the alarm acknowledge block */ static int dissect_Alarm_ack_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } col_append_str(pinfo->cinfo, COL_INFO, ", Alarm Ack"); offset = dissect_Alarm_header(tvb, offset, pinfo, tree, item, drep); offset = dissect_Alarm_specifier(tvb, offset, pinfo, tree, drep); offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep); return offset; } /* dissect the maintenance block */ static int dissect_Maintenance_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32MaintenanceStatus; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); sub_item = proto_tree_add_item(tree, hf_pn_io_maintenance_status, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_maintenance_status); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_maintenance_status_demanded, &u32MaintenanceStatus); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_maintenance_status_required, &u32MaintenanceStatus); if (u32MaintenanceStatus & 0x0002) { proto_item_append_text(item, ", Demanded"); proto_item_append_text(sub_item, ", Demanded"); } if (u32MaintenanceStatus & 0x0001) { proto_item_append_text(item, ", Required"); proto_item_append_text(sub_item, ", Required"); } return offset; } /* dissect the pe_alarm block */ static int dissect_PE_Alarm_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint8 u8PEOperationalMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } sub_item = proto_tree_add_item(tree, hf_pn_io_pe_operational_mode, tvb, offset, 1, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pe_operational_mode); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pe_operational_mode, &u8PEOperationalMode); return offset; } /* dissect the read/write header */ static int dissect_ReadWrite_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint16 *u16Index, e_guid_t *aruuid) { guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16SeqNr; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_seq_number, &u16SeqNr); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, aruuid); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* padding doesn't match offset required for align4 */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_index, u16Index); proto_item_append_text(item, ": Seq:%u, Api:0x%x, Slot:0x%x/0x%x", u16SeqNr, u32Api, u16SlotNr, u16SubslotNr); col_append_fstr(pinfo->cinfo, COL_INFO, ", Api:0x%x, Slot:0x%x/0x%x, Index:%s", u32Api, u16SlotNr, u16SubslotNr, val_to_str(*u16Index, pn_io_index, "(0x%x)")); return offset; } /* dissect the write request block */ static int dissect_IODWriteReqHeader_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t ** ar) { e_guid_t aruuid; e_guid_t null_uuid; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid); /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_record_data_length, u32RecDataLen); memset(&null_uuid, 0, sizeof(e_guid_t)); if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) { offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_target_ar_uuid, &aruuid); } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24); proto_item_append_text(item, ", Len:%u", *u32RecDataLen); if (*u32RecDataLen != 0) col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes", *u32RecDataLen); return offset; } /* dissect the read request block */ static int dissect_IODReadReqHeader_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar) { e_guid_t aruuid; e_guid_t null_uuid; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid); /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_record_data_length, u32RecDataLen); memset(&null_uuid, 0, sizeof(e_guid_t)); if (memcmp(&aruuid, &null_uuid, sizeof (e_guid_t)) == 0) { offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_target_ar_uuid, &aruuid); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 8); } else { offset = dissect_pn_padding(tvb, offset, pinfo, tree, 24); } proto_item_append_text(item, ", Len:%u", *u32RecDataLen); if (*u32RecDataLen != 0) col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes", *u32RecDataLen); return offset; } /* dissect the write response block */ static int dissect_IODWriteResHeader_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar) { e_guid_t aruuid; guint16 u16AddVal1; guint16 u16AddVal2; guint32 u32Status; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid); /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_record_data_length, u32RecDataLen); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_add_val1, &u16AddVal1); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_add_val2, &u16AddVal2); u32Status = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohl (tvb, offset) : tvb_get_ntohl (tvb, offset)); offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 16); proto_item_append_text(item, ", Len:%u, Index:0x%x, Status:0x%x, Val1:%u, Val2:%u", *u32RecDataLen, *u16Index, u32Status, u16AddVal1, u16AddVal2); if (*u32RecDataLen != 0) col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes", *u32RecDataLen); return offset; } /* dissect the read response block */ static int dissect_IODReadResHeader_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar) { e_guid_t aruuid; guint16 u16AddVal1; guint16 u16AddVal2; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_ReadWrite_header(tvb, offset, pinfo, tree, item, drep, u16Index, &aruuid); /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &aruuid); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_record_data_length, u32RecDataLen); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_add_val1, &u16AddVal1); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_add_val2, &u16AddVal2); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 20); proto_item_append_text(item, ", Len:%u, AddVal1:%u, AddVal2:%u", *u32RecDataLen, u16AddVal1, u16AddVal2); if (*u32RecDataLen != 0) col_append_fstr(pinfo->cinfo, COL_INFO, ", %u bytes", *u32RecDataLen); return offset; } /* dissect the control/connect and control/connect block */ static int dissect_ControlPlugOrConnect_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t **ar, guint16 blocktype) { e_guid_t ar_uuid; guint16 u16SessionKey; proto_item *sub_item; proto_tree *sub_tree; guint16 u16Command; guint16 u16Properties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved16, NULL); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &ar_uuid); /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey); if (((blocktype & 0x7FFF) == 0x0111) || ((blocktype & 0x7FFF) == 0x0113)) { /* control/plug */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_control_alarm_sequence_number, NULL); } else { /* control/connect */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved16, NULL); } sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_prmend, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_applready, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_release, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_done, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_ready_for_companion, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_ready_for_rt_class3, &u16Command); /* Prm.Begin */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_prmbegin, &u16Command); if (u16Command & 0x0002) { /* ApplicationReady: special decode */ sub_item = proto_tree_add_item(tree, hf_pn_io_control_block_properties_applready, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_block_properties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_bit0, &u16Properties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_bit1, &u16Properties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_block_properties_applready_otherbits, &u16Properties); } else { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_control_block_properties, &u16Properties); } proto_item_append_text(item, ": Session:%u, Command:", u16SessionKey); if (u16Command & 0x0001) { proto_item_append_text(sub_item, ", ParameterEnd"); proto_item_append_text(item, " ParameterEnd"); col_append_str(pinfo->cinfo, COL_INFO, ", Command: ParameterEnd"); } if (u16Command & 0x0002) { proto_item_append_text(sub_item, ", ApplicationReady"); proto_item_append_text(item, " ApplicationReady"); col_append_str(pinfo->cinfo, COL_INFO, ", Command: ApplicationReady"); } if (u16Command & 0x0004) { proto_item_append_text(sub_item, ", Release"); proto_item_append_text(item, " Release"); col_append_str(pinfo->cinfo, COL_INFO, ", Command: Release"); } if (u16Command & 0x0008) { proto_item_append_text(sub_item, ", Done"); proto_item_append_text(item, ", Done"); col_append_str(pinfo->cinfo, COL_INFO, ", Command: Done"); /* When Release Command Done, keep the release frame of corresponding ar & ar uuid */ if (!PINFO_FD_VISITED(pinfo) && blocktype == 0x8114) { wmem_list_frame_t* aruuid_frame; ARUUIDFrame* current_aruuid_frame = NULL; if (aruuid_frame_setup_list != NULL) { for (aruuid_frame = wmem_list_head(aruuid_frame_setup_list); aruuid_frame != NULL; aruuid_frame = wmem_list_frame_next(aruuid_frame)) { current_aruuid_frame = (ARUUIDFrame*)wmem_list_frame_data(aruuid_frame); if (current_aruuid_frame->aruuid.data1 == ar_uuid.data1) { current_aruuid_frame->releaseframe = pinfo->num; } } } } } proto_item_append_text(item, ", Properties:0x%x", u16Properties); return offset; } /* dissect the ControlBlockPrmBegin block */ static int dissect_ControlBlockPrmBegin(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen, pnio_ar_t **ar) { e_guid_t ar_uuid; guint16 u16SessionKey; guint16 u16Command; proto_item *sub_item; proto_tree *sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u32RecDataLen != 28-2) /* must be 28 see specification (version already dissected) */ { expert_add_info_format(pinfo, item, &ei_pn_io_block_length, "Block length of %u is invalid!", u32RecDataLen); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* ARUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &ar_uuid); if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(ar_uuid, pinfo->num); } /* The value NIL indicates the usage of the implicit AR*/ *ar = pnio_ar_find_by_aruuid(pinfo, &ar_uuid); /* SessionKey */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* ControlCommand */ sub_item = proto_tree_add_item(tree, hf_pn_io_control_command, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_control_command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_prmend, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_applready, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_release, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_done, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_ready_for_companion, &u16Command); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_ready_for_rt_class3, &u16Command); /* Prm.Begin */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_prmbegin, &u16Command); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_control_command_reserved_7_15, &u16Command); /* ControlBlockProperties.reserved */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_control_command_reserved, NULL); return offset; } /* dissect the SubmoduleListBlock block */ static int dissect_SubmoduleListBlock(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint32 u32RecDataLen _U_, pnio_ar_t **ar _U_) { guint16 u16Entries; guint32 u32API; guint16 u16SlotNumber; guint16 u16SubSlotNumber; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_SubmoduleListEntries, &u16Entries); while (u16Entries --) { /*API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32API); /*SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNumber); /* SubSlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubSlotNumber); } return offset; } /* dissect the PDevData block */ static int dissect_PDevData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); offset = dissect_blocks(tvb, offset, pinfo, tree, drep); return offset; } /* dissect the AdjustPreambleLength block */ static int dissect_AdjustPreambleLength_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16AdjustProperties; guint16 u16PreambleLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* PreambleLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_PreambleLength, &u16PreambleLength); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); return offset; } /* dissect the dissect_CheckMAUTypeExtension_block block */ static int dissect_CheckMAUTypeExtension_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MauTypeExtension; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MauTypeExtension */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension); return offset; } /* dissect the PDPortDataAdjust block */ static int dissect_PDPortData_Adjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16SlotNr; guint16 u16SubslotNr; tvbuff_t *new_tvb; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr); u16BodyLength -= 6; new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength); dissect_blocks(new_tvb, 0, pinfo, tree, drep); offset += u16BodyLength; /* XXX - do we have to free the new_tvb somehow? */ return offset; } /* dissect the PDPortDataCheck blocks */ static int dissect_PDPortData_Check_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16SlotNr; guint16 u16SubslotNr; tvbuff_t *new_tvb; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr); u16BodyLength -= 6; new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength); dissect_blocks(new_tvb, 0, pinfo, tree, drep); offset += u16BodyLength; /* XXX - do we have to free the new_tvb somehow? */ return offset; } /* dissect the Line Delay */ static int dissect_Line_Delay(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint32 *u32LineDelayValue) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32FormatIndicator; guint8 isFormatIndicatorEnabled; sub_item = proto_tree_add_item(tree, hf_pn_io_line_delay, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_line_delay); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_line_delay_format_indicator, &u32FormatIndicator); isFormatIndicatorEnabled = (guint8)((u32FormatIndicator >> 31) & 0x01); if (isFormatIndicatorEnabled) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_cable_delay_value, u32LineDelayValue); } else { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_line_delay_value, u32LineDelayValue); } return offset; } /* dissect the PDPortDataReal blocks */ static int dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16SlotNr; guint16 u16SubslotNr; guint8 u8LengthOwnPortID; char *pOwnPortID; proto_item *sub_item; proto_tree *sub_tree; guint8 u8NumberOfPeers; guint8 u8I; guint8 u8LengthPeerPortID; guint8 u8LengthPeerChassisID; guint8 mac[6]; char *pPeerChassisId; char *pPeerPortId; guint16 u16MAUType; guint32 u32DomainBoundary; guint32 u32MulticastBoundary; guint8 u8LinkStatePort; guint8 u8LinkStateLink; guint32 u32MediaType; guint32 u32LineDelayValue; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* LengthOwnPortID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_own_port_id, &u8LengthOwnPortID); /* OwnPortID */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_own_port_id, tvb, offset, u8LengthOwnPortID, ENC_ASCII, pinfo->pool, &pOwnPortID); offset += u8LengthOwnPortID; /* NumberOfPeers */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_peers, &u8NumberOfPeers); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); u8I = u8NumberOfPeers; while (u8I--) { sub_item = proto_tree_add_item(tree, hf_pn_io_neighbor, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_neighbor); /* LengthPeerPortID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_peer_port_id, &u8LengthPeerPortID); /* PeerPortID */ proto_tree_add_item_ret_display_string (sub_tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, ENC_ASCII, pinfo->pool, &pPeerPortId); offset += u8LengthPeerPortID; /* LengthPeerChassisID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID); /* PeerChassisID */ proto_tree_add_item_ret_display_string (sub_tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, ENC_ASCII, pinfo->pool, &pPeerChassisId); offset += u8LengthPeerChassisID; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); /* LineDelay */ offset = dissect_Line_Delay(tvb, offset, pinfo, sub_tree, drep, &u32LineDelayValue); /* PeerMACAddress */ offset = dissect_pn_mac(tvb, offset, pinfo, sub_tree, hf_pn_io_peer_macadd, mac); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); proto_item_append_text(sub_item, ": %s (%s)", pPeerChassisId, pPeerPortId); } /* MAUType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type, &u16MAUType); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* DomainBoundary */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_domain_boundary, &u32DomainBoundary); /* MulticastBoundary */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_multicast_boundary, &u32MulticastBoundary); /* LinkState.Port */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_link_state_port, &u8LinkStatePort); /* LinkState.Link */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_link_state_link, &u8LinkStateLink); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MediaType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_media_type, &u32MediaType); proto_item_append_text(item, ": Slot:0x%x/0x%x, OwnPortID:%s, Peers:%u LinkState.Port:%s LinkState.Link:%s MediaType:%s", u16SlotNr, u16SubslotNr, pOwnPortID, u8NumberOfPeers, val_to_str(u8LinkStatePort, pn_io_link_state_port, "0x%x"), val_to_str(u8LinkStateLink, pn_io_link_state_link, "0x%x"), val_to_str(u32MediaType, pn_io_media_type, "0x%x")); return offset; } /* dissect the PDPortDataRealExtended blocks */ static int dissect_PDPortDataRealExtended_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; int endoffset = offset + u16BodyLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr); while (endoffset > offset) { offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); u16Index++; } return offset; } static int dissect_PDInterfaceMrpDataAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { e_guid_t uuid; guint16 u16Role; guint8 u8LengthDomainName; guint8 u8NumberOfMrpInstances; int endoffset = offset + u16BodyLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { /* added low version == 1 */ expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow == 0) /*dissect LowVersion == 0 */ { offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Role */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_role, &u16Role); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_LengthDomainName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_length_domain_name, &u8LengthDomainName); /* MRP_DomainName */ /* XXX - IEC 61158-6-10 Edition 4.0 says, in section 5.2.17.2.4 "Coding of the field MRP_DomainName", that "This field shall be coded as data type OctetString with 1 to 240 octets according to Table 702 and 4.3.1.4.15.2." It then says, in subsection 4.3.1.4.15.2 "Encoding" of section 4.3.1.4.15 "Coding of the field NameOfStationValue", that "This field shall be coded as data type OctetString with 1 to 240 octets. The definition of IETF RFC 5890 and the following syntax applies: ..." RFC 5890 means Punycode; should we translate the domain name to UTF-8 and show both the untranslated and translated domain name? They don't mention anything about the RFC 1035 encoding of domain names as mentioned in section 3.1 "Name space definitions", with the labels being counted strings; does that mean that this is just an ASCII string to be interpreted as a Punycode Unicode domain name? */ proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); while (endoffset > offset) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); } } else if (u8BlockVersionLow == 1) /*dissect LowVersion == 1 */ { /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Number of Mrp Instances */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instances, &u8NumberOfMrpInstances); if (u8NumberOfMrpInstances > 0xf) { expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances); return offset; } while(u8NumberOfMrpInstances > 0) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); u8NumberOfMrpInstances--; } } return offset; } static int dissect_PDInterfaceMrpDataReal_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { e_guid_t uuid; guint16 u16Role; guint16 u16Version; guint8 u8LengthDomainName; guint8 u8NumberOfMrpInstances; int endoffset = offset + u16BodyLength; /* added blockversion 1 */ if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 2) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow < 2) /* dissect low versions 0 and 1 */ { /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Role */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_role, &u16Role); if (u8BlockVersionLow == 1) { /* MRP_Version */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_version, &u16Version); } /* MRP_LengthDomainName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_length_domain_name, &u8LengthDomainName); /* MRP_DomainName */ /* XXX - see comment earlier about MRP_DomainName */ proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; if (u8BlockVersionLow == 0) { /* MRP_Version */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_version, &u16Version); } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); while(endoffset > offset) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); } } else if (u8BlockVersionLow == 2) { /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Number of Mrp Instances */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instances, &u8NumberOfMrpInstances); if (u8NumberOfMrpInstances > 0xf) { expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances); return offset; } while(u8NumberOfMrpInstances > 0) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); u8NumberOfMrpInstances--; } } return offset; } static int dissect_PDInterfaceMrpDataCheck_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t uuid; guint32 u32Check; guint8 u8NumberOfMrpInstances; /* BlockVersionLow == 1 added */ if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow == 0) { offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Check */ dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_mrm, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_mrpdomain, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_reserved_1, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_reserved_2, &u32Check); offset +=4; /* MRP_Check (32 bit) done */ } else if (u8BlockVersionLow == 1) { /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Number of Mrp Instances */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instances, &u8NumberOfMrpInstances); if (u8NumberOfMrpInstances > 0xf) { expert_add_info_format(pinfo, item, &ei_pn_io_mrp_instances, "Number of MrpInstances greater 0x0f is (0x%x)", u8NumberOfMrpInstances); return offset; } while(u8NumberOfMrpInstances > 0) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); u8NumberOfMrpInstances--; } } return offset; } static int dissect_PDPortMrpData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t uuid; guint8 u8MrpInstance; /* added BlockVersionLow == 1 */ if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow == 0) { offset = dissect_pn_align4(tvb, offset, pinfo, tree); } else /*if (u8BlockVersionLow == 1) */ { /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Mrp Instance */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instance, &u8MrpInstance); } /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); return offset; } static int dissect_MrpManagerParams_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16Prio; guint16 u16TOPchgT; guint16 u16TOPNRmax; guint16 u16TSTshortT; guint16 u16TSTdefaultT; guint16 u16TSTNRmax; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MRP_Prio */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_prio, &u16Prio); /* MRP_TOPchgT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_topchgt, &u16TOPchgT); /* MRP_TOPNRmax */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_topnrmax, &u16TOPNRmax); /* MRP_TSTshortT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_tstshortt, &u16TSTshortT); /* MRP_TSTdefaultT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT); /* MSP_TSTNRmax */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_tstnrmax, &u16TSTNRmax); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } static int dissect_MrpRTMode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32RTMode; /* MRP_RTMode */ sub_item = proto_tree_add_item(tree, hf_pn_io_mrp_rtmode, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_mrp_rtmode); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mrp_rtmode_reserved2, &u32RTMode); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mrp_rtmode_reserved1, &u32RTMode); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mrp_rtmode_rtclass3, &u32RTMode); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mrp_rtmode_rtclass12, &u32RTMode); return offset; } static int dissect_MrpRTModeManagerData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16TSTNRmax; guint16 u16TSTdefaultT; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MSP_TSTNRmax */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_tstnrmax, &u16TSTNRmax); /* MRP_TSTdefaultT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_tstdefaultt, &u16TSTdefaultT); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_RTMode */ offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep); return offset; } static int dissect_MrpRingStateData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16RingState; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MRP_RingState */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_ring_state, &u16RingState); return offset; } static int dissect_MrpRTStateData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16RTState; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MRP_RTState */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_rt_state, &u16RTState); return offset; } static int dissect_MrpClientParams_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MRP_LNKdownT; guint16 u16MRP_LNKupT; guint16 u16MRP_LNKNRmax; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MRP_LNKdownT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_lnkdownt, &u16MRP_LNKdownT); /* MRP_LNKupT */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_lnkupt, &u16MRP_LNKupT); /* MRP_LNKNRmax u16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_lnknrmax, &u16MRP_LNKNRmax); return offset; } static int dissect_MrpRTModeClientData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { offset = dissect_pn_align4(tvb, offset, pinfo, tree); if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MRP_RTMode */ offset = dissect_MrpRTMode(tvb, offset, pinfo, tree, item, drep); return offset; } static int dissect_CheckSyncDifference_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16CheckSyncMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } sub_item = proto_tree_add_item(tree, hf_pn_io_check_sync_mode, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_check_sync_mode); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_check_sync_mode_reserved, &u16CheckSyncMode); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_check_sync_mode_sync_master, &u16CheckSyncMode); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_check_sync_mode_cable_delay, &u16CheckSyncMode); proto_item_append_text(sub_item, "CheckSyncMode: SyncMaster:%d, CableDelay:%d", (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1); proto_item_append_text(item, " : SyncMaster:%d, CableDelay:%d", (u16CheckSyncMode >> 1) & 1, u16CheckSyncMode & 1); return offset; } static int dissect_CheckMAUTypeDifference_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MAUTypeMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_mode, &u16MAUTypeMode); proto_item_append_text(item, ": MAUTypeMode:%s", val_to_str(u16MAUTypeMode, pn_io_mau_type_mode, "0x%x")); return offset; } /* dissect the AdjustDomainBoundary blocks */ static int dissect_AdjustDomainBoundary_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32DomainBoundary; guint32 u32DomainBoundaryIngress; guint32 u32DomainBoundaryEgress; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); switch (u8BlockVersionLow) { case(0): /* DomainBoundary */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_domain_boundary, &u32DomainBoundary); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x", u32DomainBoundary, u16AdjustProperties); break; case(1): /* DomainBoundaryIngress */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_domain_boundary_ingress, &u32DomainBoundaryIngress); /* DomainBoundaryEgress */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_domain_boundary_egress, &u32DomainBoundaryEgress); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); proto_item_append_text(item, ": BoundaryIngress:0x%x, BoundaryEgress:0x%x, Properties:0x%x", u32DomainBoundaryIngress, u32DomainBoundaryEgress, u16AdjustProperties); break; default: expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } return offset; } /* dissect the AdjustMulticastBoundary blocks */ static int dissect_AdjustMulticastBoundary_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32MulticastBoundary; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* Boundary */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_multicast_boundary, &u32MulticastBoundary); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); proto_item_append_text(item, ": Boundary:0x%x, Properties:0x%x", u32MulticastBoundary, u16AdjustProperties); return offset; } /* dissect the AdjustMAUType block */ static int dissect_AdjustMAUType_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MAUType; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MAUType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type, &u16MAUType); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); proto_item_append_text(item, ": MAUType:%s, Properties:0x%x", val_to_str(u16MAUType, pn_io_mau_type, "0x%x"), u16AdjustProperties); return offset; } /* dissect the CheckMAUType block */ static int dissect_CheckMAUType_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MAUType; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* MAUType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type, &u16MAUType); proto_item_append_text(item, ": MAUType:%s", val_to_str(u16MAUType, pn_io_mau_type, "0x%x")); return offset; } /* dissect the CheckLineDelay block */ static int dissect_CheckLineDelay_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32LineDelay; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* LineDelay */ offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelay); proto_item_append_text(item, ": LineDelay:%uns", u32LineDelay); return offset; } /* dissect the CheckPeers block */ static int dissect_CheckPeers_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8NumberOfPeers; guint8 u8I; guint8 u8LengthPeerPortID; guint8 u8LengthPeerChassisID; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* NumberOfPeers */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_peers, &u8NumberOfPeers); u8I = u8NumberOfPeers; while (u8I--) { /* LengthPeerPortID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_peer_port_id, &u8LengthPeerPortID); /* PeerPortID */ proto_tree_add_item (tree, hf_pn_io_peer_port_id, tvb, offset, u8LengthPeerPortID, ENC_ASCII); offset += u8LengthPeerPortID; /* LengthPeerChassisID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_peer_chassis_id, &u8LengthPeerChassisID); /* PeerChassisID */ proto_tree_add_item (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, ENC_ASCII); offset += u8LengthPeerChassisID; } proto_item_append_text(item, ": NumberOfPeers:%u", u8NumberOfPeers); return offset; } /* dissect the AdjustPortState block */ static int dissect_AdjustPortState_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16PortState; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* PortState */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_port_state, &u16PortState); /* AdjustProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); proto_item_append_text(item, ": PortState:%s, Properties:0x%x", val_to_str(u16PortState, pn_io_port_state, "0x%x"), u16AdjustProperties); return offset; } /* dissect the CheckPortState block */ static int dissect_CheckPortState_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16PortState; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* PortState */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_port_state, &u16PortState); proto_item_append_text(item, ": %s", val_to_str(u16PortState, pn_io_port_state, "0x%x")); return offset; } /* dissect the PDPortFODataReal block */ static int dissect_PDPortFODataReal_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint32 u32FiberOpticType; guint32 u32FiberOpticCableType; guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* FiberOpticType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fiber_optic_type, &u32FiberOpticType); /* FiberOpticCableType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType); /* optional: FiberOpticManufacturerSpecific */ if (u16BodyLength != 10) { dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); } return offset; } /* dissect the FiberOpticManufacturerSpecific block */ static int dissect_FiberOpticManufacturerSpecific_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint8 u8VendorIDHigh; guint8 u8VendorIDLow; guint16 u16VendorBlockType; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* x8 VendorIDHigh */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_high, &u8VendorIDHigh); /* x8 VendorIDLow */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_id_low, &u8VendorIDLow); /* VendorBlockType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_vendor_block_type, &u16VendorBlockType); /* Data */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength-4, "Data"); return offset; } /* dissect the FiberOpticDiagnosisInfo block */ static int dissect_FiberOpticDiagnosisInfo_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32FiberOpticPowerBudget; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* decode the u32FiberOpticPowerBudget better */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget); return offset; } /* dissect the AdjustMAUTypeExtension block */ static int dissect_AdjustMAUTypeExtension_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16MauTypeExtension; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MauTypeExtension */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MauTypeExtension); /* Properties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); return offset; } /* dissect the PDPortFODataAdjust block */ static int dissect_PDPortFODataAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32FiberOpticType; guint32 u32FiberOpticCableType; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* FiberOpticType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fiber_optic_type, &u32FiberOpticType); /* FiberOpticCableType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fiber_optic_cable_type, &u32FiberOpticCableType); /* proto_item_append_text(item, ": %s", val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/ return offset; } /* dissect the PDPortFODataCheck block */ static int dissect_PDPortFODataCheck_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32FiberOpticPowerBudget; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MaintenanceRequiredPowerBudget */ /* XXX - decode the u32FiberOpticPowerBudget better */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_maintenance_required_power_budget, &u32FiberOpticPowerBudget); /* MaintenanceDemandedPowerBudget */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_maintenance_demanded_power_budget, &u32FiberOpticPowerBudget); /* ErrorPowerBudget */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_error_power_budget, &u32FiberOpticPowerBudget); /* proto_item_append_text(item, ": %s", val_to_str(u16PortState, pn_io_port_state, "0x%x"));*/ return offset; } /* dissect the AdjustPeerToPeerBoundary block */ static int dissect_AdjustPeerToPeerBoundary_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32PeerToPeerBoundary; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); sub_item = proto_tree_add_item(tree, hf_pn_io_peer_to_peer_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_peer_to_peer_boundary); /* PeerToPeerBoundary.Bit0 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit0, &u32PeerToPeerBoundary); /* PeerToPeerBoundary.Bit1 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit1, &u32PeerToPeerBoundary); /* PeerToPeerBoundary.Bit2 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_bit2, &u32PeerToPeerBoundary); /* PeerToPeerBoundary.OtherBits */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_peer_to_peer_boundary_value_otherbits, &u32PeerToPeerBoundary); /* Properties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); return offset; } /* dissect the AdjustDCPBoundary block */ static int dissect_AdjustDCPBoundary_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32DcpBoundary; guint16 u16AdjustProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); sub_item = proto_tree_add_item(tree, hf_pn_io_dcp_boundary_value, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_dcp_boundary); /* DcpBoundary.Bit0 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit0, &u32DcpBoundary); /* DcpBoundary.Bit1 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_bit1, &u32DcpBoundary); /* DcpBoundary.OtherBits */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_dcp_boundary_value_otherbits, &u32DcpBoundary); /* Properties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_adjust_properties, &u16AdjustProperties); return offset; } static int dissect_MrpInstanceDataAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint8 u8MrpInstance; e_guid_t uuid; guint16 u16Role; guint8 u8LengthDomainName; int endoffset = offset + u16BodyLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Mrp Instance */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instance, &u8MrpInstance); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Role */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_role, &u16Role); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MRP_LengthDomainName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_length_domain_name, &u8LengthDomainName); /* MRP_DomainName */ /* XXX - see comment earlier about MRP_DomainName */ proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); while(endoffset > offset) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); } return offset; } static int dissect_MrpInstanceDataReal_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint8 u8MrpInstance; e_guid_t uuid; guint16 u16Role; guint16 u16Version; guint8 u8LengthDomainName; int endoffset = offset + u16BodyLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Mrp Instance */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instance, &u8MrpInstance); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Role */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_role, &u16Role); /* MRP_Version */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_version, &u16Version); /* MRP_LengthDomainName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_length_domain_name, &u8LengthDomainName); /* MRP_DomainName */ /* XXX - see comment earlier about MRP_DomainName */ proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); while(endoffset > offset) { offset = dissect_a_block(tvb, offset, pinfo, tree, drep); } return offset; } static int dissect_MrpInstanceDataCheck_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_) { guint8 u8MrpInstance; guint32 u32Check; e_guid_t uuid; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding one byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); /* Mrp Instance */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_instance, &u8MrpInstance); /* MRP_DomainUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_domain_uuid, &uuid); /* MRP_Check */ dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_mrm, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_mrpdomain, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_reserved_1, &u32Check); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_mrp_check_reserved_2, &u32Check); offset +=4; /* MRP_Check (32 bit) done */ return offset; } /* PDInterfaceAdjust */ static int dissect_PDInterfaceAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32SMultipleInterfaceMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MultipleInterfaceMode */ dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_MultipleInterfaceMode_NameOfDevice, &u32SMultipleInterfaceMode); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_MultipleInterfaceMode_reserved_1, &u32SMultipleInterfaceMode); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_MultipleInterfaceMode_reserved_2, &u32SMultipleInterfaceMode); return offset; } /* TSNNetworkControlDataReal */ static int dissect_TSNNetworkControlDataReal_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item* sub_item; proto_tree* sub_tree; e_guid_t nme_parameter_uuid; guint32 u32NetworkDeadline; guint16 u16SendClockFactor; guint16 u16NumberofEntries; guint16 u16TSNNMENameLength; guint16 u16TSNDomainNameLength; e_guid_t tsn_nme_name_uuid; e_guid_t tsn_domain_uuid; int bit_offset; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* NMEParameterUUID*/ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_tsn_nme_parameter_uuid, &nme_parameter_uuid); /* TSNDomainVIDConfig*/ sub_item = proto_tree_add_item(tree, hf_pn_io_tsn_domain_vid_config, tvb, offset, 16, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_tsn_domain_vid_config); bit_offset = offset << 3; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_reserved, tvb, bit_offset, 32, ENC_BIG_ENDIAN); bit_offset += 32; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_D, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_C, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_B, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_low_red_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_low_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_high_red_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_high_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); offset += 16; /* TSNDomainPortConfigBlock */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); /* Network Deadline */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_network_deadline, &u32NetworkDeadline); /* SendClockFactor 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_send_clock_factor, &u16SendClockFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_time_data_block_entries, &u16NumberofEntries); /* TSNTimeDataBlock */ while (u16NumberofEntries > 0) { u16NumberofEntries--; offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); } /* TSNNMENameUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_tsn_nme_name_uuid, &tsn_nme_name_uuid); /* TSNNMENameLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_nme_name_length, &u16TSNNMENameLength); /* TSNNMEName */ proto_tree_add_item(tree, hf_pn_io_tsn_nme_name, tvb, offset, u16TSNNMENameLength, ENC_ASCII | ENC_NA); offset += u16TSNNMENameLength; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* TSNDomainUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_tsn_domain_uuid, &tsn_domain_uuid); /* TSNDomainNameLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_domain_name_length, &u16TSNDomainNameLength); /* TSNDomainName */ proto_tree_add_item(tree, hf_pn_io_tsn_domain_name, tvb, offset, u16TSNDomainNameLength, ENC_ASCII | ENC_NA); offset += u16TSNDomainNameLength; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } /* TSNNetworkControlDataAdjust */ static int dissect_TSNNetworkControlDataAdjust_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item* sub_item; proto_tree* sub_tree; e_guid_t nme_parameter_uuid; guint32 u32NetworkDeadline; guint16 u16SendClockFactor; guint16 u16NumberofEntries; guint16 u16TSNNMENameLength; e_guid_t tsn_nme_name_uuid; int bit_offset; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* NMEParameterUUID*/ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_tsn_nme_parameter_uuid, &nme_parameter_uuid); /* TSNDomainVIDConfig*/ sub_item = proto_tree_add_item(tree, hf_pn_io_tsn_domain_vid_config, tvb, offset, 16, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_tsn_domain_vid_config); bit_offset = offset << 3; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_reserved, tvb, bit_offset, 32, ENC_BIG_ENDIAN); bit_offset += 32; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_D, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_C, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid_B, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_non_stream_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_low_red_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_low_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_high_red_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); bit_offset += 12; proto_tree_add_bits_item(sub_tree, hf_pn_io_tsn_domain_vid_config_stream_high_vid, tvb, bit_offset, 12, ENC_BIG_ENDIAN); offset += 16; /* TSNDomainPortConfigBlock */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); /* Network Deadline */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_network_deadline, &u32NetworkDeadline); /* SendClockFactor 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_send_clock_factor, &u16SendClockFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_time_data_block_entries, &u16NumberofEntries); /* TSNTimeDataBlock */ while (u16NumberofEntries > 0) { u16NumberofEntries--; offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); } /* TSNNMENameUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_tsn_nme_name_uuid, &tsn_nme_name_uuid); /* TSNNMENameLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_nme_name_length, &u16TSNNMENameLength); /* TSNNMEName */ proto_tree_add_item(tree, hf_pn_io_tsn_nme_name, tvb, offset, u16TSNNMENameLength, ENC_ASCII | ENC_NA); offset += u16TSNNMENameLength; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } /* TSNStreamPathData */ static int dissect_TSNStreamPathDataReal_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, gboolean real) { guint8 u8FDBCommand; guint16 u16NumberofEntries; guint8 dstAdd[6]; guint16 u16StreamClass; guint16 u16SlotNumber; guint16 u16SubSlotNumber; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); if (!real) { /* FDBCommand */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_fdb_command, &u8FDBCommand); } else { offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_sync_tree_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; /* DestinationAddress */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_tsn_dst_add, dstAdd); /* StreamClass */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_stream_class, &u16StreamClass); /* IngressPort */ /* TSNDomainPortID */ /*SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNumber); /* SubSlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubSlotNumber); /* EgressPort */ /* TSNDomainPortID */ /*SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNumber); /* SubSlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubSlotNumber); } return offset; } /* TSNSyncTreeData */ static int dissect_TSNSyncTreeData_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16TimeDomainNumber; guint8 u8SyncPortRole; proto_item* sub_item; proto_tree* sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_sync_tree_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; /* TSNDomainPortID */ sub_item = proto_tree_add_item(tree, hf_pn_io_tsn_domain_port_id, tvb, offset, 4, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_tsn_domain_port_id); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /*--*/ /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* TimeDomainNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_time_domain_number, &u16TimeDomainNumber); /* SyncPortRole */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_domain_sync_port_role, &u8SyncPortRole); /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); } return offset; } /* TSNDomainPortConfigBlock */ static int dissect_TSNDomainPortConfig_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; guint16 u16SlotNr; guint16 u16SubslotNr; proto_item* sub_item_port_config; proto_tree* sub_tree_port_config; guint8 u8TSNDomainPortConfig; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_port_config_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* TSNDomainPortConfig */ sub_item_port_config = proto_tree_add_item(tree, hf_pn_io_tsn_domain_port_config, tvb, offset, 1, ENC_NA); sub_tree_port_config = proto_item_add_subtree(sub_item_port_config, ett_pn_io_tsn_domain_port_config); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree_port_config, drep, hf_pn_io_tsn_domain_port_config_reserved, &u8TSNDomainPortConfig); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree_port_config, drep, hf_pn_io_tsn_domain_port_config_boundary_port_config, &u8TSNDomainPortConfig); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree_port_config, drep, hf_pn_io_tsn_domain_port_config_preemption_enabled, &u8TSNDomainPortConfig); /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 3); /* TSNDomainPortIngressRateLimiter */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); /* TSNDomainQueueConfigBlock */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); /* TSNDomainQueueRateLimiterBlock */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); } return offset; } /* TSNDomainQueueConfigBlock */ static int dissect_TSNDomainQueueConfig_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; proto_item* sub_item; proto_tree* sub_tree; guint64 u64TSNDomainQueueConfig; dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value dcv; /* fake dcerpc_call_value struct */ di.call_data = &dcv; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_queue_config_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; sub_item = proto_tree_add_item(tree, hf_pn_io_tsn_domain_queue_config, tvb, offset, 8, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_tsn_domain_queue_config); /* TSNDomainQueueConfig */ dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_mask_time_offset, &u64TSNDomainQueueConfig); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_unmask_time_offset, &u64TSNDomainQueueConfig); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_preemption_mode, &u64TSNDomainQueueConfig); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_shaper, &u64TSNDomainQueueConfig); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_tci_pcp, &u64TSNDomainQueueConfig); offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_config_queue_id, &u64TSNDomainQueueConfig); } return offset; } /* TSNTimeDataBlock */ static int dissect_TSNTimeData_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16TimeDomainNumber; guint32 u32TimePLLWindow; guint32 u32MessageIntervalFactor; guint16 u16MessageTimeoutFactor; guint16 u16TimeSyncProperties; guint8 u8TimeDomainNameLength; e_guid_t time_domain_uuid; proto_item* sub_item; proto_tree* sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* TimeDomainNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_time_domain_number, &u16TimeDomainNumber); /* TimePLLWindow */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_time_pll_window, &u32TimePLLWindow); /* MessageIntervalFactor */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_message_interval_factor, &u32MessageIntervalFactor); /* MessageTimeoutFactor */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_message_timeout_factor, &u16MessageTimeoutFactor); /* TimeSyncProperties */ sub_item = proto_tree_add_item(tree, hf_pn_io_time_sync_properties, tvb, offset, 2, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_time_sync_properties); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_time_sync_properties_reserved, &u16TimeSyncProperties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_time_sync_properties_role, &u16TimeSyncProperties); /* TimeDomainUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_io_time_domain_uuid, &time_domain_uuid); /* TimeDomainNameLength */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_time_domain_name_length, &u8TimeDomainNameLength); /* TimeDomainName */ proto_tree_add_item(tree, hf_pn_io_time_domain_name, tvb, offset, u8TimeDomainNameLength, ENC_ASCII | ENC_NA); offset += u8TimeDomainNameLength; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } /* TSNUploadNetworkAttributesBlock */ static int dissect_TSNUploadNetworkAttributes_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32TransferTimeTX; guint32 u32TransferTimeRX; guint32 u32MaxSupportedRecordSize; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Align to the next 32 bit twice */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* TSNPortIDBlock */ offset = dissect_a_block(tvb, offset, pinfo, tree, drep); /*MaxSupportedRecordSize*/ offset= dissect_dcerpc_uint32(tvb,offset,pinfo,tree,drep,hf_pn_io_tsn_max_supported_record_size,&u32MaxSupportedRecordSize); /* TransferTimeTX */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_transfer_time_tx, &u32TransferTimeTX); /* TransferTimeRX */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_transfer_time_rx, &u32TransferTimeRX); /* TSNForwardingDelayBlock */ offset = dissect_a_block(tvb, offset, pinfo, tree, drep); return offset; } /* TSNExpectedNeighborBlock */ static int dissect_TSNExpectedNeighbor_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8NumberOfPeers; guint8 u8I; guint8 u8LengthPeerPortName; guint8 u8LengthPeerStationName; guint16 u16NumberOfEntries; guint16 u16SlotNr; guint16 u16SubslotNr; guint32 u32LineDelayValue; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_expected_neighbor_block_number_of_entries, &u16NumberOfEntries); while (u16NumberOfEntries > 0) { u16NumberOfEntries--; /*TSNDomainPortID*/ /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /*--*/ /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 3); /* NumberOfPeers */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_peers, &u8NumberOfPeers); u8I = u8NumberOfPeers; while (u8I--) { /* LengthPeerPortName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_peer_port_name, &u8LengthPeerPortName); /* PeerPortName */ proto_tree_add_item(tree, hf_pn_io_peer_port_name, tvb, offset, u8LengthPeerPortName, ENC_ASCII | ENC_NA); offset += u8LengthPeerPortName; /* LengthPeerStationName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_peer_station_name, &u8LengthPeerStationName); /* PeerStationName */ proto_tree_add_item(tree, hf_pn_io_peer_station_name, tvb, offset, u8LengthPeerStationName, ENC_ASCII | ENC_NA); offset += u8LengthPeerStationName; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* LineDelay */ offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelayValue); } } return offset; } /* TSNExpectedNetworkAttributesBlock */ static int dissect_TSNExpectedNetworkAttributes_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Align to the next 32 bit twice */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* TSNPortIDBlock */ offset = dissect_a_block(tvb, offset, pinfo, tree, drep); /* TSNForwardingDelayBlock */ offset = dissect_a_block(tvb, offset, pinfo, tree, drep); /* TSNExpectedNeighborBlock */ offset = dissect_a_block(tvb, offset, pinfo, tree, drep); return offset; } /* TSNDomainPortIngressRateLimiterBlock */ static int dissect_TSNDomainPortIngressRateLimiter_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; proto_item* sub_item_port_ingress; proto_tree* sub_tree_port_ingress; guint64 u64TSNDomainPortIngressRateLimiter; dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value dcv; /* fake dcerpc_call_value struct */ di.call_data = &dcv; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_port_ingress_rate_limiter_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; /* TSNDomainPortIngressRateLimiter */ sub_item_port_ingress = proto_tree_add_item(tree, hf_pn_io_tsn_domain_port_ingress_rate_limiter, tvb, offset, 8, ENC_NA); sub_tree_port_ingress = proto_item_add_subtree(sub_item_port_ingress, ett_pn_io_tsn_domain_port_ingress_rate_limiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree_port_ingress, &di, drep, hf_pn_io_tsn_domain_port_ingress_rate_limiter_cir, &u64TSNDomainPortIngressRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree_port_ingress, &di, drep, hf_pn_io_tsn_domain_port_ingress_rate_limiter_cbs, &u64TSNDomainPortIngressRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree_port_ingress, &di, drep, hf_pn_io_tsn_domain_port_ingress_rate_limiter_envelope, &u64TSNDomainPortIngressRateLimiter); offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree_port_ingress, &di, drep, hf_pn_io_tsn_domain_port_ingress_rate_limiter_rank, &u64TSNDomainPortIngressRateLimiter); } return offset; } /* TSNDomainQueueRateLimiterBlock */ static int dissect_TSNDomainQueueRateLimiter_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberofEntries; proto_item* sub_item; proto_tree* sub_tree; guint64 u64TSNDomainQueueRateLimiter; dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value dcv; /* fake dcerpc_call_value struct */ di.call_data = &dcv; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_tsn_domain_queue_rate_limiter_entries, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; /* TSNDomainQueueRateLimiter */ sub_item = proto_tree_add_item(tree, hf_pn_io_tsn_domain_queue_rate_limiter, tvb, offset, 8, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_tsn_domain_queue_rate_limiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_cir, &u64TSNDomainQueueRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_cbs, &u64TSNDomainQueueRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_envelope, &u64TSNDomainQueueRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_rank, &u64TSNDomainQueueRateLimiter); dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_queue_id, &u64TSNDomainQueueRateLimiter); offset = dissect_dcerpc_uint64(tvb, offset, pinfo, sub_tree, &di, drep, hf_pn_io_tsn_domain_queue_rate_limiter_reserved, &u64TSNDomainQueueRateLimiter); } return offset; } /* TSNPortIDBlock */ static int dissect_TSNPortID_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8NumberOfQueues; guint8 u8ForwardingGroup; guint8 u8TSNPortCapabilities; guint16 u16NumberOfEntries; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16MAUType; guint16 u16MAUTypeExtension; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_port_id_block_number_of_entries, &u16NumberOfEntries); while (u16NumberOfEntries > 0) { u16NumberOfEntries--; /*TSNDomainPortID*/ /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /*--*/ /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /*MAUType*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type, &u16MAUType); /*MAUTypeExtension*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MAUTypeExtension); /* NumberOfQueues */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_number_of_queues, &u8NumberOfQueues); /* TSNPortCapabilities */ /* bit 0 */ dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_port_capabilities_time_aware, &u8TSNPortCapabilities); /* bit 1 */ dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_port_capabilities_preemption, &u8TSNPortCapabilities); /* bit 2 */ dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_port_capabilities_queue_masking, &u8TSNPortCapabilities); /* bit 3-7 */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_port_capabilities_reserved, &u8TSNPortCapabilities); /* ForwardingGroup */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_forwarding_group, &u8ForwardingGroup); /* Align to the next 32 bit */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); } return offset; } /* TSNForwardingDelayBlock */ static int dissect_TSNForwardingDelay_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8ForwardingGroupIngress; guint8 u8ForwardingGroupEgress; guint16 u16NumberOfEntries; guint16 u16StreamClass; guint32 u32DependentForwardingDelay; guint32 u32IndependentForwardingDelay; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_forwarding_delay_block_number_of_entries, &u16NumberOfEntries); while (u16NumberOfEntries > 0) { u16NumberOfEntries--; /*ForwardingGroupIngress*/ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_forwarding_group_ingress, &u8ForwardingGroupIngress); /*ForwardingGroupEgress*/ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_forwarding_group_egress, &u8ForwardingGroupEgress); /* StreamClass */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_stream_class, &u16StreamClass); /* DependentForwardingDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_dependent_forwarding_delay, &u32DependentForwardingDelay); /* IndependentForwardingDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_tsn_independent_forwarding_delay, &u32IndependentForwardingDelay); } return offset; } /* PDPortStatistic for one subslot */ static int dissect_PDPortStatistic_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32StatValue; guint16 u16CounterStatus; proto_item *sub_item; proto_tree *sub_tree; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } switch (u8BlockVersionLow) { case(0): /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); break; case(1): sub_item = proto_tree_add_item(tree, hf_pn_io_pdportstatistic_counter_status, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_counter_status); /* bit 0 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifInOctets, &u16CounterStatus); /* bit 1 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifOutOctets, &u16CounterStatus); /* bit 2 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifInDiscards, &u16CounterStatus); /* bit 3 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifOutDiscards, &u16CounterStatus); /* bit 4 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifInErrors, &u16CounterStatus); /* bit 5 */ dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_ifOutErrors, &u16CounterStatus); /* bit 6-15 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdportstatistic_counter_status_reserved, &u16CounterStatus); break; default: /* will not execute because of the line preceding the switch */ break; } offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifInOctets, &u32StatValue); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifOutOctets, &u32StatValue); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifInDiscards, &u32StatValue); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifOutDiscards, &u32StatValue); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifInErrors, &u32StatValue); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pdportstatistic_ifOutErrors, &u32StatValue); return offset; } /* OwnPort */ static int dissect_OwnPort_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8LengthOwnPortID; char *pOwnPortID; guint16 u16MAUType; guint16 u16MAUTypeExtension; guint32 u32MulticastBoundary; guint8 u8LinkStatePort; guint8 u8LinkStateLink; guint32 u32MediaType; guint32 u32LineDelayValue; guint16 u16PortStatus; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* LengthOwnPortID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_own_port_id, &u8LengthOwnPortID); /* OwnPortName */ proto_tree_add_item_ret_display_string (tree, hf_pn_io_own_port_id, tvb, offset, u8LengthOwnPortID, ENC_ASCII, pinfo->pool, &pOwnPortID); offset += u8LengthOwnPortID; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* LineDelay */ offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelayValue); /* MediaType */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_media_type, &u32MediaType); /* MulticastBoundary */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_multicast_boundary, &u32MulticastBoundary); /* MAUType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type, &u16MAUType); /* MAUTypeExtension */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mau_type_extension, &u16MAUTypeExtension); /* LinkState.Port */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_link_state_port, &u8LinkStatePort); /* LinkState.Link */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_link_state_link, &u8LinkStateLink); /* RTClass3_PortStatus */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rtclass3_port_status, &u16PortStatus); proto_item_append_text(item, ": OwnPortID:%s, LinkState.Port:%s LinkState.Link:%s MediaType:%s MAUType:%s", pOwnPortID, val_to_str(u8LinkStatePort, pn_io_link_state_port, "0x%x"), val_to_str(u8LinkStateLink, pn_io_link_state_link, "0x%x"), val_to_str(u32MediaType, pn_io_media_type, "0x%x"), val_to_str(u16MAUType, pn_io_mau_type, "0x%x")); return offset; } /* Neighbors */ static int dissect_Neighbors_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint8 u8NumberOfPeers; guint8 u8I; guint8 mac[6]; char *pPeerStationName; char *pPeerPortName; guint8 u8LengthPeerPortName; guint8 u8LengthPeerStationName; guint16 u16MAUType; guint16 u16MAUTypeExtension; guint32 u32LineDelayValue; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* NumberOfPeers */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_peers, &u8NumberOfPeers); offset = dissect_pn_align4(tvb, offset, pinfo, tree); u8I = u8NumberOfPeers; while (u8I--) { sub_item = proto_tree_add_item(tree, hf_pn_io_neighbor, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_neighbor); /* LineDelay */ offset = dissect_Line_Delay(tvb, offset, pinfo, sub_tree, drep, &u32LineDelayValue); /* MAUType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mau_type, &u16MAUType); /* MAUTypeExtension */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_mau_type_extension, &u16MAUTypeExtension); /* PeerMACAddress */ offset = dissect_pn_mac(tvb, offset, pinfo, sub_tree, hf_pn_io_peer_macadd, mac); /* LengthPeerPortName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_peer_port_name, &u8LengthPeerPortName); /* PeerPortName */ proto_tree_add_item_ret_display_string (sub_tree, hf_pn_io_peer_port_name, tvb, offset, u8LengthPeerPortName, ENC_ASCII, pinfo->pool, &pPeerPortName); offset += u8LengthPeerPortName; /* LengthPeerStationName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_peer_station_name, &u8LengthPeerStationName); /* PeerStationName */ proto_tree_add_item_ret_display_string (sub_tree, hf_pn_io_peer_station_name, tvb, offset, u8LengthPeerStationName, ENC_ASCII, pinfo->pool, &pPeerStationName); offset += u8LengthPeerStationName; offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); proto_item_append_text(sub_item, ": %s (%s)", pPeerStationName, pPeerPortName); } return offset; } /* dissect the PDInterfaceDataReal block */ static int dissect_PDInterfaceDataReal_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint8 u8LengthOwnChassisID; guint8 mac[6]; guint32 ip; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* LengthOwnChassisID */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_length_own_chassis_id, &u8LengthOwnChassisID); /* OwnChassisID */ proto_tree_add_item (tree, hf_pn_io_own_chassis_id, tvb, offset, u8LengthOwnChassisID, ENC_ASCII); offset += u8LengthOwnChassisID; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* MACAddressValue */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_macadd, mac); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* IPAddress */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_ip_address, &ip); /*proto_item_append_text(block_item, ", IP: %s", ip_to_str((guint8*)&ip));*/ /* Subnetmask */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_subnetmask, &ip); /*proto_item_append_text(block_item, ", Subnet: %s", ip_to_str((guint8*)&ip));*/ /* StandardGateway */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_io_standard_gateway, &ip); /*proto_item_append_text(block_item, ", Router: %s", ip_to_str((guint8*)&ip));*/ return offset; } /* dissect the PDSyncData block */ static int dissect_PDSyncData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16SlotNr; guint16 u16SubslotNr; e_guid_t uuid; guint32 u32ReservedIntervalBegin; guint32 u32ReservedIntervalEnd; guint32 u32PLLWindow; guint32 u32SyncSendFactor; guint16 u16SendClockFactor; guint16 u16SyncProperties; guint16 u16SyncFrameAddress; guint16 u16PTCPTimeoutFactor; guint16 u16PTCPTakeoverTimeoutFactor; guint16 u16PTCPMasterStartupTime; guint8 u8MasterPriority1; guint8 u8MasterPriority2; guint8 u8LengthSubdomainName; if (u8BlockVersionHigh != 1) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); switch (u8BlockVersionLow) { case(0): /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* PTCPSubdomainID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_subdomain_id, &uuid); /* IRDataID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ir_data_id, &uuid); /* ReservedIntervalBegin */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin); /* ReservedIntervalEnd */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd); /* PLLWindow enum */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pllwindow, &u32PLLWindow); /* SyncSendFactor 32 enum */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_sync_send_factor, &u32SyncSendFactor); /* SendClockFactor 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_send_clock_factor, &u16SendClockFactor); /* SyncProperties 16 bitfield */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sync_properties, &u16SyncProperties); /* SyncFrameAddress 16 bitfield */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sync_frame_address, &u16SyncFrameAddress); /* PTCPTimeoutFactor 16 enum */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor); proto_item_append_text(item, ": Slot:0x%x/0x%x, Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u", u16SlotNr, u16SubslotNr, u32ReservedIntervalBegin, u32ReservedIntervalEnd, u32PLLWindow, u32SyncSendFactor, u16SendClockFactor); break; case(2): /* PTCPSubdomainID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_subdomain_id, &uuid); /* ReservedIntervalBegin */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved_interval_begin, &u32ReservedIntervalBegin); /* ReservedIntervalEnd */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_reserved_interval_end, &u32ReservedIntervalEnd); /* PLLWindow enum */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_pllwindow, &u32PLLWindow); /* SyncSendFactor 32 enum */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_sync_send_factor, &u32SyncSendFactor); /* SendClockFactor 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_send_clock_factor, &u16SendClockFactor); /* PTCPTimeoutFactor 16 enum */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_timeout_factor, &u16PTCPTimeoutFactor); /* PTCPTakeoverTimeoutFactor 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_takeover_timeout_factor, &u16PTCPTakeoverTimeoutFactor); /* PTCPMasterStartupTime 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_master_startup_time, &u16PTCPMasterStartupTime); /* SyncProperties 16 bitfield */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sync_properties, &u16SyncProperties); /* PTCP_MasterPriority1 */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_master_priority_1, &u8MasterPriority1); /* PTCP_MasterPriority2 */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_master_priority_2, &u8MasterPriority2); /* PTCPLengthSubdomainName */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hf_pn_io_ptcp_length_subdomain_name, &u8LengthSubdomainName); /* PTCPSubdomainName */ /* XXX - another Punycode string */ proto_tree_add_item (tree, hf_pn_io_ptcp_subdomain_name, tvb, offset, u8LengthSubdomainName, ENC_ASCII); offset += u8LengthSubdomainName; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); proto_item_append_text(item, ": Interval:%u-%u, PLLWin:%u, Send:%u, Clock:%u", u32ReservedIntervalBegin, u32ReservedIntervalEnd, u32PLLWindow, u32SyncSendFactor, u16SendClockFactor); break; default: expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); } return offset; } /* dissect the PDIRData block */ static int dissect_PDIRData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; /* versions decoded are High: 1 and LOW 0..2 */ if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2 ) ) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ": Slot:0x%x/0x%x", u16SlotNr, u16SubslotNr); /* PDIRGlobalData */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); if (u8BlockVersionLow == 0) { /* PDIRFrameData */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); } else if (u8BlockVersionLow == 1) { /* [PDIRFrameData] */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); /* PDIRBeginEndData */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); }else if (u8BlockVersionLow == 2) { /* [PDIRFrameData] */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); /* PDIRBeginEndData */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); } return offset; } /* dissect the PDIRGlobalData block */ static int dissect_PDIRGlobalData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { e_guid_t uuid; guint32 u32MaxBridgeDelay; guint32 u32NumberOfPorts; guint32 u32MaxPortTxDelay; guint32 u32MaxPortRxDelay; guint32 u32MaxLineRxDelay; guint32 u32YellowTime; guint32 u32Tmp; /* added blockversion 2 */ if (u8BlockVersionHigh != 1 || (u8BlockVersionLow > 2)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* IRDataID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ir_data_id, &uuid); if (u8BlockVersionLow <= 2) { /* MaxBridgeDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_max_bridge_delay, &u32MaxBridgeDelay); /* NumberOfPorts */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_ports, &u32NumberOfPorts); u32Tmp = u32NumberOfPorts; while (u32Tmp--) { /* MaxPortTxDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_max_port_tx_delay, &u32MaxPortTxDelay); /* MaxPortRxDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_max_port_rx_delay, &u32MaxPortRxDelay); if (u8BlockVersionLow >= 2) { /* MaxLineRxDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_max_line_rx_delay, &u32MaxLineRxDelay); /* YellowTime */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_yellowtime, &u32YellowTime); } } proto_item_append_text(item, ": MaxBridgeDelay:%u, NumberOfPorts:%u", u32MaxBridgeDelay, u32NumberOfPorts); } return offset; } /* dissect the PDIRFrameData block */ static int dissect_PDIRFrameData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint32 u32FrameSendOffset; guint32 u32FrameDataProperties; guint16 u16DataLength; guint16 u16ReductionRatio; guint16 u16Phase; guint16 u16FrameID; guint16 u16Ethertype; guint8 u8RXPort; guint8 u8FrameDetails; guint8 u8NumberOfTxPortGroups; guint8 u8TxPortGroupArray; guint16 u16TxPortGroupArraySize; guint16 u16EndOffset; guint16 n = 0; proto_item *sub_item; proto_tree *sub_tree; /* added low version 1 */ if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); u16EndOffset = offset + u16BodyLength -2; if (u8BlockVersionLow > 0) { /* for low version 1 FrameDataProperties is added */ sub_item = proto_tree_add_item(tree, hf_pn_io_frame_data_properties, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_FrameDataProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_data_properties_forwarding_Mode, &u32FrameDataProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd, &u32FrameDataProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_data_properties_FragmentMode, &u32FrameDataProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_data_properties_reserved_1, &u32FrameDataProperties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_data_properties_reserved_2, &u32FrameDataProperties); } /* dissect all IR frame data */ while (offset < u16EndOffset) { proto_item *ir_frame_data_sub_item; proto_tree *ir_frame_data_tree; n++; /* new subtree for each IR frame */ ir_frame_data_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_frame_data, tvb, offset, 17, ENC_NA); ir_frame_data_tree = proto_item_add_subtree(ir_frame_data_sub_item, ett_pn_io_ir_frame_data); /* FrameSendOffset */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_frame_send_offset, &u32FrameSendOffset); /* DataLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_data_length, &u16DataLength); /* ReductionRatio */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_reduction_ratio, &u16ReductionRatio); /* Phase */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_phase, &u16Phase); /* FrameID */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_frame_id, &u16FrameID); /* Ethertype */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_ethertype, &u16Ethertype); /* RxPort */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, ir_frame_data_tree, drep, hf_pn_io_rx_port, &u8RXPort); /* FrameDetails */ sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_frame_details, tvb, offset, 1, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_frame_defails); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_details_sync_frame, &u8FrameDetails); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_details_meaning_frame_send_offset, &u8FrameDetails); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_frame_details_reserved, &u8FrameDetails); /* TxPortGroup */ u8NumberOfTxPortGroups = tvb_get_guint8(tvb, offset); sub_item = proto_tree_add_uint(ir_frame_data_tree, hf_pn_io_nr_of_tx_port_groups, tvb, offset, 1, u8NumberOfTxPortGroups); offset++; if ((u8NumberOfTxPortGroups > 21) || ((u8NumberOfTxPortGroups & 0x1) !=1)) { expert_add_info(pinfo, sub_item, &ei_pn_io_nr_of_tx_port_groups); } /* TxPortArray */ u16TxPortGroupArraySize = (u8NumberOfTxPortGroups + 7 / 8); sub_item = proto_tree_add_item(ir_frame_data_tree, hf_pn_io_TxPortGroupProperties, tvb, offset, u16TxPortGroupArraySize, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_GroupProperties); while (u16TxPortGroupArraySize > 0) { dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit0, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit1, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit2, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit3, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit4, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit5, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit6, &u8TxPortGroupArray); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_TxPortGroupProperties_bit7, &u8TxPortGroupArray); offset+=1; u16TxPortGroupArraySize --; } /* align to next dataset */ offset = dissect_pn_align4(tvb, offset, pinfo, ir_frame_data_tree); proto_item_append_text(ir_frame_data_tree, ": Offset:%u, Len:%u, Ratio:%u, Phase:%u, FrameID:0x%04x", u32FrameSendOffset, u16DataLength, u16ReductionRatio, u16Phase, u16FrameID); } proto_item_append_text(item, ": Frames:%u", n); return offset; } static int dissect_PDIRBeginEndData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16StartOfRedFrameID; guint16 u16EndOfRedFrameID; guint32 u32NumberOfPorts; guint32 u32NumberOfAssignments; guint32 u32NumberOfPhases; guint32 u32RedOrangePeriodBegin; guint32 u32OrangePeriodBegin; guint32 u32GreenPeriodBegin; guint16 u16TXPhaseAssignment; guint16 u16RXPhaseAssignment; guint32 u32SubStart; guint32 u32Tmp; guint32 u32Tmp2; guint32 u32TxRedOrangePeriodBegin[0x11] = {0}; guint32 u32TxOrangePeriodBegin [0x11] = {0}; guint32 u32TxGreenPeriodBegin [0x11] = {0}; guint32 u32RxRedOrangePeriodBegin[0x11] = {0}; guint32 u32RxOrangePeriodBegin [0x11] = {0}; guint32 u32RxGreenPeriodBegin [0x11] = {0}; guint32 u32PortIndex; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_start_of_red_frame_id, &u16StartOfRedFrameID); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_end_of_red_frame_id, &u16EndOfRedFrameID); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_ports, &u32NumberOfPorts); u32Tmp2 = u32NumberOfPorts; while (u32Tmp2--) { proto_item *ir_begin_end_port_sub_item; proto_tree *ir_begin_end_port_tree; /* new subtree for each Port */ ir_begin_end_port_sub_item = proto_tree_add_item(tree, hf_pn_io_ir_begin_end_port, tvb, offset, 0, ENC_NA); ir_begin_end_port_tree = proto_item_add_subtree(ir_begin_end_port_sub_item, ett_pn_io_ir_begin_end_port); u32SubStart = offset; offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_number_of_assignments, &u32NumberOfAssignments); u32Tmp = u32NumberOfAssignments; u32PortIndex = 0; if (u32Tmp <= 0x10) { while (u32Tmp--) { /* TXBeginEndAssignment */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_red_orange_period_begin_tx, &u32RedOrangePeriodBegin); u32TxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin; offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_orange_period_begin_tx, &u32OrangePeriodBegin); u32TxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin; offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_green_period_begin_tx, &u32GreenPeriodBegin); u32TxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin; /* RXBeginEndAssignment */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_red_orange_period_begin_rx, &u32RedOrangePeriodBegin); u32RxRedOrangePeriodBegin[u32PortIndex] = u32RedOrangePeriodBegin; offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_orange_period_begin_rx, &u32OrangePeriodBegin); u32RxOrangePeriodBegin[u32PortIndex]= u32OrangePeriodBegin; offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_green_period_begin_rx, &u32GreenPeriodBegin); u32RxGreenPeriodBegin[u32PortIndex] = u32GreenPeriodBegin; u32PortIndex++; } } offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ir_begin_end_port_tree, drep, hf_pn_io_number_of_phases, &u32NumberOfPhases); u32Tmp = u32NumberOfPhases; if (u32Tmp <= 0x10) { while (u32Tmp--) { proto_item *ir_begin_tx_phase_sub_item; proto_tree *ir_begin_tx_phase_tree; /* new subtree for TXPhaseAssignment */ ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree, hf_pn_ir_tx_phase_assignment, tvb, offset, 0, ENC_NA); ir_begin_tx_phase_tree = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_tx_phase); /* bit 0..3 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_begin_value, &u16TXPhaseAssignment); /* bit 4..7 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_orange_begin, &u16TXPhaseAssignment); /* bit 8..11 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_end_reserved, &u16TXPhaseAssignment); /* bit 12..15 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_reserved, &u16TXPhaseAssignment); proto_item_append_text(ir_begin_tx_phase_sub_item, ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d", u16TXPhaseAssignment, u32TxRedOrangePeriodBegin[u16TXPhaseAssignment & 0x0F], u32TxOrangePeriodBegin[(u16TXPhaseAssignment & 0x0F0) >> 4], u32TxGreenPeriodBegin[(u16TXPhaseAssignment & 0x0F00)>> 8]); /* new subtree for RXPhaseAssignment */ ir_begin_tx_phase_sub_item = proto_tree_add_item(ir_begin_end_port_tree, hf_pn_ir_rx_phase_assignment, tvb, offset, 0, ENC_NA); ir_begin_tx_phase_tree = proto_item_add_subtree(ir_begin_tx_phase_sub_item, ett_pn_io_ir_rx_phase); /* bit 0..3 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_begin_value, &u16RXPhaseAssignment); /* bit 4..7 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_orange_begin, &u16RXPhaseAssignment); /* bit 8..11 */ dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_end_reserved, &u16RXPhaseAssignment); /* bit 12..15 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ir_begin_tx_phase_tree, drep, hf_pn_io_tx_phase_assignment_reserved, &u16RXPhaseAssignment); proto_item_append_text(ir_begin_tx_phase_sub_item, ": 0x%x, RedOrangePeriodBegin: %d, OrangePeriodBegin: %d, GreenPeriodBegin: %d", u16RXPhaseAssignment, u32RxRedOrangePeriodBegin[u16RXPhaseAssignment & 0x0F], u32RxOrangePeriodBegin[(u16RXPhaseAssignment & 0x0F0) >> 4], u32RxGreenPeriodBegin[(u16RXPhaseAssignment & 0x0F00)>> 8]); } } proto_item_append_text(ir_begin_end_port_sub_item, ": Assignments:%u, Phases:%u", u32NumberOfAssignments, u32NumberOfPhases); proto_item_set_len(ir_begin_end_port_sub_item, offset - u32SubStart); } proto_item_append_text(item, ": StartOfRedFrameID: 0x%x, EndOfRedFrameID: 0x%x, Ports: %u", u16StartOfRedFrameID, u16EndOfRedFrameID, u32NumberOfPorts); return offset+u16BodyLength; } /* dissect the DiagnosisData block */ static int dissect_DiagnosisData_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 body_length) { guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16ChannelNumber; guint16 u16UserStructureIdentifier; proto_item *sub_item; if (u8BlockVersionHigh != 1 || (u8BlockVersionLow != 0 && u8BlockVersionLow != 1)) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } if (u8BlockVersionLow == 1) { /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); body_length-=4; } /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* ChannelNumber got new ranges: 0..0x7FFF the source is a channel as specified by the manufacturer */ /* fetch u16ChannelNumber */ u16ChannelNumber = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohs(tvb, offset) : tvb_get_ntohs(tvb, offset)); if (tree) { sub_item = proto_tree_add_item(tree,hf_pn_io_channel_number, tvb, offset, 2, DREP_ENC_INTEGER(drep)); if (u16ChannelNumber < 0x8000){ /* 0..0x7FFF the source is a channel as specified by the manufacturer */ proto_item_append_text(sub_item, " channel number of the diagnosis source"); } else if (u16ChannelNumber == 0x8000) /* 0x8000 the whole submodule is the source, */ proto_item_append_text(sub_item, " (whole) Submodule"); else proto_item_append_text(sub_item, " reserved"); } offset = offset +2; /* Advance behind ChannelNumber */ /* ChannelProperties */ offset = dissect_ChannelProperties(tvb, offset, pinfo, tree, item, drep); body_length-=8; /* UserStructureIdentifier */ u16UserStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohs(tvb, offset) : tvb_get_ntohs(tvb, offset)); if (u16UserStructureIdentifier > 0x7FFF){ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_user_structure_identifier, &u16UserStructureIdentifier); } else { /* range 0x0 to 0x7fff is manufacturer specific */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_user_structure_identifier_manf, &u16UserStructureIdentifier); } proto_item_append_text(item, ", USI:0x%x", u16UserStructureIdentifier); body_length-=2; /* the rest of the block contains optional: [MaintenanceItem] and/or [AlarmItem] */ while (body_length) { offset = dissect_AlarmUserStructure(tvb, offset, pinfo, tree, item, drep, &body_length, u16UserStructureIdentifier); } return offset; } static int dissect_ARProperties(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32ARProperties; guint8 startupMode; guint8 isTimeAware; sub_item = proto_tree_add_item(tree, hf_pn_io_ar_properties, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_properties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_pull_module_alarm_allowed, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_arproperties_StartupMode, &u32ARProperties); startupMode = (guint8)((u32ARProperties >> 30) & 0x01); /* Advanced startup mode */ if (startupMode) { dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode, &u32ARProperties); } /* Legacy startup mode */ else { dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode, &u32ARProperties); } dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_time_aware_system, &u32ARProperties); isTimeAware = (guint8)((u32ARProperties >> 28) & 0x01); wmem_map_insert(pnio_time_aware_frame_map, GUINT_TO_POINTER(pinfo->num), GUINT_TO_POINTER(isTimeAware)); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_reserved, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_achnowledge_companion_ar, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_companion_ar, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_device_access, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_reserved_1, &u32ARProperties); /* removed within 2.3 dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_data_rate, &u32ARProperties); */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_parameterization_server, &u32ARProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_supervisor_takeover_allowed, &u32ARProperties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_ar_properties_state, &u32ARProperties); return offset; } /* dissect the IOCRProperties */ static int dissect_IOCRProperties(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32IOCRProperties; sub_item = proto_tree_add_item(tree, hf_pn_io_iocr_properties, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_iocr_properties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_full_subframe_structure, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_distributed_subframe_watchdog, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_fast_forwarding_mac_adr, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_reserved_3, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_reserved_2, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_media_redundancy, &u32IOCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_reserved_1, &u32IOCRProperties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocr_properties_rtclass, &u32IOCRProperties); return offset; } /* dissect the ARData block */ static int dissect_ARData_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BlockLength) { guint16 u16NumberOfARs; guint16 u16NumberofEntries; e_guid_t aruuid; e_guid_t uuid; guint16 u16ARType; guint16 u16NameLength; guint16 u16NumberOfIOCRs; guint16 u16IOCRType; guint16 u16FrameID; guint16 u16CycleCounter; guint8 u8DataStatus; guint8 u8TransferStatus; proto_item *ds_item; proto_tree *ds_tree; guint16 u16UDPRTPort; guint16 u16AlarmCRType; guint16 u16LocalAlarmReference; guint16 u16RemoteAlarmReference; guint16 u16NumberOfAPIs; guint32 u32Api; proto_item *iocr_item; proto_tree *iocr_tree; proto_item *ar_item; proto_tree *ar_tree; guint32 u32IOCRStart; gint32 i32EndOffset; guint32 u32ARDataStart; /* added BlockversionLow == 1 */ if (u8BlockVersionHigh != 1 || u8BlockVersionLow > 1) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } i32EndOffset = offset + u16BlockLength; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_ars, &u16NumberOfARs); /* BlockversionLow: 0 */ if (u8BlockVersionLow == 0) { while (u16NumberOfARs--) { ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA); ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data); u32ARDataStart = offset; offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_uuid, &aruuid); if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num); } proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(pinfo->pool, (const e_guid_t*) &aruuid)); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_type, &u16ARType); offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_objectuuid, &uuid); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength); proto_tree_add_item (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs); while (u16NumberOfIOCRs--) { iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA); iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr); u32IOCRStart = offset; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_iocr_type, &u16IOCRType); offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_frame_id, &u16FrameID); proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID); /* add cycle counter */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_cycle_counter, &u16CycleCounter); u8DataStatus = tvb_get_guint8(tvb, offset); u8TransferStatus = tvb_get_guint8(tvb, offset+1); /* add data status subtree */ ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status, tvb, offset, 1, u8DataStatus, "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)", u8DataStatus, (u8DataStatus & 0x04) ? "Valid" : "Invalid", (u8DataStatus & 0x01) ? "Primary" : "Backup", (u8DataStatus & 0x20) ? "Ok" : "Problem", (u8DataStatus & 0x10) ? "Run" : "Stop"); ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus); offset++; /* add transfer status */ if (u8TransferStatus) { proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb, offset, 1, u8TransferStatus, "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus); } else { proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb, offset, 1, u8TransferStatus, "TransferStatus: 0x%02x (OK)", u8TransferStatus); } offset++; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_cminitiator_udprtport, &u16UDPRTPort); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_cmresponder_udprtport, &u16UDPRTPort); proto_item_set_len(iocr_item, offset - u32IOCRStart); } /* AlarmCRType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType); /* LocalAlarmReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference); /* RemoteAlarmReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_remotealarmref, &u16RemoteAlarmReference); /* ParameterServerObjectUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_parameter_server_objectuuid, &uuid); /* StationNameLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength); /* ParameterServerStationName */ proto_tree_add_item (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); /* API */ while (u16NumberOfAPIs--) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_api, &u32Api); } proto_item_set_len(ar_item, offset - u32ARDataStart); } } else { /* BlockversionLow == 1 */ while (u16NumberOfARs--) { ar_item = proto_tree_add_item(tree, hf_pn_io_ar_data, tvb, offset, 0, ENC_NA); ar_tree = proto_item_add_subtree(ar_item, ett_pn_io_ar_data); u32ARDataStart = offset; /*ARUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_uuid, &aruuid); if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num); } proto_item_append_text(ar_item, "ARUUID:%s", guid_to_str(pinfo->pool, (const e_guid_t*) &aruuid)); /* CMInitiatorObjectUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_objectuuid, &uuid); /* ParameterServerObjectUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_parameter_server_objectuuid, &uuid); /* ARProperties*/ offset = dissect_ARProperties(tvb, offset, pinfo, ar_tree, item, drep); /* ARType*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_ar_type, &u16ARType); /* AlarmCRType */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType); /* LocalAlarmReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference); /* RemoteAlarmReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_remotealarmref, &u16RemoteAlarmReference); /* InitiatorUDPRTPort*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cminitiator_udprtport, &u16UDPRTPort); /* ResponderUDPRTPort*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_cmresponder_udprtport, &u16UDPRTPort); /* CMInitiatorStationName*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength); proto_tree_add_item (ar_tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; /** align padding! **/ offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree); /* StationNameLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_station_name_length, &u16NameLength); if (u16NameLength != 0) { /* ParameterServerStationName */ proto_tree_add_item (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; } else { /* display no name present */ proto_tree_add_string (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, " <no ParameterServerStationName present>"); } /** align padding! **/ offset = dissect_pn_align4(tvb, offset, pinfo, ar_tree); /* NumberOfIOCRs*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_iocrs, &u16NumberOfIOCRs); /* align to next 32 bit */ offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2); while (u16NumberOfIOCRs--) { iocr_item = proto_tree_add_item(ar_tree, hf_pn_io_iocr_tree, tvb, offset, 0, ENC_NA); iocr_tree = proto_item_add_subtree(iocr_item, ett_pn_io_iocr); u32IOCRStart = offset; /* IOCRProperties*/ offset = dissect_IOCRProperties(tvb, offset, pinfo, iocr_tree, drep); /* IOCRType*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_iocr_type, &u16IOCRType); /* FrameID*/ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_frame_id, &u16FrameID); proto_item_append_text(iocr_item, ": FrameID:0x%x", u16FrameID); /* add cycle counter */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, iocr_tree, drep, hf_pn_io_cycle_counter, &u16CycleCounter); u8DataStatus = tvb_get_guint8(tvb, offset); u8TransferStatus = tvb_get_guint8(tvb, offset+1); /* add data status subtree */ ds_item = proto_tree_add_uint_format(iocr_tree, hf_pn_io_data_status, tvb, offset, 1, u8DataStatus, "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)", u8DataStatus, (u8DataStatus & 0x04) ? "Valid" : "Invalid", (u8DataStatus & 0x01) ? "Primary" : "Backup", (u8DataStatus & 0x20) ? "Ok" : "Problem", (u8DataStatus & 0x10) ? "Run" : "Stop"); ds_tree = proto_item_add_subtree(ds_item, ett_pn_io_data_status); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res67, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_ok, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_operate, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res3, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_valid, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_res1, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(ds_tree, hf_pn_io_data_status_primary, tvb, offset, 1, u8DataStatus); offset++; /* add transfer status */ if (u8TransferStatus) { proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb, offset, 1, u8TransferStatus, "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus); } else { proto_tree_add_uint_format(iocr_tree, hf_pn_io_transfer_status, tvb, offset, 1, u8TransferStatus, "TransferStatus: 0x%02x (OK)", u8TransferStatus); } offset++; proto_item_set_len(iocr_item, offset - u32IOCRStart); } /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); /* align to next 32 bit */ offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2); /* API */ while (u16NumberOfAPIs--) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_api, &u32Api); } /* get the number of subblocks an dissect them */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, ar_tree, drep, hf_pn_io_number_of_ARDATAInfo, &u16NumberofEntries); offset = dissect_pn_padding(tvb, offset, pinfo, ar_tree, 2); while ((offset < i32EndOffset) && (u16NumberofEntries > 0)) { offset = dissect_a_block(tvb, offset, pinfo, ar_tree, drep); u16NumberofEntries--; } proto_item_set_len(ar_item, offset - u32ARDataStart); } } return offset; } /* dissect the APIData block */ static int dissect_APIData_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); while (u16NumberOfAPIs--) { /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); } return offset; } /* dissect the SLRData block */ static int dissect_SRLData_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 RedundancyInfo; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* bit 0 ..1 EndPoint1 and EndPoint2*/ dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo, &RedundancyInfo); /* bit 2 .. 15 reserved */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_RedundancyInfo_reserved, &RedundancyInfo); offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } /* dissect the LogData block */ static int dissect_LogData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint64 u64ActualLocaltimeStamp; guint16 u16NumberOfLogEntries; guint64 u64LocaltimeStamp; e_guid_t aruuid; guint32 u32EntryDetail; dcerpc_info di; /* fake dcerpc_info struct */ dcerpc_call_value call_data; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } di.conformant_run = 0; /* we need di->call_data->flags.NDR64 == 0 */ call_data.flags = 0; di.call_data = &call_data; di.dcerpc_procedure_name = ""; /* ActualLocalTimeStamp */ offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep, hf_pn_io_actual_local_time_stamp, &u64ActualLocaltimeStamp); /* NumberOfLogEntries */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_log_entries, &u16NumberOfLogEntries); while (u16NumberOfLogEntries--) { /* LocalTimeStamp */ offset = dissect_dcerpc_uint64(tvb, offset, pinfo, tree, &di, drep, hf_pn_io_local_time_stamp, &u64LocaltimeStamp); /* ARUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &aruuid); if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num); } /* PNIOStatus */ offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep); /* EntryDetail */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_entry_detail, &u32EntryDetail); } return offset; } /* dissect the FS Hello block */ static int dissect_FSHello_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32FSHelloMode; guint32 u32FSHelloInterval; guint32 u32FSHelloRetry; guint32 u32FSHelloDelay; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* FSHelloMode */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_hello_mode, &u32FSHelloMode); /* FSHelloInterval */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_hello_interval, &u32FSHelloInterval); /* FSHelloRetry */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_hello_retry, &u32FSHelloRetry); /* FSHelloDelay */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_hello_delay, &u32FSHelloDelay); proto_item_append_text(item, ": Mode:%s, Interval:%ums, Retry:%u, Delay:%ums", val_to_str(u32FSHelloMode, pn_io_fs_hello_mode_vals, "0x%x"), u32FSHelloInterval, u32FSHelloRetry, u32FSHelloDelay); return offset; } /* dissect the FS Parameter block */ static int dissect_FSParameter_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint32 u32FSParameterMode; e_guid_t FSParameterUUID; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* FSParameterMode */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_parameter_mode, &u32FSParameterMode); /* FSParameterUUID */ offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_fs_parameter_uuid, &FSParameterUUID); proto_item_append_text(item, ": Mode:%s", val_to_str(u32FSParameterMode, pn_io_fs_parameter_mode_vals, "0x%x")); return offset; } /* dissect the FSUDataAdjust block */ static int dissect_PDInterfaceFSUDataAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { tvbuff_t *new_tvb; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); u16BodyLength -= 2; /* sub blocks */ new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength); dissect_blocks(new_tvb, 0, pinfo, tree, drep); offset += u16BodyLength; return offset; } /* dissect the ARFSUDataAdjust block */ static int dissect_ARFSUDataAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { tvbuff_t *new_tvb; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); u16BodyLength -= 2; /* sub blocks */ new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength); dissect_blocks(new_tvb, 0, pinfo, tree, drep); offset += u16BodyLength; return offset; } /* dissect the PE_EntityFilterData block */ static int dissect_PE_EntityFilterData_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16NumberOfModules; guint16 u16SlotNr; guint32 u32ModuleIdentNumber; guint16 u16NumberOfSubmodules; guint16 u16SubslotNr; guint32 u32SubmoduleIdentNumber; proto_item* api_item; proto_tree* api_tree; guint32 u32ApiStart; proto_item* module_item; proto_tree* module_tree; guint32 u32ModuleStart; proto_item* sub_item; proto_tree* sub_tree; guint32 u32SubStart; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } // NumberOfAPIs, // (API, NumberOfModules, (SlotNumber, ModuleIdentNumber, NumberOfSubmodules, (SubslotNumber, SubmoduleIdentNumber)*)*)* /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs); while (u16NumberOfAPIs--) { api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA); api_tree = proto_item_add_subtree(api_item, ett_pn_io_api); u32ApiStart = offset; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_api, &u32Api); /* NumberOfModules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_modules, &u16NumberOfModules); proto_item_append_text(api_item, ": %u, Modules: %u", u32Api, u16NumberOfModules); proto_item_append_text(item, ", Modules:%u", u16NumberOfModules); while (u16NumberOfModules--) { module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA); module_tree = proto_item_add_subtree(module_item, ett_pn_io_module); u32ModuleStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* ModuleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); /* NumberOfSubmodules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_number_of_submodules, &u16NumberOfSubmodules); proto_item_append_text(module_item, ": Slot 0x%x, Ident: 0x%x Submodules: %u", u16SlotNr, u32ModuleIdentNumber, u16NumberOfSubmodules); proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules); while (u16NumberOfSubmodules--) { sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule); u32SubStart = offset; /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* SubmoduleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); proto_item_append_text(sub_item, ": Subslot 0x%x, IdentNumber: 0x%x", u16SubslotNr, u32SubmoduleIdentNumber); proto_item_set_len(sub_item, offset - u32SubStart); } /* NumberOfSubmodules */ proto_item_set_len(module_item, offset - u32ModuleStart); } proto_item_set_len(api_item, offset - u32ApiStart); } return offset; } /* dissect the PE_EntityStatusData block */ static int dissect_PE_EntityStatusData_block(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* item _U_, guint8* drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16NumberOfModules; guint16 u16SlotNr; guint16 u16NumberOfSubmodules; guint16 u16SubslotNr; proto_item* api_item; proto_tree* api_tree; guint32 u32ApiStart; proto_item* module_item; proto_tree* module_tree; guint32 u32ModuleStart; proto_item* sub_item; proto_tree* sub_tree; guint32 u32SubStart; guint8 u8PEOperationalMode; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } // NumberOfAPIs, // (API, NumberOfModules, (SlotNumber, NumberOfSubmodules, (SubslotNumber, PE_OperationalMode, [Padding] * a)*)*)* /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs); while (u16NumberOfAPIs--) { api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA); api_tree = proto_item_add_subtree(api_item, ett_pn_io_api); u32ApiStart = offset; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_api, &u32Api); /* NumberOfModules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_modules, &u16NumberOfModules); proto_item_append_text(api_item, ": %u, Modules: %u", u32Api, u16NumberOfModules); proto_item_append_text(item, ", Modules:%u", u16NumberOfModules); while (u16NumberOfModules--) { module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA); module_tree = proto_item_add_subtree(module_item, ett_pn_io_module); u32ModuleStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* NumberOfSubmodules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_number_of_submodules, &u16NumberOfSubmodules); proto_item_append_text(module_item, ": Slot 0x%x, Submodules: %u", u16SlotNr, u16NumberOfSubmodules); proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules); while (u16NumberOfSubmodules--) { sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule); u32SubStart = offset; /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(sub_item, ": Subslot 0x%x", u16SubslotNr); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pe_operational_mode, &u8PEOperationalMode); offset = dissect_pn_padding(tvb, offset, pinfo, sub_tree, 1); proto_item_set_len(sub_item, offset - u32SubStart); } /* NumberOfSubmodules */ proto_item_set_len(module_item, offset - u32ModuleStart); } proto_item_set_len(api_item, offset - u32ApiStart); } return offset; } static const char * decode_ARType_spezial(guint16 ARType, guint16 ARAccess) { if (ARType == 0x0001) return ("IO Controller AR"); else if (ARType == 0x0003) return("IO Controller AR"); else if (ARType == 0x0010) return("IO Controller AR (RT_CLASS_3)"); else if (ARType == 0x0020) return("IO Controller AR (sysred/CiR)"); else if (ARType == 0x0006) { if (ARAccess) /*TRUE */ return("DeviceAccess AR"); else return("IO Supervisor AR"); } else return("reserved"); } /* dissect the ARBlockReq */ static int dissect_ARBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t ** ar) { guint16 u16ARType; guint32 u32ARProperties; gboolean have_aruuid = FALSE; e_guid_t aruuid; e_guid_t uuid; guint16 u16SessionKey; guint8 mac[6]; guint16 u16TimeoutFactor; guint16 u16UDPRTPort; guint16 u16NameLength; char *pStationName; pnio_ar_t *par; proto_item *sub_item; proto_tree *sub_tree; guint16 u16ArNumber; guint16 u16ArResource; guint16 u16ArReserved; proto_item *sub_item_selector; proto_tree *sub_tree_selector; conversation_t *conversation; apduStatusSwitch *apdu_status_switch = NULL; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } u32ARProperties = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohl (tvb, offset + 2 + 16 +2 + 6 +12) : tvb_get_ntohl (tvb, offset + 2 + 16 +2 + 6 +12)); u16ARType = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohs (tvb, offset) : tvb_get_ntohs (tvb, offset)); if (tree) { proto_tree_add_string_format(tree, hf_pn_io_artype_req, tvb, offset, 2, "ARType", "ARType: (0x%04x) %s ", u16ARType, decode_ARType_spezial(u16ARType, u32ARProperties)); } offset = offset + 2; if (u16ARType == 0x0020) { dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &aruuid); sub_item = proto_tree_add_item(tree, hf_pn_io_ar_uuid, tvb, offset, 16, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_ar_info); proto_tree_add_item(sub_tree, hf_pn_io_ar_discriminator, tvb, offset, 6, ENC_NA); offset += 6; proto_tree_add_item(sub_tree, hf_pn_io_ar_configid, tvb, offset, 8, ENC_NA); offset += 8; sub_item_selector = proto_tree_add_item(sub_tree, hf_pn_io_ar_selector, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree_selector = proto_item_add_subtree(sub_item_selector, ett_pn_io_ar_info); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arnumber, &u16ArNumber); dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arresource, &u16ArResource); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree_selector, drep, hf_pn_io_ar_arreserved, &u16ArReserved); /* When ARType==IOCARSR, then find or create conversation for this frame */ if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_UDP, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_UDP, 0, 0, 0); } /* Try to get apdu status switch information from the conversation */ apdu_status_switch = (apduStatusSwitch*)conversation_get_proto_data(conversation, proto_pn_io_apdu_status); /* If apdu status switch is null, then fill it*/ /* If apdu status switch is not null, then update it*/ if (apdu_status_switch == NULL) { /* apdu status switch information is valid for whole file*/ apdu_status_switch = wmem_new0(wmem_file_scope(), apduStatusSwitch); copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr)); copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr)); apdu_status_switch->isRedundancyActive = TRUE; conversation_add_proto_data(conversation, proto_pn_io_apdu_status, apdu_status_switch); } else { copy_address_shallow(&apdu_status_switch->dl_src, conversation_key_addr1(conversation->key_ptr)); copy_address_shallow(&apdu_status_switch->dl_dst, conversation_key_addr2(conversation->key_ptr)); apdu_status_switch->isRedundancyActive = TRUE; } } } else { offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &aruuid); have_aruuid = TRUE; } if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(aruuid, pinfo->num); } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey); offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_cminitiator_macadd, mac); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_cminitiator_objectuuid, &uuid); offset = dissect_ARProperties(tvb, offset, pinfo, tree, item, drep); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_cminitiator_activitytimeoutfactor, &u16TimeoutFactor); /* XXX - special values */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_cminitiator_udprtport, &u16UDPRTPort); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_station_name_length, &u16NameLength); proto_tree_add_item_ret_display_string (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII, pinfo->pool, &pStationName); offset += u16NameLength; proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x, Station:%s", decode_ARType_spezial(u16ARType, u32ARProperties), u16SessionKey, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], u16UDPRTPort, pStationName); if (have_aruuid) { par = pnio_ar_find_by_aruuid(pinfo, &aruuid); if (par == NULL) { par = pnio_ar_new(&aruuid); memcpy( (void *) (&par->controllermac), mac, sizeof(par->controllermac)); par->arType = u16ARType; /* store AR-type for filter generation */ /*strncpy( (char *) (&par->controllername), pStationName, sizeof(par->controllername));*/ } else { /*expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "ARBlockReq: AR already existing!");*/ } *ar = par; } else { *ar = NULL; } return offset; } /* dissect the ARBlockRes */ static int dissect_ARBlockRes_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t **ar) { guint16 u16ARType; e_guid_t uuid; guint16 u16SessionKey; guint8 mac[6]; guint16 u16UDPRTPort; pnio_ar_t *par; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_type, &u16ARType); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_ar_uuid, &uuid); if (!PINFO_FD_VISITED(pinfo)) { pn_init_append_aruuid_frame_setup_list(uuid, pinfo->num); } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey); offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_cmresponder_macadd, mac); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_cmresponder_udprtport, &u16UDPRTPort); proto_item_append_text(item, ": %s, Session:%u, MAC:%02x:%02x:%02x:%02x:%02x:%02x, Port:0x%x", val_to_str(u16ARType, pn_io_ar_type, "0x%x"), u16SessionKey, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], u16UDPRTPort); /* The value NIL indicates the usage of the implicit AR*/ par = pnio_ar_find_by_aruuid(pinfo, &uuid); if (par != NULL) { memcpy( (void *) (&par->devicemac), mac, sizeof(par->controllermac)); } *ar = par; return offset; } /* dissect the IOCRBlockReq */ static int dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t *ar) { guint16 u16IOCRType; guint16 u16IOCRReference; guint16 u16LT; guint16 u16DataLength; guint16 u16FrameID; guint16 u16SendClockFactor; guint16 u16ReductionRatio; guint16 u16Phase; guint16 u16Sequence; guint32 u32FrameSendOffset; guint16 u16WatchdogFactor; guint16 u16DataHoldFactor; guint16 u16IOCRTagHeader; guint8 mac[6]; guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16NumberOfIODataObjectsInAPI; guint16 u16NumberOfIODataObjectsInCR = 0U; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16IODataObjectFrameOffset; guint16 u16NumberOfIOCSInAPI; guint16 u16NumberOfIOCSInCR = 0U; guint16 u16IOCSFrameOffset; proto_item *api_item; proto_tree *api_tree; guint32 u32ApiStart; guint16 u16Tmp; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; conversation_t *conversation; conversation_t *conversation_time_aware; stationInfo *station_info = NULL; iocsObject *iocs_object; iocsObject *cmp_iocs_object; ioDataObject *io_data_object; ioDataObject *cmp_io_data_object; wmem_list_frame_t *frame; wmem_list_t *iocs_list; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_type, &u16IOCRType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_lt, &u16LT); offset = dissect_IOCRProperties(tvb, offset, pinfo, tree, drep); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_data_length, &u16DataLength); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_id, &u16FrameID); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_send_clock_factor, &u16SendClockFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_reduction_ratio, &u16ReductionRatio); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_phase, &u16Phase); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sequence, &u16Sequence); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_send_offset, &u32FrameSendOffset); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_watchdog_factor, &u16WatchdogFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_data_hold_factor, &u16DataHoldFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_tag_header, &u16IOCRTagHeader); offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_iocr_multicast_mac_add, mac); if (wmem_map_contains(pnio_time_aware_frame_map, GUINT_TO_POINTER(pinfo->num))) { address cyclic_mac_addr; address iocr_mac_addr; set_address(&cyclic_mac_addr, AT_ETHER, 6, mac); iocr_mac_addr = (u16IOCRType == PN_INPUT_CR) ? pinfo->dl_dst : pinfo->dl_src; /* Get current conversation endpoints using MAC addresses */ conversation_time_aware = find_conversation(pinfo->num, &cyclic_mac_addr, &iocr_mac_addr, CONVERSATION_NONE, 0, 0, 0); if (conversation_time_aware == NULL) { conversation_time_aware = conversation_new(pinfo->num, &iocr_mac_addr, &cyclic_mac_addr, CONVERSATION_NONE, 0, 0, 0); } conversation_add_proto_data(conversation_time_aware, proto_pn_io_time_aware_status, wmem_map_lookup(pnio_time_aware_frame_map, GUINT_TO_POINTER(pinfo->num))); } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); proto_item_append_text(item, ": %s, Ref:0x%x, Len:%u, FrameID:0x%x, Clock:%u, Ratio:%u, Phase:%u APIs:%u", val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"), u16IOCRReference, u16DataLength, u16FrameID, u16SendClockFactor, u16ReductionRatio, u16Phase, u16NumberOfAPIs); while (u16NumberOfAPIs--) { api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA); api_tree = proto_item_add_subtree(api_item, ett_pn_io_api); u32ApiStart = offset; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_api, &u32Api); /* NumberOfIODataObjects */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_io_data_objects, &u16NumberOfIODataObjectsInAPI); /* Set global Variant for Number of IO Data Objects */ /* Notice: Handle Input & Output seperate!!! */ if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as Connect Request is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; if (u16IOCRType == PN_INPUT_CR) { current_aruuid_frame->inputframe = u16FrameID; } } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, current_aruuid, station_info); } u16NumberOfIODataObjectsInCR += u16NumberOfIODataObjectsInAPI; pn_find_dcp_station_info(station_info, conversation); } u16Tmp = u16NumberOfIODataObjectsInAPI; while (u16Tmp--) { sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_data_object, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_data_object); u32SubStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* IODataObjectFrameOffset */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_io_data_object_frame_offset, &u16IODataObjectFrameOffset); proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u", u16SlotNr, u16SubslotNr, u16IODataObjectFrameOffset); proto_item_set_len(sub_item, offset - u32SubStart); if (!PINFO_FD_VISITED(pinfo) && station_info != NULL) { io_data_object = wmem_new0(wmem_file_scope(), ioDataObject); io_data_object->slotNr = u16SlotNr; io_data_object->subSlotNr = u16SubslotNr; io_data_object->frameOffset = u16IODataObjectFrameOffset; /* initial - Will be added later with Write Request */ io_data_object->f_dest_adr = 0; io_data_object->f_par_crc1 = 0; io_data_object->f_src_adr = 0; io_data_object->f_crc_seed = FALSE; io_data_object->f_crc_len = 0; /* Reset as a PNIO Connect Request of a known module appears */ io_data_object->last_sb_cb = 0; io_data_object->lastToggleBit = 0; if (u16IOCRType == PN_INPUT_CR) { iocs_list = station_info->ioobject_data_in; } else { iocs_list = station_info->ioobject_data_out; } for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) { cmp_io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (cmp_io_data_object->slotNr == u16SlotNr && cmp_io_data_object->subSlotNr == u16SubslotNr) { /* Found identical existing object */ break; } } if (frame == NULL) { /* new io_object data incoming */ wmem_list_append(iocs_list, io_data_object); } } } /* NumberOfIOCS */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_iocs, &u16NumberOfIOCSInAPI); /* Set global Vairant for NumberOfIOCS */ if (!PINFO_FD_VISITED(pinfo)) { u16NumberOfIOCSInCR += u16NumberOfIOCSInAPI; } u16Tmp = u16NumberOfIOCSInAPI; while (u16Tmp--) { sub_item = proto_tree_add_item(api_tree, hf_pn_io_io_cs, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_io_cs); u32SubStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* IOCSFrameOffset */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_iocs_frame_offset, &u16IOCSFrameOffset); proto_item_append_text(sub_item, ": Slot: 0x%x, Subslot: 0x%x FrameOffset: %u", u16SlotNr, u16SubslotNr, u16IOCSFrameOffset); proto_item_set_len(sub_item, offset - u32SubStart); if (!PINFO_FD_VISITED(pinfo)) { if (station_info != NULL) { if (u16IOCRType == PN_INPUT_CR) { iocs_list = station_info->iocs_data_in; } else { iocs_list = station_info->iocs_data_out; } for (frame = wmem_list_head(iocs_list); frame != NULL; frame = wmem_list_frame_next(frame)) { cmp_iocs_object = (iocsObject*)wmem_list_frame_data(frame); if (cmp_iocs_object->slotNr == u16SlotNr && cmp_iocs_object->subSlotNr == u16SubslotNr) { /* Found identical existing object */ break; } } if (frame == NULL) { /* new iocs_object data incoming */ iocs_object = wmem_new(wmem_file_scope(), iocsObject); iocs_object->slotNr = u16SlotNr; iocs_object->subSlotNr = u16SubslotNr; iocs_object->frameOffset = u16IOCSFrameOffset; wmem_list_append(iocs_list, iocs_object); } } } } proto_item_append_text(api_item, ": 0x%x, NumberOfIODataObjects: %u NumberOfIOCS: %u", u32Api, u16NumberOfIODataObjectsInAPI, u16NumberOfIOCSInAPI); proto_item_set_len(api_item, offset - u32ApiStart); } /* Update global object count */ if (!PINFO_FD_VISITED(pinfo)) { if (station_info != NULL) { if (u16IOCRType == PN_INPUT_CR) { station_info->iocsNr_in = u16NumberOfIOCSInCR; station_info->ioDataObjectNr_in = u16NumberOfIODataObjectsInCR; } else { station_info->iocsNr_out = u16NumberOfIOCSInCR; station_info->ioDataObjectNr_out = u16NumberOfIODataObjectsInCR; } } } if (ar != NULL) { switch (u16IOCRType) { case(1): /* Input CR */ if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) { expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID); } ar->inputframeid = u16FrameID; break; case(2): /* Output CR */ #if 0 /* will usually contain 0xffff here because the correct framid will be given in the connect.Cnf */ if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) { expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockReq: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID); } ar->outputframeid = u16FrameID; #endif break; default: expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockReq: IOCRType %u undecoded!", u16IOCRType); } } else { expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockReq: no corresponding AR found!"); } return offset; } /* dissect the AlarmCRBlockReq */ static int dissect_AlarmCRBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t *ar) { guint16 u16AlarmCRType; guint16 u16LT; guint32 u32AlarmCRProperties; guint16 u16RTATimeoutFactor; guint16 u16RTARetries; guint16 u16LocalAlarmReference; guint16 u16MaxAlarmDataLength; guint16 u16AlarmCRTagHeaderHigh; guint16 u16AlarmCRTagHeaderLow; proto_item *sub_item; proto_tree *sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_lt, &u16LT); sub_item = proto_tree_add_item(tree, hf_pn_io_alarmcr_properties, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_alarmcr_properties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarmcr_properties_reserved, &u32AlarmCRProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarmcr_properties_transport, &u32AlarmCRProperties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_alarmcr_properties_priority, &u32AlarmCRProperties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rta_timeoutfactor, &u16RTATimeoutFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rta_retries, &u16RTARetries); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_alarmcr_tagheaderhigh, &u16AlarmCRTagHeaderHigh); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_alarmcr_tagheaderlow, &u16AlarmCRTagHeaderLow); proto_item_append_text(item, ": %s, LT:0x%x, TFactor:%u, Retries:%u, Ref:0x%x, Len:%u Tag:0x%x/0x%x", val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"), u16LT, u16RTATimeoutFactor, u16RTARetries, u16LocalAlarmReference, u16MaxAlarmDataLength, u16AlarmCRTagHeaderHigh, u16AlarmCRTagHeaderLow); if (ar != NULL) { if (ar->controlleralarmref != 0xffff && ar->controlleralarmref != u16LocalAlarmReference) { expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockReq: local alarm ref changed from %u to %u!", ar->controlleralarmref, u16LocalAlarmReference); } ar->controlleralarmref = u16LocalAlarmReference; } else { expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockReq: no corresponding AR found!"); } return offset; } /* dissect the AlarmCRBlockRes */ static int dissect_AlarmCRBlockRes_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t *ar) { guint16 u16AlarmCRType; guint16 u16LocalAlarmReference; guint16 u16MaxAlarmDataLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_alarmcr_type, &u16AlarmCRType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_localalarmref, &u16LocalAlarmReference); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_maxalarmdatalength, &u16MaxAlarmDataLength); proto_item_append_text(item, ": %s, Ref:0x%04x, MaxDataLen:%u", val_to_str(u16AlarmCRType, pn_io_alarmcr_type, "0x%x"), u16LocalAlarmReference, u16MaxAlarmDataLength); if (ar != NULL) { if (ar->devicealarmref != 0xffff && ar->devicealarmref != u16LocalAlarmReference) { expert_add_info_format(pinfo, item, &ei_pn_io_localalarmref, "AlarmCRBlockRes: local alarm ref changed from %u to %u!", ar->devicealarmref, u16LocalAlarmReference); } ar->devicealarmref = u16LocalAlarmReference; } else { expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "AlarmCRBlockRes: no corresponding AR found!"); } return offset; } /* dissect the ARServerBlock */ static int dissect_ARServerBlock(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16NameLength, u16padding; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_station_name_length, &u16NameLength); proto_tree_add_item (tree, hf_pn_io_cminitiator_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; /* Padding to next 4 byte alignment in this block */ u16padding = u16BodyLength - (2 + u16NameLength); if (u16padding > 0) offset = dissect_pn_padding(tvb, offset, pinfo, tree, u16padding); return offset; } /* dissect the IOCRBlockRes */ static int dissect_IOCRBlockRes_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, pnio_ar_t *ar) { guint16 u16IOCRType; guint16 u16IOCRReference; guint16 u16FrameID; ARUUIDFrame *current_aruuid_frame = NULL; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_type, &u16IOCRType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_id, &u16FrameID); proto_item_append_text(item, ": %s, Ref:0x%04x, FrameID:0x%04x", val_to_str(u16IOCRType, pn_io_iocr_type, "0x%x"), u16IOCRReference, u16FrameID); if (ar != NULL) { switch (u16IOCRType) { case(1): /* Input CR */ if (ar->inputframeid != 0 && ar->inputframeid != u16FrameID) { expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: input frameID changed from %u to %u!", ar->inputframeid, u16FrameID); } ar->inputframeid = u16FrameID; break; case(2): /* Output CR */ if (ar->outputframeid != 0 && ar->outputframeid != u16FrameID) { expert_add_info_format(pinfo, item, &ei_pn_io_frame_id, "IOCRBlockRes: output frameID changed from %u to %u!", ar->outputframeid, u16FrameID); } ar->outputframeid = u16FrameID; break; default: expert_add_info_format(pinfo, item, &ei_pn_io_iocr_type, "IOCRBlockRes: IOCRType %u undecoded!", u16IOCRType); } } else { expert_add_info_format(pinfo, item, &ei_pn_io_ar_info_not_found, "IOCRBlockRes: no corresponding AR found!"); } if (!PINFO_FD_VISITED(pinfo)) { current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { if (u16IOCRType == 1) { current_aruuid_frame->inputframe = u16FrameID; } else if (u16IOCRType == 2) { current_aruuid_frame->outputframe = u16FrameID; } } } return offset; } /* dissect the MCRBlockReq */ static int dissect_MCRBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16IOCRReference; guint32 u32AddressResolutionProperties; guint16 u16MCITimeoutFactor; guint16 u16NameLength; char *pStationName; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_address_resolution_properties, &u32AddressResolutionProperties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_mci_timeout_factor, &u16MCITimeoutFactor); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_station_name_length, &u16NameLength); proto_tree_add_item_ret_display_string (tree, hf_pn_io_provider_station_name, tvb, offset, u16NameLength, ENC_ASCII, pinfo->pool, &pStationName); offset += u16NameLength; proto_item_append_text(item, ", CRRef:%u, Properties:0x%x, TFactor:%u, Station:%s", u16IOCRReference, u32AddressResolutionProperties, u16MCITimeoutFactor, pStationName); return offset; } /* dissect the SubFrameBlock */ static int dissect_SubFrameBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16IOCRReference; guint8 mac[6]; guint32 u32SubFrameData; guint16 u16Tmp; proto_item *sub_item; proto_tree *sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* IOCRReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference); /* CMInitiatorMACAdd */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_io_cminitiator_macadd, mac); /* SubFrameData n*32 */ u16BodyLength -= 10; u16Tmp = u16BodyLength; do { sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data); /* 31-16 reserved_2 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_reserved2, &u32SubFrameData); /* 15- 8 DataLength */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_length, &u32SubFrameData); /* 7 reserved_1 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_reserved1, &u32SubFrameData); /* 6-0 Position */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_position, &u32SubFrameData); proto_item_append_text(sub_item, ", Length:%u, Pos:%u", (u32SubFrameData & 0x0000FF00) >> 8, u32SubFrameData & 0x0000007F); } while (u16Tmp -= 4); proto_item_append_text(item, ", CRRef:%u, %u*Data", u16IOCRReference, u16BodyLength/4); return offset; } /* dissect the (PD)SubFrameBlock 0x022B */ static int dissect_PDSubFrameBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint32 u32SFIOCRProperties; guint32 u32SubFrameData; guint16 u16FrameID; proto_item *sub_item; proto_tree *sub_tree; guint16 u16RemainingLength; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* FrameID */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_frame_id, &u16FrameID); /* SFIOCRProperties */ sub_item = proto_tree_add_item(tree, hf_pn_io_SFIOCRProperties, tvb, offset, PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_SFIOCRProperties); /* dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties, &u32SFIOCRProperties); */ /* Bit 31: SFIOCRProperties.SFCRC16 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_SFCRC16, &u32SFIOCRProperties); /* Bit 30: SFIOCRProperties.DFPRedundantPathLayout */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout, &u32SFIOCRProperties); /* Bit 29: SFIOCRProperties.DFPRedundantPathLayout */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPType, &u32SFIOCRProperties); /* Bit 28 - 29: SFIOCRProperties.reserved_2 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_2, &u32SFIOCRProperties); /* Bit 24 - 27: SFIOCRProperties.reserved_1 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_reserved_1, &u32SFIOCRProperties); /* Bit 16 - 23: SFIOCRProperties.DFPmode */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_SFIOCRProperties_DFPmode, &u32SFIOCRProperties); /* Bit 8 - 15: SFIOCRProperties.RestartFactorForDistributedWD */ /* 0x00 Mandatory No restart delay necessary 0x01 - 0x09 Optional Less than 1 s restart delay 0x0A - 0x50 Mandatory 1 s to 8 s restart delay 0x51 - 0xFF Optional More than 8 s restart delay */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_RestartFactorForDistributedWD, &u32SFIOCRProperties); /* bit 0..7 SFIOCRProperties.DistributedWatchDogFactor */ offset = /* it is the last one, so advance! */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_DistributedWatchDogFactor, &u32SFIOCRProperties); /* SubframeData */ u16RemainingLength = u16BodyLength - PD_SUB_FRAME_BLOCK_FIOCR_PROPERTIES_LENGTH - PD_SUB_FRAME_BLOCK_FRAME_ID_LENGTH; while (u16RemainingLength >= PD_SUB_FRAME_BLOCK_SUB_FRAME_DATA_LENGTH) { guint8 Position, DataLength; sub_item = proto_tree_add_item(tree, hf_pn_io_subframe_data, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_subframe_data); /* Bit 0 - 6: SubframeData.Position */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_position, &u32SubFrameData); /* Bit 7: SubframeData.reserved_1 */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved1, &u32SubFrameData); /* Bit 8 - 15: SubframeData.dataLength */ dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_data_length, &u32SubFrameData); /* Bit 16 - 31: SubframeData.reserved_2 */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subframe_reserved2, &u32SubFrameData); Position = (guint8) (u32SubFrameData & 0x7F); /* the lower 6 bits */ DataLength =(guint8) ((u32SubFrameData >>8) & 0x0ff); /* bit 8 to 15 */ proto_item_append_text(sub_item, ", Length:%u (0x%x), Pos:%u", DataLength,DataLength, Position); u16RemainingLength = u16RemainingLength - 4; } return offset; } /* dissect the IRInfoBlock */ static int dissect_IRInfoBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_) { guint16 u16NumberOfIOCR; guint16 u16SubframeOffset; guint32 u32SubframeData; guint16 u16IOCRReference; e_guid_t IRDataUUID; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hf_pn_io_IRData_uuid, &IRDataUUID); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); /* Numbers of IOCRs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_iocrs, &u16NumberOfIOCR); while (u16NumberOfIOCR--) { /* IOCRReference */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_reference, &u16IOCRReference); /* SubframeOffset 16 */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeOffset, &u16SubframeOffset); /* SubframeData 32 */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_iocr_SubframeData, &u32SubframeData); } return offset; } /* dissect the SRInfoBlock */ static int dissect_SRInfoBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_) { guint16 u16RedundancyDataHoldFactor; guint32 u32sr_properties; guint8 u8SRPropertiesMode; proto_item *sub_item; proto_tree *sub_tree; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_RedundancyDataHoldFactor, &u16RedundancyDataHoldFactor); u32sr_properties = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN); sub_item = proto_tree_add_item(tree, hf_pn_io_sr_properties, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_sr_properties); u8SRPropertiesMode = (guint8)((u32sr_properties >> 2) & 0x01); /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 1 */ if (u8SRPropertiesMode) { dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1, &u32sr_properties); } /* SRProperties.InputValidOnBackupAR with SRProperties.Mode == 0 */ else { dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0, &u32sr_properties); } dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_1, &u32sr_properties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Mode, &u32sr_properties); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_2, &u32sr_properties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_sr_properties_Reserved_3, &u32sr_properties); return offset; } /* dissect the RSInfoBlock */ static int dissect_RSInfoBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_) { guint32 u32RSProperties; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* Padding 2 + 2 + 1 + 1 = 6 */ /* Therefore we need 2 byte padding to make the block u32 aligned */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties, &u32RSProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_alarm_transport, &u32RSProperties); dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved1, &u32RSProperties); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_properties_reserved2, &u32RSProperties); return offset; } /* dissect the PDIRSubframeData block 0x022a */ static int dissect_PDIRSubframeData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfSubframeBlocks; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_NumberOfSubframeBlocks, &u16NumberOfSubframeBlocks); while (u16NumberOfSubframeBlocks --) { /* dissect the Subframe Block */ offset = dissect_a_block(tvb, offset, pinfo, /*sub_*/tree, drep); } return offset; } static int dissect_ARVendorBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength _U_) { guint16 APStructureIdentifier; guint32 gu32API; guint32 guDataBytes; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } APStructureIdentifier = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohs(tvb, offset) : tvb_get_ntohs(tvb, offset)); gu32API = ((drep[0] & DREP_LITTLE_ENDIAN) ? tvb_get_letohl(tvb, offset + 2) : tvb_get_ntohl (tvb, offset + 2)); if (tree) { if (gu32API == 0) { if (APStructureIdentifier <0x8000) { proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_low, tvb, offset, 2, DREP_ENC_INTEGER(drep)); } else { if (APStructureIdentifier > 0x8000) { proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_high, tvb, offset, 2, DREP_ENC_INTEGER(drep)); } else /* APStructureIdentifier == 0x8000 */ { proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_if0_is8000, tvb, offset, 2, DREP_ENC_INTEGER(drep)); } } } else { proto_tree_add_item(tree, hf_pn_io_arvendor_strucidentifier_not0, tvb, offset, 2, DREP_ENC_INTEGER(drep)); } /* API */ proto_tree_add_item(tree, hf_pn_io_api, tvb, offset + 2, 4, DREP_ENC_INTEGER(drep)); } offset += 6; if (u16BodyLength < 6 ) return offset; /* there are no user bytes! */ guDataBytes = u16BodyLength - 6; dissect_pn_user_data(tvb, offset, pinfo, tree, guDataBytes, "Data "); return offset; } /* dissect the DataDescription */ static int dissect_DataDescription(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, ioDataObject *tmp_io_data_object) { guint16 u16DataDescription; guint16 u16SubmoduleDataLength; guint8 u8LengthIOCS; guint8 u8LengthIOPS; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; conversation_t *conversation; stationInfo *station_info = NULL; ioDataObject *io_data_object; wmem_list_frame_t *frame; wmem_list_t *ioobject_list; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; sub_item = proto_tree_add_item(tree, hf_pn_io_data_description_tree, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_data_description); u32SubStart = offset; /* DataDescription */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_data_description, &u16DataDescription); /* SubmoduleDataLength */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_submodule_data_length, &u16SubmoduleDataLength); /* LengthIOCS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_iocs, &u8LengthIOCS); /* LengthIOPS */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_length_iops, &u8LengthIOPS); proto_item_append_text(sub_item, ": %s, SubmoduleDataLength: %u, LengthIOCS: %u, u8LengthIOPS: %u", val_to_str(u16DataDescription, pn_io_data_description, "(0x%x)"), u16SubmoduleDataLength, u8LengthIOCS, u8LengthIOPS); proto_item_set_len(sub_item, offset - u32SubStart); /* Save new data for IO Data Objects */ if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); if (u16DataDescription == PN_INPUT_DATADESCRITPION) { /* INPUT HANDLING */ ioobject_list = station_info->ioobject_data_in; } else { /* OUTPUT HANDLING */ ioobject_list = station_info->ioobject_data_out; } for (frame = wmem_list_head(ioobject_list); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (io_data_object->slotNr == tmp_io_data_object->slotNr && io_data_object->subSlotNr == tmp_io_data_object->subSlotNr) { /* Write additional data from dissect_ExpectedSubmoduleBlockReq_block() to corresponding io_data_object */ io_data_object->api = tmp_io_data_object->api; io_data_object->moduleIdentNr = tmp_io_data_object->moduleIdentNr; io_data_object->subModuleIdentNr = tmp_io_data_object->subModuleIdentNr; io_data_object->length = u16SubmoduleDataLength; io_data_object->moduleNameStr = wmem_strdup(wmem_file_scope(), tmp_io_data_object->moduleNameStr); io_data_object->profisafeSupported = tmp_io_data_object->profisafeSupported; io_data_object->discardIOXS = tmp_io_data_object->discardIOXS; io_data_object->amountInGSDML = tmp_io_data_object->amountInGSDML; io_data_object->fParameterIndexNr = tmp_io_data_object->fParameterIndexNr; break; } } } } return offset; } static int resolve_pa_profile_submodule_name(ioDataObject *io_data_object) { const uint32_t u32SubmoduleIdentNumber = io_data_object->subModuleIdentNr; /* split components of submodule ident number */ const uint8_t variant = (u32SubmoduleIdentNumber >> 24u) & 0xFFu; const uint8_t block_object = (u32SubmoduleIdentNumber >> 16u) & 0xFFu; const uint8_t parent_class = (u32SubmoduleIdentNumber >> 8u) & 0xFFu; const uint8_t class = (u32SubmoduleIdentNumber) & 0xFFu; const gchar* parent_class_name = NULL; const gchar* class_name = NULL; const gchar* block_object_name = try_val_to_str(block_object, pn_io_pa_profile_block_object_vals); if (block_object_name != NULL) { switch (block_object) { case PA_PROFILE_BLOCK_DAP: if (parent_class == 0u) { class_name = try_val_to_str(class, pn_io_pa_profile_dap_submodule_vals); if (class_name != NULL) { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - %s", block_object_name, class_name); } } else { /* we have an interface or a port */ if (class == 0u) { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "Interface %d", parent_class); } else { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "Port %d Interface %d", class, parent_class); } } break; case PA_PROFILE_BLOCK_PB: parent_class_name = try_val_to_str(parent_class, pn_io_pa_profile_physical_block_parent_class_vals); if (parent_class_name != NULL) { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - %s", block_object_name, parent_class_name); } else { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - Unknown", block_object_name); } break; case PA_PROFILE_BLOCK_FB: class_name = try_val_to_str(class, pn_io_pa_profile_function_block_class_vals); if (class <= 2u) { parent_class_name = try_val_to_str(parent_class, pn_io_pa_profile_function_block_parent_class_vals); } else { parent_class_name = (class <= 4u) ? "Analog" : ""; } if ((parent_class_name != NULL) && (class_name != NULL)) { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - %s %s", block_object_name, parent_class_name, class_name); } else { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - Unknown", block_object_name); } break; case PA_PROFILE_BLOCK_TB: parent_class_name = try_val_to_str(parent_class, pn_io_pa_profile_transducer_block_parent_class_vals); if (parent_class_name != NULL) { class_name = try_val_to_str(class, pn_io_pa_profile_transducer_block_class_vals[parent_class]); (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - %s (%s)", block_object_name, parent_class_name, class_name); } else { (void)snprintf(io_data_object->moduleNameStr, MAX_NAMELENGTH, "%s - Unknown", block_object_name); } break; } if (variant != 0u) { g_strlcat (io_data_object->moduleNameStr, " (VARIANT)", MAX_NAMELENGTH); } return 1; } else { return 0; } } /* dissect the ExpectedSubmoduleBlockReq */ static int dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16SlotNr; guint32 u32ModuleIdentNumber; guint16 u16ModuleProperties; guint16 u16NumberOfSubmodules; guint16 u16SubslotNr; guint32 u32SubmoduleIdentNumber; guint16 u16SubmoduleProperties; proto_item *api_item; proto_tree *api_tree; guint32 u32ApiStart; proto_item *sub_item; proto_tree *sub_tree; proto_item *submodule_item; proto_tree *submodule_tree; guint32 u32SubStart; /* Variable for the search of gsd file */ const char vendorIdStr[] = "VendorID=\""; const char deviceIdStr[] = "DeviceID=\""; const char moduleStr[] = "ModuleIdentNumber=\""; const char subModuleStr[] = "SubmoduleIdentNumber=\""; const char profisafeStr[] = "PROFIsafeSupported=\"true\""; const char fParameterStr[] = "<F_ParameterRecordDataItem"; const char fParameterIndexStr[] = "Index="; const char moduleNameInfo[] = "<Name"; const char moduleValueInfo[] = "Value=\""; guint16 searchVendorID = 0; guint16 searchDeviceID = 0; gboolean vendorMatch; gboolean deviceMatch; conversation_t *conversation; stationInfo *station_info = NULL; ioDataObject *io_data_object = NULL; /* Used to transfer data to fct. "dissect_DataDescription()" */ /* Variable for the search of GSD-file */ guint32 read_vendor_id; guint32 read_device_id; guint32 read_module_id; guint32 read_submodule_id; gboolean gsdmlFoundFlag; gchar tmp_moduletext[MAX_NAMELENGTH]; gchar *convertStr; /* GSD-file search */ gchar *pch; /* helppointer, to save temp. the found Networkpath of GSD-file */ gchar *puffer; /* used for fgets() during GSD-file search */ gchar *temp; /* used for fgets() during GSD-file search */ gchar *diropen = NULL; /* saves the final networkpath to open for GSD-files */ GDir *dir; FILE *fp = NULL; /* filepointer */ const gchar *filename; /* saves the found GSD-file name */ ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; /* Helppointer initial */ convertStr = (gchar*)wmem_alloc(pinfo->pool, MAX_NAMELENGTH); convertStr[0] = '\0'; pch = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH); pch[0] = '\0'; puffer = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH); puffer[0] = '\0'; temp = (gchar*)wmem_alloc(pinfo->pool, MAX_LINE_LENGTH); temp[0] = '\0'; /* Initial */ io_data_object = wmem_new0(wmem_file_scope(), ioDataObject); io_data_object->profisafeSupported = FALSE; io_data_object->moduleNameStr = (gchar*)wmem_alloc(wmem_file_scope(), MAX_NAMELENGTH); (void) g_strlcpy(io_data_object->moduleNameStr, "Unknown", MAX_NAMELENGTH); vendorMatch = FALSE; deviceMatch = FALSE; gsdmlFoundFlag = FALSE; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs); /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); station_info->gsdFound = FALSE; station_info->gsdPathLength = FALSE; /* Set searchVendorID and searchDeviceID for GSDfile search */ searchVendorID = station_info->u16Vendor_id; searchDeviceID = station_info->u16Device_id; /* Use the given GSD-file networkpath of the PNIO-Preference */ if(pnio_ps_networkpath[0] != '\0') { /* check the length of the given networkpath (array overflow protection) */ station_info->gsdPathLength = TRUE; if ((dir = g_dir_open(pnio_ps_networkpath, 0, NULL)) != NULL) { /* Find all GSD-files within directory */ while ((filename = g_dir_read_name(dir)) != NULL) { /* ---- complete the path to open a GSD-file ---- */ diropen = wmem_strdup_printf(pinfo->pool, "%s" G_DIR_SEPARATOR_S "%s", pnio_ps_networkpath, filename); /* ---- Open the found GSD-file ---- */ fp = ws_fopen(diropen, "r"); if(fp != NULL) { /* ---- Get VendorID & DeviceID ---- */ while(pn_fgets(puffer, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) { /* ----- VendorID ------ */ if((strstr(puffer, vendorIdStr)) != NULL) { memset (convertStr, 0, sizeof(*convertStr)); pch = strstr(puffer, vendorIdStr); if (pch!= NULL && sscanf(pch, "VendorID=\"%199[^\"]", convertStr) == 1) { read_vendor_id = (guint32) strtoul (convertStr, NULL, 0); if(read_vendor_id == searchVendorID) { vendorMatch = TRUE; /* found correct VendorID */ } } } /* ----- DeviceID ------ */ if((strstr(puffer, deviceIdStr)) != NULL) { memset(convertStr, 0, sizeof(*convertStr)); pch = strstr(puffer, deviceIdStr); if (pch != NULL && sscanf(pch, "DeviceID=\"%199[^\"]", convertStr) == 1) { read_device_id = (guint32)strtoul(convertStr, NULL, 0); if(read_device_id == searchDeviceID) { deviceMatch = TRUE; /* found correct DeviceID */ } } } } fclose(fp); fp = NULL; if(vendorMatch && deviceMatch) { break; /* Found correct GSD-file! -> Break the searchloop */ } else { /* Couldn't find the correct GSD-file to the corresponding device */ vendorMatch = FALSE; deviceMatch = FALSE; gsdmlFoundFlag = FALSE; diropen = ""; /* reset array for next search */ } } } g_dir_close(dir); } /* ---- Found the correct GSD-file -> set Flag and save the completed path ---- */ if(vendorMatch && deviceMatch) { gsdmlFoundFlag = TRUE; station_info->gsdFound = TRUE; station_info->gsdLocation = wmem_strdup(wmem_file_scope(), diropen); } else { /* Copy searchpath to array for a detailed output message in cyclic data dissection */ station_info->gsdLocation = wmem_strdup_printf(wmem_file_scope(), "%s" G_DIR_SEPARATOR_S "*.xml", pnio_ps_networkpath); } } else { /* will be used later on in cyclic RTC1 data dissection for detailed output message */ station_info->gsdPathLength = FALSE; } } while (u16NumberOfAPIs--) { api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA); api_tree = proto_item_add_subtree(api_item, ett_pn_io_api); u32ApiStart = offset; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_api, &u32Api); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* ModuleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); /* ModuleProperties */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_module_properties, &u16ModuleProperties); /* NumberOfSubmodules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_submodules, &u16NumberOfSubmodules); proto_item_append_text(api_item, ": %u, Slot:0x%x, IdentNumber:0x%x Properties:0x%x Submodules:%u", u32Api, u16SlotNr, u32ModuleIdentNumber, u16ModuleProperties, u16NumberOfSubmodules); proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules); while (u16NumberOfSubmodules--) { sub_item = proto_tree_add_item(api_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule); u32SubStart = offset; /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* SubmoduleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); /* SubmoduleProperties */ submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_properties, tvb, offset, 2, ENC_BIG_ENDIAN); submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_properties); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_reserved, &u16SubmoduleProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_discard_ioxs, &u16SubmoduleProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_reduce_output_submodule_data_length, &u16SubmoduleProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_reduce_input_submodule_data_length, &u16SubmoduleProperties); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_shared_input, &u16SubmoduleProperties); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_properties_type, &u16SubmoduleProperties); io_data_object->api = u32Api; io_data_object->slotNr = u16SlotNr; io_data_object->subSlotNr = u16SubslotNr; io_data_object->moduleIdentNr = u32ModuleIdentNumber; io_data_object->subModuleIdentNr = u32SubmoduleIdentNumber; io_data_object->discardIOXS = u16SubmoduleProperties & 0x0020; /* Before searching the GSD, check if we have a PA Profile 4.02 submodule. If yes then the submodule's name is defined in the specification and can be resolved without the GSD. We still read the GSD afterwards, in case the user wants to override the specification's names with a GSD. Most PA Profile submodules are located in API 0x9700, but the DAP and the interfaces/ports are located in API 0 per PROFINET specification, so we need to filter also on the DAP module ident number. */ if ((io_data_object->api == PA_PROFILE_API) || ((io_data_object->moduleIdentNr & PA_PROFILE_DAP_MASK) == PA_PROFILE_DAP_IDENT)) { resolve_pa_profile_submodule_name(io_data_object); } /* Search the moduleID and subModuleID, find if PROFIsafe and also search for F-Par. Indexnumber * --------------------------------------------------------------------------------------------- * Speical case: Module has several ModuleIdentNr. in one GSD-file * Also with the given parameters of wireshark, some modules were completely equal. For this * special case a compromise for this problem has been made, to set the module name will * be more generally displayed. * Also this searchloop will find the F-Parameter Indexnumber, so that Wireshark is able to * dissect those F-Parameters correctly, as this index can change between the vendors. */ io_data_object->amountInGSDML = 0; io_data_object->fParameterIndexNr = 0; io_data_object->profisafeSupported = FALSE; if (diropen != NULL) { fp = ws_fopen(diropen, "r"); } else { fp = NULL; } if(fp != NULL && gsdmlFoundFlag) { fseek(fp, 0, SEEK_SET); /* Find Indexnumber for fParameter */ while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) { if((strstr(temp, fParameterStr)) != NULL) { memset (convertStr, 0, sizeof(*convertStr)); pch = strstr(temp, fParameterIndexStr); if (pch != NULL && sscanf(pch, "Index=\"%199[^\"]", convertStr) == 1) { io_data_object->fParameterIndexNr = (guint32)strtoul(convertStr, NULL, 0); } break; /* found Indexnumber -> break search loop */ } } memset (temp, 0, sizeof(*temp)); fseek(fp, 0, SEEK_SET); /* Set filepointer to the beginning */ while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) { if((strstr(temp, moduleStr)) != NULL) { /* find the String "ModuleIdentNumber=" */ memset (convertStr, 0, sizeof(*convertStr)); pch = strstr(temp, moduleStr); /* search for "ModuleIdentNumber=\"" within GSD-file */ if (pch != NULL && sscanf(pch, "ModuleIdentNumber=\"%199[^\"]", convertStr) == 1) { /* Change format of Value string-->numeric string */ read_module_id = (guint32)strtoul(convertStr, NULL, 0); /* Change numeric string --> unsigned long; read_module_id contains the Value of the ModuleIdentNumber */ /* If the found ModuleID matches with the wanted ModuleID, search for the Submodule and break */ if (read_module_id == io_data_object->moduleIdentNr) { ++io_data_object->amountInGSDML; /* Save the amount of same (!) Module- & SubmoduleIdentNr in one GSD-file */ while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) { if((strstr(temp, moduleNameInfo)) != NULL) { /* find the String "<Name" for the TextID */ long filePosRecord; if (sscanf(temp, "%*s TextId=\"%199[^\"]", tmp_moduletext) != 1) /* saves the correct TextId for the next searchloop */ break; filePosRecord = ftell(fp); /* save the current position of the filepointer (Offset) */ /* ftell() may return -1 for error, don't move fp in this case */ if (filePosRecord >= 0) { while (pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL && io_data_object->amountInGSDML == 1) { /* Find a String with the saved TextID and with a fitting value for it in the same line. This value is the name of the Module! */ if(((strstr(temp, tmp_moduletext)) != NULL) && ((strstr(temp, moduleValueInfo)) != NULL)) { pch = strstr(temp, moduleValueInfo); if (pch != NULL && sscanf(pch, "Value=\"%199[^\"]", io_data_object->moduleNameStr) == 1) break; /* Found the name of the module */ } } fseek(fp, filePosRecord, SEEK_SET); /* set filepointer to the correct TextID */ } } /* Search for Submoduleidentnumber in GSD-file */ if((strstr(temp, subModuleStr)) != NULL) { memset (convertStr, 0, sizeof(*convertStr)); pch = strstr(temp, subModuleStr); if (pch != NULL && sscanf(pch, "SubmoduleIdentNumber=\"%199[^\"]", convertStr) == 1) { read_submodule_id = (guint32) strtoul (convertStr, NULL, 0); /* read_submodule_id contains the Value of the SubModuleIdentNumber */ /* Find "PROFIsafeSupported" flag of the module in GSD-file */ if(read_submodule_id == io_data_object->subModuleIdentNr) { if((strstr(temp, profisafeStr)) != NULL) { io_data_object->profisafeSupported = TRUE; /* flag is in the same line as SubmoduleIdentNr */ break; } else { /* flag is not in the same line as Submoduleidentnumber -> search for it */ while(pn_fgets(temp, MAX_LINE_LENGTH, fp, pinfo->pool) != NULL) { if((strstr(temp, profisafeStr)) != NULL) { io_data_object->profisafeSupported = TRUE; break; /* Found the PROFIsafeSupported flag of the module */ } else if((strstr(temp, ">")) != NULL) { break; } } } break; /* Found the PROFIsafe Module */ } } } } } } } } fclose(fp); fp = NULL; } if(fp != NULL) { fclose(fp); fp = NULL; } switch (u16SubmoduleProperties & 0x03) { case(0x00): /* no input and no output data (one Input DataDescription Block follows) */ offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object); break; case(0x01): /* input data (one Input DataDescription Block follows) */ offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object); break; case(0x02): /* output data (one Output DataDescription Block follows) */ offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object); break; case(0x03): /* input and output data (one Input and one Output DataDescription Block follows) */ offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object); offset = dissect_DataDescription(tvb, offset, pinfo, sub_tree, drep, io_data_object); break; default: /* will not execute because of the line preceding the switch */ break; } proto_item_append_text(sub_item, ": Subslot:0x%x, Ident:0x%x Properties:0x%x", u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleProperties); proto_item_set_len(sub_item, offset - u32SubStart); } proto_item_set_len(api_item, offset - u32ApiStart); } return offset; } /* dissect the ModuleDiffBlock */ static int dissect_ModuleDiffBlock_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16NumberOfAPIs; guint32 u32Api; guint16 u16NumberOfModules; guint16 u16SlotNr; guint32 u32ModuleIdentNumber; guint16 u16ModuleState; guint16 u16NumberOfSubmodules; guint16 u16SubslotNr; guint32 u32SubmoduleIdentNumber; guint16 u16SubmoduleState; proto_item *api_item; proto_tree *api_tree; guint32 u32ApiStart; proto_item *module_item; proto_tree *module_tree; guint32 u32ModuleStart; proto_item *sub_item; proto_tree *sub_tree; proto_item *submodule_item; proto_tree *submodule_tree; guint32 u32SubStart; conversation_t *conversation; stationInfo *station_info; wmem_list_frame_t *frame; moduleDiffInfo *module_diff_info; moduleDiffInfo *cmp_module_diff_info; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* NumberOfAPIs */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_number_of_apis, &u16NumberOfAPIs); proto_item_append_text(item, ": APIs:%u", u16NumberOfAPIs); while (u16NumberOfAPIs--) { api_item = proto_tree_add_item(tree, hf_pn_io_api_tree, tvb, offset, 0, ENC_NA); api_tree = proto_item_add_subtree(api_item, ett_pn_io_api); u32ApiStart = offset; /* API */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, api_tree, drep, hf_pn_io_api, &u32Api); /* NumberOfModules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, hf_pn_io_number_of_modules, &u16NumberOfModules); proto_item_append_text(api_item, ": %u, Modules: %u", u32Api, u16NumberOfModules); proto_item_append_text(item, ", Modules:%u", u16NumberOfModules); while (u16NumberOfModules--) { module_item = proto_tree_add_item(api_tree, hf_pn_io_module_tree, tvb, offset, 0, ENC_NA); module_tree = proto_item_add_subtree(module_item, ett_pn_io_module); u32ModuleStart = offset; /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* ModuleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, module_tree, drep, hf_pn_io_module_ident_number, &u32ModuleIdentNumber); /* ModuleState */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_module_state, &u16ModuleState); /* NumberOfSubmodules */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, module_tree, drep, hf_pn_io_number_of_submodules, &u16NumberOfSubmodules); proto_item_append_text(module_item, ": Slot 0x%x, Ident: 0x%x State: %s Submodules: %u", u16SlotNr, u32ModuleIdentNumber, val_to_str(u16ModuleState, pn_io_module_state, "(0x%x)"), u16NumberOfSubmodules); if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); for (frame = wmem_list_head(station_info->diff_module); frame != NULL; frame = wmem_list_frame_next(frame)) { cmp_module_diff_info = (moduleDiffInfo*)wmem_list_frame_data(frame); if (cmp_module_diff_info->slotNr == u16SlotNr) { /* Found identical existing object */ break; } } if (frame == NULL) { /* new diffModuleInfo data incoming */ module_diff_info = wmem_new(wmem_file_scope(), moduleDiffInfo); module_diff_info->slotNr = u16SlotNr; module_diff_info->modulID = u32ModuleIdentNumber; wmem_list_append(station_info->diff_module, module_diff_info); } } } proto_item_append_text(item, ", Submodules:%u", u16NumberOfSubmodules); while (u16NumberOfSubmodules--) { sub_item = proto_tree_add_item(module_tree, hf_pn_io_submodule_tree, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_submodule); u32SubStart = offset; /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* SubmoduleIdentNumber */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_submodule_ident_number, &u32SubmoduleIdentNumber); /* SubmoduleState */ submodule_item = proto_tree_add_item(sub_tree, hf_pn_io_submodule_state, tvb, offset, 2, ENC_BIG_ENDIAN); submodule_tree = proto_item_add_subtree(submodule_item, ett_pn_io_submodule_state); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_format_indicator, &u16SubmoduleState); if (u16SubmoduleState & 0x8000) { dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_ident_info, &u16SubmoduleState); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_ar_info, &u16SubmoduleState); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_fault, &u16SubmoduleState); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_maintenance_demanded, &u16SubmoduleState); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_maintenance_required, &u16SubmoduleState); dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_advice, &u16SubmoduleState); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_add_info, &u16SubmoduleState); } else { offset = dissect_dcerpc_uint16(tvb, offset, pinfo, submodule_tree, drep, hf_pn_io_submodule_state_detail, &u16SubmoduleState); } proto_item_append_text(sub_item, ": Subslot 0x%x, IdentNumber: 0x%x, State: 0x%x", u16SubslotNr, u32SubmoduleIdentNumber, u16SubmoduleState); proto_item_set_len(sub_item, offset - u32SubStart); } /* NumberOfSubmodules */ proto_item_set_len(module_item, offset - u32ModuleStart); } proto_item_set_len(api_item, offset - u32ApiStart); } return offset; } /* dissect the IsochronousModeData block */ static int dissect_IsochronousModeData_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16ControllerApplicationCycleFactor; guint16 u16TimeDataCycle; guint32 u32TimeIOInput; guint32 u32TimeIOOutput; guint32 u32TimeIOInputValid; guint32 u32TimeIOOutputValid; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* SlotNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); /* Subslotnumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); /* ControllerApplicationCycleFactor */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_controller_appl_cycle_factor, &u16ControllerApplicationCycleFactor); /* TimeDataCycle */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_time_data_cycle, &u16TimeDataCycle); /* TimeIOInput (ns) */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_time_io_input, &u32TimeIOInput); /* TimeIOOutput (ns) */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_time_io_output, &u32TimeIOOutput); /* TimeIOInputValid (ns) */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_time_io_input_valid, &u32TimeIOInputValid); /* TimeIOOutputValid (ns) */ offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_time_io_output_valid, &u32TimeIOOutputValid); return offset+1; } static int dissect_CommunityName_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, const guint8 *drep _U_, int hfindex) { guint8 u8CommunityNameLength; proto_item* sub_item; proto_item* sub_tree; /* CommunityNameLength */ u8CommunityNameLength = tvb_get_guint8(tvb, offset); sub_item = proto_tree_add_item(tree, hfindex, tvb, offset, u8CommunityNameLength + 1, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_snmp_command_name); proto_tree_add_item(sub_tree, hf_pn_io_snmp_community_name_length, tvb, offset, 1, DREP_ENC_INTEGER(drep)); offset += 1; /* community Name */ proto_tree_add_item(sub_tree, hf_pn_io_snmp_community_name, tvb, offset, u8CommunityNameLength, ENC_ASCII | ENC_NA); proto_item_append_text(sub_item, ": %s", tvb_get_string_enc(wmem_packet_scope(), tvb, offset, u8CommunityNameLength, ENC_ASCII|ENC_NA)); offset += u8CommunityNameLength; return offset; } /* dissect the CIMSNMPAdjust block */ static int dissect_CIMSNMPAdjust_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint16 u16StartsAtOffset = offset; guint16 u16padding; if (u8BlockVersionHigh!=1 || u8BlockVersionLow!=0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* SNMPControl */ proto_tree_add_item(tree, hf_pn_io_snmp_control, tvb, offset, 2, DREP_ENC_INTEGER(drep)); offset += 2; offset = dissect_CommunityName_block(tvb, offset, pinfo, tree, drep, hf_pn_io_snmp_read_community_name); offset = dissect_CommunityName_block(tvb, offset, pinfo, tree, drep, hf_pn_io_snmp_write_community_name); u16padding = u16BodyLength - (offset - u16StartsAtOffset); if (u16padding > 0) offset = dissect_pn_padding(tvb, offset, pinfo, tree, u16padding); return offset; } /* dissect the MultipleBlockHeader block */ static int dissect_MultipleBlockHeader_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16BodyLength) { guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; tvbuff_t *new_tvb; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_align4(tvb, offset, pinfo, tree); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x", u32Api, u16SlotNr, u16SubslotNr); new_tvb = tvb_new_subset_length(tvb, offset, u16BodyLength-10); offset = dissect_blocks(new_tvb, 0, pinfo, tree, drep); /*offset += u16BodyLength;*/ return offset; } /* dissect Combined Object Container Content block */ static int dissect_COContainerContent_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar) { guint32 u32Api; guint16 u16SlotNr; guint16 u16SubslotNr; if(u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, hf_pn_io_api, &u32Api); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_slot_nr, &u16SlotNr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_subslot_nr, &u16SubslotNr); offset = dissect_pn_padding(tvb, offset, pinfo, tree, 2); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_index, &u16Index); proto_item_append_text(item, ": Api:0x%x Slot:%u Subslot:0x%x Index:0x%x", u32Api, u16SlotNr, u16SubslotNr, u16Index); if(u16Index != 0x80B0) { offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, u32RecDataLen, ar); } return offset; } static const gchar * indexReservedForProfiles(guint16 u16Index) { /* "reserved for profiles" */ if (u16Index >= 0xb000 && u16Index <= 0xbfff) { return "Reserved for Profiles (subslot specific)"; } if (u16Index >= 0xd000 && u16Index <= 0xdfff) { return "Reserved for Profiles (slot specific)"; } if (u16Index >= 0xec00 && u16Index <= 0xefff) { return "Reserved for Profiles (AR specific)"; } if (u16Index >= 0xf400 && u16Index <= 0xf7ff) { return "Reserved for Profiles (API specific)"; } if (u16Index >= 0xfc00 /* up to 0xffff */) { return "Reserved for Profiles (device specific)"; } return NULL; } /* dissect the RecordDataReadQuery block */ static int dissect_RecordDataReadQuery_block(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow, guint16 u16Index, guint16 u16BodyLength) { const gchar *userProfile; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } /* user specified format? */ if (u16Index < 0x8000) { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, "User Specified Data"); return offset; } /* "reserved for profiles"? */ userProfile = indexReservedForProfiles(u16Index); if (userProfile != NULL) { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u16BodyLength, userProfile); return offset; } return dissect_pn_undecoded(tvb, offset, pinfo, tree, u16BodyLength); } /* dissect the RS_GetEvent block */ static int dissect_RS_GetEvent_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_RS_EventInfo(tvb, offset, pinfo, tree, drep); return offset; } /* dissect the RS_AdjustControl */ static int dissect_RS_AdjustControl(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint16 *u16RSBodyLength, guint16 *u16RSBlockType) { guint16 u16ChannelNumber; guint16 u16SoEMaxScanDelay; proto_item *sub_item; proto_tree *sub_tree; guint8 u8SoEAdjustSpecifierReserved; guint8 u8SoEAdjustSpecifierIndicent; switch (*u16RSBlockType) { case(0xc010): /* SoE_DigitalInputObserver */ /* ChannelNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_channel_number, &u16ChannelNumber); /* SoE_MaxScanDelay */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_soe_max_scan_delay, &u16SoEMaxScanDelay); /* SoE_AdjustSpecifier */ sub_item = proto_tree_add_item(tree, hf_pn_io_soe_adjust_specifier, tvb, offset, 1, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_soe_adjust_specifier); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_soe_adjust_specifier_reserved, &u8SoEAdjustSpecifierReserved); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_soe_adjust_specifier_incident, &u8SoEAdjustSpecifierIndicent); /* Padding 2 + 2 + 1 = 5 */ /* Therefore we need 3 byte padding to make the block u32 aligned */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 3); break; default: offset = dissect_pn_user_data(tvb, offset, pinfo, tree, *u16RSBodyLength, "UserData"); break; } return offset; } /* dissect the RS_AdjustBlock */ static int dissect_RS_AdjustBlock(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16RSBodyLength; guint16 u16RSBlockType; sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_block); /* RS_BlockHeader */ offset = dissect_RS_BlockHeader(tvb, offset, pinfo, sub_tree, sub_item, drep, &u16RSBodyLength, &u16RSBlockType); /* RS_AdjustControl */ offset = dissect_RS_AdjustControl(tvb, offset, pinfo, sub_tree, drep, &u16RSBodyLength, &u16RSBlockType); return offset; } /* dissect the RS_AdjustInfo */ static int dissect_RS_AdjustInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16NumberofEntries; sub_item = proto_tree_add_item(tree, hf_pn_io_rs_adjust_info, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_rs_adjust_info); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_number_of_rs_event_info, &u16NumberofEntries); while (u16NumberofEntries > 0) { u16NumberofEntries--; offset = dissect_RS_AdjustBlock(tvb, offset, pinfo, sub_tree, drep); } return offset; } /* dissect the RS_AdjustObserver block */ static int dissect_RS_AdjustObserver_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_RS_AdjustInfo(tvb, offset, pinfo, tree, drep); return offset; } static int dissect_RS_AckInfo(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep) { guint16 u16RSSpecifierSequenceNumber; /* RS_Specifier.SequenceNumber */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_rs_specifier_sequence, &u16RSSpecifierSequenceNumber); return offset; } /* dissect the RS_AckEvent block */ static int dissect_RS_AckEvent_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_io_block_version, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_RS_AckInfo(tvb, offset, pinfo, tree, drep); return offset; } /* dissect one PN-IO block (depending on the block type) */ static int dissect_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 *u16Index, guint32 *u32RecDataLen, pnio_ar_t **ar) { guint16 u16BlockType; guint16 u16BlockLength; guint8 u8BlockVersionHigh; guint8 u8BlockVersionLow; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; guint16 u16BodyLength; proto_item *header_item; proto_tree *header_tree; gint remainingBytes; /* from here, we only have big endian (network byte ordering)!!! */ drep[0] &= ~DREP_LITTLE_ENDIAN; sub_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_block); u32SubStart = offset; header_item = proto_tree_add_item(sub_tree, hf_pn_io_block_header, tvb, offset, 6, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_pn_io_block_header); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep, hf_pn_io_block_type, &u16BlockType); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, header_tree, drep, hf_pn_io_block_length, &u16BlockLength); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep, hf_pn_io_block_version_high, &u8BlockVersionHigh); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, header_tree, drep, hf_pn_io_block_version_low, &u8BlockVersionLow); proto_item_append_text(header_item, ": Type=%s, Length=%u(+4), Version=%u.%u", val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)"), u16BlockLength, u8BlockVersionHigh, u8BlockVersionLow); proto_item_set_text(sub_item, "%s", val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)")); col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(u16BlockType, pn_io_block_type, "Unknown")); /* block length is without type and length fields, but with version field */ /* as it's already dissected, remove it */ u16BodyLength = u16BlockLength - 2; remainingBytes = tvb_reported_length_remaining(tvb, offset); if (remainingBytes < 0) remainingBytes = 0; if (remainingBytes +2 < u16BodyLength) { proto_item_append_text(sub_item, " Block_Length: %d greater than remaining Bytes, trying with Blocklen = remaining (%d)", u16BodyLength, remainingBytes); u16BodyLength = remainingBytes; } switch (u16BlockType) { case(0x0001): case(0x0002): dissect_AlarmNotification_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0008): dissect_IODWriteReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16Index, u32RecDataLen, ar); break; case(0x0009): dissect_IODReadReqHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16Index, u32RecDataLen, ar); break; case(0x0010): dissect_DiagnosisData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0012): /* ExpectedIdentificationData */ case(0x0013): /* RealIdentificationData */ dissect_IdentificationData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0014): dissect_SubstituteValue_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0015): dissect_RecordInputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0016): dissect_RecordOutputDataObjectElement_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; /* 0x0017 reserved */ case(0x0018): dissect_ARData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0019): dissect_LogData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x001A): dissect_APIData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x001B): dissect_SRLData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0020): dissect_IandM0_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0021): dissect_IandM1_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0022): dissect_IandM2_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0023): dissect_IandM3_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0024): dissect_IandM4_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0025): dissect_IandM5_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh,u8BlockVersionLow); break; case(0x0030): dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0031): dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0032): dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0034): dissect_IandM5Data_block(tvb, offset, pinfo, sub_tree, sub_item, drep); break; case(0x0035): dissect_AssetManagementData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0036): dissect_AM_FullInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0037): dissect_AM_HardwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0038): dissect_AM_FirmwareOnlyInformation_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0101): dissect_ARBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar); break; case(0x0102): dissect_IOCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar); break; case(0x0103): dissect_AlarmCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar); break; case(0x0104): dissect_ExpectedSubmoduleBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0106): dissect_MCRBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0107): dissect_SubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0108): case(0x8108): dissect_ARVendorBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0109): dissect_IRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x010A): dissect_SRInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x010C): dissect_RSInfoBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0110): case(0x0111): case(0x0112): case(0x0113): case(0x0114): case(0x0116): case(0x0117): dissect_ControlPlugOrConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType); break; case(0x0118): dissect_ControlBlockPrmBegin(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar); break; case(0x0119): dissect_SubmoduleListBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength, ar); break; case(0x0200): /* PDPortDataCheck */ dissect_PDPortData_Check_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0201): dissect_PDevData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0202): /*dissect_PDPortData_Adjust_block */ dissect_PDPortData_Adjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0203): dissect_PDSyncData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0204): dissect_IsochronousModeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0205): dissect_PDIRData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0206): dissect_PDIRGlobalData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0207): dissect_PDIRFrameData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0208): dissect_PDIRBeginEndData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0209): dissect_AdjustDomainBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x020A): dissect_CheckPeers_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x020B): dissect_CheckLineDelay_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x020C): dissect_CheckMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x020E): dissect_AdjustMAUType_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x020F): dissect_PDPortDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0210): dissect_AdjustMulticastBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0211): dissect_PDInterfaceMrpDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0212): dissect_PDInterfaceMrpDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0213): dissect_PDInterfaceMrpDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0214): case(0x0215): dissect_PDPortMrpData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0216): dissect_MrpManagerParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0217): dissect_MrpClientParams_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0218): dissect_MrpRTModeManagerData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0219): dissect_MrpRingStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021A): dissect_MrpRTStateData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021B): dissect_AdjustPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021C): dissect_CheckPortState_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021D): dissect_MrpRTModeClientData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021E): dissect_CheckSyncDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x021F): dissect_CheckMAUTypeDifference_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0220): dissect_PDPortFODataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0221): dissect_FiberOpticManufacturerSpecific_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0222): dissect_PDPortFODataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0223): dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0224): dissect_AdjustPeerToPeerBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0225): dissect_AdjustDCPBoundary_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0226): dissect_AdjustPreambleLength_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0227): dissect_CheckMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0228): dissect_FiberOpticDiagnosisInfo_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0229): dissect_AdjustMAUTypeExtension_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x022A): dissect_PDIRSubframeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x022B): dissect_PDSubFrameBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x022C): dissect_PDPortDataRealExtended_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0230): dissect_PDPortFODataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0231): dissect_MrpInstanceDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0232): dissect_MrpInstanceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0233): dissect_MrpInstanceDataCheck_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0240): dissect_PDInterfaceDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0241) : dissect_PDRsiInstances_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0250): dissect_PDInterfaceAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0251): dissect_PDPortStatistic_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0260): dissect_OwnPort_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0261): dissect_Neighbors_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0270): dissect_TSNNetworkControlDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0271): dissect_TSNNetworkControlDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0272): dissect_TSNDomainPortConfig_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0273): dissect_TSNDomainQueueConfig_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0274): dissect_TSNTimeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0275): dissect_TSNStreamPathDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, FALSE); break; case(0x0276): dissect_TSNSyncTreeData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0277): dissect_TSNUploadNetworkAttributes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0278): dissect_TSNForwardingDelay_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0279): dissect_TSNExpectedNetworkAttributes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x027A): dissect_TSNStreamPathDataReal_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, TRUE); break; case(0x027B): dissect_TSNDomainPortIngressRateLimiter_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x027C): dissect_TSNDomainQueueRateLimiter_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x027D): dissect_TSNPortID_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x027E): dissect_TSNExpectedNeighbor_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0300): dissect_CIMSNMPAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0400): dissect_MultipleBlockHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0401): dissect_COContainerContent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u32RecDataLen, ar); break; case(0x0500): dissect_RecordDataReadQuery_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *u16Index, u16BodyLength); break; case(0x0600): dissect_FSHello_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0601): dissect_FSParameter_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0608): dissect_PDInterfaceFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x010B): case(0x0609): dissect_ARFSUDataAdjust_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x0810): dissect_PE_EntityFilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0811): dissect_PE_EntityStatusData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0900): dissect_RS_AdjustObserver_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0901): dissect_RS_GetEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0902): dissect_RS_AckEvent_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0f00) : dissect_Maintenance_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x0f05): dissect_PE_Alarm_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x8001): case(0x8002): dissect_Alarm_ack_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x8008): dissect_IODWriteResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16Index, u32RecDataLen, ar); break; case(0x8009): dissect_IODReadResHeader_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16Index, u32RecDataLen, ar); break; case(0x8101): dissect_ARBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar); break; case(0x8102): dissect_IOCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar); break; case(0x8103): dissect_AlarmCRBlockRes_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, *ar); break; case(0x8104): dissect_ModuleDiffBlock_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; case(0x8106): dissect_ARServerBlock(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, u16BodyLength); break; case(0x8110): case(0x8111): case(0x8112): case(0x8113): case(0x8114): case(0x8116): case(0x8117): case(0x8118): dissect_ControlPlugOrConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType); break; default: dissect_pn_undecoded(tvb, offset, pinfo, sub_tree, u16BodyLength); } offset += u16BodyLength; proto_item_set_len(sub_item, offset - u32SubStart); return offset; } /* dissect any PN-IO block */ static int dissect_a_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } /* dissect any number of PN-IO blocks */ int dissect_blocks(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; while (tvb_captured_length(tvb) > (guint) offset) { offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); u16Index++; } if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } /* dissect a PN-IO (DCE-RPC) request header */ static int dissect_IPNIO_rqst_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32ArgsMax; guint32 u32ArgsLen; guint32 u32MaxCount; guint32 u32Offset; guint32 u32ArraySize; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM"); /* args_max */ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_pn_io_args_max, &u32ArgsMax); /* args_len */ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_pn_io_args_len, &u32ArgsLen); sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io); u32SubStart = offset; /* RPC array header */ offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_max_count, &u32MaxCount); offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_offset, &u32Offset); offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_act_count, &u32ArraySize); proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u", u32MaxCount, u32Offset, u32ArraySize); proto_item_set_len(sub_item, offset - u32SubStart); return offset; } /* dissect a PN-IO (DCE-RPC) response header */ static int dissect_IPNIO_resp_header(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32ArgsLen; guint32 u32MaxCount; guint32 u32Offset; guint32 u32ArraySize; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-CM"); offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep); /* args_len */ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_pn_io_args_len, &u32ArgsLen); sub_item = proto_tree_add_item(tree, hf_pn_io_array, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io); u32SubStart = offset; /* RPC array header */ offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_max_count, &u32MaxCount); offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_offset, &u32Offset); offset = dissect_ndr_uint32(tvb, offset, pinfo, sub_tree, di, drep, hf_pn_io_array_act_count, &u32ArraySize); proto_item_append_text(sub_item, ": Max: %u, Offset: %u, Size: %u", u32MaxCount, u32Offset, u32ArraySize); proto_item_set_len(sub_item, offset - u32SubStart); return offset; } /* dissect a PN-IO request */ static int dissect_IPNIO_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep); offset = dissect_blocks(tvb, offset, pinfo, tree, drep); return offset; } /* dissect a PN-IO response */ static int dissect_IPNIO_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep); offset = dissect_blocks(tvb, offset, pinfo, tree, drep); return offset; } /* dissect a PROFIDrive parameter request */ static int dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint8 request_reference; guint8 request_id; guint8 do_id; guint8 no_of_parameters; guint8 addr_idx; proto_item *profidrive_item; proto_tree *profidrive_tree; profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_request); proto_item_set_text(profidrive_item, "PROFIDrive Parameter Request: "); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_request_reference, &request_reference); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_request_id, &request_id); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_do_id, &do_id); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_no_of_parameters, &no_of_parameters); proto_item_append_text(profidrive_item, "ReqRef:0x%02x, ReqId:%s, DO:%u, NoOfParameters:%u", request_reference, val_to_str_const(request_id, pn_io_profidrive_request_id_vals, "Unknown"), do_id, no_of_parameters); col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Write Request, ReqRef:0x%02x, %s DO:%u", request_reference, request_id==0x01 ? "Read" : request_id==0x02 ? "Change" : "", do_id); /* Parameter address list */ for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { guint8 attribute; guint8 no_of_elems; guint16 parameter; guint16 idx; proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_address); proto_item_set_text(sub_item, "Parameter Address %u: ", addr_idx+1); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_attribute, &attribute); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_no_of_elems, &no_of_elems); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_number, &parameter); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_subindex, &idx); proto_item_append_text(sub_item, "Attr:%s, Elems:%u, Parameter:%u, Index:%u", val_to_str_const(attribute, pn_io_profidrive_attribute_vals, "Unknown"), no_of_elems, parameter, idx); if (no_of_elems>1) { col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d..%d]", parameter, idx, idx+no_of_elems-1); } else { col_append_fstr(pinfo->cinfo, COL_INFO, ", P%d[%d]", parameter, idx); } } /* in case of change request parameter value list */ if (request_id == 0x02) { for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { guint8 format; guint8 no_of_vals; proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value); proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_format, &format); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); while (no_of_vals--) { offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format); } } } return offset; } static int dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint8 request_reference; guint8 response_id; guint8 do_id; guint8 no_of_parameters; guint8 addr_idx; proto_item *profidrive_item; proto_tree *profidrive_tree; profidrive_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); profidrive_tree = proto_item_add_subtree(profidrive_item, ett_pn_io_profidrive_parameter_response); proto_item_set_text(profidrive_item, "PROFIDrive Parameter Response: "); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_request_reference, &request_reference); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_response_id, &response_id); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_do_id, &do_id); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, profidrive_tree, drep, hf_pn_io_profidrive_no_of_parameters, &no_of_parameters); proto_item_append_text(profidrive_item, "ReqRef:0x%02x, RspId:%s, DO:%u, NoOfParameters:%u", request_reference, val_to_str_const(response_id, pn_io_profidrive_response_id_vals, "Unknown"), do_id, no_of_parameters); col_add_fstr(pinfo->cinfo, COL_INFO, "PROFIDrive Read Response, ReqRef:0x%02x, RspId:%s", request_reference, val_to_str_const(response_id, pn_io_profidrive_response_id_vals, "Unknown response")); /* in case of parameter response value list */ if (response_id == 0x01) { for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { guint8 format; guint8 no_of_vals; proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value); proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_format, &format); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); while (no_of_vals--) { offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format); } } } if(response_id == 0x02){ // change parameter response ok, no data } if(response_id == 0x81){ for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { guint8 format; guint8 no_of_vals; guint16 value16; proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value); proto_item_set_text(sub_item, "Parameter Value %u: ", addr_idx+1); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_format, &format); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); if(format == 0x44){ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_value_error, &value16); if(value16 == 0x23){ addr_idx = no_of_parameters; } while (--no_of_vals) { switch(value16) { case 0x1: case 0x2: case 0x3: case 0x6: case 0x7: case 0x14: case 0x20: offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_value_error_sub, &value16); break; default: offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, 0x42); break; } } }else{ while (no_of_vals--){ offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, format); } } } } if(response_id == 0x82){ for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { guint8 format; guint8 no_of_vals; guint16 value16; proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(profidrive_tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_profidrive_parameter_value); proto_item_set_text(sub_item, "Parameter Change Result %u: ", addr_idx+1); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_format, &format); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); if(format == 0x44){ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_value_error, &value16); if(value16 == 0x23){ addr_idx = no_of_parameters; } while (--no_of_vals) { switch(value16) { case 0x1: case 0x2: case 0x3: case 0x6: case 0x7: case 0x14: case 0x20: offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_profidrive_param_value_error_sub, &value16); break; default: offset = dissect_profidrive_value(tvb, offset, pinfo, sub_tree, drep, 0x42); break; } } } } } return offset; } static int dissect_RecordDataRead(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen) { const gchar *userProfile; pnio_ar_t *ar = NULL; /* profidrive parameter access response */ if (u16Index == 0xb02e || u16Index == 0xb02f || u16Index == 0x002f) { return dissect_ProfiDriveParameterResponse(tvb, offset, pinfo, tree, drep); } /* user specified format? */ if (u16Index < 0x8000) { return dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data"); } /* "reserved for profiles"? */ userProfile = indexReservedForProfiles(u16Index); if (userProfile != NULL) { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile); return offset; } /* see: pn_io_index */ /* single block only */ switch (u16Index) { case(0x8010): /* Maintenance required in channel coding for one subslot */ case(0x8011): /* Maintenance demanded in channel coding for one subslot */ case(0x8012): /* Maintenance required in all codings for one subslot */ case(0x8013): /* Maintenance demanded in all codings for one subslot */ case(0x801e): /* SubstituteValues for one subslot */ case(0x8020): /* PDIRSubframeData for one subslot */ case(0x8027): /* PDPortDataRealExtended for one subslot */ case(0x8028): /* RecordInputDataObjectElement for one subslot */ case(0x8029): /* RecordOutputDataObjectElement for one subslot */ case(0x8050): /* PDInterfaceMrpDataReal for one subslot */ case(0x8051): /* PDInterfaceMrpDataCheck for one subslot */ case(0x8052): /* PDInterfaceMrpDataAdjust for one subslot */ case(0x8053): /* PDPortMrpDataAdjust for one subslot */ case(0x8054): /* PDPortMrpDataReal for one subslot */ case(0x80F0): /* TSNNetworkControlDataReal */ case(0x80F2): /* TSNSyncTreeData */ case(0x80F3): /* TSNUploadNetworkAttributes */ case(0x80F4): /* TSNExpectedNetworkAttributes */ case(0x80F5): /* TSNNetworkControlDataAdjust */ case(0x8060): /* PDPortFODataReal for one subslot */ case(0x8061): /* PDPortFODataCheck for one subslot */ case(0x8062): /* PDPortFODataAdjust for one subslot */ case(0x8063): /* PDPortSFPDataCheck for one subslot */ case(0x8070): /* PDNCDataCheck for one subslot */ case(0x8071): /* PDPortStatistic for one subslot */ case(0x8080): /* PDInterfaceDataReal */ case(0x8090): /* PDInterfaceFSUDataAdjust */ case(0x80AF): /* PE_EntityStatusData for one subslot */ case(0x80CF): /* RS_AdjustObserver */ case(0x8200): /* CIMSNMPAdjust */ case(0xaff0): /* I&M0 */ case(0xaff1): /* I&M1 */ case(0xaff2): /* I&M2 */ case(0xaff3): /* I&M3 */ case(0xaff4): /* I&M4 */ case(0xaff5): /* I&M5 */ case(0xaff6): /* I&M6 */ case(0xaff7): /* I&M7 */ case(0xaff8): /* I&M8 */ case(0xaff9): /* I&M9 */ case(0xaffa): /* I&M10 */ case(0xaffb): /* I&M11 */ case(0xaffc): /* I&M12 */ case(0xaffd): /* I&M13 */ case(0xaffe): /* I&M14 */ case(0xafff): /* I&M15 */ case(0xc010): /* Maintenance required in channel coding for one slot */ case(0xc011): /* Maintenance demanded in channel coding for one slot */ case(0xc012): /* Maintenance required in all codings for one slot */ case(0xc013): /* Maintenance demanded in all codings for one slot */ case(0xe002): /* ModuleDiffBlock for one AR */ case(0xe010): /* Maintenance required in channel coding for one AR */ case(0xe011): /* Maintenance demanded in channel coding for one AR */ case(0xe012): /* Maintenance required in all codings for one AR */ case(0xe013): /* Maintenance demanded in all codings for one AR */ case(0xe030): /* PE_EntityFilterData for one AR*/ case(0xe031): /* PE_EntityStatusData for one AR*/ case(0xf010): /* Maintenance required in channel coding for one API */ case(0xf011): /* Maintenance demanded in channel coding for one API */ case(0xf012): /* Maintenance required in all codings for one API */ case(0xf013): /* Maintenance demanded in all codings for one API */ case(0xf020): /* ARData for one API */ case(0xf820): /* ARData */ case(0xf821): /* APIData */ case(0xf830): /* LogData */ case(0xf831): /* PDevData */ case(0xf870): /* PE_EntityFilterData*/ case(0xf871): /* PE_EntityStatusData*/ case(0xf880) : /* AssetManagementData */ case(0xf8f1): /* PDRsiInstances */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); break; case(0xf840): /* I&M0FilterData */ { int end_offset = offset + u32RecDataLen; offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); if (end_offset > offset) offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); if (end_offset > offset) offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); } break; case(0xB050): case(0xB051): case(0xB060): case(0xB061): offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); break; /*** multiple blocks possible ***/ case(0x8000): /* ExpectedIdentificationData for one subslot */ case(0x8001): /* RealIdentificationData for one subslot */ case(0x800a): /* Diagnosis in channel decoding for one subslot */ case(0x800b): /* Diagnosis in all codings for one subslot */ case(0x800c): /* Diagnosis, Maintenance, Qualified and Status for one subslot */ case(0x802a): /* PDPortDataReal */ case(0x802b): /* PDPortDataCheck */ case(0x802d): /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */ case(0x802e): /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */ case(0x802f): /* PDPortDataAdjust */ case(0x8030): /* IsochronousModeData for one subslot */ case(0x8031): /* PDTimeData for one subslot */ case(0x8032): case(0x8033): case(0x8034): case(0x8035): case(0x8036): case(0x8037): case(0x8038): case(0x8039): case(0x803a): case(0x803b): case(0x803c): case(0x803d): case(0x803e): case(0x803f): case(0x8040): /* Expected PDSyncData for one subslot with SyncID value 2 ... 30 */ case(0x8041): case(0x8042): case(0x8043): case(0x8044): case(0x8045): case(0x8046): case(0x8047): case(0x8048): case(0x8049): case(0x804a): case(0x804b): case(0x804c): case(0x804d): case(0x804e): case(0x804f): /* Expected PDSyncData for one subslot with SyncID value 31 */ case(0x8055): /* PDPortMrpIcDataAdjust for one subslot */ case(0x8056): /* PDPortMrpIcDataCheck for one subslot */ case(0x8057): /* PDPortMrpIcDataReal for one subslot */ case(0x8072): /* PDPortStatistic for one subslot */ case(0xc000): /* ExpectedIdentificationData for one slot */ case(0xc001): /* RealIdentificationData for one slot */ case(0xc00a): /* Diagnosis in channel coding for one slot */ case(0xc00b): /* Diagnosis in all codings for one slot */ case(0xc00c): /* Diagnosis, Maintenance, Qualified and Status for one slot */ case(0xe000): /* ExpectedIdentificationData for one AR */ case(0xe001): /* RealIdentificationData for one AR */ case(0xe00a): /* Diagnosis in channel decoding for one AR */ case(0xe00b): /* Diagnosis in all codings for one AR */ case(0xe00c): /* Diagnosis, Maintenance, Qualified and Status for one AR */ case(0xE060): /* RS_GetEvent (using RecordDataRead service) */ case(0xf000): /* RealIdentificationData for one API */ case(0xf00a): /* Diagnosis in channel decoding for one API */ case(0xf00b): /* Diagnosis in all codings for one API */ case(0xf00c): /* Diagnosis, Maintenance, Qualified and Status for one API */ case(0xf80c): /* Diagnosis, Maintenance, Qualified and Status for one device */ case(0xf841): /* PDRealData */ case(0xf842): /* PDExpectedData */ offset = dissect_blocks(tvb, offset, pinfo, tree, drep); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen); } return offset; } /* dissect a PN-IO read response */ static int dissect_IPNIO_Read_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16Index = 0; guint32 u32RecDataLen = 0; pnio_ar_t *ar = NULL; offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep); /* When PNIOStatus is Error */ if (!tvb_captured_length_remaining(tvb, offset)) return offset; /* IODReadHeader */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); /* RecordDataRead */ if (u32RecDataLen != 0) { offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen); } if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } /* F-Parameter record data object */ static int dissect_ProfiSafeParameterRequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, wmem_list_frame_t *frame) { proto_item *f_item; proto_tree *f_tree; proto_item *flags1_item; proto_tree *flags1_tree; proto_item *flags2_item; proto_tree *flags2_tree; guint16 src_addr; guint16 dst_addr; guint16 wd_time; guint16 par_crc; guint32 ipar_crc = 0; guint8 prm_flag1; guint8 prm_flag1_chck_seq; guint8 prm_flag1_chck_ipar; guint8 prm_flag1_sil; guint8 prm_flag1_crc_len; guint8 prm_flag1_crc_seed; guint8 prm_flag1_reserved; guint8 prm_flag2; guint8 prm_flag2_reserved; guint8 prm_flag2_f_block_id; guint8 prm_flag2_f_par_version; conversation_t *conversation; stationInfo *station_info; ioDataObject *io_data_object; wmem_list_frame_t *frame_out; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; f_item = proto_tree_add_item(tree, hf_pn_io_block, tvb, offset, 0, ENC_NA); f_tree = proto_item_add_subtree(f_item, ett_pn_io_profisafe_f_parameter); proto_item_set_text(f_item, "F-Parameter: "); flags1_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag1, tvb, offset, 1, ENC_BIG_ENDIAN); flags1_tree = proto_item_add_subtree(flags1_item, ett_pn_io_profisafe_f_parameter_prm_flag1); /* dissection of F_Prm_Flag1 */ dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_chck_seq, &prm_flag1_chck_seq); dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_chck_ipar, &prm_flag1_chck_ipar); dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_sil, &prm_flag1_sil); dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_crc_len, &prm_flag1_crc_len); dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_crc_seed, &prm_flag1_crc_seed); dissect_dcerpc_uint8(tvb, offset, pinfo, flags1_tree, drep, hf_pn_io_ps_f_prm_flag1_reserved, &prm_flag1_reserved); prm_flag1 = prm_flag1_chck_seq|prm_flag1_chck_ipar|prm_flag1_sil|prm_flag1_crc_len|prm_flag1_crc_seed|prm_flag1_reserved; offset++; flags2_item = proto_tree_add_item(f_tree, hf_pn_io_ps_f_prm_flag2, tvb, offset, 1, ENC_BIG_ENDIAN); flags2_tree = proto_item_add_subtree(flags2_item, ett_pn_io_profisafe_f_parameter_prm_flag2); /* dissection of F_Prm_Flag2 */ dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep, hf_pn_io_ps_f_prm_flag2_reserved, &prm_flag2_reserved); dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep, hf_pn_io_ps_f_prm_flag2_f_block_id, &prm_flag2_f_block_id); dissect_dcerpc_uint8(tvb, offset, pinfo, flags2_tree, drep, hf_pn_io_ps_f_prm_flag2_f_par_version, &prm_flag2_f_par_version); prm_flag2 = prm_flag2_reserved|prm_flag2_f_block_id|prm_flag2_f_par_version; offset++; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep, hf_pn_io_ps_f_src_adr, &src_addr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep, hf_pn_io_ps_f_dest_adr, &dst_addr); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep, hf_pn_io_ps_f_wd_time, &wd_time); /* Dissection for F_iPar_CRC: see F_Prm_Flag2 -> F_Block_ID */ if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, f_item, drep, hf_pn_io_ps_f_ipar_crc, &ipar_crc); } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, f_item, drep, hf_pn_io_ps_f_par_crc, &par_crc); /* Differniate between ipar_crc and no_ipar_crc */ if( (prm_flag2_f_block_id & 0x08) && !(prm_flag2_f_block_id & 0x20) ) { /* include ipar_crc display */ col_append_fstr(pinfo->cinfo, COL_INFO, ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x," " dst:0x%04x, wd_time:%d, ipar_crc:0x%04x, crc:0x%04x", prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc); proto_item_append_text(f_item, "prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x, dst:0x%04x, wd_time:%d, ipar_crc:0x%04x, par_crc:0x%04x", prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, ipar_crc, par_crc); } else { /* exclude ipar_crc display */ col_append_fstr(pinfo->cinfo, COL_INFO, ", F-Parameter record, prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x," " dst:0x%04x, wd_time:%d, crc:0x%04x", prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc); proto_item_append_text(f_item, "prm_flag1:0x%02x, prm_flag2:0x%02x, src:0x%04x, dst:0x%04x, wd_time:%d, par_crc:0x%04x", prm_flag1, prm_flag2, src_addr, dst_addr, wd_time, par_crc); } if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); if (frame != NULL) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); io_data_object->f_par_crc1 = par_crc; io_data_object->f_src_adr = src_addr; io_data_object->f_dest_adr = dst_addr; io_data_object->f_crc_seed = prm_flag1 & 0x40; if (!(prm_flag1 & 0x10)) { if (prm_flag1 & 0x20) { io_data_object->f_crc_len = 4; } else { io_data_object->f_crc_len = 3; } } } /* Find same module within output data to saved data */ for (frame_out = wmem_list_head(station_info->ioobject_data_out); frame_out != NULL; frame_out = wmem_list_frame_next(frame_out)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame_out); if (u16Index == io_data_object->fParameterIndexNr && /* Check F-Parameter Indexnumber */ io_data_object->profisafeSupported && /* Arrayelement has to be PS-Module */ io_data_object->f_par_crc1 == 0) { /* Find following object with no f_par_crc1 */ io_data_object->f_par_crc1 = par_crc; io_data_object->f_src_adr = src_addr; io_data_object->f_dest_adr = dst_addr; io_data_object->f_crc_seed = prm_flag1 & 0x40; if (!(prm_flag1 & 0x10)) { if (prm_flag1 & 0x20) { io_data_object->f_crc_len = 4; } else { io_data_object->f_crc_len = 3; } } break; } } } } return offset; } static int dissect_RecordDataWrite(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16Index, guint32 u32RecDataLen) { conversation_t *conversation; stationInfo *station_info; wmem_list_frame_t *frame; ioDataObject *io_data_object; const gchar *userProfile; pnio_ar_t *ar = NULL; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; /* PROFISafe */ /* Get current conversation endpoints using MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, if no "Ident OK" frame as been dissected yet! * Need to switch dl_src & dl_dst, as current packet is sent by controller and not by device. * All conversations are based on Device MAC as addr1 */ conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } current_aruuid_frame = pn_find_aruuid_frame_setup(pinfo); if (current_aruuid_frame != NULL) { current_aruuid = current_aruuid_frame->aruuid.data1; } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); if (!PINFO_FD_VISITED(pinfo)) { /* Search within the entire existing list for current input object data */ for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (u16Index == io_data_object->fParameterIndexNr && /* Check F-Parameter Indexnumber */ io_data_object->profisafeSupported && /* Arrayelement has to be PS-Module */ io_data_object->f_par_crc1 == 0) { /* Find following object with no f_par_crc1 */ return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame); } } } else { /* User clicked another time the frame to see the data -> PROFIsafe data has already been saved * Check whether the device contains an PROFIsafe supported submodule. */ for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (u16Index == io_data_object->fParameterIndexNr && /* Check F-Parameter Indexnumber */ io_data_object->profisafeSupported) { /* Arrayelement has to be PS-Module */ return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame); } } for (frame = wmem_list_head(station_info->ioobject_data_out); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (u16Index == io_data_object->fParameterIndexNr && /* Check F-Parameter Indexnumber */ io_data_object->profisafeSupported) { /* Arrayelement has to be PS-Module */ return dissect_ProfiSafeParameterRequest(tvb, offset, pinfo, tree, drep, u16Index, frame); } } } } /* profidrive parameter request */ if (u16Index == 0xb02e || u16Index == 0xb02f || u16Index == 0x002f) { return dissect_ProfiDriveParameterRequest(tvb, offset, pinfo, tree, drep); } /* user specified format? */ if (u16Index < 0x8000) { return dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, "User Specified Data"); } /* "reserved for profiles"? */ userProfile = indexReservedForProfiles(u16Index); if (userProfile != NULL) { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, u32RecDataLen, userProfile); return offset; } /* see: pn_io_index */ switch (u16Index) { case(0x8020): /* PDIRSubframeData */ case(0x801e): /* SubstituteValues for one subslot */ case(0x802b): /* PDPortDataCheck for one subslot */ case(0x802c): /* PDirData for one subslot */ case(0x802d): /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTA */ case(0x802e): /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */ case(0x802f): /* PDPortDataAdjust for one subslot */ case(0x8030): /* IsochronousModeData for one subslot */ case(0x8031): /* PDTimeData for one subslot */ case(0x8051): /* PDInterfaceMrpDataCheck for one subslot */ case(0x8052): /* PDInterfaceMrpDataAdjust for one subslot */ case(0x8053): /* PDPortMrpDataAdjust for one subslot */ case(0x8055): /* PDPortMrpIcDataAdjust for one subslot */ case(0x8056): /* PDPortMrpIcDataCheck for one subslot */ case(0x8061): /* PDPortFODataCheck for one subslot */ case(0x8062): /* PDPortFODataAdjust for one subslot */ case(0x8063): /* PDPortSFPDataCheck for one subslot */ case(0x8070): /* PDNCDataCheck for one subslot */ case(0x8071): /* PDInterfaceAdjust */ case(0x8090): /* PDInterfaceFSUDataAdjust */ case(0x80B0): /* CombinedObjectContainer*/ case(0x80CF): /* RS_AdjustObserver */ case(0x8200): /* CIMSNMPAdjust */ case(0xaff1): /* I&M1 */ case(0xaff2): /* I&M2 */ case(0xaff3): /* I&M3 */ case(0xe050): /* FastStartUp data for one AR */ case(0xe061): /* RS_AckEvent (using RecordDataWrite service) */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, u32RecDataLen); } return offset; } #define PN_IO_MAX_RECURSION_DEPTH 100 static int dissect_IODWriteReq(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, pnio_ar_t **ar, guint recursion_count) { guint16 u16Index = 0; guint32 u32RecDataLen = 0; if (++recursion_count >= PN_IO_MAX_RECURSION_DEPTH) { proto_tree_add_expert(tree, pinfo, &ei_pn_io_max_recursion_depth_reached, tvb, 0, 0); return tvb_captured_length(tvb); } /* IODWriteHeader */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, ar); /* IODWriteMultipleReq? */ if (u16Index == 0xe040) { while (tvb_captured_length_remaining(tvb, offset) > 0) { offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, ar, recursion_count++); } } else { tvbuff_t *new_tvb = tvb_new_subset_length(tvb, offset, u32RecDataLen); /* RecordDataWrite */ offset += dissect_RecordDataWrite(new_tvb, 0, pinfo, tree, drep, u16Index, u32RecDataLen); /* Padding */ switch (offset % 4) { case(3): offset += 1; break; case(2): offset += 2; break; case(1): offset += 3; break; default: /* will not execute because of the line preceding the switch */ break; } } return offset; } /* dissect a PN-IO write request */ static int dissect_IPNIO_Write_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { pnio_ar_t *ar = NULL; guint recursion_count = 0; offset = dissect_IPNIO_rqst_header(tvb, offset, pinfo, tree, di, drep); offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count); if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } static int dissect_IODWriteRes(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; /* IODWriteResHeader */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); /* IODWriteMultipleRes? */ if (u16Index == 0xe040) { while (tvb_captured_length_remaining(tvb, offset) > 0) { offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen, &ar); } } if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } /* dissect a PN-IO write response */ static int dissect_IPNIO_Write_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { offset = dissect_IPNIO_resp_header(tvb, offset, pinfo, tree, di, drep); offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep); return offset; } /* dissect any number of PN-RSI blocks */ int dissect_rsi_blocks(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, guint8* drep, guint32 u32FOpnumOffsetOpnum, int type) { pnio_ar_t* ar = NULL; guint recursion_count = 0; guint16 u16Index = 0; guint32 u32RecDataLen = 0; switch (u32FOpnumOffsetOpnum) { case(0x0): // Connect request or response offset = dissect_blocks(tvb, offset, pinfo, tree, drep); break; case(0x2): // Read request or response offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen); break; case(0x3): // Write request or response if (type == PDU_TYPE_REQ) offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count); else if (type == PDU_TYPE_RSP) offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep); break; case(0x4): // Control request or response offset = dissect_blocks(tvb, offset, pinfo, tree, drep); break; case(0x5): // ReadImplicit request or response offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen); break; case(0x6): // ReadConnectionless request or response offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen); break; case(0x7): // ReadNotification request or response offset = dissect_RecordDataRead(tvb, offset, pinfo, tree, drep, u16Index, u32RecDataLen); break; case(0x8): // PrmWriteMore request or response if (type == PDU_TYPE_REQ) offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count); else if (type == PDU_TYPE_RSP) offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep); break; case(0x9): // PrmWriteEnd request or response if (type == PDU_TYPE_REQ) offset = dissect_IODWriteReq(tvb, offset, pinfo, tree, drep, &ar, recursion_count); else if (type == PDU_TYPE_RSP) offset = dissect_IODWriteRes(tvb, offset, pinfo, tree, drep); break; default: col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb)); break; } if (ar != NULL) { pnio_ar_info(tvb, pinfo, tree, ar); } return offset; } /* dissect the IOxS (IOCS, IOPS) field */ static int dissect_PNIO_IOxS(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex) { if (tree) { guint8 u8IOxS; proto_item *ioxs_item; proto_tree *ioxs_tree; u8IOxS = tvb_get_guint8(tvb, offset); /* add ioxs subtree */ ioxs_item = proto_tree_add_uint(tree, hfindex, tvb, offset, 1, u8IOxS); proto_item_append_text(ioxs_item, " (%s%s)", (u8IOxS & 0x01) ? "another IOxS follows " : "", (u8IOxS & 0x80) ? "good" : "bad"); ioxs_tree = proto_item_add_subtree(ioxs_item, ett_pn_io_ioxs); proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_datastate, tvb, offset, 1, u8IOxS); proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_instance, tvb, offset, 1, u8IOxS); proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_res14, tvb, offset, 1, u8IOxS); proto_tree_add_uint(ioxs_tree, hf_pn_io_ioxs_extension, tvb, offset, 1, u8IOxS); } return offset + 1; } /* dissect a PN-IO Cyclic Service Data Unit (on top of PN-RT protocol) */ static int dissect_PNIO_C_SDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep _U_) { proto_tree *data_tree = NULL; /* gint iTotalLen = 0; */ /* gint iSubFrameLen = 0; */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO"); if (tree) { proto_item *data_item; data_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb), "PROFINET IO Cyclic Service Data Unit: %u bytes", tvb_captured_length(tvb)); data_tree = proto_item_add_subtree(data_item, ett_pn_io_rtc); } /*dissect_dcerpc_uint16(tvb, offset, pinfo, data_tree, drep, hf_pn_io_packedframe_SFCRC, &u16SFCRC);*/ if (dissect_CSF_SDU_heur(tvb, pinfo, data_tree, NULL)) return(tvb_captured_length(tvb)); /* XXX - dissect the remaining data */ /* this will be one or more DataItems followed by an optional GAP and RTCPadding */ /* as we don't have the required context information to dissect the specific DataItems, */ /* this will be tricky :-( */ /* actual: there may be an IOxS but most case there isn't so better display a data-stream */ /* offset = dissect_PNIO_IOxS(tvb, offset, pinfo, data_tree, drep, hf_pn_io_ioxs); */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset), "User Data (including GAP and RTCPadding)"); return offset; } /* dissect a PN-IO RTA PDU (on top of PN-RT protocol) */ static int dissect_PNIO_RTA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16AlarmDstEndpoint; guint16 u16AlarmSrcEndpoint; guint8 u8PDUType; guint8 u8PDUVersion; guint8 u8WindowSize; guint8 u8Tack; guint16 u16SendSeqNum; guint16 u16AckSeqNum; guint16 u16VarPartLen; int start_offset = offset; guint16 u16Index = 0; guint32 u32RecDataLen; pnio_ar_t *ar = NULL; proto_item *rta_item; proto_tree *rta_tree; proto_item *sub_item; proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-AL"); rta_item = proto_tree_add_protocol_format(tree, proto_pn_io, tvb, offset, tvb_captured_length(tvb), "PROFINET IO Alarm"); rta_tree = proto_item_add_subtree(rta_item, ett_pn_io_rta); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_io_alarm_dst_endpoint, &u16AlarmDstEndpoint); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_io_alarm_src_endpoint, &u16AlarmSrcEndpoint); col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: 0x%x, Dst: 0x%x", u16AlarmSrcEndpoint, u16AlarmDstEndpoint); /* PDU type */ sub_item = proto_tree_add_item(rta_tree, hf_pn_io_pdu_type, tvb, offset, 1, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pdu_type); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdu_type_type, &u8PDUType); u8PDUType &= 0x0F; offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_pdu_type_version, &u8PDUVersion); u8PDUVersion >>= 4; proto_item_append_text(sub_item, ", Type: %s, Version: %u", val_to_str_const(u8PDUType, pn_io_pdu_type, "Unknown"), u8PDUVersion); /* additional flags */ sub_item = proto_tree_add_item(rta_tree, hf_pn_io_add_flags, tvb, offset, 1, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_add_flags); dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_window_size, &u8WindowSize); u8WindowSize &= 0x0F; offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_io_tack, &u8Tack); u8Tack >>= 4; proto_item_append_text(sub_item, ", Window Size: %u, Tack: %u", u8WindowSize, u8Tack); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_io_send_seq_num, &u16SendSeqNum); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_io_ack_seq_num, &u16AckSeqNum); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_io_var_part_len, &u16VarPartLen); switch ( u8PDUType & 0x0F) { case(1): /* Data-RTA */ col_append_str(pinfo->cinfo, COL_INFO, ", Data-RTA"); offset = dissect_block(tvb, offset, pinfo, rta_tree, drep, &u16Index, &u32RecDataLen, &ar); break; case(2): /* NACK-RTA */ col_append_str(pinfo->cinfo, COL_INFO, ", NACK-RTA"); /* no additional data */ break; case(3): /* ACK-RTA */ col_append_str(pinfo->cinfo, COL_INFO, ", ACK-RTA"); /* no additional data */ break; case(4): /* ERR-RTA */ col_append_str(pinfo->cinfo, COL_INFO, ", ERR-RTA"); offset = dissect_PNIO_status(tvb, offset, pinfo, rta_tree, drep); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb)); } proto_item_set_len(rta_item, offset - start_offset); return offset; } /* possibly dissect a PN-IO related PN-RT packet */ static gboolean dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { guint8 drep_data = 0; guint8 *drep = &drep_data; /* the sub tvb will NOT contain the frame_id here! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); heur_dtbl_entry_t *hdtbl_entry; conversation_t* conversation; guint8 isTimeAware = FALSE; /* * In case the packet is a protocol encoded in the basic PNIO transport stream, * give that protocol a chance to make a heuristic dissection, before we continue * to dissect it as a normal PNIO packet. */ if (dissector_try_heuristic(heur_pn_subdissector_list, tvb, pinfo, tree, &hdtbl_entry, NULL)) return TRUE; /* TimeAwareness Information needed for dissecting RTC3 - RTSteam frames */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation != NULL) { isTimeAware = GPOINTER_TO_UINT(conversation_get_proto_data(conversation, proto_pn_io_time_aware_status)); } /* is this a (none DFP) PNIO class 3 data packet? */ /* frame id must be in valid range (cyclic Real-Time, class=3) */ if (((u16FrameID >= 0x0100 && u16FrameID <= 0x06FF) || /* RTC3 non redundant */ (u16FrameID >= 0x0700 && u16FrameID <= 0x0fff)) && /* RTC3 redundant */ !isTimeAware) { dissect_CSF_SDU_heur(tvb, pinfo, tree, data); return TRUE; } /* is this a PNIO class stream data packet? */ /* frame id must be in valid range (cyclic Real-Time, class=Stream) */ if (((u16FrameID >= 0x1000 && u16FrameID <= 0x2FFF) || (u16FrameID >= 0x3800 && u16FrameID <= 0x3FFF)) && isTimeAware) { dissect_CSF_SDU_heur(tvb, pinfo, tree, data); return TRUE; } /* The following range is reserved for following developments */ /* frame id must be in valid range (Reserved) and * first byte (CBA version field) has to be != 0x11 */ if (u16FrameID >= 0x4000 && u16FrameID <= 0x7fff) { dissect_PNIO_C_SDU(tvb, 0, pinfo, tree, drep); return TRUE; } /* is this a PNIO class 1 data packet? */ /* frame id must be in valid range (cyclic Real-Time, class=1) and * first byte (CBA version field) has to be != 0x11 */ if (u16FrameID >= 0x8000 && u16FrameID < 0xbfff) { dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep, u16FrameID); return TRUE; } /* is this a PNIO class 1 (legacy) data packet? */ /* frame id must be in valid range (cyclic Real-Time, class=1, legacy) and * first byte (CBA version field) has to be != 0x11 */ if (u16FrameID >= 0xc000 && u16FrameID < 0xfbff) { dissect_PNIO_C_SDU_RTC1(tvb, 0, pinfo, tree, drep, u16FrameID); return TRUE; } /* is this a PNIO high priority alarm packet? */ if (u16FrameID == 0xfc01) { col_set_str(pinfo->cinfo, COL_INFO, "Alarm High"); dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep); return TRUE; } /* is this a PNIO low priority alarm packet? */ if (u16FrameID == 0xfe01) { col_set_str(pinfo->cinfo, COL_INFO, "Alarm Low"); dissect_PNIO_RTA(tvb, 0, pinfo, tree, drep); return TRUE; } /* is this a Remote Service Interface (RSI) packet*/ if (u16FrameID == 0xfe02) { dissect_PNIO_RSI(tvb, 0, pinfo, tree, drep); return TRUE; } /* this PN-RT packet doesn't seem to be PNIO specific */ return FALSE; } static gboolean pn_io_ar_conv_valid(packet_info *pinfo, void *user_data _U_) { void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0); return ((profinet_type != NULL) && (GPOINTER_TO_UINT(profinet_type) == 10)); } static gchar * pn_io_ar_conv_filter(packet_info *pinfo, void *user_data _U_) { pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0); void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0); char *buf; address controllermac_addr, devicemac_addr; if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) { return NULL; } set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac); set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac); buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || " /* Alarm CR (contr -> dev) */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)", /* Alarm CR (dev -> contr) */ guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid), ar->controlleralarmref, address_to_str(pinfo->pool, &controllermac_addr), ar->devicealarmref, address_to_str(pinfo->pool, &devicemac_addr)); return buf; } static gchar * pn_io_ar_conv_data_filter(packet_info *pinfo, void *user_data _U_) { pnio_ar_t *ar = (pnio_ar_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pn_io, 0); void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_pn_io, 0); char *buf, *controllermac_str, *devicemac_str, *guid_str; address controllermac_addr, devicemac_addr; if ((profinet_type == NULL) || (GPOINTER_TO_UINT(profinet_type) != 10) || (ar == NULL)) { return NULL; } set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac); set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac); controllermac_str = address_to_str(pinfo->pool, &controllermac_addr); devicemac_str = address_to_str(pinfo->pool, &devicemac_addr); guid_str = guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid); if (ar->arType == 0x0010) /* IOCARSingle using RT_CLASS_3 */ { buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_rt.frame_id == 0x%x) || (pn_rt.frame_id == 0x%x) || " "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || " /* Alarm CR (contr -> dev) */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)", /* Alarm CR (dev -> contr) */ guid_str, ar->inputframeid, ar->outputframeid, ar->controlleralarmref, controllermac_str, ar->devicealarmref, devicemac_str); } else { buf = ws_strdup_printf( "pn_io.ar_uuid == %s || " /* ARUUID */ "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || " /* Input CR && dev MAC -> contr MAC */ "(pn_rt.frame_id == 0x%x && eth.src == %s && eth.dst == %s) || " /* Output CR && contr MAC -> dev MAC */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s) || " /* Alarm CR (contr -> dev) */ "(pn_io.alarm_src_endpoint == 0x%x && eth.src == %s)", /* Alarm CR (dev -> contr) */ guid_str, ar->inputframeid, devicemac_str, controllermac_str, ar->outputframeid, controllermac_str, devicemac_str, ar->controlleralarmref, controllermac_str, ar->devicealarmref, devicemac_str); } return buf; } /* the PNIO dcerpc interface table */ static dcerpc_sub_dissector pn_io_dissectors[] = { { 0, "Connect", dissect_IPNIO_rqst, dissect_IPNIO_resp }, { 1, "Release", dissect_IPNIO_rqst, dissect_IPNIO_resp }, { 2, "Read", dissect_IPNIO_rqst, dissect_IPNIO_Read_resp }, { 3, "Write", dissect_IPNIO_Write_rqst, dissect_IPNIO_Write_resp }, { 4, "Control", dissect_IPNIO_rqst, dissect_IPNIO_resp }, { 5, "Read Implicit", dissect_IPNIO_rqst, dissect_IPNIO_Read_resp }, { 0, NULL, NULL, NULL } }; static void pnio_cleanup(void) { g_list_free(pnio_ars); pnio_ars = NULL; } static void pnio_setup(void) { aruuid_frame_setup_list = wmem_list_new(wmem_file_scope()); pnio_time_aware_frame_map = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); } void proto_register_pn_io (void) { static hf_register_info hf[] = { { &hf_pn_io_opnum, { "Operation", "pn_io.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_reserved16, { "Reserved", "pn_io.reserved16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_array, { "Array", "pn_io.array", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_args_max, { "ArgsMaximum", "pn_io.args_max", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_args_len, { "ArgsLength", "pn_io.args_len", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_array_max_count, { "MaximumCount", "pn_io.array_max_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_array_offset, { "Offset", "pn_io.array_offset", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_array_act_count, { "ActualCount", "pn_io.array_act_count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_data, { "ARDATA for AR:", "pn_io.ar_data", FT_NONE, BASE_NONE, 0x0, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_type, { "ARType", "pn_io.ar_type", FT_UINT16, BASE_HEX, VALS(pn_io_ar_type), 0x0, NULL, HFILL } }, { &hf_pn_io_cminitiator_macadd, { "CMInitiatorMacAdd", "pn_io.cminitiator_mac_add", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL } }, { &hf_pn_io_cminitiator_objectuuid, { "CMInitiatorObjectUUID", "pn_io.cminitiator_uuid", FT_GUID, BASE_NONE, 0x0, 0x0, NULL, HFILL } }, { &hf_pn_io_parameter_server_objectuuid, { "ParameterServerObjectUUID", "pn_io.parameter_server_objectuuid", FT_GUID, BASE_NONE, 0x0, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_properties, { "ARProperties", "pn_io.ar_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_properties_state, { "State", "pn_io.ar_properties.state", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_state), 0x00000007, NULL, HFILL } }, { &hf_pn_io_ar_properties_supervisor_takeover_allowed, { "SupervisorTakeoverAllowed", "pn_io.ar_properties.supervisor_takeover_allowed", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_supervisor_takeover_allowed), 0x00000008, NULL, HFILL } }, { &hf_pn_io_ar_properties_parameterization_server, { "ParameterizationServer", "pn_io.ar_properties.parameterization_server", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_parameterization_server), 0x00000010, NULL, HFILL } }, { &hf_pn_io_artype_req, { "ARType", "pn_io.artype_req", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_io_ar_properties_companion_ar, { "CompanionAR", "pn_io.ar_properties.companion_ar", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_companion_ar), 0x00000600, NULL, HFILL } }, { &hf_pn_io_ar_properties_achnowledge_companion_ar, { "AcknowledgeCompanionAR", "pn_io.ar_properties.acknowledge_companion_ar", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_acknowldege_companion_ar), 0x00000800, NULL, HFILL } }, { &hf_pn_io_ar_properties_reserved, { "Reserved", "pn_io.ar_properties.reserved", FT_UINT32, BASE_HEX, NULL, 0x0FFFF000, NULL, HFILL } }, { &hf_pn_io_ar_properties_time_aware_system, { "TimeAwareSystem", "pn_io.ar_properties.time_aware_system", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_time_aware_system), 0x10000000, NULL, HFILL } }, { &hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode, { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_legacy_startupmode), 0x20000000, NULL, HFILL } }, { &hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode, { "CombinedObjectContainer", "pn_io.ar_properties.combined_object_container", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_combined_object_container_with_advanced_startupmode), 0x20000000, NULL, HFILL } }, { &hf_pn_io_arproperties_StartupMode, { "StartupMode", "pn_io.ar_properties.StartupMode", FT_UINT32, BASE_HEX, VALS(pn_io_arpropertiesStartupMode), 0x40000000, NULL, HFILL } }, { &hf_pn_io_ar_properties_pull_module_alarm_allowed, { "PullModuleAlarmAllowed", "pn_io.ar_properties.pull_module_alarm_allowed", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_pull_module_alarm_allowed), 0x80000000, NULL, HFILL } }, { &hf_pn_RedundancyInfo, { "RedundancyInfo.EndPoint", "pn_io.srl_data.redundancyInfo", FT_UINT16, BASE_HEX, VALS(pn_io_RedundancyInfo), 0x0003, NULL, HFILL } }, { &hf_pn_RedundancyInfo_reserved, { "RedundancyInfo.reserved", "pn_io.srl_data.redundancyInfoReserved", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } }, { &hf_pn_io_number_of_ARDATAInfo, { "ARDataInfo.NumberOfEntries", "pn_io.number_of_ARDATAInfo", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_cminitiator_activitytimeoutfactor, { "CMInitiatorActivityTimeoutFactor", "pn_io.cminitiator_activitytimeoutfactor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_cminitiator_udprtport, { "CMInitiatorUDPRTPort", "pn_io.cminitiator_udprtport", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_station_name_length, { "StationNameLength", "pn_io.station_name_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_cminitiator_station_name, { "CMInitiatorStationName", "pn_io.cminitiator_station_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_parameter_server_station_name, { "ParameterServerStationName", "pn_io.parameter_server_station_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_cmresponder_macadd, { "CMResponderMacAdd", "pn_io.cmresponder_macadd", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL } }, { &hf_pn_io_cmresponder_udprtport, { "CMResponderUDPRTPort", "pn_io.cmresponder_udprtport", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_number_of_iocrs, { "NumberOfIOCRs", "pn_io.number_of_iocrs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_tree, { "IOCR", "pn_io.iocr_tree", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_type, { "IOCRType", "pn_io.iocr_type", FT_UINT16, BASE_HEX, VALS(pn_io_iocr_type), 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_reference, { "IOCRReference", "pn_io.iocr_reference", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_SubframeOffset, { "-> SubframeOffset", "pn_io.subframe_offset", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_SubframeData, { "SubframeData", "pn_io.subframe_data", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_RedundancyDataHoldFactor, { "RedundancyDataHoldFactor", "pn_io.RedundancyDataHoldFactor", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_RedundancyDataHoldFactor), 0x0, NULL, HFILL } }, { &hf_pn_io_sr_properties, { "SRProperties", "pn_io.sr_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0, { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR", FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_0), 0x00000001, NULL, HFILL } }, { &hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1, { "InputValidOnBackupAR", "pn_io.sr_properties.InputValidOnBackupAR", FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1), 0x00000001, NULL, HFILL } }, { &hf_pn_io_sr_properties_Reserved_1, { "Reserved_1", "pn_io.sr_properties.Reserved_1", FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Reserved1), 0x00000002, NULL, HFILL } }, { &hf_pn_io_sr_properties_Mode, { "Mode", "pn_io.sr_properties.Mode", FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_Mode), 0x00000004, NULL, HFILL } }, { &hf_pn_io_sr_properties_Reserved_2, { "Reserved_2", "pn_io.sr_properties.Reserved_2", FT_UINT32, BASE_HEX, NULL, 0x0000FFF8, NULL, HFILL } }, { &hf_pn_io_sr_properties_Reserved_3, { "Reserved_3", "pn_io.sr_properties.Reserved_3", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_arvendor_strucidentifier_if0_low, { "APStructureIdentifier: Vendor specific", "pn_io.structidentifier_api_0_low", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_arvendor_strucidentifier_if0_high, { "APStructureIdentifier: Administrative number for common profiles", "pn_io.structidentifier_api_0_high", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_arvendor_strucidentifier_if0_is8000, { "APStructureIdentifier: Extended identification rules", "pn_io.tructidentifier_api_0_is8000", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_arvendor_strucidentifier_not0, { "APStructureIdentifier: Administrative number for application profiles", "pn_io.tructidentifier_api_not_0", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_lt, { "LT", "pn_io.lt", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_properties, { "IOCRProperties", "pn_io.iocr_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_properties_rtclass, { "RTClass", "pn_io.iocr_properties.rtclass", FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_rtclass), 0x0000000F, NULL, HFILL } }, { &hf_pn_io_iocr_properties_reserved_1, { "Reserved1", "pn_io.iocr_properties.reserved1", FT_UINT32, BASE_HEX, NULL, 0x00000FF0, NULL, HFILL } }, { &hf_pn_io_iocr_properties_media_redundancy, { "MediaRedundancy", "pn_io.iocr_properties.media_redundancy", FT_UINT32, BASE_HEX, VALS(pn_io_iocr_properties_media_redundancy), 0x00000800, NULL, HFILL } }, { &hf_pn_io_iocr_properties_reserved_2, { "Reserved2", "pn_io.iocr_properties.reserved2", FT_UINT32, BASE_HEX, NULL, 0x00FFF000, NULL, HFILL } }, { &hf_pn_io_iocr_properties_reserved_3, { "Reserved3", "pn_io.iocr_properties.reserved3", FT_UINT32, BASE_HEX, NULL, 0x0F000000, NULL, HFILL } }, { &hf_pn_io_iocr_properties_fast_forwarding_mac_adr, { "FastForwardingMACAdr", "pn_io.iocr_properties.fast_forwarding_mac_adr", FT_UINT32, BASE_HEX, NULL, 0x20000000, NULL, HFILL } }, { &hf_pn_io_iocr_properties_distributed_subframe_watchdog, { "DistributedSubFrameWatchDog", "pn_io.iocr_properties.distributed_subframe_watchdog", FT_UINT32, BASE_HEX, NULL, 0x40000000, NULL, HFILL } }, { &hf_pn_io_iocr_properties_full_subframe_structure, { "FullSubFrameStructure", "pn_io.iocr_properties.full_subframe_structure", FT_UINT32, BASE_HEX, NULL, 0x80000000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties, { "SFIOCRProperties", "pn_io.SFIOCRProperties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_DistributedWatchDogFactor, { "SFIOCRProperties.DistributedWatchDogFactor", "pn_io.SFIOCRProperties.DistributedWatchDogFactor", FT_UINT32, BASE_HEX, NULL, 0x000000FF, NULL, HFILL } }, { &hf_pn_io_RestartFactorForDistributedWD, { "SFIOCRProperties.RestartFactorForDistributedWD", "pn_io.SFIOCRProperties.RestartFactorForDistributedWD", FT_UINT32, BASE_HEX, NULL, 0x0000ff00, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_DFPmode, { "SFIOCRProperties.DFPmode", "pn_io.SFIOCRProperties.DFPmode", FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_reserved_1, { "SFIOCRProperties.reserved_1", "pn_io.SFIOCRProperties.reserved_1", FT_UINT32, BASE_HEX, NULL, 0x0F000000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_reserved_2, { "SFIOCRProperties.reserved_2", "pn_io.SFIOCRProperties.reserved_2", FT_UINT32, BASE_HEX, NULL, 0x10000000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_DFPType, { "SFIOCRProperties.DFPType", "pn_io.SFIOCRProperties.DFPType", FT_UINT32, BASE_HEX, VALS(pn_io_SFIOCRProperties_DFPType_vals), 0x20000000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout, { "SFIOCRProperties.DFPRedundantPathLayout", "pn_io.SFIOCRProperties.DFPRedundantPathLayout", FT_UINT32, BASE_HEX, VALS(pn_io_DFPRedundantPathLayout_decode), 0x40000000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_SFCRC16, { "SFIOCRProperties.SFCRC16", "pn_io.SFIOCRProperties.SFCRC16", FT_UINT32, BASE_HEX, VALS(pn_io_SFCRC16_Decode), 0x80000000, NULL, HFILL } }, { &hf_pn_io_data_length, { "DataLength", "pn_io.data_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ir_frame_data, { "Frame data", "pn_io.ir_frame_data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_id, { "FrameID", "pn_io.frame_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_send_clock_factor, { "SendClockFactor", "pn_io.send_clock_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_reduction_ratio, { "ReductionRatio", "pn_io.reduction_ratio", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_phase, { "Phase", "pn_io.phase", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sequence, { "Sequence", "pn_io.sequence", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_send_offset, { "FrameSendOffset", "pn_io.frame_send_offset", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_data_properties, { "FrameDataProperties", "pn_io.frame_data_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_data_properties_forwarding_Mode, { "ForwardingMode", "pn_io.frame_data_properties_forwardingMode", FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_forwardingMode), 0x01, NULL, HFILL } }, { &hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd, { "FastForwardingMulticastMACAdd", "pn_io.frame_data_properties_MulticastMACAdd", FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FFMulticastMACAdd), 0x06, NULL, HFILL } }, { &hf_pn_io_frame_data_properties_FragmentMode, { "FragmentationMode", "pn_io.frame_data_properties_FragMode", FT_UINT32, BASE_HEX, VALS(hf_pn_io_frame_data_properties_FragMode), 0x18, NULL, HFILL } }, { &hf_pn_io_frame_data_properties_reserved_1, { "Reserved_1", "pn_io.frame_data.reserved_1", FT_UINT32, BASE_HEX, NULL, 0x0000FFE0, NULL, HFILL } }, { &hf_pn_io_frame_data_properties_reserved_2, { "Reserved_2", "pn_io.frame_data.reserved_2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_watchdog_factor, { "WatchdogFactor", "pn_io.watchdog_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_data_hold_factor, { "DataHoldFactor", "pn_io.data_hold_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_tag_header, { "IOCRTagHeader", "pn_io.iocr_tag_header", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocr_multicast_mac_add, { "IOCRMulticastMACAdd", "pn_io.iocr_multicast_mac_add", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_apis, { "NumberOfAPIs", "pn_io.number_of_apis", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_io_data_objects, { "NumberOfIODataObjects", "pn_io.number_of_io_data_objects", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_iocs, { "NumberOfIOCS", "pn_io.number_of_iocs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocs_frame_offset, { "IOCSFrameOffset", "pn_io.iocs_frame_offset", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_alarmcr_type, { "AlarmCRType", "pn_io.alarmcr_type", FT_UINT16, BASE_HEX, VALS(pn_io_alarmcr_type), 0x0, NULL, HFILL } }, { &hf_pn_io_alarmcr_properties, { "AlarmCRProperties", "pn_io.alarmcr_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_alarmcr_properties_priority, { "priority", "pn_io.alarmcr_properties.priority", FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_priority), 0x00000001, NULL, HFILL } }, { &hf_pn_io_alarmcr_properties_transport, { "Transport", "pn_io.alarmcr_properties.transport", FT_UINT32, BASE_HEX, VALS(pn_io_alarmcr_properties_transport), 0x00000002, NULL, HFILL } }, { &hf_pn_io_alarmcr_properties_reserved, { "Reserved", "pn_io.alarmcr_properties.reserved", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC, NULL, HFILL } }, { &hf_pn_io_rta_timeoutfactor, { "RTATimeoutFactor", "pn_io.rta_timeoutfactor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_rta_retries, { "RTARetries", "pn_io.rta_retries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* XXX - only values 3 - 15 allowed */ { &hf_pn_io_localalarmref, { "LocalAlarmReference", "pn_io.localalarmref", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_remotealarmref, { "RemoteAlarmReference", "pn_io.remotealarmref", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - special values */ { &hf_pn_io_maxalarmdatalength, { "MaxAlarmDataLength", "pn_io.maxalarmdatalength", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - only values 200 - 1432 allowed */ { &hf_pn_io_alarmcr_tagheaderhigh, { "AlarmCRTagHeaderHigh", "pn_io.alarmcr_tagheaderhigh", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - 16 bitfield! */ { &hf_pn_io_alarmcr_tagheaderlow, { "AlarmCRTagHeaderLow", "pn_io.alarmcr_tagheaderlow", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - 16 bitfield!*/ { &hf_pn_io_api_tree, { "API", "pn_io.api_tree", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_module_tree, { "Module", "pn_io.module_tree", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_tree, { "Submodule", "pn_io.submodule_tree", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_data_object, { "IODataObject", "pn_io.io_data_object", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_data_object_frame_offset, { "IODataObjectFrameOffset", "pn_io.io_data_object.frame_offset", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_cs, { "IOCS", "pn_io.io_cs", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_substitutionmode, { "Substitutionmode", "pn_io.substitutionmode", FT_UINT16, BASE_HEX, VALS(pn_io_substitutionmode), 0x0, NULL, HFILL } }, { &hf_pn_io_IRData_uuid, { "IRDataUUID", "pn_io.IRData_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_uuid, { "ARUUID", "pn_io.ar_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_target_ar_uuid, { "TargetARUUID", "pn_io.target_ar_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_discriminator, { "Discriminator", "pn_io.ar_discriminator", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_configid, { "ConfigID", "pn_io.ar_configid", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_arnumber, { "ARnumber", "pn_io.ar_arnumber", FT_UINT16, BASE_HEX, VALS(pn_io_ar_arnumber), 0x0007, NULL, HFILL } }, { &hf_pn_io_ar_arresource, { "ARresource", "pn_io.ar_arresource", FT_UINT16, BASE_HEX, VALS(pn_io_ar_arresource), 0x0018, NULL, HFILL } }, { &hf_pn_io_ar_arreserved, { "ARreserved", "pn_io.ar_arreserved", FT_UINT16, BASE_HEX, NULL, 0xFFE0, NULL, HFILL } }, { &hf_pn_io_ar_selector, { "Selector", "pn_io.ar_selector", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_api, { "API", "pn_io.api", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_slot_nr, { "SlotNumber", "pn_io.slot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_subslot_nr, { "SubslotNumber", "pn_io.subslot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_index, { "Index", "pn_io.index", FT_UINT16, BASE_HEX, VALS(pn_io_index), 0x0, NULL, HFILL } }, { &hf_pn_io_seq_number, { "SeqNumber", "pn_io.seq_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_record_data_length, { "RecordDataLength", "pn_io.record_data_length", FT_UINT32, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_add_val1, { "AdditionalValue1", "pn_io.add_val1", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_add_val2, { "AdditionalValue2", "pn_io.add_val2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_block_header, { "BlockHeader", "pn_io.block_header", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_block_type, { "BlockType", "pn_io.block_type", FT_UINT16, BASE_HEX, VALS(pn_io_block_type), 0x0, NULL, HFILL } }, { &hf_pn_io_block_length, { "BlockLength", "pn_io.block_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_block_version_high, { "BlockVersionHigh", "pn_io.block_version_high", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_block_version_low, { "BlockVersionLow", "pn_io.block_version_low", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sessionkey, { "SessionKey", "pn_io.session_key", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_control_alarm_sequence_number, { "AlarmSequenceNumber", "pn_io.control_alarm_sequence_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_control_command, { "ControlCommand", "pn_io.control_command", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_control_command_reserved, { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_control_command_prmend, { "PrmEnd", "pn_io.control_command.prmend", FT_UINT16, BASE_DEC, NULL, 0x0001, NULL, HFILL } }, { &hf_pn_io_control_command_applready, { "ApplicationReady", "pn_io.control_command.applready", FT_UINT16, BASE_DEC, NULL, 0x0002, NULL, HFILL } }, { &hf_pn_io_control_command_release, { "Release", "pn_io.control_command.release", FT_UINT16, BASE_DEC, NULL, 0x0004, NULL, HFILL } }, { &hf_pn_io_control_command_done, { "Done", "pn_io.control_command.done", FT_UINT16, BASE_DEC, NULL, 0x0008, NULL, HFILL } }, { &hf_pn_io_control_command_ready_for_companion, { "ReadyForCompanion", "pn_io.control_command.ready_for_companion", FT_UINT16, BASE_DEC, NULL, 0x0010, NULL, HFILL } }, { &hf_pn_io_control_command_ready_for_rt_class3, { "ReadyForRT Class 3", "pn_io.control_command.ready_for_rt_class3", FT_UINT16, BASE_DEC, NULL, 0x0020, NULL, HFILL } }, { &hf_pn_io_control_command_prmbegin, { "PrmBegin", "pn_io.control_command.prmbegin", FT_UINT16, BASE_DEC, VALS(pn_io_control_properties_prmbegin_vals), 0x0040, NULL, HFILL } }, { &hf_pn_io_control_command_reserved_7_15, { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved_7_15", FT_UINT16, BASE_HEX, NULL, 0xFF80, NULL, HFILL } }, { &hf_pn_io_control_block_properties, { "ControlBlockProperties", "pn_io.control_block_properties", FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_control_block_properties_applready, { "ControlBlockProperties", "pn_io.control_block_properties.appl_ready", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_control_block_properties_applready_bit0, { "ApplicationReady.Bit0", "pn_io.control_block_properties.appl_ready_bit0", FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_application_ready_bit0_vals), 0x0001, NULL, HFILL } }, { &hf_pn_io_control_block_properties_applready_bit1, { "ApplicationReady.Bit1", "pn_io.control_block_properties.appl_ready_bit1", FT_UINT16, BASE_HEX, VALS(pn_io_control_properties_application_ready_bit1_vals), 0x0002, NULL, HFILL } }, { &hf_pn_io_control_block_properties_applready_otherbits, { "ApplicationReady.Bit2-15(reserved)", "pn_io.control_block_properties.appl_ready_otherbits", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } }, { &hf_pn_io_SubmoduleListEntries, { "NumberOfEntries", "pn_io.SubmoduleListEntries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_block, { "Block", "pn_io.block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_alarm_type, { "AlarmType", "pn_io.alarm_type", FT_UINT16, BASE_HEX, VALS(pn_io_alarm_type), 0x0, NULL, HFILL } }, { &hf_pn_io_alarm_specifier, { "AlarmSpecifier", "pn_io.alarm_specifier", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_alarm_specifier_sequence, { "SequenceNumber", "pn_io.alarm_specifier.sequence", FT_UINT16, BASE_HEX, NULL, 0x07FF, NULL, HFILL } }, { &hf_pn_io_alarm_specifier_channel, { "ChannelDiagnosis", "pn_io.alarm_specifier.channel", FT_UINT16, BASE_HEX, NULL, 0x0800, NULL, HFILL } }, { &hf_pn_io_alarm_specifier_manufacturer, { "ManufacturerSpecificDiagnosis", "pn_io.alarm_specifier.manufacturer", FT_UINT16, BASE_HEX, NULL, 0x1000, NULL, HFILL } }, { &hf_pn_io_alarm_specifier_submodule, { "SubmoduleDiagnosisState", "pn_io.alarm_specifier.submodule", FT_UINT16, BASE_HEX, NULL, 0x2000, NULL, HFILL } }, { &hf_pn_io_alarm_specifier_ardiagnosis, { "ARDiagnosisState", "pn_io.alarm_specifier.ardiagnosis", FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL } }, { &hf_pn_io_alarm_dst_endpoint, { "AlarmDstEndpoint", "pn_io.alarm_dst_endpoint", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_alarm_src_endpoint, { "AlarmSrcEndpoint", "pn_io.alarm_src_endpoint", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdu_type, { "PDUType", "pn_io.pdu_type", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdu_type_type, { "Type", "pn_io.pdu_type.type", FT_UINT8, BASE_HEX, VALS(pn_io_pdu_type), 0x0F, NULL, HFILL } }, { &hf_pn_io_pdu_type_version, { "Version", "pn_io.pdu_type.version", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, { &hf_pn_io_add_flags, { "AddFlags", "pn_io.add_flags", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_window_size, { "WindowSize", "pn_io.window_size", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } }, { &hf_pn_io_tack, { "TACK", "pn_io.tack", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, { &hf_pn_io_send_seq_num, { "SendSeqNum", "pn_io.send_seq_num", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ack_seq_num, { "AckSeqNum", "pn_io.ack_seq_num", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_var_part_len, { "VarPartLen", "pn_io.var_part_len", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_module_ident_number, { "ModuleIdentNumber", "pn_io.module_ident_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_ident_number, { "SubmoduleIdentNumber", "pn_io.submodule_ident_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_modules, { "NumberOfModules", "pn_io.number_of_modules", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_module_properties, { "ModuleProperties", "pn_io.module_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_module_state, { "ModuleState", "pn_io.module_state", FT_UINT16, BASE_HEX, VALS(pn_io_module_state), 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_submodules, { "NumberOfSubmodules", "pn_io.number_of_submodules", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_properties, { "SubmoduleProperties", "pn_io.submodule_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_properties_type, { "Type", "pn_io.submodule_properties.type", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_type), 0x0003, NULL, HFILL } }, { &hf_pn_io_submodule_properties_shared_input, { "SharedInput", "pn_io.submodule_properties.shared_input", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_shared_input), 0x0004, NULL, HFILL } }, { &hf_pn_io_submodule_properties_reduce_input_submodule_data_length, { "ReduceInputSubmoduleDataLength", "pn_io.submodule_properties.reduce_input_submodule_data_length", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_input_submodule_data_length), 0x0008, NULL, HFILL } }, { &hf_pn_io_submodule_properties_reduce_output_submodule_data_length, { "ReduceOutputSubmoduleDataLength", "pn_io.submodule_properties.reduce_output_submodule_data_length", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_reduce_output_submodule_data_length), 0x0010, NULL, HFILL } }, { &hf_pn_io_submodule_properties_discard_ioxs, { "DiscardIOXS", "pn_io.submodule_properties.discard_ioxs", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_properties_discard_ioxs), 0x0020, NULL, HFILL } }, { &hf_pn_io_submodule_properties_reserved, { "Reserved", "pn_io.submodule_properties.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFC0, NULL, HFILL } }, { &hf_pn_io_submodule_state, { "SubmoduleState", "pn_io.submodule_state", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_state_format_indicator, { "FormatIndicator", "pn_io.submodule_state.format_indicator", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_format_indicator), 0x8000, NULL, HFILL } }, { &hf_pn_io_submodule_state_add_info, { "AddInfo", "pn_io.submodule_state.add_info", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_add_info), 0x0007, NULL, HFILL } }, { &hf_pn_io_submodule_state_advice, { "Advice", "pn_io.submodule_state.advice", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_advice), 0x0008, NULL, HFILL } }, { &hf_pn_io_submodule_state_maintenance_required, { "MaintenanceRequired", "pn_io.submodule_state.maintenance_required", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_required), 0x0010, NULL, HFILL } }, { &hf_pn_io_submodule_state_maintenance_demanded, { "MaintenanceDemanded", "pn_io.submodule_state.maintenance_demanded", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_demanded), 0x0020, NULL, HFILL } }, { &hf_pn_io_submodule_state_fault, { "Fault", "pn_io.submodule_state.fault", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_fault), 0x0040, NULL, HFILL } }, { &hf_pn_io_submodule_state_ar_info, { "ARInfo", "pn_io.submodule_state.ar_info", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ar_info), 0x0780, NULL, HFILL } }, { &hf_pn_io_submodule_state_ident_info, { "IdentInfo", "pn_io.submodule_state.ident_info", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_ident_info), 0x7800, NULL, HFILL } }, { &hf_pn_io_submodule_state_detail, { "Detail", "pn_io.submodule_state.detail", FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_detail), 0x7FFF, NULL, HFILL } }, { &hf_pn_io_data_description_tree, { "DataDescription", "pn_io.data_description_tree", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_data_description, { "DataDescription", "pn_io.data_description", FT_UINT16, BASE_HEX, VALS(pn_io_data_description), 0x0, NULL, HFILL } }, { &hf_pn_io_submodule_data_length, { "SubmoduleDataLength", "pn_io.submodule_data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_iocs, { "LengthIOCS", "pn_io.length_iocs", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_iops, { "LengthIOPS", "pn_io.length_iops", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocs, { "IOCS", "pn_io.ioxs", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iops, { "IOPS", "pn_io.iops", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ioxs_extension, { "Extension (1:another IOxS follows/0:no IOxS follows)", "pn_io.ioxs.extension", FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL } }, { &hf_pn_io_ioxs_res14, { "Reserved (should be zero)", "pn_io.ioxs.res14", FT_UINT8, BASE_HEX, NULL, 0x1E, NULL, HFILL } }, { &hf_pn_io_ioxs_instance, { "Instance (only valid, if DataState is bad)", "pn_io.ioxs.instance", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs), 0x60, NULL, HFILL } }, { &hf_pn_io_ioxs_datastate, { "DataState (1:good/0:bad)", "pn_io.ioxs.datastate", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, { &hf_pn_io_address_resolution_properties, { "AddressResolutionProperties", "pn_io.address_resolution_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mci_timeout_factor, { "MCITimeoutFactor", "pn_io.mci_timeout_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_provider_station_name, { "ProviderStationName", "pn_io.provider_station_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_user_structure_identifier, { "UserStructureIdentifier", "pn_io.user_structure_identifier", FT_UINT16, BASE_HEX, VALS(pn_io_user_structure_identifier), 0x0, NULL, HFILL } }, { &hf_pn_io_user_structure_identifier_manf, { "UserStructureIdentifier manufacturer specific", "pn_io.user_structure_identifier_manf", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ar_properties_reserved_1, { "Reserved_1", "pn_io.ar_properties.reserved_1", FT_UINT32, BASE_HEX, NULL, 0x000000E0, NULL, HFILL }}, { &hf_pn_io_ar_properties_device_access, { "DeviceAccess", "pn_io.ar_properties.device_access", FT_UINT32, BASE_HEX, VALS(pn_io_arproperties_DeviceAccess), 0x00000100, NULL, HFILL }}, { &hf_pn_io_subframe_data, { "SubFrameData", "pn_io.subframe_data", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_subframe_reserved2, { "Reserved2", "pn_io.subframe_data.reserved2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_subframe_data_length, { "DataLength", "pn_io.subframe_data.data_length", FT_UINT32, BASE_HEX, NULL, 0x0000FF00, NULL, HFILL } }, { &hf_pn_io_subframe_reserved1, { "Reserved1", "pn_io.subframe_data.reserved1", FT_UINT32, BASE_HEX, NULL, 0x00000080, NULL, HFILL } }, { &hf_pn_io_subframe_data_position, { "DataPosition", "pn_io.subframe_data.position", FT_UINT32, BASE_HEX, NULL, 0x0000007F, NULL, HFILL } }, { &hf_pn_io_subframe_data_reserved1, { "Reserved1", "pn_io.subframe_data.reserved_1", FT_UINT32, BASE_HEX, NULL, 0x00000080, NULL, HFILL } }, { &hf_pn_io_subframe_data_reserved2, { "Reserved2", "pn_io.subframe_data.reserved_2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_channel_number, { "ChannelNumber", "pn_io.channel_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_channel_properties, { "ChannelProperties", "pn_io.channel_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_channel_properties_type, { "Type", "pn_io.channel_properties.type", FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_type), 0x00FF, NULL, HFILL } }, { &hf_pn_io_channel_properties_accumulative, { "Accumulative", "pn_io.channel_properties.accumulative", FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_accumulative_vals), 0x0100, NULL, HFILL } }, { &hf_pn_io_NumberOfSubframeBlocks, { "NumberOfSubframeBlocks", "pn_io.NumberOfSubframeBlocks", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_channel_properties_maintenance, { "Maintenance (Severity)", "pn_io.channel_properties.maintenance", FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_maintenance), 0x0600, NULL, HFILL } }, { &hf_pn_io_channel_properties_specifier, { "Specifier", "pn_io.channel_properties.specifier", FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_specifier), 0x1800, NULL, HFILL } }, { &hf_pn_io_channel_properties_direction, { "Direction", "pn_io.channel_properties.direction", FT_UINT16, BASE_HEX, VALS(pn_io_channel_properties_direction), 0xE000, NULL, HFILL } }, { &hf_pn_io_channel_error_type, { "ChannelErrorType", "pn_io.channel_error_type", FT_UINT16, BASE_HEX, VALS(pn_io_channel_error_type), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0, { "ExtChannelErrorType", "pn_io.ext_channel_error_type0", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8000, { "ExtChannelErrorType", "pn_io.ext_channel_error_type0800", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8000), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8001, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8001", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8001), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8002, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8002", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8002), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8003, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8003", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8003), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8004, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8004", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8004), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8005, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8005", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8005), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8007, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8007", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8007), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8008, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8008", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8008), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x800A, { "ExtChannelErrorType", "pn_io.ext_channel_error_type800A", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800A), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x800B, { "ExtChannelErrorType", "pn_io.ext_channel_error_type800B", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800B), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x800C, { "ExtChannelErrorType", "pn_io.ext_channel_error_type800C", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x800C), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type0x8010, { "ExtChannelErrorType", "pn_io.ext_channel_error_type8010", FT_UINT16, BASE_HEX, VALS(pn_io_ext_channel_error_type0x8010), 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_error_type, { "ExtChannelErrorType", "pn_io.ext_channel_error_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ext_channel_add_value, { "ExtChannelAddValue", "pn_io.ext_channel_add_value", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_qualified_channel_qualifier, { "QualifiedChannelQualifier", "pn_io.qualified_channel_qualifier", FT_UINT32, BASE_HEX, VALS(pn_io_qualified_channel_qualifier), 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_subdomain_id, { "PTCPSubdomainID", "pn_io.ptcp_subdomain_id", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ir_data_id, { "IRDataID", "pn_io.ir_data_id", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_max_bridge_delay, { "MaxBridgeDelay", "pn_io.max_bridge_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_ports, { "NumberOfPorts", "pn_io.number_of_ports", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_max_port_tx_delay, { "MaxPortTxDelay", "pn_io.max_port_tx_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_max_port_rx_delay, { "MaxPortRxDelay", "pn_io.max_port_rx_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_max_line_rx_delay, { "MaxLineRxDelay", "pn_io.max_line_rx_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_yellowtime, { "YellowTime", "pn_io.yellowtime", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_reserved_interval_begin, { "ReservedIntervalBegin", "pn_io.reserved_interval_begin", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_reserved_interval_end, { "ReservedIntervalEnd", "pn_io.reserved_interval_end", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pllwindow, { "PLLWindow", "pn_io.pllwindow", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sync_send_factor, { "SyncSendFactor", "pn_io.sync_send_factor", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sync_properties, { "SyncProperties", "pn_io.sync_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_sync_frame_address, { "SyncFrameAddress", "pn_io.sync_frame_address", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_timeout_factor, { "PTCPTimeoutFactor", "pn_io.ptcp_timeout_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_takeover_timeout_factor, { "PTCPTakeoverTimeoutFactor", "pn_io.ptcp_takeover_timeout_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_master_startup_time, { "PTCPMasterStartupTime", "pn_io.ptcp_master_startup_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_master_priority_1, { "PTCP_MasterPriority1", "pn_io.ptcp_master_priority_1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_master_priority_2, { "PTCP_MasterPriority2", "pn_io.ptcp_master_priority_2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_length_subdomain_name, { "PTCPLengthSubdomainName", "pn_io.ptcp_length_subdomain_name", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ptcp_subdomain_name, { "PTCPSubdomainName", "pn_io.ptcp_subdomain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_MultipleInterfaceMode_NameOfDevice, { "MultipleInterfaceMode.NameOfDevice", "pn_io.MultipleInterfaceMode_NameOfDevice", FT_UINT32, BASE_HEX, VALS(pn_io_MultipleInterfaceMode_NameOfDevice), 0x01, NULL, HFILL } }, { &hf_pn_io_MultipleInterfaceMode_reserved_1, { "MultipleInterfaceMode.Reserved_1", "pn_io.MultipleInterfaceMode_reserved_1", FT_UINT32, BASE_HEX, NULL, 0xFFFE, NULL, HFILL } }, { &hf_pn_io_MultipleInterfaceMode_reserved_2, { "MultipleInterfaceMode.Reserved_2", "pn_io.MultipleInterfaceMode_reserved_2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status, { "CounterStatus", "pn_io.CounterStatus", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifInOctets, { "CounterStatus.ifInOctets", "pn_io.CounterStatus.ifInOctets", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0001, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifOutOctets, { "CounterStatus.ifOutOctets", "pn_io.CounterStatus.ifOutOctets", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0002, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifInDiscards, { "CounterStatus.ifInDiscards", "pn_io.CounterStatus.ifInDiscards", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0004, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifOutDiscards, { "CounterStatus.ifOutDiscards", "pn_io.CounterStatus.ifOutDiscards", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0008, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifInErrors, { "CounterStatus.ifInErrors", "pn_io.CounterStatus.ifInErrors", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0010, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_ifOutErrors, { "CounterStatus.ifOutErrors", "pn_io.CounterStatus.ifOutErrors", FT_BOOLEAN, 16, TFS(&pn_io_pdportstatistic_counter_status_contents), 0x0020, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_counter_status_reserved, { "CounterStatus.Reserved", "pn_io.CounterStatus.Reserved", FT_UINT16, BASE_HEX, VALS(pn_io_pdportstatistic_counter_status_reserved), 0xFFC0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifInOctets, { "ifInOctets", "pn_io.ifInOctets", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifOutOctets, { "ifOutOctets", "pn_io.ifOutOctets", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifInDiscards, { "ifInDiscards", "pn_io.ifInDiscards", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifOutDiscards, { "ifOutDiscards", "pn_io.ifOutDiscards", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifInErrors, { "ifInErrors", "pn_io.ifInErrors", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_pdportstatistic_ifOutErrors, { "ifOutErrors", "pn_io.ifOutErrors", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_domain_boundary, { "DomainBoundary", "pn_io.domain_boundary", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_domain_boundary_ingress, { "DomainBoundaryIngress", "pn_io.domain_boundary.ingress", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_domain_boundary_egress, { "DomainBoundaryEgress", "pn_io.domain_boundary.egress", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_multicast_boundary, { "MulticastBoundary", "pn_io.multicast_boundary", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_adjust_properties, { "AdjustProperties", "pn_io.adjust_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_PreambleLength, { "Preamble Length", "pn_io.preamble_length", FT_UINT16, BASE_DEC_HEX, VALS(pn_io_preamble_length), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_max_supported_record_size, { "MaxSupportedRecordSize", "pn_io.tsn_upload_network_attributes.max_supported_record_size", FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_max_supported_record_size_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_transfer_time_tx, { "TransferTimeTX", "pn_io.tsn_upload_network_attributes.transfer_time_tx", FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_transfer_time_tx_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_transfer_time_rx, { "TransferTimeRX", "pn_io.tsn_upload_network_attributes.transfer_time_rx", FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_transfer_time_rx_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_number_of_queues, { "NumberOfQueues", "pn_io.tsn_port_id_block.number_of_queues", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_number_of_queues_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_forwarding_delay_block_number_of_entries, { "TSNForwardingDelayBlockNumberOfEntries", "pn_io.tsn_forward_delaying_block.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_port_id_block_number_of_entries, { "TSNPortIDBlockNumberOfEntries", "pn_io.tsn_port_id_block.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_expected_neighbor_block_number_of_entries, { "TSNExpectedNeighborBlockNumberOfEntries", "pn_io.tsn_expected_neighbor_block.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_port_capabilities_time_aware, { "TSNPortCapabilities.TimeAware", "pn_io.tsn_port_capabilities.time_aware", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_port_capabilities_time_aware_vals), 0x01, NULL, HFILL } }, { &hf_pn_io_tsn_port_capabilities_preemption, { "TSNPortCapabilities.Preemption", "pn_io.tsn_port_capabilities.preemption", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_port_capabilities_preemption_vals), 0x02, NULL, HFILL } }, { &hf_pn_io_tsn_port_capabilities_queue_masking, { "TSNPortCapabilities.QueueMasking", "pn_io.tsn_port_capabilities.queue_masking", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_port_capabilities_queue_masking_vals), 0x04, NULL, HFILL } }, { &hf_pn_io_tsn_port_capabilities_reserved, { "TSNPortCapabilities.Reserved", "pn_io.tsn_port_capabilities_reserved", FT_UINT8, BASE_HEX, NULL, 0xF8, NULL, HFILL } }, { &hf_pn_io_tsn_forwarding_group, { "ForwardingGroup", "pn_io.tsn_port_id_block.forwarding_group", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_forwarding_group_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_forwarding_group_ingress, { "ForwardingGroupIngress", "pn_io.tsn_port_id_block.forwarding_group_ingress", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_forwarding_group_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_forwarding_group_egress, { "ForwardingGroupEgress", "pn_io.tsn_port_id_block.forwarding_group_egress", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_forwarding_group_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_stream_class, { "StreamClass", "pn_io.tsn_forwarding_delay_entry.stream_class", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_stream_class_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_dependent_forwarding_delay, { "DependentForwardDelay", "pn_io.tsn_forwarding_delay_entry.dependent_forwarding_delay", FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_dependent_forwarding_delay_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_independent_forwarding_delay, { "IndependentForwardDelay", "pn_io.tsn_forwarding_delay_entry.independent_forwarding_delay", FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_independent_forwarding_delay_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_nme_parameter_uuid, { "NMEParameterUUID", "pn_io.tsn_nme_parameter_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config, { "TSNDomainVIDConfig", "pn_io.tsn_domain_vid_config", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_stream_high_vid, { "TSNDomainVIDConfig.StreamHighVID", "pn_io.tsn_domain_vid_config.stream_high_vid", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_stream_high_red_vid, { "TSNDomainVIDConfig.StreamHighRedVID", "pn_io.tsn_domain_vid_config.stream_high_red_vid", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_stream_low_vid, { "TSNDomainVIDConfig.StreamLowVID", "pn_io.tsn_domain_vid_config.stream_low_vid", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_stream_low_red_vid, { "TSNDomainVIDConfig.StreamLowRedVID", "pn_io.tsn_domain_vid_config.stream_low_red_vid", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_non_stream_vid, { "TSNDomainVIDConfig.NonStreamVID", "pn_io.tsn_domain_vid_config.non_stream_vid", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_non_stream_vid_B, { "TSNDomainVIDConfig.NonStreamVIDB", "pn_io.tsn_domain_vid_config.non_stream_vid_B", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_non_stream_vid_C, { "TSNDomainVIDConfig.NonStreamVIDC", "pn_io.tsn_domain_vid_config.non_stream_vid_C", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_non_stream_vid_D, { "TSNDomainVIDConfig.NonStreamVIDD", "pn_io.tsn_domain_vid_config.non_stream_vid_D", FT_UINT16, BASE_HEX, VALS(pn_io_tsn_domain_vid_config_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_vid_config_reserved, { "TSNDomainVIDConfig.Reserved", "pn_io.tsn_domain_vid_config.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_domain_port_config_entries, { "TSNDomainPortConfig.NumberOfEntries", "pn_io.tsn_domain_port_config.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_time_data_block_entries, { "TSNTimeDataBlock.NumberOfEntries", "pn_io.tsn_time_data_block.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_domain_queue_rate_limiter_entries, { "TSNDomainQueueRateLimiter.NumberOfEntries", "pn_io.tsn_domain_queue_rate_limiter.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_domain_port_ingress_rate_limiter_entries, { "TSNDomainPortIngressRateLimiter.NumberOfEntries", "pn_io.tsn_domain_port_ingress_limiter.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_config, { "TSNDomainPortConfig", "pn_io.tsn_domain_port_config", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_config_preemption_enabled, { "TSNDomainPortConfig.PreemptionEnabled", "pn_io.tsn_domain_port_config.preemption_enabled", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_domain_port_config_preemption_enabled_vals), 0x01, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_config_boundary_port_config, { "TSNDomainPortConfig.BoundaryPortConfig", "pn_io.tsn_domain_port_config.boundary_port_config", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_domain_port_config_boundary_port_config_vals), 0x0E, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_config_reserved, { "TSNDomainPortConfig.Reserved", "pn_io.tsn_domain_port_config.reserved", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_ingress_rate_limiter, { "TSNDomainPortIngressRateLimiter", "pn_io.tsn_domain_port_ingress_rate_limiter", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_ingress_rate_limiter_cir, { "TSNDomainPortIngressRateLimiter.Cir", "pn_io.tsn_domain_port_ingress_rate_limiter.cir", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_port_ingress_rate_limiter_cir), 0x000000000000FFFF, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_ingress_rate_limiter_cbs, { "TSNDomainPortIngressRateLimiter.Cbs", "pn_io.tsn_domain_port_ingress_rate_limiter.cbs", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_port_ingress_rate_limiter_cbs), 0x00000000FFFF0000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_ingress_rate_limiter_envelope, { "TSNDomainPortIngressRateLimiter.Envelope", "pn_io.tsn_domain_port_ingress_rate_limiter.envelope", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_port_ingress_rate_limiter_envelope), 0x0000FFFF00000000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_ingress_rate_limiter_rank, { "TSNDomainPortIngressRateLimiter.Rank", "pn_io.tsn_domain_port_ingress_rate_limiter.rank", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_port_ingress_rate_limiter_rank), 0xFFFF000000000000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter, { "TSNDomainQueueRateLimiter", "pn_io.tsn_domain_port_queue_rate_limiter", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_cir, { "TSNDomainQueueRateLimiter.Cir", "pn_io.tsn_domain_port_queue_rate_limiter.cir", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_cir), 0x000000000000FFFF, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_cbs, { "TSNDomainQueueRateLimiter.Cbs", "pn_io.tsn_domain_port_queue_rate_limiter.cbs", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_cbs), 0x00000000FFFF0000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_envelope, { "TSNDomainQueueRateLimiter.Envelope", "pn_io.tsn_domain_port_queue_rate_limiter.envelope", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_envelope), 0x000000FF00000000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_rank, { "TSNDomainQueueRateLimiter.Rank", "pn_io.tsn_domain_port_queue_rate_limiter.rank", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_rank), 0x0000FF0000000000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_queue_id, { "TSNDomainQueueRateLimiter.QueueID", "pn_io.tsn_domain_port_queue_rate_limiter.queue_id", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_queue_id), 0x00FF000000000000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_rate_limiter_reserved, { "TSNDomainQueueRateLimiter.Reserved", "pn_io.tsn_domain_port_queue_rate_limiter.reserved", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_rate_limiter_reserved), 0xFF00000000000000, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_domain_queue_config_entries, { "TSNDomainQueueConfig.NumberOfEntries", "pn_io.tsn_domain_queue_config.number_of_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config, { "TSNDomainQueueConfig", "pn_io.tsn_domain_queue_config", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_queue_id, { "TSNDomainQueueConfig.QueueID", "pn_io.tsn_domain_queue_config.queue_id", FT_UINT64, BASE_HEX, NULL, 0xF, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_tci_pcp, { "TSNDomainQueueConfig.TciPcp", "pn_io.tsn_domain_queue_config.tci_pcp", FT_UINT64, BASE_HEX, NULL, 0x70, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_shaper, { "TSNDomainQueueConfig.Shaper", "pn_io.tsn_domain_queue_config.shaper", FT_UINT64, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_queue_config_shaper), 0x3F80, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_preemption_mode, { "TSNDomainQueueConfig.PreemptionMode", "pn_io.tsn_domain_queue_config.preemption_mode", FT_UINT64, BASE_HEX, NULL, 0xC000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_unmask_time_offset, { "TSNDomainQueueConfig.UnmaskTimeOffset", "pn_io.tsn_domain_queue_config.unmask_time_offset", FT_UINT64, BASE_HEX, NULL, 0xFFFFFF0000, NULL, HFILL } }, { &hf_pn_io_tsn_domain_queue_config_mask_time_offset, { "TSNDomainQueueConfig.MaskTimeOffset", "pn_io.tsn_domain_queue_config.mask_time_offset", FT_UINT64, BASE_HEX, NULL, 0xFFFFFF0000000000, NULL, HFILL } }, { &hf_pn_io_network_deadline, { "NetworkDeadline", "pn_io.network_deadline", FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_network_domain), 0x0, NULL, HFILL } }, { &hf_pn_io_time_domain_number, { "TimeDomainNumber", "pn_io.time_domain_number", FT_UINT16, BASE_HEX , VALS(pn_io_time_domain_number_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_time_pll_window, { "TimePLLWindow", "pn_io.time_pll_window", FT_UINT32, BASE_DEC , VALS(pn_io_time_pll_window_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_message_interval_factor, { "MessageIntervalFactor", "pn_io.message_interval_factor", FT_UINT32, BASE_DEC , VALS(pn_io_message_interval_factor_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_message_timeout_factor, { "MessageTimeoutFactor", "pn_io.message_timeout_factor", FT_UINT16, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_message_timeout_factor), 0x0, NULL, HFILL } }, { &hf_pn_io_time_sync_properties, { "TimeSyncProperties", "pn_io.time_sync_properties", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_sync_properties_role, { "TimeSyncProperties.Role", "pn_io.time_sync_properties.role", FT_UINT16, BASE_HEX, VALS(pn_io_time_sync_properties_vals), 0x3, NULL, HFILL } }, { &hf_pn_io_time_sync_properties_reserved, { "TimeSyncProperties.Reserved", "pn_io.time_sync_properties.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } }, { &hf_pn_io_time_domain_uuid, { "TimeDomainUUID", "pn_io.time_domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_domain_name_length, { "TimeDomainNameLength", "pn_io.time_domain_name_length", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_domain_name, { "TimeDomainName", "pn_io.time_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_nme_name_uuid, { "TSNNMENameUUID", "pn_io.tsn_nme_name_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_nme_name_length, { "TSNNMENameLength", "pn_io.tsn_nme_name_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_nme_name, { "TSNNMEName", "pn_io.tsn_nme_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_uuid, { "TSNDomainUUID", "pn_io.tsn_domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_name_length, { "TSNDomainNameLength", "pn_io.tsn_domain_name_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_name, { "TSNDomainName", "pn_io.tsn_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_fdb_command, { "FDBCommand", "pn_io.tsn_fdb_command", FT_UINT8, BASE_HEX, VALS(pn_io_tsn_fdb_command), 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_dst_add, { "DestinationAddress", "pn_io.tsn_dst_add", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_tsn_domain_sync_tree_entries, { "NumberOfEntries", "pn_io.tsn_domain_sync_tree_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_port_id, { "TSNDomainPortID", "pn_io.tsn_domain_port_id", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tsn_domain_sync_port_role, { "SyncPortRole", "pn_io.tsn_domain_sync_port_rule", FT_UINT8,BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_tsn_domain_sync_port_role_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_mau_type, { "MAUType", "pn_io.mau_type", FT_UINT16, BASE_HEX, VALS(pn_io_mau_type), 0x0, NULL, HFILL } }, { &hf_pn_io_mau_type_mode, { "MAUTypeMode", "pn_io.mau_type_mode", FT_UINT16, BASE_HEX, VALS(pn_io_mau_type_mode), 0x0, NULL, HFILL } }, { &hf_pn_io_dcp_boundary_value, { "DCPBoundary", "pn_io.dcp_boundary_value", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_dcp_boundary_value_bit0, { "DCPBoundary", "pn_io.dcp_boundary_value_bit0", FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit0), 0x1, NULL, HFILL } }, { &hf_pn_io_dcp_boundary_value_bit1, { "DCPBoundary", "pn_io.dcp_boundary_value_bit1", FT_UINT32, BASE_HEX, VALS(pn_io_dcp_boundary_value_bit1), 0x2, NULL, HFILL } }, { &hf_pn_io_dcp_boundary_value_otherbits, { "DCPBoundary", "pn_io.dcp_boundary_value_otherbits", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC, NULL, HFILL } }, { &hf_pn_io_peer_to_peer_boundary_value, { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_to_peer_boundary_value_bit0, { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit0", FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit0), 0x1, NULL, HFILL } }, { &hf_pn_io_peer_to_peer_boundary_value_bit1, { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit1", FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit1), 0x2, NULL, HFILL } }, { &hf_pn_io_peer_to_peer_boundary_value_bit2, { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_bit2", FT_UINT32, BASE_HEX, VALS(pn_io_peer_to_peer_boundary_value_bit2), 0x4, NULL, HFILL } }, { &hf_pn_io_peer_to_peer_boundary_value_otherbits, { "AdjustPeerToPeer-Boundary", "pn_io.peer_to_peer_boundary_value_otherbits", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF8, NULL, HFILL } }, { &hf_pn_io_port_state, { "PortState", "pn_io.port_state", FT_UINT16, BASE_HEX, VALS(pn_io_port_state), 0x0, NULL, HFILL } }, { &hf_pn_io_link_state_port, { "LinkState.Port", "pn_io.link_state_port", FT_UINT8, BASE_HEX, VALS(pn_io_link_state_port), 0x0, NULL, HFILL } }, { &hf_pn_io_link_state_link, { "LinkState.Link", "pn_io.link_state_link", FT_UINT8, BASE_HEX, VALS(pn_io_link_state_link), 0x0, NULL, HFILL } }, { &hf_pn_io_line_delay, { "LineDelay", "pn_io.line_delay", FT_UINT32, BASE_HEX, NULL, 0x0, "LineDelay in nanoseconds", HFILL } }, { &hf_pn_io_line_delay_value, { "LineDelayValue", "pn_io.line_delay_value", FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_line_delay_value), 0x7FFFFFFF, NULL, HFILL } }, { &hf_pn_io_cable_delay_value, { "CableDelayValue", "pn_io.cable_delay_value", FT_UINT32, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_io_cable_delay_value), 0x7FFFFFFF, NULL, HFILL } }, { &hf_pn_io_line_delay_format_indicator, { "LineDelayFormatIndicator", "pn_io.line_delay_format_indicator", FT_UINT32, BASE_HEX, NULL, 0x80000000, "LineDelay FormatIndicator", HFILL } }, { &hf_pn_io_number_of_peers, { "NumberOfPeers", "pn_io.number_of_peers", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_peer_port_id, { "LengthPeerPortID", "pn_io.length_peer_port_id", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_port_id, { "PeerPortID", "pn_io.peer_port_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_peer_chassis_id, { "LengthPeerChassisID", "pn_io.length_peer_chassis_id", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_chassis_id, { "PeerChassisID", "pn_io.peer_chassis_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_neighbor, { "Neighbor", "pn_io.neighbor", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_peer_port_name, { "LengthPeerPortName", "pn_io.length_peer_port_name", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_port_name, { "PeerPortName", "pn_io.peer_port_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_peer_station_name, { "LengthPeerStationName", "pn_io.length_peer_station_name", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_station_name, { "PeerStationName", "pn_io.peer_station_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_own_chassis_id, { "LengthOwnChassisID", "pn_io.length_own_chassis_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_own_chassis_id, { "OwnChassisID", "pn_io.own_chassis_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rtclass3_port_status, { "RTClass3_PortStatus", "pn_io.rtclass3_port_status", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_own_port_id, { "LengthOwnPortID", "pn_io.length_own_port_id", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_own_port_id, { "OwnPortID", "pn_io.own_port_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_peer_macadd, { "PeerMACAddress", "pn_io.peer_macadd", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_macadd, { "MACAddress", "pn_io.macadd", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_media_type, { "MediaType", "pn_io.media_type", FT_UINT32, BASE_HEX, VALS(pn_io_media_type), 0x0, NULL, HFILL } }, { &hf_pn_io_ethertype, { "Ethertype", "pn_io.ethertype", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rx_port, { "RXPort", "pn_io.rx_port", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_details, { "FrameDetails", "pn_io.frame_details", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_details_sync_frame, { "SyncFrame", "pn_io.frame_details.sync_frame", FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_sync_master_vals), 0x03, NULL, HFILL } }, { &hf_pn_io_frame_details_meaning_frame_send_offset, { "Meaning", "pn_io.frame_details.meaning_frame_send_offset", FT_UINT8, BASE_HEX, VALS(pn_io_frame_details_meaning_frame_send_offset_vals), 0x0C, NULL, HFILL } }, { &hf_pn_io_frame_details_reserved, { "Reserved", "pn_io.frame_details.reserved", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL } }, { &hf_pn_io_nr_of_tx_port_groups, { "NumberOfTxPortGroups", "pn_io.nr_of_tx_port_groups", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties, { "TxPortGroupProperties", "pn_io.tx_port_properties", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit0, { "TxPortLocal", "pn_io.tx_port_properties_bit_0", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x01, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit1, { "TxPort_1", "pn_io.tx_port_properties_bit_1", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x02, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit2, { "TxPort_2", "pn_io.tx_port_properties_bit_2", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x04, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit3, { "TxPort_3", "pn_io.tx_port_properties_bit_3", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x08, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit4, { "TxPort_4", "pn_io.tx_port_properties_bit_4", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x10, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit5, { "TxPort_5", "pn_io.tx_port_properties_bit_5", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x20, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit6, { "TxPort_6", "pn_io.tx_port_properties_bit_6", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x40, NULL, HFILL } }, { &hf_pn_io_TxPortGroupProperties_bit7, { "TxPort_7", "pn_io.tx_port_properties_bit_7", FT_UINT8, BASE_HEX, VALS(pn_io_txgroup_state), 0x80, NULL, HFILL } }, { &hf_pn_io_start_of_red_frame_id, { "StartOfRedFrameID", "pn_io.start_of_red_frame_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_end_of_red_frame_id, { "EndOfRedFrameID", "pn_io.end_of_red_frame_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ir_begin_end_port, { "Port", "pn_io.ir_begin_end_port", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_assignments, { "NumberOfAssignments", "pn_io.number_of_assignments", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_phases, { "NumberOfPhases", "pn_io.number_of_phases", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_red_orange_period_begin_tx, { "RedOrangePeriodBegin [TX]", "pn_io.red_orange_period_begin_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_orange_period_begin_tx, { "OrangePeriodBegin [TX]", "pn_io.orange_period_begin_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_green_period_begin_tx, { "GreenPeriodBegin [TX]", "pn_io.green_period_begin_tx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_red_orange_period_begin_rx, { "RedOrangePeriodBegin [RX]", "pn_io.red_orange_period_begin_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_orange_period_begin_rx, { "OrangePeriodBegin [RX]", "pn_io.orange_period_begin_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_green_period_begin_rx, { "GreenPeriodBegin [RX]", "pn_io.green_period_begin_rx", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_ir_tx_phase_assignment, { "TXPhaseAssignment", "pn_io.tx_phase_assignment_sub", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_tx_phase_assignment_begin_value, { "AssignedValueForReservedBegin", "pn_io.tx_phase_assignment_begin_value", FT_UINT16, BASE_DEC, NULL, 0x000F, NULL, HFILL } }, { &hf_pn_io_tx_phase_assignment_orange_begin, { "AssignedValueForOrangeBegin", "pn_io.tx_phase_assignment_orange_begin", FT_UINT16, BASE_DEC, NULL, 0x00F0, NULL, HFILL } }, { &hf_pn_io_tx_phase_assignment_end_reserved, { "AssignedValueForReservedEnd", "pn_io.tx_phase_assignment_end_reserved", FT_UINT16, BASE_DEC, NULL, 0x0F00, NULL, HFILL } }, { &hf_pn_io_tx_phase_assignment_reserved, { "Reserved should be 0", "pn_io.tx_phase_assignment_reserved", FT_UINT16, BASE_DEC, NULL, 0xF000, NULL, HFILL } }, { &hf_pn_ir_rx_phase_assignment, { "RXPhaseAssignment", "pn_io.rx_phase_assignment_sub", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_slot, { "Slot", "pn_io.slot", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_subslot, { "Subslot", "pn_io.subslot", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_slots, { "NumberOfSlots", "pn_io.number_of_slots", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_subslots, { "NumberOfSubslots", "pn_io.number_of_subslots", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_maintenance_required_power_budget, { "MaintenanceRequiredPowerBudget", "pn_io.maintenance_required_power_budget", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_maintenance_demanded_power_budget, { "MaintenanceDemandedPowerBudget", "pn_io.maintenance_demanded_power_budget", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_error_power_budget, { "ErrorPowerBudget", "pn_io.error_power_budget", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_fiber_optic_type, { "FiberOpticType", "pn_io.fiber_optic_type", FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_type), 0x0, NULL, HFILL } }, { &hf_pn_io_fiber_optic_cable_type, { "FiberOpticCableType", "pn_io.fiber_optic_cable_type", FT_UINT32, BASE_HEX, VALS(pn_io_fiber_optic_cable_type), 0x0, NULL, HFILL } }, { &hf_pn_io_controller_appl_cycle_factor, { "ControllerApplicationCycleFactor", "pn_io.controller_appl_cycle_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_data_cycle, { "TimeDataCycle", "pn_io.time_data_cycle", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_io_input, { "TimeIOInput", "pn_io.time_io_input", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_io_output, { "TimeIOOutput", "pn_io.time_io_output", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_io_input_valid, { "TimeIOInputValid", "pn_io.time_io_input_valid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_time_io_output_valid, { "TimeIOOutputValid", "pn_io.time_io_output_valid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_maintenance_status, { "MaintenanceStatus", "pn_io.maintenance_status", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_maintenance_status_required, { "Required", "pn_io.maintenance_status_required", FT_UINT32, BASE_HEX, NULL, 0x0001, NULL, HFILL } }, { &hf_pn_io_maintenance_status_demanded, { "Demanded", "pn_io.maintenance_status_demanded", FT_UINT32, BASE_HEX, NULL, 0x0002, NULL, HFILL } }, { &hf_pn_io_vendor_id_high, { "VendorIDHigh", "pn_io.vendor_id_high", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_vendor_id_low, { "VendorIDLow", "pn_io.vendor_id_low", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_vendor_block_type, { "VendorBlockType", "pn_io.vendor_block_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_order_id, { "OrderID", "pn_io.order_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_serial_number, { "IMSerialNumber", "pn_io.im_serial_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_hardware_revision, { "IMHardwareRevision", "pn_io.im_hardware_revision", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* XXX - better use a simple char here -> vals */ { &hf_pn_io_im_revision_prefix, { "IMRevisionPrefix", "pn_io.im_revision_prefix", FT_CHAR, BASE_HEX, VALS(pn_io_im_revision_prefix_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_im_sw_revision_functional_enhancement, { "IMSWRevisionFunctionalEnhancement", "pn_io.im_sw_revision_functional_enhancement", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_revision_bugfix, { "IM_SWRevisionBugFix", "pn_io.im_revision_bugfix", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_sw_revision_internal_change, { "IMSWRevisionInternalChange", "pn_io.im_sw_revision_internal_change", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_revision_counter, { "IMRevisionCounter", "pn_io.im_revision_counter", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_profile_id, { "IMProfileID", "pn_io.im_profile_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_profile_specific_type, { "IMProfileSpecificType", "pn_io.im_profile_specific_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_version_major, { "IMVersionMajor", "pn_io.im_version_major", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_version_minor, { "IMVersionMinor", "pn_io.im_version_minor", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_supported, { "IM_Supported", "pn_io.im_supported", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_numberofentries, { "NumberOfEntries", "pn_io.im_numberofentries", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_annotation, { "IM Annotation", "pn_io.im_annotation", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_order_id, { "IM Order ID", "pn_io.im_order_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_ars, { "NumberOfARs", "pn_io.number_of_ars", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_cycle_counter, { "CycleCounter", "pn_io.cycle_counter", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_data_status, { "DataStatus", "pn_io.ds", FT_UINT8, BASE_HEX, 0, 0x0, NULL, HFILL } }, { &hf_pn_io_data_status_res67, { "Reserved (should be zero)", "pn_io.ds_res67", FT_UINT8, BASE_HEX, 0, 0xc0, NULL, HFILL } }, { &hf_pn_io_data_status_ok, { "StationProblemIndicator (1:Ok/0:Problem)", "pn_io.ds_ok", FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL } }, { &hf_pn_io_data_status_operate, { "ProviderState (1:Run/0:Stop)", "pn_io.ds_operate", FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL } }, { &hf_pn_io_data_status_res3, { "Reserved (should be zero)", "pn_io.ds_res3", FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL } }, { &hf_pn_io_data_status_valid, { "DataValid (1:Valid/0:Invalid)", "pn_io.ds_valid", FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL } }, { &hf_pn_io_data_status_res1, { "primary AR of a given AR-set is present (0:One/ 1:None)", "pn_io.ds_res1", FT_UINT8, BASE_HEX, 0, 0x02, NULL, HFILL } }, { &hf_pn_io_data_status_primary, { "State (1:Primary/0:Backup)", "pn_io.ds_primary", FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL } }, { &hf_pn_io_transfer_status, { "TransferStatus", "pn_io.transfer_status", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_actual_local_time_stamp, { "ActualLocalTimeStamp", "pn_io.actual_local_time_stamp", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_local_time_stamp, { "LocalTimeStamp", "pn_io.local_time_stamp", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_log_entries, { "NumberOfLogEntries", "pn_io.number_of_log_entries", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_entry_detail, { "EntryDetail", "pn_io.entry_detail", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ip_address, { "IPAddress", "pn_io.ip_address", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_subnetmask, { "Subnetmask", "pn_io.subnetmask", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_standard_gateway, { "StandardGateway", "pn_io.standard_gateway", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_domain_uuid, { "MRP_DomainUUID", "pn_io.mrp_domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_role, { "MRP_Role", "pn_io.mrp_role", FT_UINT16, BASE_HEX, VALS(pn_io_mrp_role_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_length_domain_name, { "MRP_LengthDomainName", "pn_io.mrp_length_domain_name", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_domain_name, { "MRP_DomainName", "pn_io.mrp_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_instances, { "NumberOfMrpInstances", "pn_io.mrp_Number_MrpInstances", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_instance, { "Mrp_Instance", "pn_io.mrp_MrpInstance", FT_UINT8, BASE_DEC, VALS(pn_io_mrp_instance_no), 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_prio, { "MRP_Prio", "pn_io.mrp_prio", FT_UINT16, BASE_HEX, VALS(pn_io_mrp_prio_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_topchgt, { "MRP_TOPchgT", "pn_io.mrp_topchgt", FT_UINT16, BASE_DEC, NULL, 0x0, "time base 10ms", HFILL } }, { &hf_pn_io_mrp_topnrmax, { "MRP_TOPNRmax", "pn_io.mrp_topnrmax", FT_UINT16, BASE_DEC, NULL, 0x0, "number of iterations", HFILL } }, { &hf_pn_io_mrp_tstshortt, { "MRP_TSTshortT", "pn_io.mrp_tstshortt", FT_UINT16, BASE_DEC, NULL, 0x0, "time base 1 ms", HFILL } }, { &hf_pn_io_mrp_tstdefaultt, { "MRP_TSTdefaultT", "pn_io.mrp_tstdefaultt", FT_UINT16, BASE_DEC, NULL, 0x0, "time base 1ms", HFILL } }, { &hf_pn_io_mrp_tstnrmax, { "MRP_TSTNRmax", "pn_io.mrp_tstnrmax", FT_UINT16, BASE_DEC, NULL, 0x0, "number of outstanding test indications causes ring failure", HFILL } }, { &hf_pn_io_mrp_check, { "MRP_Check", "pn_io.mrp_check", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_check_mrm, { "MRP_Check.MediaRedundancyManager", "pn_io.mrp_check.mrm", FT_UINT32, BASE_HEX, VALS(pn_io_mrp_mrm_on), 0x01, NULL, HFILL } }, { &hf_pn_io_mrp_check_mrpdomain, { "MRP_Check.MRP_DomainUUID", "pn_io.mrp_check.domainUUID", FT_UINT32, BASE_HEX, VALS(pn_io_mrp_checkUUID), 0x02, NULL, HFILL } }, { &hf_pn_io_mrp_check_reserved_1, { "MRP_Check.reserved_1", "pn_io.mrp_check_reserved_1", FT_UINT32, BASE_HEX, NULL, 0xFFFFFC, NULL, HFILL } }, { &hf_pn_io_mrp_check_reserved_2, { "MRP_Check.reserved_2", "pn_io.mrp_check_reserved_2", FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode, { "MRP_RTMode", "pn_io.mrp_rtmode", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode_rtclass12, { "RTClass1_2", "pn_io.mrp_rtmode.class1_2", FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass12_vals), 0x00000001, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode_rtclass3, { "RTClass1_3", "pn_io.mrp_rtmode.class3", FT_UINT32, BASE_HEX, VALS(pn_io_mrp_rtmode_rtclass3_vals), 0x00000002, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode_reserved1, { "Reserved_1", "pn_io.mrp_rtmode.reserved_1", FT_UINT32, BASE_HEX, NULL, 0x00fffffc, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode_reserved2, { "Reserved_2", "pn_io.mrp_rtmode.reserved_2", FT_UINT32, BASE_HEX, NULL, 0xff000000, NULL, HFILL } }, { &hf_pn_io_mrp_lnkdownt, { "MRP_LNKdownT", "pn_io.mrp_lnkdownt", FT_UINT16, BASE_HEX, NULL, 0x0, "Link down Interval in ms", HFILL } }, { &hf_pn_io_mrp_lnkupt, { "MRP_LNKupT", "pn_io.mrp_lnkupt", FT_UINT16, BASE_HEX, NULL, 0x0, "Link up Interval in ms", HFILL } }, { &hf_pn_io_mrp_lnknrmax, { "MRP_LNKNRmax", "pn_io.mrp_lnknrmax", FT_UINT16, BASE_HEX, NULL, 0x0, "number of iterations", HFILL } }, { &hf_pn_io_mrp_version, { "MRP_Version", "pn_io.mrp_version", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_substitute_active_flag, { "SubstituteActiveFlag", "pn_io.substitute_active_flag", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_length_data, { "LengthData", "pn_io.length_data", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_ring_state, { "MRP_RingState", "pn_io.mrp_ring_state", FT_UINT16, BASE_HEX, VALS(pn_io_mrp_ring_state_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_mrp_rt_state, { "MRP_RTState", "pn_io.mrp_rt_state", FT_UINT16, BASE_HEX, VALS(pn_io_mrp_rt_state_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_im_tag_function, { "IM_Tag_Function", "pn_io.im_tag_function", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_tag_location, { "IM_Tag_Location", "pn_io.im_tag_location", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_date, { "IM_Date", "pn_io.im_date", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_descriptor, { "IM_Descriptor", "pn_io.im_descriptor", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_fs_hello_mode, { "FSHelloMode", "pn_io.fs_hello_mode", FT_UINT32, BASE_HEX, VALS(pn_io_fs_hello_mode_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_fs_hello_interval, { "FSHelloInterval", "pn_io.fs_hello_interval", FT_UINT32, BASE_DEC, NULL, 0x0, "ms before conveying a second DCP_Hello.req", HFILL } }, { &hf_pn_io_fs_hello_retry, { "FSHelloRetry", "pn_io.fs_hello_retry", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_fs_hello_delay, { "FSHelloDelay", "pn_io.fs_hello_delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_fs_parameter_mode, { "FSParameterMode", "pn_io.fs_parameter_mode", FT_UINT32, BASE_HEX, VALS(pn_io_fs_parameter_mode_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_fs_parameter_uuid, { "FSParameterUUID", "pn_io.fs_parameter_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_check_sync_mode, { "CheckSyncMode", "pn_io.check_sync_mode", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_check_sync_mode_reserved, { "Reserved", "pn_io.check_sync_mode.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } }, { &hf_pn_io_check_sync_mode_sync_master, { "SyncMaster", "pn_io.check_sync_mode.sync_master", FT_UINT16, BASE_HEX, NULL, 0x0002, NULL, HFILL } }, { &hf_pn_io_check_sync_mode_cable_delay, { "CableDelay", "pn_io.check_sync_mode.cable_delay", FT_UINT16, BASE_HEX, NULL, 0x0001, NULL, HFILL } }, /* PROFIsafe F-Parameter */ { &hf_pn_io_ps_f_prm_flag1, { "F_Prm_Flag1", "pn_io.ps.f_prm_flag1", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_chck_seq, { "F_Check_SeqNr", "pn_io.ps.f_prm_flag1.f_check_seqnr", FT_UINT8, BASE_HEX, VALS(pn_io_f_check_seqnr), 0x01, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_chck_ipar, { "F_Check_iPar", "pn_io.ps.f_prm_flag1.f_check_ipar", FT_UINT8, BASE_HEX, VALS(pn_io_f_check_ipar), 0x02, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_sil, { "F_SIL", "pn_io.ps.f_prm_flag1.f_sil", FT_UINT8, BASE_HEX, VALS(pn_io_f_sil), 0xc, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_crc_len, { "F_CRC_Length", "pn_io.ps.f_prm_flag1.f_crc_len", FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_len), 0x30, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_crc_seed, { "F_CRC_Seed", "pn_io.ps.f_prm_flag1.f_crc_seed", FT_UINT8, BASE_HEX, VALS(pn_io_f_crc_seed), 0x40, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag1_reserved, { "Reserved", "pn_io.ps.f_prm_flag1.reserved", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag2, { "F_Prm_Flag2", "pn_io.ps.f_prm_flag2", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag2_reserved, { "Reserved", "pn_io.ps.f_prm_flag2.reserved", FT_UINT8, BASE_HEX, NULL, 0x07, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag2_f_block_id, { "F_Block_ID", "pn_io.ps.f_prm_flag2.f_block_id", FT_UINT8, BASE_HEX, VALS(pn_io_f_block_id), 0x38, NULL, HFILL } }, { &hf_pn_io_ps_f_prm_flag2_f_par_version, { "F_Par_Version", "pn_io.ps.f_prm_flag2.f_par_version", FT_UINT8, BASE_HEX, VALS(pn_io_f_par_version), 0xC0, NULL, HFILL } }, { &hf_pn_io_ps_f_wd_time, { "F_WD_Time", "pn_io.ps.f_wd_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_ipar_crc, { "F_iPar_CRC", "pn_io.ps.f_ipar_crc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_par_crc, { "F_Par_CRC", "pn_io.ps.f_par_crc", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_dest_adr, { "F_Dest_Add", "pn_io.ps.f_dest_add", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_src_adr, { "F_Source_Add", "pn_io.ps.f_source_add", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* profidrive parameter access */ { &hf_pn_io_profidrive_request_reference, { "RequestReference", "pn_io.profidrive.parameter.request_reference", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_request_id, { "RequestID", "pn_io.profidrive.parameter.request_id", FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_request_id_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_do_id, { "DO", "pn_io.profidrive.parameter.do", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_no_of_parameters, { "NoOfParameters", "pn_io.profidrive.parameter.no_of_parameters", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_attribute, { "Attribute", "pn_io.profidrive.parameter.attribute", FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_attribute_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_no_of_elems, { "NoOfElements", "pn_io.profidrive.parameter.no_of_elems", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_number, { "Parameter", "pn_io.profidrive.parameter.number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_subindex, { "Index", "pn_io.profidrive.parameter.index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_response_id, { "ResponseID", "pn_io.profidrive.parameter.response_id", FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_response_id_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_format, { "Format", "pn_io.profidrive.parameter.format", FT_UINT8, BASE_HEX, VALS(pn_io_profidrive_format_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_error, { "Error Number", "pn_io.profidrive.parameter.error_num", FT_UINT16, BASE_HEX, VALS(pn_io_profidrive_parameter_resp_errors), 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_error_sub, { "Error Subindex", "pn_io.profidrive.parameter.error_subindex", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_no_of_values, { "NoOfValues", "pn_io.profidrive.parameter.no_of_values", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_byte, { "Value", "pn_io.profidrive.parameter.value_b", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_word, { "Value", "pn_io.profidrive.parameter.value_w", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_dword, { "Value", "pn_io.profidrive.parameter.value_dw", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_float, { "Value", "pn_io.profidrive.parameter.value_float", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_profidrive_param_value_string, { "Value", "pn_io.profidrive.parameter.value_str", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_alarm_info_reserved_8_15, { "RSAlarmInfo.Reserved2", "pn_io.rs_alarm_info_reserved_8_15", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } }, { &hf_pn_io_rs_alarm_info_reserved_0_7, { "RSAlarmInfo.Reserved1", "pn_io.rs_alarm_info_reserved_0_7", FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } }, { &hf_pn_io_rs_alarm_info, { "RS Alarm Info", "pn_io.rs_alarm_info", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_event_info, { "RS Event Info", "pn_io.rs_event_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_event_block, { "RS Event Block", "pn_io.rs_event_block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_adjust_block, { "RS Adjust Block", "pn_io.rs_adjust_block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_event_data_extension, { "RS Event Data Extension", "pn_io.rs_event_data_extension", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_rs_event_info, { "RSEventInfo.NumberOfEntries", "pn_io.number_of_rs_event_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_block_type, { "RS Block Type", "pn_io.rs_block_type", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_rs_block_type), 0x0, NULL, HFILL } }, { &hf_pn_io_rs_block_length, { "RS Block Length", "pn_io.rs_block_length", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_specifier, { "RS_Specifier", "pn_io.rs_specifier", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_specifier_sequence, { "RS_Specifier.SequenceNumber", "pn_io.rs_specifier.sequence", FT_UINT16, BASE_HEX, NULL, 0x07FF, NULL, HFILL } }, { &hf_pn_io_rs_specifier_reserved, { "RS_Specifier.Reserved", "pn_io.rs_specifier_reserved", FT_UINT16, BASE_HEX, NULL, 0x3800, NULL, HFILL } }, { &hf_pn_io_rs_specifier_specifier, { "RS_Specifier.Specifier", "pn_io.rs_specifier.specifier", FT_UINT16, BASE_HEX, VALS(pn_io_rs_specifier_specifier), 0xC000, NULL, HFILL } }, { &hf_pn_io_rs_time_stamp, { "RS_TimeStamp", "pn_io.rs_time_stamp", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_time_stamp_status, { "RS_TimeStamp.Status", "pn_io.rs_time_stamp.status", FT_UINT16, BASE_HEX, VALS(pn_io_rs_time_stamp_status), 0x0003, NULL, HFILL } }, { &hf_pn_io_rs_time_stamp_value, { "RS_TimeStamp.Value", "pn_io.rs_time_stamp.value", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_minus_error, { "RS_MinusError", "pn_io.rs_minus_error", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_plus_error, { "RS_PlusError", "pn_io.rs_plus_error", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_extension_block_type, { "RS_ExtensionBlockType", "pn_io.rs_extension_block_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_extension_block_length, { "RS_ExtensionBlockLength", "pn_io.rs_extension_block_length", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_reason_code, { "RS_ReasonCode", "pn_io.rs_reason_code", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_reason_code_reason, { "RS_ReasonCode.Reason", "pn_io.rs_reason_code.reason", FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_reason), 0x0000FFFF, NULL, HFILL } }, { &hf_pn_io_rs_reason_code_detail, { "RS_ReasonCode.Detail", "pn_io.rs_reason_code.detail", FT_UINT32, BASE_HEX, VALS(pn_io_rs_reason_code_detail), 0xFFFF0000, NULL, HFILL } }, { &hf_pn_io_rs_domain_identification, { "RS_DomainIdentification", "pn_io.rs_domain_identification", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_master_identification, { "RS_MasterIdentification", "pn_io.rs_master_identification", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_soe_digital_input_current_value, { "SoE_DigitalInputCurrentValue", "pn_io.soe_digital_input_current_value", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_soe_digital_input_current_value_value, { "SoE_DigitalInputCurrentValue.Value", "pn_io.soe_digital_input_current_value.value", FT_UINT16, BASE_HEX, VALS(pn_io_soe_digital_input_current_value_value), 0x0001, NULL, HFILL } }, { &hf_pn_io_soe_digital_input_current_value_reserved, { "SoE_DigitalInputCurrentValue.Reserved", "pn_io.soe_digital_input_current_value.reserved", FT_UINT16, BASE_HEX, NULL, 0xFFFE, NULL, HFILL } }, { &hf_pn_io_am_device_identification, { "AM_DeviceIdentification", "pn_io.am_device_identification", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_device_identification_device_sub_id, { "AM_DeviceIdentification.DeviceSubID", "pn_io.am_device_identification.device_sub_id", FT_UINT64, BASE_HEX, NULL, 0x000000000000FFFF, NULL, HFILL } }, { &hf_pn_io_am_device_identification_device_id, { "AM_DeviceIdentification.DeviceID", "pn_io.am_device_identification.device_id", FT_UINT64, BASE_HEX, NULL, 0x00000000FFFF0000, NULL, HFILL } }, { &hf_pn_io_am_device_identification_vendor_id, { "AM_DeviceIdentification.VendorID", "pn_io.am_device_identification.vendor_id", FT_UINT64, BASE_HEX, NULL, 0x0000FFFF00000000, NULL, HFILL } }, { &hf_pn_io_am_device_identification_organization, { "AM_DeviceIdentification.Organization", "pn_io.am_device_identification.organization", FT_UINT64, BASE_HEX, NULL, 0xFFFF000000000000, NULL, HFILL } }, { &hf_pn_io_rs_adjust_info, { "RS Adjust Info", "pn_io.rs_adjust_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_soe_max_scan_delay, { "SoE_MaxScanDelay", "pn_io.soe_max_scan_delay", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_soe_adjust_specifier, { "SoE_AdjustSpecifier", "pn_io.soe_adjust_specifier", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_soe_adjust_specifier_reserved, { "SoE_AdjustSpecifier.Reserved", "pn_io.soe_adjust_specifier.reserved", FT_UINT8, BASE_HEX, NULL, 0x3F, NULL, HFILL } }, { &hf_pn_io_soe_adjust_specifier_incident, { "SoE_AdjustSpecifier.Incident", "pn_io.soe_adjust_specifier.incident", FT_UINT8, BASE_HEX, VALS(pn_io_soe_adjust_specifier_incident), 0xC0, NULL, HFILL } }, { &hf_pn_io_rs_properties, { "RSProperties", "pn_io.rs_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_rs_properties_alarm_transport, { "RSProperties", "pn_io.rs_properties", FT_UINT32, BASE_HEX, VALS(pn_io_rs_properties_alarm_transport), 0x00000001, NULL, HFILL } }, { &hf_pn_io_rs_properties_reserved1, { "RSProperties.Reserved1", "pn_io.rs_properties.reserved1", FT_UINT32, BASE_HEX, NULL, 0x00FFFFFE, NULL, HFILL } }, { &hf_pn_io_rs_properties_reserved2, { "RSProperties.Reserved2", "pn_io.rs_properties.reserved2", FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL } }, { &hf_pn_io_asset_management_info, { "Asset Management Info", "pn_io.asset_management_info", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_number_of_asset_management_info, { "AssetManagementInfo.NumberOfEntries", "pn_io.number_of_asset_management_info", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_im_uniqueidentifier, { "IM_UniqueIdentifier", "pn_io.IM_UniqueIdentifier", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_structure, { "AM_Location.Structure", "pn_io.am_location.structure", FT_UINT8, BASE_HEX, VALS(pn_io_am_location_structure_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location, { "AM_Location", "pn_io.am_location", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL } }, { &hf_pn_io_am_location_level_0, { "AM_Location Level 0", "pn_io.am_location.level_0", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_1, { "AM_Location Level 1", "pn_io.am_location.level_1", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_2, { "AM_Location Level 2", "pn_io.am_location.level_2", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_3, { "AM_Location Level 3", "pn_io.am_location.level_3", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_4, { "AM_Location Level 4", "pn_io.am_location.level_4", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_5, { "AM_Location Level 5", "pn_io.am_location.level_5", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_6, { "AM_Location Level 6", "pn_io.am_location.level_6", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_7, { "AM_Location Level 7", "pn_io.am_location.level_7", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_8, { "AM_Location Level 8", "pn_io.am_location.level_8", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_9, { "AM_Location Level 9", "pn_io.am_location.level_9", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_10, { "AM_Location Level 10", "pn_io.am_location.level_10", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_level_11, { "AM_Location Level 11", "pn_io.am_location.level_11", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_am_location_level_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved1, { "AM_Location.Reserved1", "pn_io.am_location.reserved1", FT_UINT8, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved2, { "AM_Location.Reserved2", "pn_io.am_location.reserved2", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved3, { "AM_Location.Reserved3", "pn_io.am_location.reserved3", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_reserved4, { "AM_Location.Reserved4", "pn_io.am_location.reserved4", FT_UINT16, BASE_HEX, VALS(pn_io_am_location_reserved_vals), 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_beginslotnum, { "AM_Location.BeginSlotNumber", "pn_io.slot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_beginsubslotnum, { "AM_Location.BeginSubSlotNumber", "pn_io.subslot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_endslotnum, { "AM_Location.EndSlotNumber", "pn_io.slot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_location_endsubslotnum, { "AM_Location.EndSubSlotNumber", "pn_io.subslot_nr", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_software_revision, { "AM Software Revision", "pn_io.am_software_revision", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_hardware_revision, { "AM Hardware Revision", "pn_io.am_hardware_revision", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_type_identification, { "AM Type Identification", "pn_io.am_type_identification", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_am_reserved, { "AM Reserved", "pn_io.am_reserved", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_mau_type_extension, { "MAUTypeExtension", "pn_io.mau_type_extension", FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_mau_type_extension), 0x0, NULL, HFILL } }, { &hf_pn_io_pe_operational_mode, { "PE_OperationalMode", "pn_io.pe_operationalmode", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(pn_io_pe_operational_mode), 0x0, NULL, HFILL } }, { &hf_pn_io_snmp_control, { "SNMPControl", "pn_io.snmp_control", FT_UINT16, BASE_HEX, VALS(pn_io_snmp_control), 0x0, NULL, HFILL } }, { &hf_pn_io_snmp_community_name_length, { "CommunityNameLength", "pn_io.snmp_community_name_length", FT_UINT8, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_snmp_community_name, { "CommunityName", "pn_io.snmp_community_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_snmp_read_community_name, { "SNMP read only community name", "pn_io.snmp_read_community_name", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_snmp_write_community_name, { "SNMP read write community name", "pn_io.snmp_write_community_name", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { &ett_pn_io, &ett_pn_io_block, &ett_pn_io_block_header, &ett_pn_io_rtc, &ett_pn_io_rta, &ett_pn_io_pdu_type, &ett_pn_io_add_flags, &ett_pn_io_control_command, &ett_pn_io_ioxs, &ett_pn_io_api, &ett_pn_io_data_description, &ett_pn_io_module, &ett_pn_io_submodule, &ett_pn_io_io_data_object, &ett_pn_io_io_cs, &ett_pn_io_ar_properties, &ett_pn_io_iocr_properties, &ett_pn_io_submodule_properties, &ett_pn_io_alarmcr_properties, &ett_pn_io_submodule_state, &ett_pn_io_channel_properties, &ett_pn_io_slot, &ett_pn_io_subslot, &ett_pn_io_maintenance_status, &ett_pn_io_data_status, &ett_pn_io_iocr, &ett_pn_io_mrp_rtmode, &ett_pn_io_control_block_properties, &ett_pn_io_check_sync_mode, &ett_pn_io_ir_frame_data, &ett_pn_FrameDataProperties, &ett_pn_io_ar_info, &ett_pn_io_ar_data, &ett_pn_io_ir_begin_end_port, &ett_pn_io_ir_tx_phase, &ett_pn_io_ir_rx_phase, &ett_pn_io_subframe_data, &ett_pn_io_SFIOCRProperties, &ett_pn_io_frame_defails, &ett_pn_io_profisafe_f_parameter, &ett_pn_io_profisafe_f_parameter_prm_flag1, &ett_pn_io_profisafe_f_parameter_prm_flag2, &ett_pn_io_profidrive_parameter_request, &ett_pn_io_profidrive_parameter_response, &ett_pn_io_profidrive_parameter_address, &ett_pn_io_profidrive_parameter_value, &ett_pn_io_GroupProperties, &ett_pn_io_rs_alarm_info, &ett_pn_io_rs_event_info, &ett_pn_io_rs_event_block, &ett_pn_io_rs_adjust_block, &ett_pn_io_rs_event_data_extension, &ett_pn_io_rs_specifier, &ett_pn_io_rs_time_stamp, &ett_pn_io_am_device_identification, &ett_pn_io_rs_reason_code, &ett_pn_io_soe_digital_input_current_value, &ett_pn_io_rs_adjust_info, &ett_pn_io_soe_adjust_specifier, &ett_pn_io_asset_management_info, &ett_pn_io_asset_management_block, &ett_pn_io_am_location, &ett_pn_io_sr_properties, &ett_pn_io_line_delay, &ett_pn_io_counter_status, &ett_pn_io_dcp_boundary, &ett_pn_io_peer_to_peer_boundary, &ett_pn_io_mau_type_extension, &ett_pn_io_pe_operational_mode, &ett_pn_io_neighbor, &ett_pn_io_tsn_domain_vid_config, &ett_pn_io_tsn_domain_port_config, &ett_pn_io_tsn_domain_queue_config, &ett_pn_io_tsn_domain_port_ingress_rate_limiter, &ett_pn_io_tsn_domain_queue_rate_limiter, &ett_pn_io_time_sync_properties, &ett_pn_io_tsn_domain_port_id, &ett_pn_io_snmp_command_name }; static ei_register_info ei[] = { { &ei_pn_io_block_version, { "pn_io.block_version.not_implemented", PI_UNDECODED, PI_WARN, "Block version not implemented yet!", EXPFILL }}, { &ei_pn_io_ar_info_not_found, { "pn_io.ar_info_not_found", PI_UNDECODED, PI_NOTE, "IODWriteReq: AR information not found!", EXPFILL }}, { &ei_pn_io_block_length, { "pn_io.block_length.invalid", PI_UNDECODED, PI_WARN, "Block length invalid!", EXPFILL }}, { &ei_pn_io_unsupported, { "pn_io.profidrive.parameter.format.invalid", PI_UNDECODED, PI_WARN, "Unknown Formatvalue", EXPFILL }}, { &ei_pn_io_mrp_instances, { "pn_io.mrp_Number_MrpInstances.invalid", PI_UNDECODED, PI_WARN, "Number of MrpInstances invalid", EXPFILL }}, { &ei_pn_io_frame_id, { "pn_io.frame_id.changed", PI_UNDECODED, PI_WARN, "FrameID changed", EXPFILL }}, { &ei_pn_io_iocr_type, { "pn_io.iocr_type.unknown", PI_UNDECODED, PI_WARN, "IOCRType undecoded!", EXPFILL }}, { &ei_pn_io_localalarmref, { "pn_io.localalarmref.changed", PI_UNDECODED, PI_WARN, "AlarmCRBlockReq: local alarm ref changed", EXPFILL }}, { &ei_pn_io_nr_of_tx_port_groups, { "pn_io.nr_of_tx_port_groups.not_allowed", PI_PROTOCOL, PI_WARN, "Not allowed value of NumberOfTxPortGroups", EXPFILL }}, { &ei_pn_io_max_recursion_depth_reached, { "pn_io.max_recursion_depth_reached", PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stopping dissection", EXPFILL }} }; module_t *pnio_module; expert_module_t* expert_pn_io; proto_pn_io = proto_register_protocol ("PROFINET IO", "PNIO", "pn_io"); /* Register by name */ register_dissector("pnio", dissect_PNIO_heur, proto_pn_io); /* Created to remove Decode As confusion */ proto_pn_io_device = proto_register_protocol_in_name_only("PROFINET IO (Device)", "PNIO (Device Interface)", "pn_io_device", proto_pn_io, FT_PROTOCOL); proto_pn_io_controller = proto_register_protocol_in_name_only("PROFINET IO (Controller)", "PNIO (Controller Interface)", "pn_io_controller", proto_pn_io, FT_PROTOCOL); proto_pn_io_supervisor = proto_register_protocol_in_name_only("PROFINET IO (Supervisor)", "PNIO (Supervisor Interface)", "pn_io_supervisor", proto_pn_io, FT_PROTOCOL); proto_pn_io_parameterserver = proto_register_protocol_in_name_only("PROFINET IO (Parameter Server)", "PNIO (Parameter Server Interface)", "pn_io_parameterserver", proto_pn_io, FT_PROTOCOL); proto_pn_io_implicitar = proto_register_protocol_in_name_only("PROFINET IO (Implicit Ar)", "PNIO (Implicit Ar)", "pn_io_implicitar", proto_pn_io, FT_PROTOCOL); proto_pn_io_apdu_status = proto_register_protocol_in_name_only("PROFINET IO (Apdu Status)", "PNIO (Apdu Status)", "pn_io_apdu_status", proto_pn_io, FT_PROTOCOL); proto_pn_io_time_aware_status = proto_register_protocol_in_name_only("PROFINET IO (Time Aware Status)", "PNIO (Time Aware Status)", "pn_io_time_aware_status", proto_pn_io, FT_PROTOCOL); proto_register_field_array (proto_pn_io, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); expert_pn_io = expert_register_protocol(proto_pn_io); expert_register_field_array(expert_pn_io, ei, array_length(ei)); /* Register preferences */ pnio_module = prefs_register_protocol(proto_pn_io, NULL); prefs_register_bool_preference(pnio_module, "pnio_ps_selection", "Enable detailed PROFIsafe dissection", "Whether the PNIO dissector is allowed to use detailed PROFIsafe dissection of cyclic data frames", &pnio_ps_selection); prefs_register_directory_preference(pnio_module, "pnio_ps_networkpath", "Configuration GSD-File Networkpath", /* Title */ "Select your Networkpath to your GSD-Files.", /* Descreption */ &pnio_ps_networkpath); /* Variable to save the GSD-File networkpath */ /* subdissector code */ register_dissector("pn_io", dissect_PNIO_heur, proto_pn_io); heur_pn_subdissector_list = register_heur_dissector_list("pn_io", proto_pn_io); /* Initialise RTC1 dissection */ init_pn_io_rtc1(proto_pn_io); /* Initialise RSI dissection */ init_pn_rsi(proto_pn_io); /* Init functions of PNIO protocol */ register_init_routine(pnio_setup); /* Cleanup functions of PNIO protocol */ register_cleanup_routine(pnio_cleanup); register_conversation_filter("pn_io", "PN-IO AR", pn_io_ar_conv_valid, pn_io_ar_conv_filter, NULL); register_conversation_filter("pn_io", "PN-IO AR (with data)", pn_io_ar_conv_valid, pn_io_ar_conv_data_filter, NULL); } void proto_reg_handoff_pn_io (void) { /* Register the protocols as dcerpc */ dcerpc_init_uuid (proto_pn_io_device, ett_pn_io, &uuid_pn_io_device, ver_pn_io_device, pn_io_dissectors, hf_pn_io_opnum); dcerpc_init_uuid (proto_pn_io_controller, ett_pn_io, &uuid_pn_io_controller, ver_pn_io_controller, pn_io_dissectors, hf_pn_io_opnum); dcerpc_init_uuid (proto_pn_io_supervisor, ett_pn_io, &uuid_pn_io_supervisor, ver_pn_io_supervisor, pn_io_dissectors, hf_pn_io_opnum); dcerpc_init_uuid (proto_pn_io_parameterserver, ett_pn_io, &uuid_pn_io_parameterserver, ver_pn_io_parameterserver, pn_io_dissectors, hf_pn_io_opnum); dcerpc_init_uuid (proto_pn_io_implicitar, ett_pn_io, &uuid_pn_io_implicitar, ver_pn_io_implicitar, pn_io_dissectors, hf_pn_io_opnum); heur_dissector_add("pn_rt", dissect_PNIO_heur, "PROFINET IO", "pn_io_pn_rt", proto_pn_io, HEURISTIC_ENABLE); } /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-dcom-cba-acco.c
/* packet-dcom-cba-acco.c * Routines for DCOM CBA * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <string.h> #include <epan/packet.h> #include <epan/expert.h> #include <epan/addr_resolv.h> #include <epan/conversation_filter.h> #include <epan/proto_data.h> #include <epan/dissectors/packet-dcerpc.h> #include <epan/dissectors/packet-dcom.h> #include "packet-dcom-cba-acco.h" #include <epan/ws_printf.h> void proto_register_dcom_cba_acco(void); void proto_reg_handoff_dcom_cba_acco(void); static int hf_cba_acco_opnum = -1; static int hf_cba_acco_ping_factor = -1; static int hf_cba_acco_count = -1; static int hf_cba_acco_item = -1; static int hf_cba_acco_data = -1; static int hf_cba_acco_qc = -1; static int hf_cba_acco_time_stamp = -1; static int hf_cba_acco_conn_qos_type = -1; static int hf_cba_acco_conn_qos_value = -1; static int hf_cba_acco_conn_state = -1; static int hf_cba_acco_conn_cons_id = -1; static int hf_cba_acco_conn_version = -1; static int hf_cba_acco_conn_prov_id = -1; static int hf_cba_acco_conn_provider = -1; static int hf_cba_acco_conn_consumer = -1; static int hf_cba_acco_conn_provider_item = -1; static int hf_cba_acco_conn_consumer_item = -1; static int hf_cba_acco_conn_substitute = -1; static int hf_cba_acco_conn_epsilon = -1; static int hf_cba_acco_conn_persist = -1; static int hf_cba_acco_cb_length = -1; static int hf_cba_acco_cb_conn_data = -1; static int hf_cba_acco_cb_version = -1; static int hf_cba_acco_cb_flags = -1; static int hf_cba_acco_cb_count = -1; static int hf_cba_acco_cb_item = -1; static int hf_cba_acco_cb_item_hole = -1; static int hf_cba_acco_cb_item_length = -1; static int hf_cba_acco_cb_item_data = -1; static int hf_cba_connect_in = -1; static int hf_cba_disconnect_in = -1; static int hf_cba_connectcr_in = -1; static int hf_cba_disconnectcr_in = -1; static int hf_cba_disconnectme_in = -1; static int hf_cba_data_first_in = -1; static int hf_cba_data_last_in = -1; /* static int hf_cba_acco_server_pICBAAccoCallback = -1; */ static int hf_cba_acco_server_first_connect = -1; static int hf_cba_acco_serversrt_prov_mac = -1; static int hf_cba_acco_serversrt_cons_mac = -1; static int hf_cba_acco_serversrt_cr_id = -1; static int hf_cba_acco_serversrt_cr_length = -1; static int hf_cba_acco_serversrt_cr_flags = -1; static int hf_cba_acco_serversrt_cr_flags_timestamped = -1; static int hf_cba_acco_serversrt_cr_flags_reconfigure = -1; static int hf_cba_acco_serversrt_record_length = -1; /* static int hf_cba_acco_serversrt_action = -1; */ static int hf_cba_acco_serversrt_last_connect = -1; static int hf_cba_getprovconnout = -1; static int hf_cba_type_desc_len = -1; static int hf_cba_connectincr = -1; static int hf_cba_connectoutcr = -1; static int hf_cba_connectin = -1; static int hf_cba_connectout = -1; static int hf_cba_getconnectionout = -1; static int hf_cba_readitemout = -1; static int hf_cba_writeitemin = -1; static int hf_cba_addconnectionin = -1; static int hf_cba_addconnectionout = -1; static int hf_cba_getidout = -1; static int hf_cba_getconsconnout = -1; static int hf_cba_diagconsconnout = -1; static int hf_cba_acco_conn_error_state = -1; static int hf_cba_acco_info_max = -1; static int hf_cba_acco_info_curr = -1; static int hf_cba_acco_cdb_cookie = -1; static int hf_cba_acco_rtauto = -1; static int hf_cba_acco_prov_crid = -1; static int hf_cba_acco_diag_req = -1; static int hf_cba_acco_diag_in_length = -1; static int hf_cba_acco_diag_out_length = -1; static int hf_cba_acco_diag_data = -1; static int hf_cba_acco_dcom_call = -1; static int hf_cba_acco_srt_call = -1; gint ett_cba_connectincr = -1; gint ett_cba_connectoutcr = -1; gint ett_cba_connectin = -1; gint ett_cba_connectout = -1; gint ett_cba_getprovconnout = -1; gint ett_cba_addconnectionin = -1; gint ett_cba_addconnectionout = -1; gint ett_cba_getidout = -1; gint ett_cba_getconnectionout = -1; gint ett_cba_readitemout = -1; gint ett_cba_writeitemin = -1; gint ett_cba_acco_serversrt_cr_flags = -1; gint ett_cba_frame_info = -1; gint ett_cba_conn_info = -1; static expert_field ei_cba_acco_pdev_find = EI_INIT; static expert_field ei_cba_acco_prov_crid = EI_INIT; static expert_field ei_cba_acco_conn_consumer = EI_INIT; static expert_field ei_cba_acco_ldev_unknown = EI_INIT; static expert_field ei_cba_acco_no_request_info = EI_INIT; static expert_field ei_cba_acco_ipid_unknown = EI_INIT; static expert_field ei_cba_acco_qc = EI_INIT; static expert_field ei_cba_acco_pdev_find_unknown_interface = EI_INIT; static expert_field ei_cba_acco_disconnect = EI_INIT; static expert_field ei_cba_acco_connect = EI_INIT; static int proto_ICBAAccoMgt = -1; static gint ett_ICBAAccoMgt = -1; static e_guid_t uuid_ICBAAccoMgt = { 0xcba00041, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoMgt = 0; static int proto_ICBAAccoMgt2 = -1; static e_guid_t uuid_ICBAAccoMgt2 = { 0xcba00046, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoMgt2 = 0; static int proto_ICBAAccoCallback = -1; static gint ett_ICBAAccoCallback = -1; static gint ett_ICBAAccoCallback_Buffer = -1; static gint ett_ICBAAccoCallback_Item = -1; static e_guid_t uuid_ICBAAccoCallback = { 0xcba00042, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoCallback = 0; static int proto_ICBAAccoCallback2 = -1; static e_guid_t uuid_ICBAAccoCallback2 = { 0xcba00047, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoCallback2 = 0; static int proto_ICBAAccoServer = -1; static gint ett_ICBAAccoServer = -1; static e_guid_t uuid_ICBAAccoServer = { 0xcba00043, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoServer = 0; static int proto_ICBAAccoServer2 = -1; static e_guid_t uuid_ICBAAccoServer2 = { 0xcba00048, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoServer2 = 0; static int proto_ICBAAccoServerSRT = -1; static gint ett_ICBAAccoServerSRT = -1; static e_guid_t uuid_ICBAAccoServerSRT = { 0xcba00045, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoServerSRT = 0; static int proto_ICBAAccoSync = -1; static gint ett_ICBAAccoSync = -1; static e_guid_t uuid_ICBAAccoSync = { 0xcba00044, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoSync = 0; static const value_string cba_acco_qc_vals[] = { { 0x1c, "BadOutOfService" }, { 0x44, "UncertainLastUsableValue" }, { 0x48, "UncertainSubstituteSet" }, { 0x50, "UncertainSensorNotAccurate" }, { 0x80, "GoodNonCascOk" }, { 0, NULL } }; static const value_string cba_qos_type_vals[] = { { 0x00, "Acyclic" }, { 0x01, "Acyclic seconds" }, /* obsolete */ { 0x02, "Acyclic status" }, { 0x03, "Acyclic HMI" }, { 0x20, "Constant" }, { 0x30, "Cyclic Real-Time" }, { 0, NULL } }; static const value_string cba_persist_vals[] = { { 0x00, "Volatile" }, { 0x01, "PendingPersistent" }, { 0x02, "Persistent" }, { 0, NULL } }; static const value_string cba_acco_conn_state_vals[] = { { 0x00, "Passive" }, { 0x01, "Active" }, { 0, NULL } }; #if 0 static const value_string cba_acco_serversrt_action_vals[] = { { 0x00, "Activate" }, { 0x01, "Deactivate" }, { 0x02, "Remove" }, { 0, NULL } }; #endif static const value_string cba_acco_serversrt_last_connect_vals[] = { { 0x00, "CR not complete" }, { 0x01, "CR complete" }, { 0, NULL } }; static const value_string cba_acco_diag_req_vals[] = { { 0x0000, "Function directory" }, { 0x1000, "DevCat statistic" }, { 0x2000, "Reset statistic" }, { 0x3000, "Consumer Comm. Events" }, { 0x4000, "Provider Comm. Events" }, { 0, NULL } }; static const true_false_string cba_acco_call_flags = { "Consumer calls Provider (TRUE)", "Provider calls Consumer (FALSE)" }; static const value_string cba_qos_type_short_vals[] = { { 0x00, "DCOM" }, { 0x01, "DCOM(sec)" }, /* obsolete */ { 0x02, "Status" }, { 0x03, "HMI" }, { 0x20, "Const" }, { 0x30, "SRT" }, { 0, NULL } }; typedef struct cba_frame_s { cba_ldev_t *consparent; cba_ldev_t *provparent; GList *conns; guint packet_connect; guint packet_disconnect; guint packet_disconnectme; guint packet_first; guint packet_last; guint16 length; guint8 consmac[6]; guint16 conscrid; guint32 provcrid; guint32 conncrret; guint16 qostype; guint16 qosvalue; guint16 offset; } cba_frame_t; typedef struct cba_connection_s { cba_ldev_t *consparentacco; cba_ldev_t *provparentacco; cba_frame_t *parentframe; guint packet_connect; guint packet_disconnect; guint packet_disconnectme; guint packet_first; guint packet_last; guint16 length; guint32 consid; guint32 provid; const gchar *provitem; guint32 connret; guint16 typedesclen; guint16 *typedesc; guint16 qostype; guint16 qosvalue; guint16 frame_offset; } cba_connection_t; typedef struct server_frame_call_s { guint frame_count; cba_frame_t **frames; } server_frame_call_t; typedef struct server_connect_call_s { guint conn_count; cba_frame_t *frame; cba_connection_t **conns; } server_connect_call_t; typedef struct server_disconnectme_call_s { cba_ldev_t *cons; cba_ldev_t *prov; } server_disconnectme_call_t; GList *cba_pdevs; /* as we are a plugin, we cannot get this from libwireshark! */ const true_false_string acco_flags_set_truth = { "Set", "Not set" }; static gboolean cba_filter_valid(packet_info *pinfo, void *user_data _U_) { void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0); return ((profinet_type != NULL) && (GPOINTER_TO_UINT(profinet_type) < 10)); } static gchar* cba_build_filter(packet_info *pinfo, void *user_data _U_) { gboolean is_tcp = proto_is_frame_protocol(pinfo->layers, "tcp"); void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0); if ((pinfo->net_src.type == AT_IPv4) && (pinfo->net_dst.type == AT_IPv4) && is_tcp) { /* IPv4 */ switch(GPOINTER_TO_UINT(profinet_type)) { case 1: return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); case 2: return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.dcom == 0)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src)); case 3: return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst)); case 4: return ws_strdup_printf("(ip.src eq %s and ip.dst eq %s and cba.acco.srt == 1) || (ip.src eq %s and ip.dst eq %s and cba.acco.srt == 0)", address_to_str(pinfo->pool, &pinfo->net_src), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_dst), address_to_str(pinfo->pool, &pinfo->net_src)); default: return NULL; } } return NULL; } #if 0 static void cba_connection_dump(cba_connection_t *conn, const char *role) { if (conn->qostype != 0x30) { ws_debug_printf(" %s#%5u: CID:0x%8x PID:0x%8x PItem:\"%s\" Type:%s QoS:%s/%u Ret:%s Data#%5u-#%5u", role, conn->packet_connect, conn->consid, conn->provid, conn->provitem, conn->typedesclen != 0 ? val_to_str(conn->typedesc[0], dcom_variant_type_vals, "Unknown (0x%08x)") : "-", val_to_str(conn->qostype, cba_qos_type_short_vals, "0x%x"), conn->qosvalue, conn->connret==0xffffffff ? "[pending]" : val_to_str(conn->connret, dcom_hresult_vals, "Unknown (0x%08x)"), conn->packet_first, conn->packet_last); } else { ws_debug_printf(" %s#%5u: CID:0x%8x PID:0x%8x PItem:\"%s\" Type:%s QoS:%s/%u Ret:%s Off:%u", role, conn->packet_connect, conn->consid, conn->provid, conn->provitem, conn->typedesclen != 0 ? val_to_str(conn->typedesc[0], dcom_variant_type_vals, "Unknown (0x%08x)") : "-", val_to_str(conn->qostype, cba_qos_type_short_vals, "0x%x"), conn->qosvalue, conn->connret==0xffffffff ? "[pending]" : val_to_str(conn->connret, dcom_hresult_vals, "Unknown (0x%08x)"), conn->frame_offset); } } static void cba_object_dump(void) { GList *pdevs; GList *ldevs; GList *frames; GList *conns; cba_pdev_t *pdev; cba_ldev_t *ldev; cba_frame_t *frame; address addr; for(pdevs = cba_pdevs; pdevs != NULL; pdevs = g_list_next(pdevs)) { pdev = pdevs->data; set_address(&addr, AT_IPv4, 4, pdev->ip); ws_debug_printf("PDev #%5u: %s IFs:%u", pdev->first_packet, address_to_str(pinfo->pool, &addr), pdev->object ? g_list_length(pdev->object->interfaces) : 0); for(ldevs = pdev->ldevs; ldevs != NULL; ldevs = g_list_next(ldevs)) { ldev = ldevs->data; ws_debug_printf(" LDev#%5u: \"%s\" LDevIFs:%u AccoIFs:%u", ldev->first_packet, ldev->name, ldev->ldev_object ? g_list_length(ldev->ldev_object->interfaces) : 0, ldev->acco_object ? g_list_length(ldev->acco_object->interfaces) : 0); for(frames = ldev->consframes; frames != NULL; frames = g_list_next(frames)) { frame = frames->data; ws_debug_printf(" ConsFrame#%5u: CCRID:0x%x PCRID:0x%x Len:%u Ret:%s Data#%5u-#%5u", frame->packet_connect, frame->conscrid, frame->provcrid, frame->length, frame->conncrret==0xffffffff ? "[pending]" : val_to_str(frame->conncrret, dcom_hresult_vals, "Unknown (0x%08x)"), frame->packet_first, frame->packet_last); for(conns = frame->conns; conns != NULL; conns = g_list_next(conns)) { cba_connection_dump(conns->data, "ConsConn"); } } for(frames = ldev->provframes; frames != NULL; frames = g_list_next(frames)) { frame = frames->data; ws_debug_printf(" ProvFrame#%5u: CCRID:0x%x PCRID:0x%x Len:%u Ret:%s Data#%5u-#%5u", frame->packet_connect, frame->conscrid, frame->provcrid, frame->length, frame->conncrret==0xffffffff ? "[pending]" : val_to_str(frame->conncrret, dcom_hresult_vals, "Unknown (0x%08x)"), frame->packet_first, frame->packet_last); for(conns = frame->conns; conns != NULL; conns = g_list_next(conns)) { cba_connection_dump(conns->data, "ProvConn"); } } for(conns = ldev->consconns; conns != NULL; conns = g_list_next(conns)) { cba_connection_dump(conns->data, "ConsConn"); } for(conns = ldev->provconns; conns != NULL; conns = g_list_next(conns)) { cba_connection_dump(conns->data, "ProvConn"); } } } } #endif cba_pdev_t * cba_pdev_find(packet_info *pinfo, const address *addr, e_guid_t *ipid) { cba_pdev_t *pdev; dcom_interface_t *interf; interf = dcom_interface_find(pinfo, addr, ipid); if (interf != NULL) { pdev = (cba_pdev_t *)interf->parent->private_data; if (pdev == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_pdev_find, "pdev_find: no pdev for IP:%s IPID:%s", address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid, pinfo->pool)); } } else { expert_add_info_format(pinfo, NULL, &ei_cba_acco_pdev_find_unknown_interface, "pdev_find: unknown interface of IP:%s IPID:%s", address_to_str(pinfo->pool, addr), guids_resolve_guid_to_str(ipid, pinfo->pool)); pdev = NULL; } return pdev; } cba_pdev_t * cba_pdev_add(packet_info *pinfo, const address *addr) { GList *cba_iter; cba_pdev_t *pdev; /* find pdev */ for(cba_iter = cba_pdevs; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { pdev = (cba_pdev_t *)cba_iter->data; if (memcmp(pdev->ip, addr->data, 4) == 0) { return pdev; } } /* not found, create a new */ pdev = wmem_new(wmem_file_scope(), cba_pdev_t); memcpy( (void *) (pdev->ip), addr->data, 4); pdev->first_packet = pinfo->num; pdev->ldevs = NULL; pdev->object = NULL; cba_pdevs = g_list_append(cba_pdevs, pdev); return pdev; } void cba_pdev_link(packet_info *pinfo _U_, cba_pdev_t *pdev, dcom_interface_t *pdev_interf) { /* "crosslink" pdev interface and its object */ pdev->object = pdev_interf->parent; pdev_interf->private_data = pdev; if (pdev_interf->parent) { pdev_interf->parent->private_data = pdev; } } void cba_ldev_link(packet_info *pinfo _U_, cba_ldev_t *ldev, dcom_interface_t *ldev_interf) { /* "crosslink" interface and its object */ ldev->ldev_object = ldev_interf->parent; ldev_interf->private_data = ldev; if (ldev_interf->parent) { ldev_interf->parent->private_data = ldev; } } void cba_ldev_link_acco(packet_info *pinfo _U_, cba_ldev_t *ldev, dcom_interface_t *acco_interf) { /* "crosslink" interface and its object */ ldev->acco_object = acco_interf->parent; acco_interf->private_data = ldev; if (acco_interf->parent) { acco_interf->parent->private_data = ldev; } } cba_ldev_t * cba_ldev_add(packet_info *pinfo, cba_pdev_t *pdev, const char *name) { GList *cba_iter; cba_ldev_t *ldev; /* find ldev */ for(cba_iter = pdev->ldevs; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { ldev = (cba_ldev_t *)cba_iter->data; if (strcmp(ldev->name, name) == 0) { return ldev; } } /* not found, create a new */ ldev = wmem_new(wmem_file_scope(), cba_ldev_t); ldev->name = wmem_strdup(wmem_file_scope(), name); ldev->first_packet = pinfo->num; ldev->ldev_object = NULL; ldev->acco_object = NULL; ldev->parent = pdev; ldev->provframes = NULL; ldev->consframes = NULL; ldev->provconns = NULL; ldev->consconns = NULL; pdev->ldevs = g_list_append(pdev->ldevs, ldev); return ldev; } cba_ldev_t * cba_ldev_find(packet_info *pinfo, const address *addr, e_guid_t *ipid) { dcom_interface_t *interf; cba_ldev_t *ldev; interf = dcom_interface_find(pinfo, addr, ipid); if (interf != NULL) { ldev = (cba_ldev_t *)interf->private_data; if (ldev == NULL) { ldev = (cba_ldev_t *)interf->parent->private_data; } if (ldev == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_ldev_unknown, "Unknown LDev of %s", address_to_str(pinfo->pool, addr)); } } else { expert_add_info_format(pinfo, NULL, &ei_cba_acco_ipid_unknown, "Unknown IPID of %s", address_to_str(pinfo->pool, addr)); ldev = NULL; } return ldev; } static cba_ldev_t * cba_acco_add(packet_info *pinfo, const char *acco) { char *ip_str; char *delim; guint32 ip; cba_pdev_t *pdev; cba_ldev_t *ldev; address addr; ip_str = g_strdup(acco); delim = strchr(ip_str, '!'); if (delim == NULL) { g_free(ip_str); return NULL; } *delim = 0; if (!get_host_ipaddr(ip_str, &ip)) { g_free(ip_str); return NULL; } set_address(&addr, AT_IPv4, 4, &ip); pdev = cba_pdev_add(pinfo, &addr); delim++; ldev = cba_ldev_add(pinfo, pdev, delim); g_free(ip_str); return ldev; } static gboolean cba_packet_in_range(packet_info *pinfo, guint packet_connect, guint packet_disconnect, guint packet_disconnectme) { if (packet_connect == 0) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_connect, "cba_packet_in_range#%u: packet_connect not set?", pinfo->num); } if (packet_connect == 0 || pinfo->num < packet_connect) { return FALSE; } if (packet_disconnect != 0 && pinfo->num > packet_disconnect) { return FALSE; } if (packet_disconnectme != 0 && pinfo->num > packet_disconnectme) { return FALSE; } return TRUE; } static void cba_frame_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, cba_frame_t *frame) { if (tree) { proto_item *item; proto_item *sub_item; proto_tree *sub_tree; sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_cba_frame_info, &sub_item, "Cons:\"%s\" CCRID:0x%x Prov:\"%s\" PCRID:0x%x QoS:%s/%ums Len:%u", frame->consparent ? frame->consparent->name : "", frame->conscrid, frame->provparent ? frame->provparent->name : "", frame->provcrid, val_to_str(frame->qostype, cba_qos_type_short_vals, "%u"), frame->qosvalue, frame->length); proto_item_set_generated(sub_item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_qos_type, tvb, 0, 0, frame->qostype); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_qos_value, tvb, 0, 0, frame->qosvalue); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_serversrt_cr_id, tvb, 0, 0, frame->conscrid); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_prov_crid, tvb, 0, 0, frame->provcrid); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_serversrt_cr_length, tvb, 0, 0, frame->length); proto_item_set_generated(item); if (frame->consparent != NULL) { item = proto_tree_add_string(sub_tree, hf_cba_acco_conn_consumer, tvb, 0, 0, frame->consparent->name); proto_item_set_generated(item); } if (frame->provparent != NULL) { item = proto_tree_add_string(sub_tree, hf_cba_acco_conn_provider, tvb, 0, 0, frame->provparent->name); proto_item_set_generated(item); } item = proto_tree_add_uint(sub_tree, hf_cba_connectcr_in, tvb, 0, 0, frame->packet_connect); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_data_first_in, tvb, 0, 0, frame->packet_first); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_data_last_in, tvb, 0, 0, frame->packet_last); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_disconnectcr_in, tvb, 0, 0, frame->packet_disconnect); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_disconnectme_in, tvb, 0, 0, frame->packet_disconnectme); proto_item_set_generated(item); } } static cba_frame_t * cba_frame_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ldev, guint16 qostype, guint16 qosvalue, const guint8 *consmac, guint16 conscrid, guint16 length) { GList *cba_iter; cba_frame_t *frame; /* find frame */ for(cba_iter = cons_ldev->consframes; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { frame = (cba_frame_t *)cba_iter->data; if ( frame->conscrid == conscrid && memcmp(frame->consmac, consmac, 6) == 0 && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { return frame; } } frame = wmem_new(wmem_file_scope(), cba_frame_t); frame->consparent = cons_ldev; frame->provparent = prov_ldev; frame->packet_connect = pinfo->num; frame->packet_disconnect = 0; frame->packet_disconnectme = 0; frame->packet_first = 0; frame->packet_last = 0; frame->length = length; memcpy( (guint8 *) (frame->consmac), consmac, sizeof(frame->consmac)); frame->conscrid = conscrid; frame->qostype = qostype; frame->qosvalue = qosvalue; frame->offset = 4; frame->conns = NULL; frame->provcrid = 0; frame->conncrret = -1; cons_ldev->consframes = g_list_append(cons_ldev->consframes, frame); prov_ldev->provframes = g_list_append(prov_ldev->provframes, frame); return frame; } static void cba_frame_disconnect(packet_info *pinfo, cba_frame_t *frame) { if (frame->packet_disconnect == 0) { frame->packet_disconnect = pinfo->num; } if (frame->packet_disconnect != pinfo->num) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_disconnect, "cba_frame_disconnect#%u: frame already disconnected in #%u", pinfo->num, frame->packet_disconnect); } } static void cba_frame_disconnectme(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ldev) { GList *frames; cba_frame_t *frame; for(frames = cons_ldev->consframes; frames != NULL; frames = g_list_next(frames)) { frame = (cba_frame_t *)frames->data; if ( frame->provparent == prov_ldev && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { cba_frame_info(tvb, pinfo, tree, frame); if (frame->packet_disconnectme == 0) { frame->packet_disconnectme = pinfo->num; } if (frame->packet_disconnectme != pinfo->num) { expert_add_info_format(pinfo, tree, &ei_cba_acco_disconnect, "cba_frame_disconnectme#%u: frame already disconnectme'd in #%u", pinfo->num, frame->packet_disconnectme); } } } } static cba_frame_t * cba_frame_find_by_cons(packet_info *pinfo, const guint8 *consmac, guint16 conscrid) { GList *pdevs; GList *ldevs; GList *frames; cba_pdev_t *pdev; cba_ldev_t *ldev; cba_frame_t *frame; /* find pdev */ for(pdevs = cba_pdevs; pdevs != NULL; pdevs = g_list_next(pdevs)) { pdev = (cba_pdev_t *)pdevs->data; /* find ldev */ for(ldevs = pdev->ldevs; ldevs != NULL; ldevs = g_list_next(ldevs)) { ldev = (cba_ldev_t *)ldevs->data; /* find frame */ for(frames = ldev->consframes; frames != NULL; frames = g_list_next(frames)) { frame = (cba_frame_t *)frames->data; if ( frame->conscrid == conscrid && memcmp(frame->consmac, consmac, 6) == 0 && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { return frame; } } } } return NULL; } static cba_frame_t * cba_frame_find_by_provcrid(packet_info *pinfo, cba_ldev_t *prov_ldev, guint32 provcrid) { GList *frames; cba_frame_t *frame; if (prov_ldev == NULL) { return NULL; } for(frames = prov_ldev->provframes; frames != NULL; frames = g_list_next(frames)) { frame = (cba_frame_t *)frames->data; if ( frame->provcrid == provcrid && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { return frame; } } expert_add_info(pinfo, NULL, &ei_cba_acco_prov_crid); return NULL; } static void cba_frame_incoming_data(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree _U_, cba_frame_t *frame) { if (frame->packet_first == 0) { frame->packet_first = pinfo->num; } if ( pinfo->num > frame->packet_last && cba_packet_in_range(pinfo, frame->packet_connect, frame->packet_disconnect, frame->packet_disconnectme)) { frame->packet_last = pinfo->num; } } static void cba_connection_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, cba_connection_t *conn) { if (tree) { proto_item *item; proto_item *sub_item; proto_tree *sub_tree; if (conn->qostype != 0x30) { sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_cba_conn_info, &sub_item, "ProvItem:\"%s\" PID:0x%x CID:0x%x QoS:%s/%ums", conn->provitem, conn->provid, conn->consid, val_to_str(conn->qostype, cba_qos_type_short_vals, "%u"), conn->qosvalue); } else { sub_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_cba_conn_info, &sub_item, "ProvItem:\"%s\" PID:0x%x CID:0x%x Len:%u", conn->provitem, conn->provid, conn->consid, conn->length); } proto_item_set_generated(sub_item); item = proto_tree_add_string(sub_tree, hf_cba_acco_conn_provider_item, tvb, 0, 0 /* len */, conn->provitem); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_prov_id, tvb, 0, 0 /* len */, conn->provid); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_cons_id, tvb, 0, 0 /* len */, conn->consid); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_serversrt_record_length, tvb, 0, 0 /* len */, conn->length); proto_item_set_generated(item); if (conn->qostype != 0x30) { item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_qos_type, tvb, 0, 0, conn->qostype); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_acco_conn_qos_value, tvb, 0, 0, conn->qosvalue); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_connect_in, tvb, 0, 0, conn->packet_connect); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_data_first_in, tvb, 0, 0, conn->packet_first); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_data_last_in, tvb, 0, 0, conn->packet_last); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_disconnect_in, tvb, 0, 0, conn->packet_disconnect); proto_item_set_generated(item); item = proto_tree_add_uint(sub_tree, hf_cba_disconnectme_in, tvb, 0, 0, conn->packet_disconnectme); proto_item_set_generated(item); } } } static cba_connection_t * cba_connection_connect(packet_info *pinfo, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ldev, cba_frame_t *cons_frame, guint16 qostype, guint16 qosvalue, const char *provitem, guint32 consid, guint16 length, guint16 *typedesc, guint16 typedesclen) { GList *cba_iter; cba_connection_t *conn; /* find connection */ if (cons_frame != NULL) { /* SRT: search in frame */ for(cba_iter = cons_frame->conns; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { conn = (cba_connection_t *)cba_iter->data; if (conn->consid == consid) { return conn; } } } else { /* DCOM: search in ldev */ for(cba_iter = cons_ldev->consconns; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { conn = (cba_connection_t *)cba_iter->data; if ( conn->consid == consid && cba_packet_in_range(pinfo, conn->packet_connect, conn->packet_disconnect, conn->packet_disconnectme)) { return conn; } } } conn = wmem_new(wmem_file_scope(), cba_connection_t); conn->consparentacco = cons_ldev; conn->provparentacco = prov_ldev; conn->parentframe = cons_frame; conn->packet_connect = pinfo->num; conn->packet_disconnect = 0; conn->packet_disconnectme = 0; conn->packet_first = 0; conn->packet_last = 0; conn->consid = consid; conn->provitem = wmem_strdup(wmem_file_scope(), provitem); conn->typedesclen = typedesclen; conn->typedesc = typedesc; conn->qostype = qostype; conn->qosvalue = qosvalue; conn->length = length; conn->provid = 0; conn->connret = -1; if (cons_frame != NULL) { conn->frame_offset = cons_frame->offset; conn->length = length; cons_frame->offset += length; cons_frame->conns = g_list_append(cons_frame->conns, conn); } else { conn->frame_offset = 0; cons_ldev->consconns = g_list_append(cons_ldev->consconns, conn); prov_ldev->provconns = g_list_append(prov_ldev->provconns, conn); } return conn; } static void cba_connection_disconnect(packet_info *pinfo, cba_connection_t *conn) { /* XXX - detect multiple disconnects? */ if (conn->packet_disconnect == 0) { conn->packet_disconnect = pinfo->num; } if (conn->packet_disconnect != pinfo->num) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_disconnect, "connection_disconnect#%u: already disconnected", conn->packet_disconnect); } } static void cba_connection_disconnectme(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cba_ldev_t *cons_ldev, cba_ldev_t *prov_ldev) { GList *conns; cba_connection_t *conn; for(conns = cons_ldev->consconns; conns != NULL; conns = g_list_next(conns)) { conn = (cba_connection_t *)conns->data; if ( conn->provparentacco == prov_ldev && cba_packet_in_range(pinfo, conn->packet_connect, conn->packet_disconnect, conn->packet_disconnectme)) { cba_connection_info(tvb, pinfo, tree, conn); if (conn->packet_disconnectme == 0) { conn->packet_disconnectme = pinfo->num; } if (conn->packet_disconnectme != pinfo->num) { expert_add_info_format(pinfo, tree, &ei_cba_acco_disconnect, "connection_disconnectme#%u: already disconnectme'd", conn->packet_disconnectme); } } } } static cba_connection_t * cba_connection_find_by_provid(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree _U_, cba_ldev_t *prov_ldev, guint32 provid) { GList *cba_iter; cba_connection_t *conn; for(cba_iter = prov_ldev->provconns; cba_iter != NULL; cba_iter = g_list_next(cba_iter)) { conn = (cba_connection_t *)cba_iter->data; if ( conn->provid == provid && cba_packet_in_range(pinfo, conn->packet_connect, conn->packet_disconnect, conn->packet_disconnectme)) { return conn; } } return NULL; } static void cba_connection_incoming_data(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree _U_, cba_connection_t *conn) { if (conn->packet_first == 0) { conn->packet_first = pinfo->num; } if ( pinfo->num > conn->packet_last && cba_packet_in_range(pinfo, conn->packet_connect, conn->packet_disconnect, conn->packet_disconnectme)) { conn->packet_last = pinfo->num; } } /* dissect a response containing an array of hresults (e.g: ICBAAccoMgt::RemoveConnections) */ static int dissect_HResultArray_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer_SetActivation_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_Disconnect_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_SetActivation_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer_Connect_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32VariableOffset; guint32 u32SubStart; guint32 u32Pointer; guint16 u16VarType; guint32 u32ConsID; gchar szItem[1000] = { 0 }; guint32 u32MaxItemLen = sizeof(szItem); gchar szCons[1000] = { 0 }; guint32 u32MaxConsLen = sizeof(szCons); guint32 u32Idx; proto_item *item; dcom_interface_t *cons_interf; cba_ldev_t *cons_ldev; cba_ldev_t *prov_ldev; cba_connection_t *conn; server_connect_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szCons, u32MaxConsLen); /* find the consumer ldev by its name */ cons_ldev = cba_acco_add(pinfo, szCons); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_BYTE(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, &cons_interf); if (cons_interf == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_conn_consumer, "Server_Connect: consumer interface invalid"); } /* "crosslink" consumer interface and its object */ if (cons_interf != NULL && cons_ldev != NULL) { cba_ldev_link_acco(pinfo, cons_ldev, cons_interf); } offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* link connections infos to the call */ if (prov_ldev != NULL && cons_ldev != NULL) { call = (server_connect_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_connect_call_t) + u32ArraySize * sizeof(cba_connection_t *)); call->conn_count = 0; call->frame = NULL; call->conns = (cba_connection_t **) (call+1); di->call_data->private_data = call; } else{ call = NULL; } u32VariableOffset = offset + u32ArraySize*16; /* array of CONNECTINs */ u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_connectin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectin); u32SubStart = offset; /* ProviderItem */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szItem, u32MaxItemLen); } /* DataType */ offset = dissect_dcom_VARTYPE(tvb, offset, pinfo, sub_tree, di, drep, &u16VarType); /* Epsilon */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } /* ConsumerID */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); /* add to object database */ if (prov_ldev != NULL && cons_ldev != NULL) { conn = cba_connection_connect(pinfo, cons_ldev, prov_ldev, /*cons_frame*/ NULL, u16QoSType, u16QoSValue, szItem, u32ConsID, 0, /* XXX - VarType must be translated to new type description if it includes an array (0x2000) */ (guint16 *)wmem_memdup(wmem_file_scope(), &u16VarType, 2), 1); cba_connection_info(tvb, pinfo, sub_tree, conn); } else { conn = NULL; } /* add to current call */ if (call != NULL) { call->conn_count++; call->conns[u32Idx-1] = conn; } /* update subtree header */ proto_item_append_text(sub_item, "[%u]: ConsID=0x%x, ProvItem=\"%s\", VarType=%s", u32Idx, u32ConsID, szItem, val_to_str(u16VarType, dcom_variant_type_vals, "Unknown (0x%04x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Consumer=\"%s\" Cnt=%u", szCons, u32Count); return u32VariableOffset; } static int dissect_ICBAAccoServer2_Connect2_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32VariableOffset; guint32 u32SubStart; guint32 u32Pointer; guint16 u16VarType; guint32 u32ConsID; gchar szItem[1000] = { 0 }; guint32 u32MaxItemLen = sizeof(szItem); gchar szCons[1000] = { 0 }; guint32 u32MaxConsLen = sizeof(szCons); guint32 u32Idx; guint16 u16TypeDescLen; guint32 u32ArraySize2; guint32 u32Idx2; guint16 u16VarType2 = -1; proto_item *item; dcom_interface_t *cons_interf; cba_ldev_t *prov_ldev; cba_ldev_t *cons_ldev; cba_connection_t *conn; guint16 typedesclen = 0; guint16 *typedesc = NULL; server_connect_call_t *call = NULL; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szCons, u32MaxConsLen); /* find the consumer ldev by its name */ cons_ldev = cba_acco_add(pinfo, szCons); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_BYTE(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_MInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, &cons_interf); if (cons_interf == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_conn_consumer, "Server2_Connect2: consumer interface invalid"); } } else { /* GetConnectionData do it this way */ cons_interf = NULL; } /* "crosslink" consumer interface and its object */ if (cons_interf != NULL && cons_ldev != NULL) { cba_ldev_link_acco(pinfo, cons_ldev, cons_interf); } offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* link connection infos to the call */ if (prov_ldev != NULL && cons_ldev != NULL) { call = (server_connect_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_connect_call_t) + u32ArraySize * sizeof(cba_connection_t *)); call->conn_count = 0; call->frame = NULL; call->conns = (cba_connection_t **) (call+1); di->call_data->private_data = call; } else{ call = NULL; } u32VariableOffset = offset + u32ArraySize*20; /* array of CONNECTINs */ u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_connectin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectin); u32SubStart = offset; /* ProviderItem */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szItem, u32MaxItemLen); } /* TypeDescLen */ offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_type_desc_len, &u16TypeDescLen); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); /* pTypeDesc */ if (u32Pointer) { u32VariableOffset = dissect_dcom_dcerpc_array_size(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, &u32ArraySize2); /* limit the allocation to a reasonable size */ if (u32ArraySize2 < 1000) { typedesc = (guint16 *)wmem_alloc0(wmem_file_scope(), u32ArraySize2 * 2); typedesclen = u32ArraySize2; } else { typedesc = NULL; typedesclen = 0; } /* extended type description will build an array here */ u32Idx2 = 1; while (u32ArraySize2--) { /* ToBeDone: some of the type description values are counts */ u32VariableOffset = dissect_dcom_VARTYPE(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, &u16VarType); if (typedesc != NULL && u32Idx2 <= typedesclen) { typedesc[u32Idx2-1] = u16VarType; } /* remember first VarType only */ if (u32Idx2 == 1) { u16VarType2 = u16VarType; } u32Idx2++; } } /* Epsilon */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } /* ConsumerID */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); /* add to object database */ if (prov_ldev != NULL && cons_ldev != NULL) { conn = cba_connection_connect(pinfo, cons_ldev, prov_ldev, /*cons_frame*/ NULL, u16QoSType, u16QoSValue, szItem, u32ConsID, 0, typedesc, typedesclen); cba_connection_info(tvb, pinfo, sub_tree, conn); } else { conn = NULL; } /* add to current call */ if (call != NULL) { call->conn_count++; call->conns[u32Idx-1] = conn; } /* update subtree header */ proto_item_append_text(sub_item, "[%u]: ConsID=0x%x, ProvItem=\"%s\", TypeDesc=%s", u32Idx, u32ConsID, szItem, val_to_str(u16VarType2, dcom_variant_type_vals, "Unknown (0x%04x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Consumer=\"%s\" Cnt=%u", szCons, u32Count); return u32VariableOffset; } static int dissect_ICBAAccoServer_Connect_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint8 u8FirstConnect; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32HResult; guint32 u32Idx = 1; guint32 u32ProvID; guint32 u32SubStart; proto_item *item; cba_connection_t *conn; server_connect_call_t *call = (server_connect_call_t *)di->call_data->private_data; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); if (call == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_no_request_info); } item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_server_first_connect, &u8FirstConnect); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* array of CONNECTOUTs */ while(u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_connectout, tvb, offset, 8, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectout); u32SubStart = offset; offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); /* put response data into the connection */ if (call && u32Idx <= call->conn_count) { conn = call->conns[u32Idx-1]; conn->provid = u32ProvID; conn->connret = u32HResult; cba_connection_info(tvb, pinfo, sub_tree, conn); } proto_item_append_text(sub_item, "[%u]: ProvID=0x%x %s", u32Idx, u32ProvID, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); /* this might be a global HRESULT */ while(call && u32Idx <= call->conn_count) { conn = call->conns[u32Idx-1]; conn->provid = 0; conn->connret = u32HResult; u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": %s Cnt=%u -> %s", (u8FirstConnect) ? "First" : "NotFirst", u32Idx-1, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer_Disconnect_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; proto_item *item; cba_ldev_t *prov_ldev; cba_connection_t *conn; server_connect_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); /* link connection infos to the call */ if (prov_ldev != NULL) { call = (server_connect_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_connect_call_t) + u32ArraySize * sizeof(cba_connection_t *)); call->conn_count = 0; call->frame = NULL; call->conns = (cba_connection_t **) (call+1); di->call_data->private_data = call; } else{ call = NULL; } u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); /* add to current call */ if (call != NULL) { conn = cba_connection_find_by_provid(tvb, pinfo, tree, prov_ldev, u32ProvID); call->conn_count++; call->conns[u32Idx-1] = conn; } u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoServer_Disconnect_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; proto_item *item; cba_connection_t *conn; server_connect_call_t *call = (server_connect_call_t *)di->call_data->private_data; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); if (call == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_no_request_info); } item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); /* mark this connection as disconnected */ if (call && u32Idx <= call->conn_count) { conn = call->conns[u32Idx-1]; if (conn != NULL) { cba_connection_disconnect(pinfo, conn); } } u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_Disconnect_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; proto_item *item; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoServer_DisconnectMe_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); proto_item *item; cba_ldev_t *prov_ldev; cba_ldev_t *cons_ldev; server_disconnectme_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szStr, u32MaxStr); /* find the consumer ldev by its name */ cons_ldev = cba_acco_add(pinfo, szStr); if (prov_ldev != NULL && cons_ldev != NULL) { call = wmem_new(wmem_file_scope(), server_disconnectme_call_t); call->cons = cons_ldev; call->prov = prov_ldev; di->call_data->private_data = call; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " Consumer=\"%s\"", szStr); return offset; } static int dissect_ICBAAccoServer_DisconnectMe_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; proto_item *item; server_disconnectme_call_t *call; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); call = (server_disconnectme_call_t *)di->call_data->private_data; if (call) { cba_connection_disconnectme(tvb, pinfo, tree, call->cons, call->prov); } col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_DisconnectMe_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); proto_item *item; cba_ldev_t *prov_ldev; cba_ldev_t *cons_ldev; server_disconnectme_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szStr, u32MaxStr); /* find the consumer ldev by its name */ cons_ldev = cba_acco_add(pinfo, szStr); if (prov_ldev != NULL && cons_ldev != NULL) { call = wmem_new(wmem_file_scope(), server_disconnectme_call_t); call->cons = cons_ldev; call->prov = prov_ldev; di->call_data->private_data = call; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " Consumer=\"%s\"", szStr); return offset; } static int dissect_ICBAAccoServerSRT_DisconnectMe_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; proto_item *item; server_disconnectme_call_t *call; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); call = (server_disconnectme_call_t *)di->call_data->private_data; if (call) { cba_frame_disconnectme(tvb, pinfo, tree, call->cons, call->prov); } col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer_Ping_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer_SetActivation_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; proto_item *item; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoServerSRT_SetActivation_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; proto_item *item; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoServer_Ping_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); proto_item *item; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szStr, u32MaxStr); /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " Consumer=\"%s\"", szStr); return offset; } static int dissect_ICBAAccoServerSRT_ConnectCR_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szCons[1000] = { 0 }; guint32 u32MaxConsLen = sizeof(szCons); guint16 u16QoSType; guint16 u16QoSValue; guint8 u8ConsMac[6]; guint16 u16CRID = 0; guint16 u16CRLength = 0; guint32 u32Flags; guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; proto_item *item; proto_tree *flags_tree; guint32 u32SubStart; dcom_interface_t *cons_interf; cba_ldev_t *prov_ldev; cba_ldev_t *cons_ldev; cba_frame_t *frame; server_frame_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); /* szCons */ offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szCons, u32MaxConsLen); /* find the consumer ldev by its name */ cons_ldev = cba_acco_add(pinfo, szCons); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, &cons_interf); if (cons_interf == NULL) { expert_add_info_format(pinfo, NULL, &ei_cba_acco_conn_consumer, "ServerSRT_ConnectCR: consumer interface invalid"); } /* "crosslink" consumer interface and its object */ if (cons_interf != NULL && cons_ldev != NULL) { cba_ldev_link_acco(pinfo, cons_ldev, cons_interf); } /* ConsumerMAC (big-endian, 1byte-aligned) */ tvb_memcpy(tvb, u8ConsMac, offset, 6); proto_tree_add_ether(tree, hf_cba_acco_serversrt_cons_mac, tvb, offset, 6, u8ConsMac); offset += 6; /* add flags subtree */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, NULL /*tree*/, di, drep, 0 /* hfindex */, &u32Flags); offset -= 4; item = proto_tree_add_uint_format_value(tree, hf_cba_acco_serversrt_cr_flags, tvb, offset, 4, u32Flags, "0x%02x (%s, %s)", u32Flags, (u32Flags & 0x2) ? "Reconfigure" : "not Reconfigure", (u32Flags & 0x1) ? "Timestamped" : "not Timestamped"); flags_tree = proto_item_add_subtree(item, ett_cba_acco_serversrt_cr_flags); proto_tree_add_boolean(flags_tree, hf_cba_acco_serversrt_cr_flags_reconfigure, tvb, offset, 4, u32Flags); proto_tree_add_boolean(flags_tree, hf_cba_acco_serversrt_cr_flags_timestamped, tvb, offset, 4, u32Flags); offset += 4; offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* link frame infos to the call */ if (prov_ldev != NULL && cons_ldev != NULL && u32ArraySize < 100) { call = (server_frame_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_frame_call_t) + u32ArraySize * sizeof(cba_frame_t *)); call->frame_count = 0; call->frames = (cba_frame_t **) (call+1); di->call_data->private_data = call; } else { call = NULL; } u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; /* array of CONNECTINCRs */ sub_item = proto_tree_add_item(tree, hf_cba_connectincr, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectincr); u32SubStart = offset; offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_serversrt_cr_id, &u16CRID); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_serversrt_cr_length, &u16CRLength); /* add to object database */ if (prov_ldev != NULL && cons_ldev != NULL) { frame = cba_frame_connect(pinfo, cons_ldev, prov_ldev, u16QoSType, u16QoSValue, u8ConsMac, u16CRID, u16CRLength); cba_frame_info(tvb, pinfo, sub_tree, frame); } else { frame = NULL; } /* add to current call */ if (call != NULL) { call->frame_count++; call->frames[u32Idx-1] = frame; } /* update subtree header */ proto_item_append_text(sub_item, "[%u]: CRID=0x%x, CRLength=%u", u32Idx, u16CRID, u16CRLength); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": %sConsCRID=0x%x Len=%u QoS=%u", (u32Flags & 0x2) ? "Reco " : "", u16CRID, u16CRLength, u16QoSValue); return offset; } static int dissect_ICBAAccoServerSRT_ConnectCR_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint8 u8FirstConnect; guint8 u8ProvMac[6]; guint32 u32ProvCRID = 0; guint32 u32HResult; guint32 u32ArraySize; guint32 u32Idx = 1; guint32 u32Pointer; guint32 u32SubStart; proto_item *item; cba_frame_t *frame; server_frame_call_t *call = (server_frame_call_t *)di->call_data->private_data; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); if (call == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_no_request_info); } item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_server_first_connect, &u8FirstConnect); /* ProviderMAC (big-endian, 1byte-aligned) */ tvb_memcpy(tvb, u8ProvMac, offset, 6); proto_tree_add_ether(tree, hf_cba_acco_serversrt_prov_mac, tvb, offset, 6, u8ProvMac); offset += 6; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; /* array of CONNECTOUTCRs */ sub_item = proto_tree_add_item(tree, hf_cba_connectoutcr, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectoutcr); u32SubStart = offset; offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_prov_crid, &u32ProvCRID); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult); /* put response data into the frame */ if (call && u32Idx <= call->frame_count) { frame = call->frames[u32Idx-1]; frame->provcrid = u32ProvCRID; frame->conncrret = u32HResult; cba_frame_info(tvb, pinfo, sub_tree, frame); } /* update subtree header */ proto_item_append_text(sub_item, "[%u]: ProvCRID=0x%x, %s", u32Idx, u32ProvCRID, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); /* this might be a global HRESULT */ while(call && u32Idx <= call->frame_count) { frame = call->frames[u32Idx-1]; frame->provcrid = 0; frame->conncrret = u32HResult; u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": %s PCRID=0x%x -> %s", (u8FirstConnect) ? "FirstCR" : "NotFirstCR", u32ProvCRID, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_DisconnectCR_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvCRID = 0; proto_item *item; cba_ldev_t *prov_ldev; cba_frame_t *frame; server_frame_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* link frame infos to the call */ if (prov_ldev != NULL) { call = (server_frame_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_frame_call_t) + u32ArraySize * sizeof(cba_frame_t *)); call->frame_count = 0; call->frames = (cba_frame_t **) (call+1); di->call_data->private_data = call; } else{ call = NULL; } u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_prov_crid, &u32ProvCRID, u32Idx); /* find frame and add it to current call */ if (call != NULL) { frame = cba_frame_find_by_provcrid(pinfo, prov_ldev, u32ProvCRID); call->frame_count++; call->frames[u32Idx-1] = frame; } u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": PCRID=0x%x", u32ProvCRID); return offset; } static int dissect_ICBAAccoServerSRT_DisconnectCR_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32Idx; guint32 u32Tmp; cba_frame_t *frame; proto_item *item; server_frame_call_t *call = (server_frame_call_t *)di->call_data->private_data; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; u32Tmp = u32ArraySize; while (u32Tmp--) { offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult, u32Idx); /* put response data into the frame */ if (call && u32Idx <= call->frame_count) { frame = call->frames[u32Idx-1]; if (frame != NULL) { cba_frame_disconnect(pinfo, frame); } } u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServerSRT_Connect_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32ProvCRID; guint8 u8State; guint8 u8LastConnect; guint32 u32Count; guint32 u32ArraySize; guint32 u32VariableOffset; guint32 u32Idx; guint32 u32SubStart; guint32 u32Pointer; gchar szProvItem[1000] = { 0 }; guint32 u32MaxProvItemLen = sizeof(szProvItem); guint16 u16TypeDescLen; guint32 u32ArraySize2; guint32 u32Idx2; guint16 u16VarType2 = -1; guint16 u16VarType; guint32 u32ConsID; guint16 u16RecordLength; proto_item *item; cba_ldev_t *prov_ldev; cba_frame_t *frame = NULL; guint16 typedesclen = 0; guint16 *typedesc = NULL; cba_connection_t *conn; server_connect_call_t *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ prov_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_prov_crid, &u32ProvCRID); frame = cba_frame_find_by_provcrid(pinfo, prov_ldev, u32ProvCRID); if (frame != NULL) { cba_frame_info(tvb, pinfo, tree, frame); } offset = dissect_dcom_BYTE(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_BYTE(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_serversrt_last_connect, &u8LastConnect); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* link connections infos to the call */ if (frame != NULL) { call = (server_connect_call_t *)wmem_alloc(wmem_file_scope(), sizeof(server_connect_call_t) + u32ArraySize * sizeof(cba_connection_t *)); call->conn_count = 0; call->frame = frame; call->conns = (cba_connection_t **) (call+1); di->call_data->private_data = call; } else{ call = NULL; } u32VariableOffset = offset + u32ArraySize*20; u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; /* array of CONNECTINs */ sub_item = proto_tree_add_item(tree, hf_cba_connectin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectin); u32SubStart = offset; /* ProviderItem */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szProvItem, u32MaxProvItemLen); } /* TypeDescLen */ offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_type_desc_len, &u16TypeDescLen); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); /* pTypeDesc */ if (u32Pointer) { u32VariableOffset = dissect_dcom_dcerpc_array_size(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, &u32ArraySize2); typedesc = (guint16 *)wmem_alloc0(wmem_file_scope(), u32ArraySize2 * 2); typedesclen = u32ArraySize2; /* extended type description will build an array here */ u32Idx2 = 1; while (u32ArraySize2--) { /* ToBeDone: some of the type description values are counts */ u32VariableOffset = dissect_dcom_VARTYPE(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, &u16VarType); if (u32Idx2 <= typedesclen) { typedesc[u32Idx2-1] = u16VarType; } /* remember first VarType only */ if (u32Idx2 == 1) { u16VarType2 = u16VarType; } u32Idx2++; } } /* ConsumerID */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); /* RecordLength */ offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_serversrt_record_length, &u16RecordLength); /* add to object database */ if (frame != NULL) { conn = cba_connection_connect(pinfo, frame->consparent, frame->provparent, frame, frame->qostype, frame->qosvalue, szProvItem, u32ConsID, u16RecordLength, typedesc, typedesclen); cba_connection_info(tvb, pinfo, sub_tree, conn); } else { conn = NULL; } /* add to current call */ if (call != NULL) { call->conn_count++; call->conns[u32Idx-1] = conn; } /* update subtree header */ proto_item_append_text(sub_item, "[%u]: ConsID=0x%x, ProvItem=\"%s\", TypeDesc=%s", u32Idx, u32ConsID, szProvItem, val_to_str(u16VarType2, dcom_variant_type_vals, "Unknown (0x%04x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": %s Cnt=%u PCRID=0x%x", (u8LastConnect) ? "LastOfCR" : "", u32Idx-1, u32ProvCRID); return u32VariableOffset; } static int dissect_ICBAAccoServerSRT_Connect_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint32 u32ArraySize; guint32 u32Idx = 1; guint32 u32SubStart; guint32 u32ProvID; guint32 u32HResult; proto_item *item; server_connect_call_t *call = (server_connect_call_t *)di->call_data->private_data; cba_connection_t *conn; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); if (call == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_no_request_info); } item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (call && call->frame != NULL) { cba_frame_info(tvb, pinfo, tree, call->frame); } if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /* array of CONNECTOUTs */ while(u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_connectout, tvb, offset, 8, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_connectout); u32SubStart = offset; offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); /* put response data into the frame */ if (call && u32Idx <= call->conn_count) { conn = call->conns[u32Idx-1]; conn->provid = u32ProvID; conn->connret = u32HResult; cba_connection_info(tvb, pinfo, sub_tree, conn); } proto_item_append_text(sub_item, "[%u]: ProvID=0x%x %s", u32Idx, u32ProvID, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); /* this might be a global HRESULT */ while(call && u32Idx <= call->conn_count) { conn = call->conns[u32Idx-1]; conn->provid = 0; conn->connret = u32HResult; u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32Idx-1, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_Server_GetProvIDs_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32Pointer; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); if (u32Count) { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u ProvID=", u32Count); } else { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); if (u32Idx == 1) { col_append_fstr(pinfo->cinfo, COL_INFO, "0x%x", u32ProvID); } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ProvID); } else if (u32Idx == 10) { col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_Server_GetProvConnections_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ProvID; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_prov_id, &u32ProvID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_Server_GetProvConnections_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32TmpCount; guint32 u32Pointer; guint32 u32VariableOffset; guint32 u32Idx; guint32 u32SubStart; gchar szCons[1000] = { 0 }; guint32 u32MaxConsLen = sizeof(szCons); gchar szProvItem[1000] = { 0 }; guint32 u32MaxProvItemLen = sizeof(szProvItem); guint32 u32ConsID; guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); u32VariableOffset = offset; if (u32Pointer) { offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); u32VariableOffset = offset + u32Count*28; /* array fixed part (including pointers to variable part) */ u32TmpCount = u32Count; u32Idx = 1; while (u32TmpCount--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_getprovconnout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_getprovconnout); u32SubStart = offset; /* wszConsumer */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_consumer, szCons, u32MaxConsLen); } /* wszProviderItem */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szProvItem, u32MaxProvItemLen); } /* dwConsID */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); /* Epsilon */ offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } /* QoS Type */ offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); /* QoS Value */ offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); /* State */ offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_state, &u8State); /* PartialResult */ offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: %s", u32Idx, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } u32VariableOffset = dissect_dcom_HRESULT(tvb, u32VariableOffset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return u32VariableOffset; } #define CBA_MRSH_VERSION_DCOM 0x01 #define CBA_MRSH_VERSION_SRT_WITH_CONSID 0x10 #define CBA_MRSH_VERSION_SRT_WITHOUT_CONSID 0x11 static int dissect_CBA_Connection_Data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cba_ldev_t *cons_ldev, cba_frame_t *frame) { guint8 u8Version; guint8 u8Flags; guint16 u16CountFix; guint16 u16Count; guint32 u32ItemIdx; guint32 u32HoleIdx; proto_item *conn_data_item = NULL; proto_tree *conn_data_tree = NULL; guint16 u16Len; guint32 u32ID; guint8 u8QC; guint16 u16DataLen; guint16 u16HdrLen; int offset = 0; int offset_hole; gboolean qc_reported = FALSE; int qc_good = 0; int qc_uncertain = 0; int qc_bad = 0; GList *conns; int item_offset; cba_connection_t *conn; /*** ALL data in this buffer is NOT aligned and always little endian ordered ***/ if (tree) { conn_data_item = proto_tree_add_item(tree, hf_cba_acco_cb_conn_data, tvb, offset, 0, ENC_NA); conn_data_tree = proto_item_add_subtree(conn_data_item, ett_ICBAAccoCallback_Buffer); } /* add buffer header */ u8Version = tvb_get_guint8 (tvb, offset); if (conn_data_tree) { proto_tree_add_item(conn_data_tree, hf_cba_acco_cb_version, tvb, offset, 1, ENC_LITTLE_ENDIAN); } offset += 1; u8Flags = tvb_get_guint8 (tvb, offset); if (conn_data_tree) { proto_tree_add_item(conn_data_tree, hf_cba_acco_cb_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); } offset += 1; u16Count = tvb_get_letohs (tvb, offset); if (conn_data_tree) { proto_tree_add_item(conn_data_tree, hf_cba_acco_cb_count, tvb, offset, 2, ENC_LITTLE_ENDIAN); } offset += 2; u16CountFix = u16Count; /* show meta information */ if (frame) { cba_frame_info(tvb, pinfo, conn_data_tree, frame); } else { if (cons_ldev && cons_ldev->name) { proto_item *item; item = proto_tree_add_string(conn_data_tree, hf_cba_acco_conn_consumer, tvb, offset, 0, cons_ldev->name); proto_item_set_generated(item); } } /* update column info now */ #if 0 col_append_fstr(pinfo->cinfo, COL_INFO, " Cnt=%u", u16Count); #endif /* is this an OnDataChanged buffer format (version), we know? */ if ((u8Version != CBA_MRSH_VERSION_DCOM) && (u8Version != CBA_MRSH_VERSION_SRT_WITH_CONSID) && (u8Version != CBA_MRSH_VERSION_SRT_WITHOUT_CONSID)) { return offset; } /* Timestamps are currently unused -> flags must be zero */ if (u8Flags != 0) { return offset; } u32ItemIdx = 1; u32HoleIdx = 1; while (u16Count--) { proto_item *sub_item; proto_tree *sub_tree; proto_item *item; /* find next record header */ u16Len = tvb_get_letohs (tvb, offset); /* trapped inside an empty hole? -> try to find next record header */ if (u16Len == 0 && (u8Version == CBA_MRSH_VERSION_SRT_WITH_CONSID || u8Version == CBA_MRSH_VERSION_SRT_WITHOUT_CONSID)) { u32HoleIdx++; offset_hole = offset; /* length smaller or larger than possible -> must be a hole */ while (u16Len == 0) { offset++; u16Len = tvb_get_letohs(tvb, offset); /* this is a bit tricky here! we know: */ /* u16Len must be greater than 3 (min. size of header itself) */ /* u16Len must be a lot smaller than 0x300 (max. size of frame) */ /* -> if we found a length larger than 0x300, */ /* this must be actually the high byte, so do one more step */ if (u16Len > 0x300) { u16Len = 0; } } proto_tree_add_none_format(conn_data_tree, hf_cba_acco_cb_item_hole, tvb, offset_hole, offset - offset_hole, "Hole(--): -------------, offset=%2u, length=%2u", offset_hole, offset - offset_hole); } /* add callback-item subtree */ sub_item = proto_tree_add_item(conn_data_tree, hf_cba_acco_cb_item, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_ICBAAccoCallback_Item); item_offset = offset; /* add item header fields */ if (sub_tree) { proto_tree_add_item(sub_tree, hf_cba_acco_cb_item_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); } offset += 2; u16HdrLen = 2; if (u8Version == CBA_MRSH_VERSION_DCOM || u8Version == CBA_MRSH_VERSION_SRT_WITH_CONSID) { u32ID = tvb_get_letohl (tvb, offset); if (sub_tree) { proto_tree_add_item(sub_tree, hf_cba_acco_conn_cons_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); } offset += 4; u16HdrLen += 4; } else { u32ID = 0; } u8QC = tvb_get_guint8 (tvb, offset); item = NULL; if (sub_tree) { item = proto_tree_add_item(sub_tree, hf_cba_acco_qc, tvb, offset, 1, ENC_LITTLE_ENDIAN); } offset += 1; u16HdrLen += 1; if ( u8QC != 0x80 && /* GoodNonCascOk */ u8QC != 0x1C && /* BadOutOfService (usually permanent, so don't report for every frame) */ qc_reported == 0) { expert_add_info_format(pinfo, item, &ei_cba_acco_qc, "%s QC: %s", u8Version == CBA_MRSH_VERSION_DCOM ? "DCOM" : "SRT", val_to_str(u8QC, cba_acco_qc_vals, "Unknown (0x%02x)")); qc_reported = 0; } switch(u8QC >> 6) { case(00): qc_bad++; break; case(01): qc_uncertain++; break; default: qc_good++; } /* user data length is item length without headers */ u16DataLen = u16Len - u16HdrLen; /* append text to subtree header */ if (u8Version == CBA_MRSH_VERSION_DCOM || u8Version == CBA_MRSH_VERSION_SRT_WITH_CONSID) { proto_item_append_text(sub_item, "[%2u]: ConsID=0x%08x, offset=%2u, length=%2u (user-length=%2u), QC=%s (0x%02x)", u32ItemIdx, u32ID, offset - u16HdrLen, u16Len, u16DataLen, val_to_str(u8QC, cba_acco_qc_vals, "Unknown (0x%02x)"), u8QC ); } else { proto_item_append_text(sub_item, "[%2u]: ConsID=-, offset=%2u, length=%2u (user-length=%2u), QC=%s (0x%02x)", u32ItemIdx, offset - u16HdrLen, u16Len, u16DataLen, val_to_str(u8QC, cba_acco_qc_vals, "Unknown (0x%02x)"), u8QC ); } proto_item_set_len(sub_item, u16Len); /* hexdump of user data */ proto_tree_add_item(sub_tree, hf_cba_acco_cb_item_data, tvb, offset, u16DataLen, ENC_NA); offset += u16DataLen; if (frame != NULL ) { /* find offset in SRT */ /* XXX - expensive! */ cba_frame_incoming_data(tvb, pinfo, sub_tree, frame); for(conns = frame->conns; conns != NULL; conns = g_list_next(conns)) { conn = (cba_connection_t *)conns->data; if (conn->frame_offset == item_offset) { cba_connection_info(tvb, pinfo, sub_tree, conn); break; } } } else { /* find consID in ldev */ /* XXX - expensive! */ if (cons_ldev != NULL) { for(conns = cons_ldev->consconns; conns != NULL; conns = g_list_next(conns)) { conn = (cba_connection_t *)conns->data; if (conn->consid == u32ID) { cba_connection_info(tvb, pinfo, sub_tree, conn); cba_connection_incoming_data(tvb, pinfo, sub_tree, conn); break; } } } } u32ItemIdx++; } if (u8Version == 1) { proto_item_append_text(conn_data_item, ": Version=0x%x (DCOM), Flags=0x%x, Count=%u", u8Version, u8Flags, u16CountFix); } else { proto_item_append_text(conn_data_item, ": Version=0x%x (SRT), Flags=0x%x, Count=%u, Items=%u, Holes=%u", u8Version, u8Flags, u16CountFix, u32ItemIdx-1, u32HoleIdx-1); } proto_item_set_len(conn_data_item, offset); col_append_fstr(pinfo->cinfo, COL_INFO, ", QC (G:%u,U:%u,B:%u)", qc_good, qc_uncertain, qc_bad); return offset; } static gboolean dissect_CBA_Connection_Data_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { guint8 u8Version; guint8 u8Flags; /* the tvb will NOT contain the frame_id here! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); cba_frame_t *frame; /* frame id must be in valid range (cyclic Real-Time, class=1 or class=2) */ if (u16FrameID < 0x8000 || u16FrameID >= 0xfb00) { return FALSE; } u8Version = tvb_get_guint8 (tvb, 0); u8Flags = tvb_get_guint8 (tvb, 1); /* version and flags must be ok */ if (u8Version != 0x11 || u8Flags != 0x00) { return FALSE; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-CBA"); frame = cba_frame_find_by_cons(pinfo, (const guint8 *)pinfo->dl_dst.data, u16FrameID); dissect_CBA_Connection_Data(tvb, pinfo, tree, frame ? frame->consparent : NULL, frame); return TRUE; } static int dissect_ICBAAccoCallback_OnDataChanged_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Length; guint32 u32ArraySize; tvbuff_t *next_tvb; proto_item *item; cba_ldev_t *cons_ldev; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); /* get corresponding provider ldev */ cons_ldev = cba_ldev_find(pinfo, &pinfo->net_dst, &di->call_data->object_uuid); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); /* length */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_cb_length, &u32Length); /* array size */ offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /*** the data below is NOT ndr encoded (especially NOT aligned)!!! ***/ /* dissect PROFINET component data (without header) */ next_tvb = tvb_new_subset_remaining(tvb, offset); offset += dissect_CBA_Connection_Data(next_tvb, pinfo, tree, cons_ldev, NULL /* frame */); return offset; } static int dissect_ICBAAccoCallback_OnDataChanged_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoCallback_Gnip_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { proto_item *item; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(3)); return offset; } static int dissect_ICBAAccoCallback_Gnip_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; proto_item *item; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_srt_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(4)); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoServer2_GetConnectionData_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); proto_item *item; cba_ldev_t *cons_ldev; cba_ldev_t **call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, TRUE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(2)); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_consumer, szStr, u32MaxStr); cons_ldev = cba_acco_add(pinfo, szStr); /* link ldev to the call */ if (cons_ldev != NULL) { call = (cba_ldev_t **)wmem_alloc(wmem_file_scope(), sizeof(cba_ldev_t *)); *call = cons_ldev; di->call_data->private_data = call; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " Consumer=\"%s\"", szStr); return offset; } static int dissect_ICBAAccoServer2_GetConnectionData_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Length; guint32 u32ArraySize; tvbuff_t *next_tvb; guint32 u32Pointer; guint32 u32HResult; proto_item *item; cba_ldev_t **call = (cba_ldev_t **)di->call_data->private_data; cba_ldev_t *cons_ldev = (call!=NULL) ? *call : NULL; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); if (cons_ldev == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_no_request_info); } item = proto_tree_add_boolean (tree, hf_cba_acco_dcom_call, tvb, offset, 0, FALSE); proto_item_set_generated(item); p_add_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0, GUINT_TO_POINTER(1)); /* length */ offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_cb_length, &u32Length); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { /* array size */ offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); /*** the data below is NOT ndr encoded (especially NOT aligned)!!! ***/ /* dissect PROFINET component data (without header) */ next_tvb = tvb_new_subset_remaining(tvb, offset); offset += dissect_CBA_Connection_Data(next_tvb, pinfo, tree, (call != NULL) ? *call : NULL, NULL /* frame */); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_AddConnections_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szConsumer[1000] = { 0 }; guint32 u32MaxConsLen = sizeof(szConsumer); guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32Pointer; guint16 u16Persistence; gchar szConsItem[1000] = { 0 }; guint32 u32MaxConsItemLen = sizeof(szConsItem); gchar szProvItem[1000] = { 0 }; guint32 u32MaxProvItemLen = sizeof(szProvItem); guint32 u32VariableOffset; guint32 u32SubStart; guint32 u32Idx; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_provider, szConsumer, u32MaxConsLen); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32VariableOffset = offset + u32ArraySize * 20; u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_addconnectionin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_addconnectionin); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szProvItem, u32MaxProvItemLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_consumer_item, szConsItem, u32MaxConsItemLen); } offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_persist, &u16Persistence); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_substitute); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } proto_item_append_text(sub_item, "[%u]: ConsItem=\"%s\" ProvItem=\"%s\" %s Pers=%u", u32Idx, szConsItem, szProvItem, val_to_str(u16Persistence, cba_persist_vals, "Unknown (0x%02x)"), u16Persistence); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Prov=\"%s\" State=%s Cnt=%u", szConsumer, val_to_str(u8State, cba_acco_conn_state_vals, "Unknown (0x%02x)"), u32Count); return u32VariableOffset; } static int dissect_ICBAAccoMgt_AddConnections_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint32 u32ArraySize = 0; guint32 u32ConsID; guint16 u16ConnVersion; guint32 u32HResult = 0; guint32 u32Count = 0; guint32 u32Idx; guint32 u32SubStart; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Count = u32ArraySize; u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_addconnectionout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_addconnectionout); u32SubStart = offset; offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_version, &u16ConnVersion); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: ConsID=0x%x Version=%u %s", u32Idx, u32ConsID, u16ConnVersion, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_RemoveConnections_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ConsID; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoMgt_SetActivationState_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint8 u8State; guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ConsID; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID, u32Idx); u32Idx++; } /* update column info now */ col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return offset; } static int dissect_ICBAAccoMgt_GetInfo_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Max; guint32 u32CurCnt; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_info_max, &u32Max); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_info_curr, &u32CurCnt); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": %u/%u -> %s", u32CurCnt, u32Max, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_GetIDs_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32Pointer; guint32 u32ArraySize; guint32 u32ConsID; guint8 u8State; guint16 u16Version; guint32 u32HResult; guint32 u32Idx; guint32 u32SubStart; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); if (u32Count) { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u ConsID=", u32Count); } else { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_getidout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_getidout); u32SubStart = offset; offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_version, &u16Version); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: ConsID=0x%x State=%s Version=%u %s", u32Idx, u32ConsID, val_to_str(u8State, cba_acco_conn_state_vals, "Unknown (0x%02x)"), u16Version, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); if (u32Idx == 1) { col_append_fstr(pinfo->cinfo, COL_INFO, "0x%x", u32ConsID); } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ConsID); } else if (u32Idx == 10) { col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt2_GetConsIDs_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32Pointer; guint32 u32ArraySize; guint32 u32Idx; guint32 u32ConsID; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); if (u32Count) { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u ConsID=", u32Count); } else { col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID, u32Idx); if (u32Idx == 1) { col_append_fstr(pinfo->cinfo, COL_INFO, "0x%x", u32ConsID); } else if (u32Idx < 10) { col_append_fstr(pinfo->cinfo, COL_INFO, ",0x%x", u32ConsID); } else if (u32Idx == 10) { col_append_str(pinfo->cinfo, COL_INFO, ",..."); } u32Idx++; } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt2_GetConsConnections_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32TmpCount; guint32 u32Pointer; guint32 u32HResult; guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint16 u16Persistence; guint32 u32SubStart; guint32 u32Idx; guint32 u32VariableOffset; gchar szProv[1000] = { 0 }; guint32 u32MaxProvLen = sizeof(szProv); gchar szProvItem[1000] = { 0 }; guint32 u32MaxProvItemLen = sizeof(szProvItem); gchar szConsItem[1000] = { 0 }; guint32 u32MaxConsItemLen = sizeof(szConsItem); offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); u32VariableOffset = offset; if (u32Pointer) { offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); u32VariableOffset = offset + u32Count*32; /* array fixed part (including pointers to variable part) */ u32TmpCount = u32Count; u32Idx = 1; while (u32TmpCount--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_getconsconnout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_getconnectionout); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider, szProv, u32MaxProvLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szProvItem, u32MaxProvItemLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_consumer_item, szConsItem, u32MaxConsItemLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_substitute); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_persist, &u16Persistence); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: %s", u32Idx, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } u32VariableOffset = dissect_dcom_HRESULT(tvb, u32VariableOffset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return u32VariableOffset; } static int dissect_ICBAAccoMgt2_DiagConsConnections_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32TmpCount; guint32 u32Pointer; guint32 u32HResult; guint8 u8State; guint16 u16Persistence; guint16 u16ConnVersion; guint32 u32SubStart; guint32 u32Idx; guint32 u32VariableOffset; guint32 u32ConnErrorState; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); u32VariableOffset = offset; if (u32Pointer) { offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); u32VariableOffset = offset + u32Count*16; /* array fixed part (including pointers to variable part) */ u32TmpCount = u32Count; u32Idx = 1; while (u32TmpCount--) { proto_item *sub_item; proto_tree *sub_tree; proto_item *state_item; sub_item = proto_tree_add_item(tree, hf_cba_diagconsconnout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_getconnectionout); u32SubStart = offset; offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_persist, &u16Persistence); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_version, &u16ConnVersion); /* connection state */ #if 0 offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_error_state, &u32ConnErrorState); #endif offset = dissect_dcom_HRESULT_item(tvb, offset, pinfo, sub_tree, di, drep, &u32ConnErrorState, hf_cba_acco_conn_error_state, &state_item); proto_item_set_text(state_item, "ConnErrorState: %s (0x%x)", val_to_str(u32ConnErrorState, dcom_hresult_vals, "Unknown (0x%08x)"), u32ConnErrorState); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: %s", u32Idx, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } u32VariableOffset = dissect_dcom_HRESULT(tvb, u32VariableOffset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return u32VariableOffset; } static int dissect_ICBAAccoMgt_GetConnections_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32ConsID; guint32 u32Count; guint32 u32ArraySize; guint32 u32Idx; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32Idx = 1; while (u32ArraySize--){ offset = dissect_dcom_indexed_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_cons_id, &u32ConsID, u32Idx); u32Idx++; } return offset; } static int dissect_ICBAAccoMgt_GetConnections_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32TmpCount; guint32 u32Pointer; guint32 u32HResult; guint16 u16QoSType; guint16 u16QoSValue; guint8 u8State; guint16 u16Persistence; guint16 u16ConnVersion; guint32 u32SubStart; guint32 u32Idx; guint32 u32VariableOffset; gchar szProv[1000] = { 0 }; guint32 u32MaxProvLen = sizeof(szProv); gchar szProvItem[1000] = { 0 }; guint32 u32MaxProvItemLen = sizeof(szProvItem); gchar szConsItem[1000] = { 0 }; guint32 u32MaxConsItemLen = sizeof(szConsItem); offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); u32VariableOffset = offset; if (u32Pointer) { offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); u32VariableOffset = offset + u32Count*36; /* array fixed part (including pointers to variable part) */ u32TmpCount = u32Count; u32Idx = 1; while (u32TmpCount--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_getconnectionout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_getconnectionout); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider, szProv, u32MaxProvLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_provider_item, szProvItem, u32MaxProvItemLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_consumer_item, szConsItem, u32MaxConsItemLen); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_substitute); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_epsilon); } offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_BOOLEAN(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_state, &u8State); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_persist, &u16Persistence); offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_conn_version, &u16ConnVersion); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: %s", u32Idx, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } u32VariableOffset = dissect_dcom_HRESULT(tvb, u32VariableOffset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return u32VariableOffset; } static int dissect_ICBAAccoMgt_ReviseQoS_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16QoSType; guint16 u16QoSValue; gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_LPWSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_rtauto, szStr, u32MaxStr); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_type, &u16QoSType); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); col_append_fstr(pinfo->cinfo, COL_INFO, ": RTAuto=\"%s\" QoSType=%s QoSValue=%u", szStr, val_to_str(u16QoSType, cba_qos_type_vals, "Unknown (0x%04x)"), u16QoSValue); return offset; } static int dissect_ICBAAccoMgt_ReviseQoS_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16QoSValue; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_conn_qos_value, &u16QoSValue); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": %u -> %s", u16QoSValue, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_get_PingFactor_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16PF; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_ping_factor, &u16PF); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": %u -> %s", u16PF, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_put_PingFactor_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16PF; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_ping_factor, &u16PF); col_append_fstr(pinfo->cinfo, COL_INFO, ": %u", u16PF); return offset; } static int dissect_ICBAAccoMgt_get_CDBCookie_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Cookie; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_cdb_cookie, &u32Cookie); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": CDBCookie=0x%x -> %s", u32Cookie, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAAccoMgt_GetDiagnosis_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Request; guint32 u32InLength; guint32 u32ArraySize; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_diag_req, &u32Request); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_diag_in_length, &u32InLength); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); if (u32ArraySize != 0) { proto_tree_add_item(tree, hf_cba_acco_diag_data, tvb, offset, u32InLength, ENC_NA); } col_append_fstr(pinfo->cinfo, COL_INFO, ": %s: %u bytes", val_to_str(u32Request, cba_acco_diag_req_vals, "Unknown request (0x%08x)"), u32InLength); return offset; } static int dissect_ICBAAccoMgt_GetDiagnosis_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32OutLength; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_diag_out_length, &u32OutLength); if (u32OutLength != 0) { proto_tree_add_item(tree, hf_cba_acco_diag_data, tvb, offset, u32OutLength, ENC_NA); } col_append_fstr(pinfo->cinfo, COL_INFO, ": %u bytes", u32OutLength); return offset; } static int dissect_ICBAAccoSync_ReadItems_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; guint32 u32ArraySize; guint32 u32VariableOffset; guint32 u32Idx; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32VariableOffset = offset + u32ArraySize*4; u32Idx = 1; while (u32ArraySize--) { offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_indexed_LPWSTR(tvb, u32VariableOffset, pinfo, tree, di, drep, hf_cba_acco_item, szStr, u32MaxStr, u32Idx); } u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return u32VariableOffset; } static int dissect_ICBAAccoSync_ReadItems_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint16 u16QC; guint32 u32ArraySize = 0; guint32 u32HResult; guint32 u32Idx; guint32 u32SubStart; guint32 u32VariableOffset; guint32 u32Tmp; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); u32VariableOffset = offset; if (u32Pointer) { offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32VariableOffset = offset + u32ArraySize * 20; u32Idx = 1; u32Tmp = u32ArraySize; while(u32Tmp--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_readitemout, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_readitemout); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_data); } offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_qc, &u16QC); offset = dissect_dcom_FILETIME(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_time_stamp, NULL); offset = dissect_dcom_indexed_HRESULT(tvb, offset, pinfo, sub_tree, di, drep, &u32HResult, u32Idx); proto_item_append_text(sub_item, "[%u]: QC=%s (0x%02x) %s", u32Idx, val_to_str_const(u16QC, cba_acco_qc_vals, "Unknown"), u16QC, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } } u32VariableOffset = dissect_dcom_HRESULT(tvb, u32VariableOffset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u -> %s", u32ArraySize, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return u32VariableOffset; } static int dissect_ICBAAccoSync_WriteItems_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; guint32 u32VariableOffset; guint32 u32SubStart; guint32 u32Idx; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32VariableOffset = offset + u32ArraySize * 8; u32Idx = 1; while(u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_writeitemin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_writeitemin); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_item, szStr, u32MaxStr); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_data); } proto_item_append_text(sub_item, "[%u]: Item=\"%s\"", u32Idx, szStr); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return u32VariableOffset; } static int dissect_ICBAAccoSync_WriteItemsQCD_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32ArraySize; gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; guint32 u32VariableOffset; guint32 u32SubStart; guint32 u32Idx; guint16 u16QC; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_acco_count, &u32Count); offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, tree, di, drep, &u32ArraySize); u32VariableOffset = offset + u32ArraySize * 20; u32Idx = 1; while(u32ArraySize--) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_cba_writeitemin, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_cba_writeitemin); u32SubStart = offset; offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_LPWSTR(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_item, szStr, u32MaxStr); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer); if (u32Pointer) { u32VariableOffset = dissect_dcom_VARIANT(tvb, u32VariableOffset, pinfo, sub_tree, di, drep, hf_cba_acco_data); } offset = dissect_dcom_WORD(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_qc, &u16QC); offset = dissect_dcom_FILETIME(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_acco_time_stamp, NULL); proto_item_append_text(sub_item, "[%u]: Item=\"%s\" QC=%s (0x%02x)", u32Idx, szStr, val_to_str_const(u16QC, cba_acco_qc_vals, "Unknown"), u16QC); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; } col_append_fstr(pinfo->cinfo, COL_INFO, ": Cnt=%u", u32Count); return u32VariableOffset; } /* sub dissector table of ICBAAccoMgt / ICBAAccoMgt2 interface */ static dcerpc_sub_dissector ICBAAccoMgt_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "AddConnections", dissect_ICBAAccoMgt_AddConnections_rqst, dissect_ICBAAccoMgt_AddConnections_resp }, { 4, "RemoveConnections", dissect_ICBAAccoMgt_RemoveConnections_rqst, dissect_HResultArray_resp }, { 5, "ClearConnections", dissect_dcom_simple_rqst, dissect_dcom_simple_resp }, { 6, "SetActivationState", dissect_ICBAAccoMgt_SetActivationState_rqst, dissect_HResultArray_resp }, { 7, "GetInfo", dissect_dcom_simple_rqst, dissect_ICBAAccoMgt_GetInfo_resp }, { 8, "GetIDs", dissect_dcom_simple_rqst, dissect_ICBAAccoMgt_GetIDs_resp }, { 9, "GetConnections", dissect_ICBAAccoMgt_GetConnections_rqst, dissect_ICBAAccoMgt_GetConnections_resp }, {10, "ReviseQoS", dissect_ICBAAccoMgt_ReviseQoS_rqst, dissect_ICBAAccoMgt_ReviseQoS_resp }, {11, "get_PingFactor", dissect_dcom_simple_rqst, dissect_ICBAAccoMgt_get_PingFactor_resp }, {12, "put_PingFactor", dissect_ICBAAccoMgt_put_PingFactor_rqst, dissect_dcom_simple_resp }, {13, "get_CDBCookie", dissect_dcom_simple_rqst, dissect_ICBAAccoMgt_get_CDBCookie_resp }, /* stage 2 */ {14, "GetConsIDs", dissect_dcom_simple_rqst, dissect_ICBAAccoMgt2_GetConsIDs_resp }, {15, "GetConsConnections", dissect_ICBAAccoMgt_GetConnections_rqst, dissect_ICBAAccoMgt2_GetConsConnections_resp }, {16, "DiagConsConnections", dissect_ICBAAccoMgt_GetConnections_rqst, dissect_ICBAAccoMgt2_DiagConsConnections_resp }, {17, "GetProvIDs", dissect_dcom_simple_rqst, dissect_Server_GetProvIDs_resp }, {18, "GetProvConnections", dissect_Server_GetProvConnections_rqst, dissect_Server_GetProvConnections_resp }, {19, "GetDiagnosis", dissect_ICBAAccoMgt_GetDiagnosis_rqst, dissect_ICBAAccoMgt_GetDiagnosis_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAAccoCallback interface */ static dcerpc_sub_dissector ICBAAccoCallback_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "OnDataChanged", dissect_ICBAAccoCallback_OnDataChanged_rqst, dissect_ICBAAccoCallback_OnDataChanged_resp }, /* stage 2 */ { 4, "Gnip", dissect_ICBAAccoCallback_Gnip_rqst, dissect_ICBAAccoCallback_Gnip_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAAccoServer interface */ static dcerpc_sub_dissector ICBAAccoServer_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "Connect", dissect_ICBAAccoServer_Connect_rqst, dissect_ICBAAccoServer_Connect_resp }, { 4, "Disconnect", dissect_ICBAAccoServer_Disconnect_rqst, dissect_ICBAAccoServer_Disconnect_resp }, { 5, "DisconnectMe", dissect_ICBAAccoServer_DisconnectMe_rqst, dissect_ICBAAccoServer_DisconnectMe_resp }, { 6, "SetActivation", dissect_ICBAAccoServer_SetActivation_rqst, dissect_ICBAAccoServer_SetActivation_resp }, { 7, "Ping", dissect_ICBAAccoServer_Ping_rqst, dissect_ICBAAccoServer_Ping_resp }, /* stage 2 */ { 8, "Connect2", dissect_ICBAAccoServer2_Connect2_rqst, dissect_ICBAAccoServer_Connect_resp }, { 9, "GetConnectionData", dissect_ICBAAccoServer2_GetConnectionData_rqst, dissect_ICBAAccoServer2_GetConnectionData_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAAccoServerSRT interface (stage 2 only) */ static dcerpc_sub_dissector ICBAAccoServerSRT_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "ConnectCR", dissect_ICBAAccoServerSRT_ConnectCR_rqst, dissect_ICBAAccoServerSRT_ConnectCR_resp }, { 4, "DisconnectCR", dissect_ICBAAccoServerSRT_DisconnectCR_rqst, dissect_ICBAAccoServerSRT_DisconnectCR_resp }, { 5, "Connect", dissect_ICBAAccoServerSRT_Connect_rqst, dissect_ICBAAccoServerSRT_Connect_resp }, { 6, "Disconnect", dissect_ICBAAccoServerSRT_Disconnect_rqst, dissect_ICBAAccoServerSRT_Disconnect_resp }, { 7, "DisconnectMe", dissect_ICBAAccoServerSRT_DisconnectMe_rqst, dissect_ICBAAccoServerSRT_DisconnectMe_resp }, { 8, "SetActivation", dissect_ICBAAccoServerSRT_SetActivation_rqst, dissect_ICBAAccoServerSRT_SetActivation_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAAccoSync interface */ static dcerpc_sub_dissector ICBAAccoSync_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "ReadItems", dissect_ICBAAccoSync_ReadItems_rqst, dissect_ICBAAccoSync_ReadItems_resp }, { 4, "WriteItems", dissect_ICBAAccoSync_WriteItems_rqst, dissect_HResultArray_resp }, { 5, "WriteItemsQCD", dissect_ICBAAccoSync_WriteItemsQCD_rqst, dissect_HResultArray_resp }, { 0, NULL, NULL, NULL }, }; /* register protocol */ void proto_register_dcom_cba_acco (void) { static gint *ett3[3]; static gint *ett4[4]; static gint *ett5[5]; static hf_register_info hf_cba_acco_array[] = { { &hf_cba_acco_opnum, { "Operation", "cba.acco.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_ping_factor, { "PingFactor", "cba.acco.ping_factor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_count, { "Count", "cba.acco.count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_info_max, { "Max", "cba.acco.info_max", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_info_curr, { "Current", "cba.acco.info_curr", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_rtauto, { "RTAuto", "cba.acco.rtauto", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_item, { "Item", "cba.acco.item", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_data, { "Data", "cba.acco.data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_qc, { "QualityCode", "cba.acco.qc", FT_UINT8, BASE_HEX, VALS(cba_acco_qc_vals), 0x0, NULL, HFILL } }, { &hf_cba_acco_time_stamp, { "TimeStamp", "cba.acco.time_stamp", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_readitemout, { "ReadItemOut", "cba.acco.readitemout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_writeitemin, { "WriteItemIn", "cba.acco.writeitemin", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cdb_cookie, { "CDBCookie", "cba.acco.cdb_cookie", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* dcom_hresult_vals from packet-dcom.h doesn't work here, as length is unknown! */ { &hf_cba_acco_conn_error_state, { "ConnErrorState", "cba.acco.conn_error_state", FT_UINT32, BASE_HEX, NULL /*VALS(dcom_hresult_vals)*/, 0x0, NULL, HFILL } }, { &hf_cba_acco_diag_req, { "Request", "cba.acco.diag_req", FT_UINT32, BASE_HEX, VALS(cba_acco_diag_req_vals), 0x0, NULL, HFILL } }, { &hf_cba_acco_diag_in_length, { "InLength", "cba.acco.diag_in_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_diag_out_length, { "OutLength", "cba.acco.diag_out_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_diag_data, { "Data", "cba.acco.diag_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_dcom_call, { "DcomRuntime", "cba.acco.dcom", FT_BOOLEAN, BASE_NONE, TFS(&cba_acco_call_flags), 0x0, "This is a DCOM runtime context", HFILL } }, { &hf_cba_acco_srt_call, { "SrtRuntime", "cba.acco.srt", FT_BOOLEAN, BASE_NONE, TFS(&cba_acco_call_flags), 0x0, "This is an SRT runtime context", HFILL } } }; static hf_register_info hf_cba_acco_server[] = { #if 0 { &hf_cba_acco_server_pICBAAccoCallback, { "pICBAAccoCallback", "cba.acco.server_pICBAAccoCallback", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, #endif { &hf_cba_acco_server_first_connect, { "FirstConnect", "cba.acco.server_first_connect", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_getprovconnout, { "GETPROVCONNOUT", "cba.acco.getprovconnout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_prov_mac, { "ProviderMAC", "cba.acco.serversrt_prov_mac", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_cons_mac, { "ConsumerMAC", "cba.acco.serversrt_cons_mac", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_cr_id, { "ConsumerCRID", "cba.acco.serversrt_cr_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_cr_length, { "CRLength", "cba.acco.serversrt_cr_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_cr_flags, { "Flags", "cba.acco.serversrt_cr_flags", FT_UINT32, BASE_HEX, 0, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_cr_flags_timestamped, { "Timestamped", "cba.acco.serversrt_cr_flags_timestamped", FT_BOOLEAN, 32, TFS (&acco_flags_set_truth), 0x1, NULL, HFILL } }, { &hf_cba_acco_serversrt_cr_flags_reconfigure, { "Reconfigure", "cba.acco.serversrt_cr_flags_reconfigure", FT_BOOLEAN, 32, TFS (&acco_flags_set_truth), 0x2, NULL, HFILL } }, { &hf_cba_type_desc_len, { "TypeDescLen", "cba.acco.type_desc_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_serversrt_record_length, { "RecordLength", "cba.acco.serversrt_record_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, #if 0 { &hf_cba_acco_serversrt_action, { "Action", "cba.acco.serversrt_action", FT_UINT32, BASE_DEC, VALS(cba_acco_serversrt_action_vals), 0x0, NULL, HFILL } }, #endif { &hf_cba_acco_serversrt_last_connect, { "LastConnect", "cba.acco.serversrt_last_connect", FT_UINT8, BASE_DEC, VALS(cba_acco_serversrt_last_connect_vals), 0x0, NULL, HFILL } }, }; static hf_register_info hf_cba_connectcr_array[] = { { &hf_cba_acco_prov_crid, { "ProviderCRID", "cba.acco.prov_crid", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, }; static hf_register_info hf_cba_connect_array[] = { { &hf_cba_addconnectionin, { "ADDCONNECTIONIN", "cba.acco.addconnectionin", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_addconnectionout, { "ADDCONNECTIONOUT", "cba.acco.addconnectionout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_getidout, { "GETIDOUT", "cba.acco.getidout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_getconnectionout, { "GETCONNECTIONOUT", "cba.acco.getconnectionout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_getconsconnout, { "GETCONSCONNOUT", "cba.acco.getconsconnout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_diagconsconnout, { "DIAGCONSCONNOUT", "cba.acco.diagconsconnout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_connectincr, { "CONNECTINCR", "cba.acco.connectincr", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_connectoutcr, { "CONNECTOUTCR", "cba.acco.connectoutcr", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_connectin, { "CONNECTIN", "cba.acco.connectin", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_connectout, { "CONNECTOUT", "cba.acco.connectout", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_prov_id, { "ProviderID", "cba.acco.conn_prov_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_cons_id, { "ConsumerID", "cba.acco.conn_cons_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_version, { "ConnVersion", "cba.acco.conn_version", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_consumer, { "Consumer", "cba.acco.conn_consumer", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_qos_type, { "QoSType", "cba.acco.conn_qos_type", FT_UINT16, BASE_HEX, VALS(cba_qos_type_vals), 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_qos_value, { "QoSValue", "cba.acco.conn_qos_value", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_state, { "State", "cba.acco.conn_state", FT_UINT8, BASE_HEX, VALS(cba_acco_conn_state_vals), 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_provider, { "Provider", "cba.acco.conn_provider", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_provider_item, { "ProviderItem", "cba.acco.conn_provider_item", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_consumer_item, { "ConsumerItem", "cba.acco.conn_consumer_item", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_persist, { "Persistence", "cba.acco.conn_persist", FT_UINT16, BASE_HEX, VALS(cba_persist_vals), 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_epsilon, { "Epsilon", "cba.acco.conn_epsilon", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_conn_substitute, { "Substitute", "cba.acco.conn_substitute", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static hf_register_info hf_cba_acco_cb[] = { { &hf_cba_acco_cb_length, { "Length", "cba.acco.cb_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_version, { "Version", "cba.acco.cb_version", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_flags, { "Flags", "cba.acco.cb_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_count, { "Count", "cba.acco.cb_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_conn_data, { "CBA Connection data", "cba.acco.cb_conn_data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_item, { "Item", "cba.acco.cb_item", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_item_hole, { "Hole", "cba.acco.cb_item_hole", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_item_length, { "Length", "cba.acco.cb_item_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_cba_acco_cb_item_data, { "Data(Hex)", "cba.acco.cb_item_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_cba_connect_in, { "Connect in frame", "cba.connect_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This connection Connect was in the packet with this number", HFILL } }, { &hf_cba_disconnect_in, { "Disconnect in frame", "cba.disconnect_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This connection Disconnect was in the packet with this number", HFILL } }, { &hf_cba_connectcr_in, { "ConnectCR in frame", "cba.connect_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This frame ConnectCR was in the packet with this number", HFILL } }, { &hf_cba_disconnectcr_in, { "DisconnectCR in frame", "cba.disconnect_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This frame DisconnectCR was in the packet with this number", HFILL } }, { &hf_cba_disconnectme_in, { "DisconnectMe in frame", "cba.disconnectme_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This connection/frame DisconnectMe was in the packet with this number", HFILL } }, { &hf_cba_data_first_in, { "First data in frame", "cba.data_first_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "The first data of this connection/frame in the packet with this number", HFILL } }, { &hf_cba_data_last_in, { "Last data in frame", "cba.data_last_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "The last data of this connection/frame in the packet with this number", HFILL } }, }; static ei_register_info ei[] = { { &ei_cba_acco_pdev_find, { "cba.acco.pdev_find.fail", PI_UNDECODED, PI_NOTE, "pdev_find: no pdev for IP", EXPFILL }}, { &ei_cba_acco_pdev_find_unknown_interface, { "cba.acco.pdev_find.unknown_interface", PI_UNDECODED, PI_NOTE, "pdev_find: unknown interface", EXPFILL }}, { &ei_cba_acco_ldev_unknown, { "cba.acco.ldev.unknown", PI_UNDECODED, PI_NOTE, "Unknown LDev", EXPFILL }}, { &ei_cba_acco_ipid_unknown, { "cba.acco.ipid.unknown", PI_UNDECODED, PI_NOTE, "Unknown IPID", EXPFILL }}, { &ei_cba_acco_prov_crid, { "cba.acco.prov_crid.unknown", PI_UNDECODED, PI_NOTE, "Unknown provider frame ProvCRID", EXPFILL }}, { &ei_cba_acco_conn_consumer, { "cba.acco.conn_consumer.invalid", PI_UNDECODED, PI_NOTE, "Consumer interface invalid", EXPFILL }}, { &ei_cba_acco_no_request_info, { "cba.acco.no_request_info", PI_UNDECODED, PI_NOTE, "No request info, response data ignored", EXPFILL }}, { &ei_cba_acco_qc, { "cba.acco.qc.expert", PI_RESPONSE_CODE, PI_CHAT, "expert QC", EXPFILL }}, { &ei_cba_acco_disconnect, { "cba.acco.disconnect", PI_SEQUENCE, PI_NOTE, "Disconnection sequence issue", EXPFILL }}, { &ei_cba_acco_connect, { "cba.acco.connect_not_set", PI_SEQUENCE, PI_NOTE, "packet_connect not set", EXPFILL }}, }; expert_module_t* expert_cba_acco; ett5[0] = &ett_ICBAAccoMgt; ett5[1] = &ett_cba_addconnectionin; ett5[2] = &ett_cba_addconnectionout; ett5[3] = &ett_cba_getidout; ett5[4] = &ett_cba_getconnectionout; proto_ICBAAccoMgt = proto_register_protocol ("ICBAAccoMgt", "ICBAAccoMgt", "cba_acco_mgt"); proto_register_field_array(proto_ICBAAccoMgt, hf_cba_acco_array, array_length(hf_cba_acco_array)); proto_register_field_array(proto_ICBAAccoMgt, hf_cba_connect_array, array_length(hf_cba_connect_array)); proto_register_field_array(proto_ICBAAccoMgt, hf_cba_connectcr_array, array_length(hf_cba_connectcr_array)); proto_register_subtree_array (ett5, array_length (ett5)); /* XXX - just pick a protocol to register the expert info in */ /* XXX - also, just pick a protocol to use proto_data for */ expert_cba_acco = expert_register_protocol(proto_ICBAAccoMgt); expert_register_field_array(expert_cba_acco, ei, array_length(ei)); proto_ICBAAccoMgt2 = proto_register_protocol ("ICBAAccoMgt2", "ICBAAccoMgt2", "cba_acco_mgt2"); ett3[0] = &ett_ICBAAccoCallback; ett3[1] = &ett_ICBAAccoCallback_Item; ett3[2] = &ett_ICBAAccoCallback_Buffer; proto_ICBAAccoCallback = proto_register_protocol ("ICBAAccoCallback", "ICBAAccoCB", "cba_acco_cb"); proto_register_field_array(proto_ICBAAccoCallback, hf_cba_acco_cb, array_length(hf_cba_acco_cb)); proto_register_subtree_array (ett3, array_length (ett3)); proto_ICBAAccoCallback2 = proto_register_protocol ("ICBAAccoCallback2", "ICBAAccoCB2", "cba_acco_cb2"); ett4[0] = &ett_ICBAAccoServer; ett4[1] = &ett_cba_connectin; ett4[2] = &ett_cba_connectout; ett4[3] = &ett_cba_getprovconnout; proto_ICBAAccoServer = proto_register_protocol ("ICBAAccoServer", "ICBAAccoServ", "cba_acco_server"); proto_register_field_array(proto_ICBAAccoServer, hf_cba_acco_server, array_length(hf_cba_acco_server)); proto_register_subtree_array (ett4, array_length (ett4)); proto_ICBAAccoServer2 = proto_register_protocol ("ICBAAccoServer2", "ICBAAccoServ2", "cba_acco_server2"); ett4[0] = &ett_ICBAAccoServerSRT; ett4[1] = &ett_cba_acco_serversrt_cr_flags; ett4[2] = &ett_cba_connectincr; ett4[3] = &ett_cba_connectoutcr; proto_ICBAAccoServerSRT = proto_register_protocol ("ICBAAccoServerSRT", "ICBAAccoServSRT", "cba_acco_server_srt"); proto_register_subtree_array (ett4, array_length (ett4)); ett5[0] = &ett_ICBAAccoSync; ett5[1] = &ett_cba_readitemout; ett5[2] = &ett_cba_writeitemin; ett5[3] = &ett_cba_frame_info; ett5[4] = &ett_cba_conn_info; proto_ICBAAccoSync = proto_register_protocol ("ICBAAccoSync", "ICBAAccoSync", "cba_acco_sync"); proto_register_subtree_array (ett5, array_length (ett5)); register_conversation_filter("cba", "PN-CBA", cba_filter_valid, cba_build_filter, NULL); } /* handoff protocol */ void proto_reg_handoff_dcom_cba_acco (void) { /* Register the interfaces */ dcerpc_init_uuid(proto_ICBAAccoMgt, ett_ICBAAccoMgt, &uuid_ICBAAccoMgt, ver_ICBAAccoMgt, ICBAAccoMgt_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoMgt2, ett_ICBAAccoMgt, &uuid_ICBAAccoMgt2, ver_ICBAAccoMgt2, ICBAAccoMgt_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoCallback, ett_ICBAAccoCallback, &uuid_ICBAAccoCallback, ver_ICBAAccoCallback, ICBAAccoCallback_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoCallback2, ett_ICBAAccoCallback, &uuid_ICBAAccoCallback2, ver_ICBAAccoCallback2, ICBAAccoCallback_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoServer, ett_ICBAAccoServer, &uuid_ICBAAccoServer, ver_ICBAAccoServer, ICBAAccoServer_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoServer2, ett_ICBAAccoServer, &uuid_ICBAAccoServer2, ver_ICBAAccoServer2, ICBAAccoServer_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoServerSRT, ett_ICBAAccoServerSRT, &uuid_ICBAAccoServerSRT, ver_ICBAAccoServerSRT, ICBAAccoServerSRT_dissectors, hf_cba_acco_opnum); dcerpc_init_uuid(proto_ICBAAccoSync, ett_ICBAAccoSync, &uuid_ICBAAccoSync, ver_ICBAAccoSync, ICBAAccoSync_dissectors, hf_cba_acco_opnum); heur_dissector_add("pn_rt", dissect_CBA_Connection_Data_heur, "PROFINET CBA IO", "pn_cba_pn_rt", proto_ICBAAccoServer, HEURISTIC_ENABLE); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/profinet/packet-dcom-cba-acco.h
/* packet-dcom-cba-acco.h * Routines for DCOM CBA * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef __PACKET_DCERPC_DCOM_CBA_ACCO_H #define __PACKET_DCERPC_DCOM_CBA_ACCO_H typedef struct cba_pdev_s { GList *ldevs; dcom_object_t *object; gint first_packet; guint8 ip[4]; } cba_pdev_t; typedef struct cba_ldev_s { GList *provframes; GList *consframes; GList *provconns; GList *consconns; dcom_object_t *ldev_object; dcom_object_t *acco_object; cba_pdev_t *parent; gint first_packet; const char *name; } cba_ldev_t; extern GList *cba_pdevs; extern cba_pdev_t * cba_pdev_find(packet_info *pinfo, const address *addr, e_guid_t *ipid); extern void cba_pdev_link(packet_info *pinfo, cba_pdev_t *pdev, dcom_interface_t *pdev_interf); extern cba_pdev_t * cba_pdev_add(packet_info *pinfo, const address *addr); extern void cba_ldev_link(packet_info *pinfo, cba_ldev_t *ldev, dcom_interface_t *ldev_interf); extern void cba_ldev_link_acco(packet_info *pinfo, cba_ldev_t *ldev, dcom_interface_t *acco_interf); extern cba_ldev_t * cba_ldev_find(packet_info *pinfo, const address *addr, e_guid_t *ipid); extern cba_ldev_t * cba_ldev_add(packet_info *pinfo, cba_pdev_t *pdev, const char *name); #endif /* packet-dcerpc-dcom-cba-acco.h */
C
wireshark/plugins/epan/profinet/packet-dcom-cba.c
/* packet-dcom-cba.c * Routines for DCOM CBA * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/expert.h> #include <epan/dissectors/packet-dcerpc.h> #include <epan/dissectors/packet-dcom.h> #include <epan/dissectors/packet-dcom-dispatch.h> #include "packet-dcom-cba-acco.h" void proto_register_dcom_cba(void); void proto_reg_handoff_dcom_cba(void); static int hf_cba_opnum = -1; static int hf_cba_revision_major = -1; static int hf_cba_revision_minor = -1; static int hf_cba_revision_service_pack = -1; static int hf_cba_revision_build = -1; static int hf_cba_time = -1; static int hf_cba_name = -1; static int hf_cba_producer = -1; static int hf_cba_product = -1; static int hf_cba_production_date = -1; static int hf_cba_serial_no = -1; static int hf_cba_multi_app = -1; static int hf_cba_profinet_dcom_stack = -1; static int hf_cba_pdev_stamp = -1; static int hf_cba_browse_count = -1; static int hf_cba_browse_offset = -1; static int hf_cba_browse_max_return = -1; static int hf_cba_browse_item = -1; static int hf_cba_browse_data_type = -1; static int hf_cba_browse_access_right = -1; static int hf_cba_browse_selector = -1; static int hf_cba_browse_info1 = -1; static int hf_cba_browse_info2 = -1; static int hf_cba_cookie = -1; static int hf_cba_state = -1; static int hf_cba_new_state = -1; static int hf_cba_old_state = -1; static int hf_cba_grouperror = -1; static int hf_cba_new_grouperror = -1; static int hf_cba_old_grouperror = -1; static int hf_cba_component_id = -1; static int hf_cba_component_version = -1; static int hf_cba_pbaddress = -1; static int hf_cba_pbaddress_system_id = -1; static int hf_cba_pbaddress_address = -1; static int hf_cba_save_ldev_name = -1; static int hf_cba_save_result = -1; static expert_field ei_cba_acco_interface_pointer_unresolved = EI_INIT; static e_guid_t uuid_coclass_CBAPhysicalDevice = { 0xcba00000, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; /* CBA interfaces */ static int proto_ICBAPhysicalDevice = -1; static gint ett_ICBAPhysicalDevice = -1; static e_guid_t uuid_ICBAPhysicalDevice = { 0xcba00001, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPhysicalDevice = 0; static int proto_ICBAPhysicalDevice2 = -1; static e_guid_t uuid_ICBAPhysicalDevice2 = { 0xcba00006, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPhysicalDevice2 = 0; static int proto_ICBABrowse = -1; static gint ett_ICBABrowse = -1; static e_guid_t uuid_ICBABrowse = { 0xcba00002, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBABrowse = 0; static int proto_ICBABrowse2 = -1; static e_guid_t uuid_ICBABrowse2 = { 0xcba00007, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBABrowse2 = 0; static int proto_ICBAPhysicalDevicePC = -1; static gint ett_ICBAPhysicalDevicePC = -1; static e_guid_t uuid_ICBAPhysicalDevicePC = { 0xcba00003, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPhysicalDevicePC = 0; static int proto_ICBAPhysicalDevicePCEvent = -1; static gint ett_ICBAPhysicalDevicePCEvent = -1; static e_guid_t uuid_ICBAPhysicalDevicePCEvent = { 0xcba00004, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPhysicalDevicePCEvent = 0; static int proto_ICBAPersist = -1; static gint ett_ICBAPersist = -1; static e_guid_t uuid_ICBAPersist = { 0xcba00005, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPersist = 0; static int proto_ICBAPersist2 = -1; static e_guid_t uuid_ICBAPersist2 = { 0xcba00008, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAPersist2 = 0; static int proto_ICBALogicalDevice = -1; static gint ett_ICBALogicalDevice = -1; static e_guid_t uuid_ICBALogicalDevice = { 0xcba00011, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBALogicalDevice = 0; static int proto_ICBALogicalDevice2 = -1; static e_guid_t uuid_ICBALogicalDevice2 = { 0xcba00017, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBALogicalDevice2 = 0; static int proto_ICBAState = -1; static gint ett_ICBAState = -1; static e_guid_t uuid_ICBAState = { 0xcba00012, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAState = 0; static int proto_ICBAStateEvent = -1; static gint ett_ICBAStateEvent = -1; static e_guid_t uuid_ICBAStateEvent = { 0xcba00013, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAStateEvent = 0; static int proto_ICBATime = -1; static gint ett_ICBATime = -1; static e_guid_t uuid_ICBATime = { 0xcba00014, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBATime = 0; static int proto_ICBAGroupError = -1; static gint ett_ICBAGroupError = -1; static e_guid_t uuid_ICBAGroupError = { 0xcba00015, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAGroupError = 0; static int proto_ICBAGroupErrorEvent = -1; static gint ett_ICBAGroupErrorEvent = -1; static e_guid_t uuid_ICBAGroupErrorEvent = { 0xcba00016, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAGroupErrorEvent = 0; static int proto_ICBARTAuto = -1; static gint ett_ICBARTAuto = -1; static e_guid_t uuid_ICBARTAuto = { 0xcba00051, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBARTAuto = 0; static int proto_ICBARTAuto2 = -1; static e_guid_t uuid_ICBARTAuto2 = { 0xcba00052, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBARTAuto2 = 0; static int proto_ICBASystemProperties = -1; static gint ett_ICBASystemProperties = -1; static e_guid_t uuid_ICBASystemProperties = { 0xcba00062, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBASystemProperties = 0; static gint ett_PBAddress = -1; static const value_string cba_state_vals[] = { { 0x00, "NonExistent" }, { 0x01, "Initializing" }, { 0x02, "Ready" }, { 0x03, "Operating" }, { 0x04, "Defect" }, { 0, NULL } }; static const value_string cba_grouperror_vals[] = { { 0x00, "NonAccessible" }, { 0x01, "Okay" }, { 0x02, "Problem" }, { 0x03, "Unknown" }, { 0x04, "MaintenanceRequired" }, { 0x05, "MaintenanceDemanded" }, { 0x06, "MaintenanceRequiredAndDemanded" }, { 0x07, "ProblemAndMaintenanceRequired" }, { 0x08, "ProblemAndMaintenanceDemanded" }, { 0x09, "ProblemAndMaintenanceRequiredAndDemanded" }, { 0, NULL } }; static const value_string dcom_boolean_vals[] = { { 0x00, "FALSE" }, { 0x01, "TRUE" }, { 0xffff, "TRUE" }, { 0, NULL } }; static int dissect_ICBABrowse_get_Count_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Count; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_count, &u32Count); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); if (u32HResult) { /* !S_OK */ col_append_fstr(pinfo->cinfo, COL_INFO, "-> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); } else { col_append_fstr(pinfo->cinfo, COL_INFO, " Cnt=%u -> S_OK", u32Count); } return offset; } static int dissect_ICBABrowse_BrowseItems_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Offset; guint32 u32MaxReturn; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_offset, &u32Offset); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_max_return, &u32MaxReturn); col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%u MaxReturn=%u", u32Offset, u32MaxReturn); return offset; } static int dissect_ICBABrowse_BrowseItems_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_item); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_data_type); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_access_right); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBABrowse2_get_Count2_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Selector; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_selector, &u32Selector); col_append_fstr(pinfo->cinfo, COL_INFO, " Selector=%u", u32Selector); return offset; } static int dissect_ICBABrowse2_BrowseItems2_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Selector; guint32 u32Offset; guint32 u32MaxReturn; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_selector, &u32Selector); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_offset, &u32Offset); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_max_return, &u32MaxReturn); col_append_fstr(pinfo->cinfo, COL_INFO, " Sel=%u Offset=%u MaxReturn=%u", u32Selector, u32Offset, u32MaxReturn); return offset; } static int dissect_ICBABrowse2_BrowseItems2_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_item); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_info1); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_browse_info2); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAPersist2_Save2_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_save_ldev_name); } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_save_result); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_get_BSTR_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hfindex, szStr, u32MaxStr); } else { szStr[0] = '\0'; } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\" -> %s", szStr, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_get_ProductionDate_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; gdouble r8Date; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, di, drep, hf_cba_production_date, &r8Date); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Date: %g -> %s", r8Date, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_get_SerialNo_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; guint32 u32Pointer; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_VARIANT(tvb, offset, pinfo, tree, di, drep, hf_cba_serial_no); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBATime_get_Time_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; gdouble r8Date; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, di, drep, hf_cba_time, &r8Date); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Time: %g -> %s", r8Date, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBATime_put_Time_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gdouble r8Date; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DATE(tvb, offset, pinfo, tree, di, drep, hf_cba_time, &r8Date); return offset; } static int dissect_get_Producer_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, di, drep, hf_cba_producer); } static int dissect_get_Product_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, di, drep, hf_cba_product); } static int dissect_ICBAPhysicalDevice_get_LogicalDevice_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Pointer; gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); gchar *call; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_name, szStr, u32MaxStr); } else { szStr[0] = '\0'; } if (strlen(szStr) > 0) { call = wmem_strdup(wmem_file_scope(), szStr); di->call_data->private_data = call; } col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", szStr); return offset; } static int dissect_ICBAPhysicalDevice_get_LogicalDevice_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; gchar *ldev_name = (gchar *)di->call_data->private_data; dcom_interface_t *pdev_interf; dcom_interface_t *ldev_interf; cba_pdev_t *pdev; cba_ldev_t *ldev; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, &ldev_interf); /* try to read the ldev name from the request */ if (ldev_name != NULL && ldev_interf != NULL) { /* XXX - this is a hack to create a pdev interface */ /* as I currently don't understand the objref process for a root interface! */ pdev_interf = dcom_interface_new(pinfo, &pinfo->net_dst, &uuid_ICBAPhysicalDevice, 0, 0, &di->call_data->object_uuid); if (pdev_interf != NULL) { pdev = cba_pdev_add(pinfo, &pinfo->net_dst); cba_pdev_link(pinfo, pdev, pdev_interf); ldev = cba_ldev_add(pinfo, pdev, ldev_name); cba_ldev_link(pinfo, ldev, ldev_interf); } } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAPhysicalDevice2_Type_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16MultiApp; guint16 u16PROFInetDCOMStack; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_VARIANT_BOOL(tvb, offset, pinfo, tree, di, drep, hf_cba_multi_app, &u16MultiApp); offset = dissect_dcom_VARIANT_BOOL(tvb, offset, pinfo, tree, di, drep, hf_cba_profinet_dcom_stack, &u16PROFInetDCOMStack); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " App=%s Stack=%s -> %s", (u16MultiApp) ? "Multi" : "Single", (u16PROFInetDCOMStack) ? "PN-DCOM" : "MS-DCOM", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_PROFInetRevision_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16Major; guint16 u16Minor; guint16 u16ServicePack; guint16 u16Build; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_major, &u16Major); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_minor, &u16Minor); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_service_pack, &u16ServicePack); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_build, &u16Build); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " Revision=%u.%u.%u.%u -> %s", u16Major, u16Minor, u16ServicePack, u16Build, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAPhysicalDevice2_get_PDevStamp_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32PDevStamp; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_pdev_stamp, &u32PDevStamp); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " PDevStamp=0x%x -> %s", u32PDevStamp, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_Revision_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16Major; guint16 u16Minor; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_major, &u16Major); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_revision_minor, &u16Minor); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": %u.%u -> %s", u16Major, u16Minor, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBALogicalDevice_get_Name_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_name, szStr, u32MaxStr); } else { szStr[0] = '\0'; } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\" -> %s", szStr, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_RTAuto_get_Name_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { return dissect_get_BSTR_resp(tvb, offset, pinfo, tree, di, drep, hf_cba_name); } static int dissect_ICBALogicalDevice_get_ACCO_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; dcom_interface_t *acco_interf; cba_ldev_t *ldev; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, &acco_interf); if (acco_interf == NULL) { expert_add_info(pinfo, NULL, &ei_cba_acco_interface_pointer_unresolved); } ldev = cba_ldev_find(pinfo, &pinfo->net_src, &di->call_data->object_uuid); /* "crosslink" interface and its object */ if (ldev != NULL && acco_interf != NULL) { cba_ldev_link_acco(pinfo, ldev, acco_interf); } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBALogicalDevice_get_RTAuto_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, NULL); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBALogicalDevice_Get_RTAuto_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); guint32 u32Pointer; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_name, szStr, u32MaxStr); } else { szStr[0] = '\0'; } col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"", szStr); return offset; } static int dissect_ComponentInfo_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { gchar szStr[1000]; guint32 u32MaxStr = sizeof(szStr); gchar szStr2[1000]; guint32 u32MaxStr2 = sizeof(szStr2); guint32 u32HResult; guint32 u32Pointer; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_component_id, szStr, u32MaxStr); } else { szStr[0] = '\0'; } offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, tree, di, drep, &u32Pointer); if (u32Pointer) { offset = dissect_dcom_BSTR(tvb, offset, pinfo, tree, di, drep, hf_cba_component_version, szStr2, u32MaxStr2); } else { szStr2[0] = '\0'; } offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": ID=\"%s\" Version=\"%s\" -> %s", szStr, szStr2, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static void dissect_PBAddressInfo(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, guint32 u32VarType _U_, guint32 u32ArraySize) { guint8 u8ID; guint8 u8Addr; proto_item *sub_item; proto_tree *sub_tree; while (u32ArraySize != 0) { sub_item = proto_tree_add_item(tree, hf_cba_pbaddress, tvb, offset, 2, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_PBAddress); offset = dissect_dcom_BYTE(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_pbaddress_system_id, &u8ID); offset = dissect_dcom_BYTE(tvb, offset, pinfo, sub_tree, di, drep, hf_cba_pbaddress_address, &u8Addr); u32ArraySize-=2; proto_item_append_text(sub_item, ": ID=0x%x Addr=%u", u8ID, u8Addr); col_append_fstr(pinfo->cinfo, COL_INFO, ", ID=0x%x Addr=%u", u8ID, u8Addr); } } static int dissect_PBAddressInfo_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_SAFEARRAY(tvb, offset, pinfo, tree, di, drep, 0 /*hfindex _U_ */, dissect_PBAddressInfo); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_Advise_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, NULL); return offset; } static int dissect_Advise_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Cookie; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_cookie, &u32Cookie); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x -> %s", u32Cookie, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_Unadvise_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Cookie; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_cookie, &u32Cookie); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x", u32Cookie); return offset; } static int dissect_ICBAState_get_State_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16State; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_state, &u16State); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": State=%s -> %s", val_to_str(u16State, cba_state_vals, "Unknown (0x%08x)"), val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAStateEvent_OnStateChanged_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16NewState; guint16 u16OldState; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_new_state, &u16NewState); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_old_state, &u16OldState); col_append_fstr(pinfo->cinfo, COL_INFO, ": NewState=%s OldState=%s", val_to_str(u16NewState, cba_state_vals, "Unknown (0x%04x)"), val_to_str(u16OldState, cba_state_vals, "Unknown (0x%04x)") ); return offset; } static int dissect_ICBAGroupError_OnGroupErrorChanged_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16NewGroupError; guint16 u16OldGroupError; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_new_grouperror, &u16NewGroupError); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_old_grouperror, &u16OldGroupError); col_append_fstr(pinfo->cinfo, COL_INFO, ": NewGE=%s OldGE=%s", val_to_str(u16NewGroupError, cba_grouperror_vals, "Unknown (0x%04x)"), val_to_str(u16OldGroupError, cba_grouperror_vals, "Unknown (0x%04x)") ); return offset; } static int dissect_ICBAPhysicalDevicePCEvent_OnLogicalDeviceAdded_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint32 u32Cookie; guint32 u32HResult; offset = dissect_dcom_this(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_cookie, &u32Cookie); offset = dissect_dcom_PMInterfacePointer(tvb, offset, pinfo, tree, di, drep, 0, NULL); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": Cookie=0x%x %s", u32Cookie, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } static int dissect_ICBAGroupError_GroupError_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { guint16 u16GroupError; guint32 u32Cookie; guint32 u32HResult; offset = dissect_dcom_that(tvb, offset, pinfo, tree, di, drep); offset = dissect_dcom_WORD(tvb, offset, pinfo, tree, di, drep, hf_cba_grouperror, &u16GroupError); offset = dissect_dcom_DWORD(tvb, offset, pinfo, tree, di, drep, hf_cba_cookie, &u32Cookie); offset = dissect_dcom_HRESULT(tvb, offset, pinfo, tree, di, drep, &u32HResult); col_append_fstr(pinfo->cinfo, COL_INFO, ": GroupError=%s Cookie=0x%x -> %s", val_to_str(u16GroupError, cba_grouperror_vals, "Unknown (0x%08x)"), u32Cookie, val_to_str(u32HResult, dcom_hresult_vals, "Unknown (0x%08x)") ); return offset; } /* sub dissector table of ICBAPhysicalDevice / ICBAPhysicalDevice2 interface */ static dcerpc_sub_dissector ICBAPhysicalDevice_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_Producer", dissect_dcom_simple_rqst, dissect_get_Producer_resp }, { 8, "get_Product", dissect_dcom_simple_rqst, dissect_get_Product_resp }, { 9, "get_SerialNo", dissect_dcom_simple_rqst, dissect_get_SerialNo_resp }, {10, "get_ProductionDate", dissect_dcom_simple_rqst, dissect_get_ProductionDate_resp }, {11, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp }, {12, "get_LogicalDevice", dissect_ICBAPhysicalDevice_get_LogicalDevice_rqst, dissect_ICBAPhysicalDevice_get_LogicalDevice_resp }, /* stage 2 */ {13, "Type", dissect_dcom_simple_rqst, dissect_ICBAPhysicalDevice2_Type_resp }, {14, "PROFInetRevision", dissect_dcom_simple_rqst, dissect_PROFInetRevision_resp }, {15, "PDevStamp", dissect_dcom_simple_rqst, dissect_ICBAPhysicalDevice2_get_PDevStamp_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBABrowse / ICBABrowse2 interface */ static dcerpc_sub_dissector ICBABrowse_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_Count", dissect_dcom_simple_rqst, dissect_ICBABrowse_get_Count_resp }, { 8, "BrowseItems", dissect_ICBABrowse_BrowseItems_rqst, dissect_ICBABrowse_BrowseItems_resp }, /* stage 2 */ { 9, "get_Count2", dissect_ICBABrowse2_get_Count2_rqst, dissect_ICBABrowse_get_Count_resp }, {10, "BrowseItems2", dissect_ICBABrowse2_BrowseItems2_rqst, dissect_ICBABrowse2_BrowseItems2_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAPersist / ICBAPersist2 interface */ static dcerpc_sub_dissector ICBAPersist_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "Save", dissect_dcom_simple_rqst, dissect_dcom_simple_resp }, /* stage 2 */ { 8, "Save2", dissect_dcom_simple_rqst, dissect_ICBAPersist2_Save2_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAPhysicalDevicePC interface */ /* (local COM interface, not to be called over network) */ static dcerpc_sub_dissector ICBAPhysicalDevicePC_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "AddLogicalDevice", dissect_Advise_rqst, dissect_Advise_resp }, { 4, "RemoveLogicalDevice", dissect_Unadvise_rqst, dissect_dcom_simple_resp }, { 5, "AdvisePDevPC", dissect_Advise_rqst, dissect_Advise_resp }, { 6, "UnadvisePDevPC", dissect_Unadvise_rqst, dissect_dcom_simple_resp }, /* stage 2 */ { 7, "RegisterApplication", NULL, NULL }, { 8, "UnRegisterApplication", NULL, NULL }, { 9, "AddLogicalDevice2", NULL, NULL }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAPhysicalDevicePCEvent interface */ static dcerpc_sub_dissector ICBAPhysicalDevicePCEvent_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "OnLogicalDeviceAdded", dissect_ICBAPhysicalDevicePCEvent_OnLogicalDeviceAdded_rqst, dissect_dcom_simple_resp }, { 4, "OnLogicalDeviceRemoved", dissect_Unadvise_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBALogicalDevice / ICBALogicalDevice2 interface */ static dcerpc_sub_dissector ICBALogicalDevice_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_Name", dissect_dcom_simple_rqst, dissect_ICBALogicalDevice_get_Name_resp }, { 8, "get_Producer", dissect_dcom_simple_rqst, dissect_get_Producer_resp }, { 9, "get_Product", dissect_dcom_simple_rqst, dissect_get_Product_resp }, {10, "get_SerialNo", dissect_dcom_simple_rqst, dissect_get_SerialNo_resp }, {11, "get_ProductionDate", dissect_dcom_simple_rqst, dissect_get_ProductionDate_resp }, {12, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp }, {13, "get_ACCO", dissect_dcom_simple_rqst, dissect_ICBALogicalDevice_get_ACCO_resp }, {14, "get_RTAuto", dissect_ICBALogicalDevice_Get_RTAuto_rqst, dissect_ICBALogicalDevice_get_RTAuto_resp }, /* stage 2 */ {15, "PROFInetRevision", dissect_dcom_simple_rqst, dissect_PROFInetRevision_resp }, {16, "ComponentInfo", dissect_dcom_simple_rqst, dissect_ComponentInfo_resp }, {17, "PBAddressInfo", dissect_dcom_simple_rqst, dissect_PBAddressInfo_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAState interface */ static dcerpc_sub_dissector ICBAState_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_State", dissect_dcom_simple_rqst, dissect_ICBAState_get_State_resp }, { 8, "Activate", dissect_dcom_simple_rqst, dissect_dcom_simple_resp }, { 9, "Deactivate", dissect_dcom_simple_rqst, dissect_dcom_simple_resp }, {10, "Reset", dissect_dcom_simple_rqst, dissect_dcom_simple_resp }, {11, "AdviseState", dissect_Advise_rqst, dissect_Advise_resp }, {12, "UnadviseState", dissect_Unadvise_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAStateEvent interface */ static dcerpc_sub_dissector ICBAStateEvent_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "OnStateChanged", dissect_ICBAStateEvent_OnStateChanged_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBATime interface */ static dcerpc_sub_dissector ICBATime_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_Time", dissect_dcom_simple_rqst, dissect_ICBATime_get_Time_resp }, { 8, "put_Time", dissect_ICBATime_put_Time_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAGroupError interface */ static dcerpc_sub_dissector ICBAGroupError_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "GroupError", dissect_dcom_simple_rqst, dissect_ICBAGroupError_GroupError_resp }, { 8, "AdviseGroupError", dissect_Advise_rqst, dissect_Advise_resp }, { 9, "UnadviseGroupError", dissect_Unadvise_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBAGroupErrorEvent interface */ static dcerpc_sub_dissector ICBAGroupErrorEvent_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "OnGroupErrorChanged", dissect_ICBAGroupError_OnGroupErrorChanged_rqst, dissect_dcom_simple_resp }, { 0, NULL, NULL, NULL }, }; /* sub dissector table of ICBARTAuto interface */ static dcerpc_sub_dissector ICBARTAuto_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "get_Name", dissect_dcom_simple_rqst, dissect_RTAuto_get_Name_resp }, { 8, "Revision", dissect_dcom_simple_rqst, dissect_Revision_resp }, /* stage 2 */ { 9, "ComponentInfo", dissect_dcom_simple_rqst, dissect_ComponentInfo_resp }, { 0, NULL, NULL, NULL }, }; /* the interface ICBASystemProperties will NOT be seen on the ethernet */ /* sub dissector table of ICBASystemProperties interface (stage 2 only) */ /* (usually not called over network, no dissecting needed) */ static dcerpc_sub_dissector ICBASystemProperties_dissectors[] = { { 0, "QueryInterface", NULL, NULL }, { 1, "AddRef", NULL, NULL }, { 2, "Release", NULL, NULL }, { 3, "GetTypeInfoCount", dissect_dcom_simple_rqst, dissect_IDispatch_GetTypeInfoCount_resp }, { 4, "GetTypeInfo", dissect_IDispatch_GetTypeInfo_rqst, dissect_IDispatch_GetTypeInfo_resp }, { 5, "GetIDsOfNames", dissect_IDispatch_GetIDsOfNames_rqst, dissect_IDispatch_GetIDsOfNames_resp }, { 6, "Invoke", dissect_IDispatch_Invoke_rqst, dissect_IDispatch_Invoke_resp }, { 7, "StateCollection", dissect_dcom_simple_rqst, NULL }, { 8, "StampCollection", dissect_dcom_simple_rqst, NULL }, { 0, NULL, NULL, NULL }, }; static void cba_cleanup(void) { g_list_free(cba_pdevs); cba_pdevs = NULL; } /* register protocol */ void proto_register_dcom_cba (void) { static hf_register_info hf_cba_browse_array[] = { { &hf_cba_browse_count, { "Count", "cba.browse.count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_offset, { "Offset", "cba.browse.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_max_return, { "MaxReturn", "cba.browse.max_return", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_item, { "ItemNames", "cba.browse.item", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_data_type, { "DataTypes", "cba.browse.data_type", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_access_right, { "AccessRights", "cba.browse.access_right", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_selector, { "Selector", "cba.browse.selector", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_info1, { "Info1", "cba.browse.info1", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_browse_info2, { "Info2", "cba.browse.info2", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static hf_register_info hf_cba_pdev_array[] = { { &hf_cba_revision_major, { "Major", "cba.revision_major", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_revision_minor, { "Minor", "cba.revision_minor", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_revision_service_pack, { "ServicePack", "cba.revision_service_pack", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_revision_build, { "Build", "cba_revision_build", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_producer, { "Producer", "cba.producer", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_product, { "Product", "cba.product", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_multi_app, { "MultiApp", "cba.multi_app", FT_UINT16, BASE_HEX, VALS(dcom_boolean_vals), 0x0, NULL, HFILL }}, { &hf_cba_profinet_dcom_stack, { "PROFInetDCOMStack", "cba.profinet_dcom_stack", FT_UINT16, BASE_HEX, VALS(dcom_boolean_vals), 0x0, NULL, HFILL }}, { &hf_cba_pdev_stamp, { "PDevStamp", "cba.pdev_stamp", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cba_save_ldev_name, { "LDevName", "cba.save_ldev_name", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_save_result, { "PartialResult", "cba.save_result", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static hf_register_info hf_cba_ldev_array[] = { { &hf_cba_name, { "Name", "cba.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_component_id, { "ComponentID", "cba.component_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_component_version, { "Version", "cba.component_version", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_pbaddress, { "PROFIBUS Address", "cba.pbaddress", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_pbaddress_system_id, { "SystemID", "cba.pbaddress.system_id", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cba_pbaddress_address, { "Address", "cba.pbaddress.address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static hf_register_info hf_cba_array[] = { { &hf_cba_opnum, { "Operation", "cba.opnum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cba_production_date, { "ProductionDate", "cba.production_date", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_time, { "Time", "cba.time", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_serial_no, { "SerialNo", "cba.serial_no", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cba_state, { "State", "cba.state", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }}, { &hf_cba_new_state, { "NewState", "cba.state_new", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }}, { &hf_cba_old_state, { "OldState", "cba.state_old", FT_UINT16, BASE_HEX, VALS(cba_state_vals), 0x0, NULL, HFILL }}, { &hf_cba_cookie, { "Cookie", "cba.cookie", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cba_grouperror, { "GroupError", "cba.grouperror", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }}, { &hf_cba_new_grouperror, { "NewGroupError", "cba.grouperror_new", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }}, { &hf_cba_old_grouperror, { "OldGroupError", "cba.grouperror_old", FT_UINT16, BASE_HEX, VALS(cba_grouperror_vals), 0x0, NULL, HFILL }}, }; static gint *ett_cba[] = { &ett_ICBAPhysicalDevice, &ett_ICBABrowse, &ett_ICBAPhysicalDevicePC, &ett_ICBAPhysicalDevicePCEvent, &ett_ICBAPersist, &ett_ICBALogicalDevice, &ett_ICBAState, &ett_ICBAStateEvent, &ett_ICBATime, &ett_ICBAGroupError, &ett_ICBAGroupErrorEvent, &ett_ICBARTAuto, &ett_ICBASystemProperties, &ett_PBAddress }; static ei_register_info ei[] = { { &ei_cba_acco_interface_pointer_unresolved, { "cba.acco.interface_pointer_unresolved", PI_UNDECODED, PI_WARN, "LDev_get_ACCO: can't resolve ACCO interface pointer", EXPFILL }}, }; expert_module_t* expert_cba_acco; proto_register_subtree_array (ett_cba, array_length (ett_cba)); proto_ICBAPhysicalDevice = proto_register_protocol ("ICBAPhysicalDevice", "ICBAPDev", "cba_pdev"); proto_register_field_array(proto_ICBAPhysicalDevice, hf_cba_pdev_array, array_length(hf_cba_pdev_array)); /* XXX - just pick a protocol to register the expert info in */ expert_cba_acco = expert_register_protocol(proto_ICBAPhysicalDevice); expert_register_field_array(expert_cba_acco, ei, array_length(ei)); proto_ICBAPhysicalDevice2 = proto_register_protocol ("ICBAPhysicalDevice2", "ICBAPDev2", "cba_pdev2"); proto_ICBABrowse = proto_register_protocol ("ICBABrowse", "ICBABrowse", "cba_browse"); proto_register_field_array(proto_ICBABrowse, hf_cba_array, array_length(hf_cba_array)); proto_register_field_array(proto_ICBABrowse, hf_cba_browse_array, array_length(hf_cba_browse_array)); proto_ICBABrowse2 = proto_register_protocol ("ICBABrowse2", "ICBABrowse2", "cba_browse2"); proto_ICBAPhysicalDevicePC = proto_register_protocol ("ICBAPhysicalDevicePC", "ICBAPDevPC", "cba_pdev_pc"); proto_ICBAPhysicalDevicePCEvent = proto_register_protocol ("ICBAPhysicalDevicePCEvent", "ICBAPDevPCEvent", "cba_pdev_pc_event"); proto_ICBAPersist = proto_register_protocol ("ICBAPersist", "ICBAPersist", "cba_persist"); proto_ICBAPersist2 = proto_register_protocol ("ICBAPersist2", "ICBAPersist2", "cba_persist2"); proto_ICBALogicalDevice = proto_register_protocol ("ICBALogicalDevice", "ICBALDev", "cba_ldev"); proto_register_field_array(proto_ICBAPhysicalDevice, hf_cba_ldev_array, array_length(hf_cba_ldev_array)); proto_ICBALogicalDevice2 = proto_register_protocol ("ICBALogicalDevice2", "ICBALDev2", "cba_ldev2"); proto_ICBAState = proto_register_protocol ("ICBAState", "ICBAState", "cba_state"); proto_ICBAStateEvent = proto_register_protocol ("ICBAStateEvent", "ICBAStateEvent", "cba_state_event"); proto_ICBATime = proto_register_protocol ("ICBATime", "ICBATime", "cba_time"); proto_ICBAGroupError = proto_register_protocol ("ICBAGroupError", "ICBAGErr", "cba_grouperror"); proto_ICBAGroupErrorEvent = proto_register_protocol ("ICBAGroupErrorEvent", "ICBAGErrEvent", "cba_grouperror_event"); proto_ICBARTAuto = proto_register_protocol ("ICBARTAuto", "ICBARTAuto", "cba_rtauto"); proto_ICBARTAuto2 = proto_register_protocol ("ICBARTAuto2", "ICBARTAuto2", "cba_rtauto2"); proto_ICBASystemProperties = proto_register_protocol ("ICBASystemProperties", "ICBASysProp", "cba_sysprop"); register_cleanup_routine(cba_cleanup); } /* handoff protocol */ void proto_reg_handoff_dcom_cba (void) { /* Register the CBA class ID */ guids_add_uuid(&uuid_coclass_CBAPhysicalDevice, "CBA"); /* Register the interfaces */ dcerpc_init_uuid(proto_ICBAPhysicalDevice, ett_ICBAPhysicalDevice, &uuid_ICBAPhysicalDevice, ver_ICBAPhysicalDevice, ICBAPhysicalDevice_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAPhysicalDevice2, ett_ICBAPhysicalDevice, &uuid_ICBAPhysicalDevice2, ver_ICBAPhysicalDevice2, ICBAPhysicalDevice_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBABrowse, ett_ICBABrowse, &uuid_ICBABrowse, ver_ICBABrowse, ICBABrowse_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBABrowse2, ett_ICBABrowse, &uuid_ICBABrowse2, ver_ICBABrowse2, ICBABrowse_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAPhysicalDevicePC, ett_ICBAPhysicalDevicePC, &uuid_ICBAPhysicalDevicePC, ver_ICBAPhysicalDevicePC, ICBAPhysicalDevicePC_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAPhysicalDevicePCEvent, ett_ICBAPhysicalDevicePCEvent, &uuid_ICBAPhysicalDevicePCEvent, ver_ICBAPhysicalDevicePCEvent, ICBAPhysicalDevicePCEvent_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAPersist, ett_ICBAPersist, &uuid_ICBAPersist, ver_ICBAPersist, ICBAPersist_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAPersist2, ett_ICBAPersist, &uuid_ICBAPersist2, ver_ICBAPersist2, ICBAPersist_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBALogicalDevice, ett_ICBALogicalDevice, &uuid_ICBALogicalDevice, ver_ICBALogicalDevice, ICBALogicalDevice_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBALogicalDevice2, ett_ICBALogicalDevice, &uuid_ICBALogicalDevice2, ver_ICBALogicalDevice2, ICBALogicalDevice_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAState, ett_ICBAState, &uuid_ICBAState, ver_ICBAState, ICBAState_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAStateEvent, ett_ICBAStateEvent, &uuid_ICBAStateEvent, ver_ICBAStateEvent, ICBAStateEvent_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBATime, ett_ICBATime, &uuid_ICBATime, ver_ICBATime, ICBATime_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAGroupError, ett_ICBAGroupError, &uuid_ICBAGroupError, ver_ICBAGroupError, ICBAGroupError_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBAGroupErrorEvent, ett_ICBAGroupErrorEvent, &uuid_ICBAGroupErrorEvent, ver_ICBAGroupErrorEvent, ICBAGroupErrorEvent_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBARTAuto, ett_ICBARTAuto, &uuid_ICBARTAuto, ver_ICBARTAuto, ICBARTAuto_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBARTAuto2, ett_ICBARTAuto, &uuid_ICBARTAuto2, ver_ICBARTAuto2, ICBARTAuto_dissectors, hf_cba_opnum); dcerpc_init_uuid(proto_ICBASystemProperties, ett_ICBASystemProperties, &uuid_ICBASystemProperties, ver_ICBASystemProperties, ICBASystemProperties_dissectors, hf_cba_opnum); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-dcp.c
/* packet-pn-dcp.c * Routines for PN-DCP (PROFINET Discovery and basic Configuration Protocol) * packet dissection. * * IEC 61158-6-10 section 4.3 * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* * Cyclic PNIO RTC1 Data Dissection: * * Added new functions to packet-pn-dcp.c. The profinet plug-in will now save * the information (Stationname, -type, -id) of "Ident OK" frames. Those * informations will later be used for detailled dissection of cyclic PNIO RTC1 * dataframes. * * The declaration of the new added structures are within packet-pn.h to * use the information within packet-pn-rtc-one.c * * Overview for cyclic PNIO RTC1 data dissection functions: * -> dissect_PNDCP_Suboption_Device (Save Stationname, -type, -id) */ #include "config.h" #include <string.h> #include <glib.h> #include <epan/packet.h> #include <epan/exceptions.h> #include <epan/to_str.h> #include <epan/wmem_scopes.h> #include <epan/expert.h> #include <epan/conversation.h> #include "packet-pn.h" void proto_register_pn_dcp(void); void proto_reg_handoff_pn_dcp(void); int proto_pn_dcp = -1; static int hf_pn_dcp_service_id = -1; static int hf_pn_dcp_service_type = -1; static int hf_pn_dcp_xid = -1; static int hf_pn_dcp_reserved8 = -1; static int hf_pn_dcp_reserved16 = -1; static int hf_pn_dcp_response_delay = -1; static int hf_pn_dcp_data_length = -1; static int hf_pn_dcp_block_length = -1; static int hf_pn_dcp_block = -1; static int hf_pn_dcp_block_error = -1; static int hf_pn_dcp_option = -1; static int hf_pn_dcp_block_info = -1; static int hf_pn_dcp_block_qualifier = -1; static int hf_pn_dcp_blockqualifier = -1; static int hf_pn_dcp_blockqualifier_r2f = -1; static int hf_pn_dcp_suboption_ip = -1; static int hf_pn_dcp_suboption_ip_block_info = -1; static int hf_pn_dcp_suboption_ip_ip = -1; static int hf_pn_dcp_suboption_ip_subnetmask = -1; static int hf_pn_dcp_suboption_ip_standard_gateway = -1; static int hf_pn_dcp_suboption_ip_mac_address = -1; static int hf_pn_dcp_suboption_device = -1; static int hf_pn_dcp_suboption_device_typeofstation = -1; static int hf_pn_dcp_suboption_device_nameofstation = -1; static int hf_pn_dcp_suboption_vendor_id = -1; static int hf_pn_dcp_suboption_device_id = -1; static int hf_pn_dcp_suboption_device_role = -1; static int hf_pn_dcp_suboption_device_aliasname = -1; static int hf_pn_dcp_suboption_device_instance_high = -1; static int hf_pn_dcp_suboption_device_instance_low = -1; static int hf_pn_dcp_suboption_device_oem_ven_id = -1; static int hf_pn_dcp_suboption_device_oem_dev_id = -1; static int hf_pn_dcp_rsi_properties_value = -1; static int hf_pn_dcp_rsi_properties_value_bit0 = -1; static int hf_pn_dcp_rsi_properties_value_bit1 = -1; static int hf_pn_dcp_rsi_properties_value_bit2 = -1; static int hf_pn_dcp_rsi_properties_value_bit3 = -1; static int hf_pn_dcp_rsi_properties_value_bit4 = -1; static int hf_pn_dcp_rsi_properties_value_bit5 = -1; static int hf_pn_dcp_rsi_properties_value_otherbits = -1; static int hf_pn_dcp_suboption_tsn = -1; static int hf_pn_dcp_suboption_tsn_domain_name = -1; static int hf_pn_dcp_suboption_tsn_domain_uuid = -1; static int hf_pn_dcp_suboption_tsn_nme_prio = -1; static int hf_pn_dcp_suboption_tsn_nme_parameter_uuid = -1; static int hf_pn_dcp_suboption_tsn_nme_agent = -1; static int hf_pn_dcp_suboption_dhcp = -1; static int hf_pn_dcp_suboption_dhcp_option_code = -1; static int hf_pn_dcp_suboption_dhcp_parameter_length = -1; static int hf_pn_dcp_suboption_dhcp_parameter_data = -1; static int hf_pn_dcp_suboption_dhcp_arbitrary_client_id = -1; static int hf_pn_dcp_suboption_dhcp_control_parameter_data = -1; static int hf_pn_dcp_suboption_control = -1; static int hf_pn_dcp_suboption_control_option = -1; static int hf_pn_dcp_suboption_control_signal_value = -1; static int hf_pn_dcp_suboption_deviceinitiative = -1; static int hf_pn_dcp_deviceinitiative_value = -1; static int hf_pn_dcp_suboption_all = -1; static int hf_pn_dcp_suboption_manuf = -1; static int hf_pn_dcp_vendor_id_high = -1; static int hf_pn_dcp_vendor_id_low = -1; static int hf_pn_dcp_device_id_high = -1; static int hf_pn_dcp_device_id_low = -1; static int hf_pn_dcp_instance_id_high = -1; static int hf_pn_dcp_instance_id_low = -1; static gint ett_pn_dcp = -1; static gint ett_pn_dcp_block = -1; static gint ett_pn_dcp_rsi_properties_value = -1; static expert_field ei_pn_dcp_block_parse_error = EI_INIT; static expert_field ei_pn_dcp_block_error_unknown = EI_INIT; static expert_field ei_pn_dcp_ip_conflict = EI_INIT; #define PNDCP_SERVICE_ID_GET 0x03 #define PNDCP_SERVICE_ID_SET 0x04 #define PNDCP_SERVICE_ID_IDENTIFY 0x05 #define PNDCP_SERVICE_ID_HELLO 0x06 static const value_string pn_dcp_service_id[] = { { 0x00, "reserved" }, { 0x01, "Manufacturer specific" }, { 0x02, "Manufacturer specific" }, { PNDCP_SERVICE_ID_GET, "Get" }, { PNDCP_SERVICE_ID_SET, "Set" }, { PNDCP_SERVICE_ID_IDENTIFY,"Identify" }, { PNDCP_SERVICE_ID_HELLO, "Hello" }, /* 0x07 - 0xff reserved */ { 0, NULL } }; #define PNDCP_SERVICE_TYPE_REQUEST 0 #define PNDCP_SERVICE_TYPE_RESPONSE_SUCCESS 1 #define PNDCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED 5 static const value_string pn_dcp_service_type[] = { { PNDCP_SERVICE_TYPE_REQUEST, "Request" }, { PNDCP_SERVICE_TYPE_RESPONSE_SUCCESS, "Response Success" }, { PNDCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED, "Response - Request not supported" }, /* all others reserved */ { 0, NULL } }; static const value_string pn_dcp_block_error[] = { { 0x00, "Ok" }, { 0x01, "Option unsupp." }, { 0x02, "Suboption unsupp. or no DataSet avail." }, { 0x03, "Suboption not set" }, { 0x04, "Resource Error" }, { 0x05, "SET not possible by local reasons" }, { 0x06, "In operation, SET not possible" }, /* all others reserved */ { 0, NULL } }; static const range_string pn_dcp_block_info[] = { { 0x0000, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; static const value_string pn_dcp_block_qualifier[] = { { 0x0000, "Use the value temporary" }, { 0x0001, "Save the value permanent" }, /*0x0002 - 0xffff reserved */ { 0, NULL } }; static const value_string pn_dcp_BlockQualifier[] = { { 0x0002, "Reset application data" }, { 0x0003, "Reset application data" }, { 0x0004, "Reset communication parameter" }, { 0x0005, "Reset communication parameter" }, { 0x0006, "Reset engineering parameter" }, { 0x0007, "Reset engineering parameter" }, { 0x0008, "Resets all stored data" }, { 0x0009, "Resets all stored data" }, { 0x000A, "Reset engineering parameter" }, { 0x000B, "Reset engineering parameter" }, { 0x000C, "Reserved" }, { 0x000D, "Reserved" }, { 0x000E, "Reserved" }, { 0x0010, "Resets all stored data in the IOD or IOC to its factory values" }, { 0x0011, "Resets all stored data in the IOD or IOC to its factory values" }, { 0x0012, "Reset and restore data" }, { 0x0013, "Reset and restore data" }, { 0x0014, "Reserved" }, { 0x0015, "Reserved" }, { 0x0016, "Reserved" }, { 0, NULL } }; #define PNDCP_OPTION_IP 0x01 #define PNDCP_OPTION_DEVICE 0x02 #define PNDCP_OPTION_DHCP 0x03 #define PNDCP_OPTION_RESERVED 0x04 #define PNDCP_OPTION_CONTROL 0x05 #define PNDCP_OPTION_DEVICEINITIATIVE 0x06 #define PNDCP_OPTION_TSN 0x07 #define PNDCP_OPTION_MANUF_X80 0x80 #define PNDCP_OPTION_MANUF_XFE 0xFE #define PNDCP_OPTION_ALLSELECTOR 0xFF static const range_string pn_dcp_option[] = { { 0x00, 0x00, "Reserved" }, { PNDCP_OPTION_IP , PNDCP_OPTION_IP , "IP" }, { PNDCP_OPTION_DEVICE , PNDCP_OPTION_DEVICE , "Device properties" }, { PNDCP_OPTION_DHCP , PNDCP_OPTION_DHCP , "DHCP" }, { PNDCP_OPTION_RESERVED , PNDCP_OPTION_RESERVED , "Reserved" }, { PNDCP_OPTION_CONTROL , PNDCP_OPTION_CONTROL , "Control" }, { PNDCP_OPTION_DEVICEINITIATIVE, PNDCP_OPTION_DEVICEINITIATIVE, "Device Initiative" }, { PNDCP_OPTION_TSN , PNDCP_OPTION_TSN , "TSN Domain"}, /*0x07 - 0x7F reserved */ /*0x80 - 0xFE manufacturer specific */ { PNDCP_OPTION_MANUF_X80 , PNDCP_OPTION_MANUF_XFE , "Manufacturer specific" }, { PNDCP_OPTION_ALLSELECTOR, PNDCP_OPTION_ALLSELECTOR, "All Selector" }, { 0, 0, NULL } }; #define PNDCP_SUBOPTION_IP_MAC 0x01 #define PNDCP_SUBOPTION_IP_IP 0x02 #define PNDCP_SUBOPTION_IP_FULL_IP_SUITE 0x03 static const value_string pn_dcp_suboption_ip[] = { { 0x00, "Reserved" }, { PNDCP_SUBOPTION_IP_MAC, "MAC address" }, { PNDCP_SUBOPTION_IP_IP, "IP parameter" }, { PNDCP_SUBOPTION_IP_FULL_IP_SUITE, "Full IP suite" }, /*0x03 - 0xff reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_ip_block_info[] = { { 0x0000, "IP not set" }, { 0x0001, "IP set" }, { 0x0002, "IP set by DHCP" }, { 0x0080, "IP not set (address conflict detected)" }, { 0x0081, "IP set (address conflict detected)" }, { 0x0082, "IP set by DHCP (address conflict detected)" }, /*0x0003 - 0xffff reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_control_signal_value[] = { {0x0100, "Flash Once"}, {0, NULL} }; #define PNDCP_SUBOPTION_DEVICE_MANUF 0x01 #define PNDCP_SUBOPTION_DEVICE_NAMEOFSTATION 0x02 #define PNDCP_SUBOPTION_DEVICE_DEV_ID 0x03 #define PNDCP_SUBOPTION_DEVICE_DEV_ROLE 0x04 #define PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS 0x05 #define PNDCP_SUBOPTION_DEVICE_ALIAS_NAME 0x06 #define PNDCP_SUBOPTION_DEVICE_DEV_INSTANCE 0x07 #define PNDCP_SUBOPTION_DEVICE_OEM_DEV_ID 0x08 #define PNDCP_SUBOPTION_DEVICE_RSI_PROPERTIES 0x0A static const value_string pn_dcp_suboption_device[] = { { 0x00, "Reserved" }, { PNDCP_SUBOPTION_DEVICE_MANUF, "Manufacturer specific (Type of Station)" }, { PNDCP_SUBOPTION_DEVICE_NAMEOFSTATION, "Name of Station" }, { PNDCP_SUBOPTION_DEVICE_DEV_ID, "Device ID" }, { PNDCP_SUBOPTION_DEVICE_DEV_ROLE, "Device Role" }, { PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS, "Device Options" }, { PNDCP_SUBOPTION_DEVICE_ALIAS_NAME, "Alias Name" }, { PNDCP_SUBOPTION_DEVICE_DEV_INSTANCE, "Device Instance" }, { PNDCP_SUBOPTION_DEVICE_OEM_DEV_ID, "OEM Device ID"}, { PNDCP_SUBOPTION_DEVICE_RSI_PROPERTIES,"RSI Properties" }, /*0x09 - 0xff reserved */ { 0, NULL } }; static const true_false_string pn_dcp_rsi_properties_value_bit = { "Available", "Not available" } ; #define PNDCP_SUBOPTION_TSN_DOMAIN_NAME 0x01 #define PNDCP_SUBOPTION_TSN_NME_MANAGER 0x02 #define PNDCP_SUBOPTION_TSN_NME_PARAMETER_UUID 0x03 #define PNDCP_SUBOPTION_TSN_NME_AGENT 0x04 #define PNDCP_SUBOPTION_TSN_CIM_INTERFACE 0x05 static const value_string pn_dcp_suboption_tsn[] = { { 0x00, "Reserved" }, { PNDCP_SUBOPTION_TSN_DOMAIN_NAME, "TSN Domain Name" }, { PNDCP_SUBOPTION_TSN_NME_MANAGER, "NME Manager" }, { PNDCP_SUBOPTION_TSN_NME_PARAMETER_UUID, "NME Paramater UUID" }, { PNDCP_SUBOPTION_TSN_NME_AGENT, "NME Agent" }, { PNDCP_SUBOPTION_TSN_CIM_INTERFACE, "CIM Interface" }, { 0, NULL } }; static const range_string pn_dcp_suboption_tsn_nme_prio[] = { { 0x0000, 0x0000, "Highest priority NME manager" }, { 0x0001, 0x3000, "High priorities for NME manager" }, { 0x3001, 0x9FFF, "Low priorities for NME manager" }, { 0xA000, 0xA000, "Lowest priority for NME manager / Default priority for NME manager" }, { 0xA001, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; #define PNDCP_SUBOPTION_DHCP_CLIENT_ID 61 #define PNDCP_SUBOPTION_DHCP_CONTROL_FOR_ADDRESS_RES 255 static const value_string pn_dcp_suboption_dhcp[] = { { 12, "Host name" }, { 43, "Vendor specific" }, { 54, "Server identifier" }, { 55, "Parameter request list" }, { 60, "Class identifier" }, { PNDCP_SUBOPTION_DHCP_CLIENT_ID, "DHCP client identifier" }, { 81, "FQDN, Fully Qualified Domain Name" }, { 97, "UUID/GUID-based Client" }, { PNDCP_SUBOPTION_DHCP_CONTROL_FOR_ADDRESS_RES, "Control DHCP for address resolution" }, /*all others reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_dhcp_control_parameter_data[] = { { 0x00, "Don't use DHCP (Default)" }, { 0x01, "Don't use DHCP, all DHCPOptions set to Reset to Factory value" }, { 0x02, "Use DHCP with the given set of DHCPOptions" }, { 0, NULL } }; #define PNDCP_SUBOPTION_CONTROL_START_TRANS 0x01 #define PNDCP_SUBOPTION_CONTROL_END_TRANS 0x02 #define PNDCP_SUBOPTION_CONTROL_SIGNAL 0x03 #define PNDCP_SUBOPTION_CONTROL_RESPONSE 0x04 #define PNDCP_SUBOPTION_CONTROL_FACT_RESET 0x05 #define PNDCP_SUBOPTION_CONTROL_RESET_TO_FACT 0x06 static const value_string pn_dcp_suboption_control[] = { { 0x00, "Reserved" }, { PNDCP_SUBOPTION_CONTROL_START_TRANS, "Start Transaction" }, { PNDCP_SUBOPTION_CONTROL_END_TRANS, "End Transaction" }, { PNDCP_SUBOPTION_CONTROL_SIGNAL, "Signal" }, { PNDCP_SUBOPTION_CONTROL_RESPONSE, "Response" }, { PNDCP_SUBOPTION_CONTROL_FACT_RESET, "Reset Factory Settings" }, { PNDCP_SUBOPTION_CONTROL_RESET_TO_FACT,"Reset to Factory" }, /*0x07 - 0xff reserved */ { 0, NULL } }; #define PNDCP_SUBOPTION_DEVICEINITIATIVE 0x01 static const value_string pn_dcp_suboption_deviceinitiative[] = { { 0x00, "Reserved" }, { PNDCP_SUBOPTION_DEVICEINITIATIVE, "Device Initiative" }, /*0x00 - 0xff reserved */ { 0, NULL } }; static const value_string pn_dcp_deviceinitiative_value[] = { { 0x00, "Device does not issue a DCP-Hello-ReqPDU after power on" }, { 0x01, "Device does issue a DCP-Hello-ReqPDU after power on" }, /*0x02 - 0xff reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_all[] = { { 0xff, "ALL Selector" }, /* all other reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_other[] = { { 0x00, "Default" }, /* all other reserved */ { 0, NULL } }; static const value_string pn_dcp_suboption_manuf[] = { /* none known */ { 0, NULL } }; /* dissect the option field */ static int dissect_PNDCP_Option(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, int hfindex, gboolean append_col) { guint8 option; guint8 suboption; const value_string *val_str; offset = dissect_pn_uint8 (tvb, offset, pinfo, tree, hfindex, &option); switch (option) { case PNDCP_OPTION_IP: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip, &suboption); val_str = pn_dcp_suboption_ip; break; case PNDCP_OPTION_DEVICE: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device, &suboption); val_str = pn_dcp_suboption_device; break; case PNDCP_OPTION_DHCP: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp, &suboption); val_str = pn_dcp_suboption_dhcp; break; case PNDCP_OPTION_CONTROL: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_control, &suboption); val_str = pn_dcp_suboption_control; break; case PNDCP_OPTION_DEVICEINITIATIVE: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_deviceinitiative, &suboption); val_str = pn_dcp_suboption_deviceinitiative; break; case PNDCP_OPTION_TSN: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn, &suboption); val_str = pn_dcp_suboption_tsn; break; case PNDCP_OPTION_ALLSELECTOR: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_all, &suboption); val_str = pn_dcp_suboption_all; break; default: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_manuf, &suboption); val_str = pn_dcp_suboption_manuf; } proto_item_append_text(block_item, ", Status from %s - %s", rval_to_str_const(option, pn_dcp_option, "Unknown"), val_to_str_const(suboption, val_str, "Unknown")); if (append_col) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(suboption, val_str, "Unknown")); } return offset; } /* dissect the "IP" suboption */ static int dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id, gboolean is_response) { guint8 suboption; guint16 block_length; guint16 block_info; guint16 block_qualifier; gboolean have_block_info = FALSE; gboolean have_block_qualifier = FALSE; guint8 mac[6]; guint32 ip; proto_item *item = NULL; address addr; /* SuboptionIPParameter */ offset = dissect_pn_uint8 (tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip, &suboption); /* DCPBlockLength */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); switch (suboption) { case PNDCP_SUBOPTION_IP_MAC: /* MACAddressValue? */ pn_append_info(pinfo, dcp_item, ", MAC"); proto_item_append_text(block_item, "IP/MAC"); /* BlockInfo? */ if (((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); have_block_info = TRUE; block_length -= 2; } /* BlockQualifier? */ if ((service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); have_block_qualifier = TRUE; block_length -= 2; } if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_mac_address, mac); set_address(&addr, AT_ETHER, 6, mac); proto_item_append_text(block_item, ", MACAddress: %s", address_to_str(pinfo->pool, &addr)); break; case PNDCP_SUBOPTION_IP_IP: pn_append_info(pinfo, dcp_item, ", IP"); proto_item_append_text(block_item, "IP/IP"); /* BlockInfo? */ if (((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { block_info = tvb_get_ntohs(tvb, offset); if (tree) { item = proto_tree_add_uint(tree, hf_pn_dcp_suboption_ip_block_info, tvb, offset, 2, block_info); } offset += 2; proto_item_append_text(block_item, ", BlockInfo: %s", val_to_str_const(block_info, pn_dcp_suboption_ip_block_info, "Undecoded")); block_length -= 2; if (block_info & 0x80) { expert_add_info(pinfo, item, &ei_pn_dcp_ip_conflict); } } /* BlockQualifier? */ if ( (service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); block_length -= 2; } /* IPParameterValue ... */ /* IPAddress */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_ip, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", IP: %s", address_to_str(pinfo->pool, &addr)); /* Subnetmask */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_subnetmask, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", Subnet: %s", address_to_str(pinfo->pool, &addr)); /* StandardGateway */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_standard_gateway, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", Gateway: %s", address_to_str(pinfo->pool, &addr)); break; case PNDCP_SUBOPTION_IP_FULL_IP_SUITE: pn_append_info(pinfo, dcp_item, ", MAC"); proto_item_append_text(block_item, "IP/MAC"); /* BlockInfo? */ if (((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); have_block_info = TRUE; block_length -= 2; } /* BlockQualifier? */ if ((service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); have_block_qualifier = TRUE; block_length -= 2; } if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } /* IPAddress */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_ip, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", IP: %s", address_to_str(pinfo->pool, &addr)); /* Subnetmask */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_subnetmask, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", Subnet: %s", address_to_str(pinfo->pool, &addr)); /* StandardGateway */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_standard_gateway, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", Gateway: %s", address_to_str(pinfo->pool, &addr)); /* IPAddress_1 */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_ip, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", DNSServerIP1: %s", address_to_str(pinfo->pool, &addr)); /* IPAddress_2 */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_subnetmask, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", DNSServerIP2: %s", address_to_str(pinfo->pool, &addr)); /* IPAddress_3 */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_standard_gateway, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", DNSServerIP3: %s", address_to_str(pinfo->pool, &addr)); /* IPAddress_4 */ offset = dissect_pn_ipv4(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_ip_standard_gateway, &ip); set_address(&addr, AT_IPv4, 4, &ip); proto_item_append_text(block_item, ", DNSServerIP4: %s", address_to_str(pinfo->pool, &addr)); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } return offset; } /* dissect the "device" suboption */ static int dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id, gboolean is_response) { guint8 suboption; guint16 block_length; gchar *info_str; guint8 device_role; guint16 vendor_id; guint16 device_id; char *typeofstation; char *nameofstation; char *aliasname; guint16 block_info = 0; guint16 block_qualifier = 0; gboolean have_block_info = FALSE; gboolean have_block_qualifier = FALSE; guint8 device_instance_high; guint8 device_instance_low; guint16 oem_vendor_id; guint16 oem_device_id; proto_item *sub_item; proto_tree *sub_tree; conversation_t *conversation; stationInfo *station_info; /* SuboptionDevice... */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device, &suboption); /* DCPBlockLength */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); /* BlockInfo? */ if ( ((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); have_block_info = TRUE; block_length -= 2; } /* BlockQualifier? */ if ( (service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); have_block_qualifier = TRUE; block_length -= 2; } switch (suboption) { case PNDCP_SUBOPTION_DEVICE_MANUF: /* * XXX - IEC 61158-6-10 Edition 4.0, section 4.3, says this field * "shall be coded as data type VisibleString", and that VisibleString * is "ISO/IEC 646 - International Reference Version without the "del" * (coding 0x7F) character", i.e. ASCII. * * However, at least one capture has a packet where 0xAE is used in * a place where a registered trademark symbol would be appropriate, * so the host sending it apparently extended ASCII to ISO 8859-n * for some value of n. That may have just been an error on their * part, not realizing that they should have done "(R)" or something * such as that. */ proto_tree_add_item_ret_display_string (tree, hf_pn_dcp_suboption_device_typeofstation, tvb, offset, block_length, ENC_ASCII, pinfo->pool, &typeofstation); pn_append_info(pinfo, dcp_item, ", DeviceVendorValue"); proto_item_append_text(block_item, "Device/Manufacturer specific"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info){ proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", DeviceVendorValue: \"%s\"", typeofstation); if (PINFO_FD_VISITED(pinfo) == FALSE) { /* Create a conversation between the MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, need to switch dl_src & dl_dst if not a response * All conversations are based on Device MAC as addr1 */ if (is_response) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } else { conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, proto_pn_dcp, station_info); } station_info->typeofstation = wmem_strdup(wmem_file_scope(), typeofstation); } offset += block_length; break; case PNDCP_SUBOPTION_DEVICE_NAMEOFSTATION: /* * XXX - IEC 61158-6-10 Edition 4.0 says, in section 4.3.1.4.15 * "Coding of the field NameOfStationValue", that "This field shall * be coded as data type OctetString with 1 to 240 octets. The * definition of IETF RFC 5890 and the following syntax applies: ..." * * RFC 5890 means Punycode; should we translate the domain name to * UTF-8 and show both the untranslated and translated domain name? * * They don't mention anything about the RFC 1035 encoding of * domain names as mentioned in section 3.1 "Name space definitions", * with the labels being counted strings; does that mean that this * is just an ASCII string to be interpreted as a Punycode Unicode * domain name? */ proto_tree_add_item_ret_display_string (tree, hf_pn_dcp_suboption_device_nameofstation, tvb, offset, block_length, ENC_ASCII, pinfo->pool, &nameofstation); pn_append_info(pinfo, dcp_item, wmem_strdup_printf(pinfo->pool, ", NameOfStation:\"%s\"", nameofstation)); proto_item_append_text(block_item, "Device/NameOfStation"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", \"%s\"", nameofstation); if (PINFO_FD_VISITED(pinfo) == FALSE) { /* Create a conversation between the MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, need to switch dl_src & dl_dst if not a response * All conversations are based on Device MAC as addr1 */ if (is_response) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } else { conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, proto_pn_dcp, station_info); } station_info->nameofstation = wmem_strdup(wmem_file_scope(), nameofstation); } offset += block_length; break; case PNDCP_SUBOPTION_DEVICE_DEV_ID: offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_vendor_id, &vendor_id); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_id, &device_id); if (PINFO_FD_VISITED(pinfo) == FALSE) { /* Create a conversation between the MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { /* Create new conversation, need to switch dl_src & dl_dst if not a response * All conversations are based on Device MAC as addr1 */ if (is_response) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } else { conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, proto_pn_dcp, station_info); } station_info->u16Vendor_id = vendor_id; station_info->u16Device_id = device_id; } pn_append_info(pinfo, dcp_item, ", Dev-ID"); proto_item_append_text(block_item, "Device/Device ID"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", VendorID: 0x%04x / DeviceID: 0x%04x", vendor_id, device_id); break; case PNDCP_SUBOPTION_DEVICE_DEV_ROLE: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_role, &device_role); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_reserved8, NULL); pn_append_info(pinfo, dcp_item, ", Dev-Role"); proto_item_append_text(block_item, "Device/Device Role"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); if (device_role & 0x01) proto_item_append_text(block_item, ", IO-Device"); if (device_role & 0x02) proto_item_append_text(block_item, ", IO-Controller"); if (device_role & 0x04) proto_item_append_text(block_item, ", IO-Multidevice"); if (device_role & 0x08) proto_item_append_text(block_item, ", PN-Supervisor"); break; case PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS: info_str = wmem_strdup_printf(pinfo->pool, ", Dev-Options(%u)", block_length/2); pn_append_info(pinfo, dcp_item, info_str); proto_item_append_text(block_item, "Device/Device Options"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", %u options", block_length/2); for( ; block_length != 0; block_length -= 2) { offset = dissect_PNDCP_Option(tvb, offset, pinfo, tree, NULL /*block_item*/, hf_pn_dcp_option, FALSE /* append_col */); } break; case PNDCP_SUBOPTION_DEVICE_ALIAS_NAME: /* * XXX - IEC 61158-6-10 Edition 4.0, section 4.3.1.4.17 "Coding of * the field AliasNameValue", says this field "shall be coded as * OctetString. The content shall be the concatenation of the content * of the fields NameOfPort and NameOfStation. * * AliasNameValue = NameOfPort + "." + NameOfStation * * " and: * * It says in section 4.3.1.4.16 "Coding of the field NameOfPort" * that "This field shall be coded as OctetString[8] or * OctetString[14] as "port-xyz" or "port-xyz-rstuv" where x, y, * z is in the range "0"-"9" from 001 up to 255 and r, s, t, u, v * is in the range "0"-"9" from 00000 up to 65535. ... * Furthermore, the definition of IETF RFC 5890 shall be applied." * * That suggests that the Octets are probably just ASCII characters; * IETF RFC 5890 means Punycode, but there isn't anything in those * string formats that requires non-ASCII characters - they're * just literally "port-" followed by numbers and hyphens. * * It says in section 4.3.1.4.15 "Coding of the field * NameOfStationValue" that it's a domain name, complete with * RFC 5890 Punycode. */ proto_tree_add_item_ret_display_string (tree, hf_pn_dcp_suboption_device_aliasname, tvb, offset, block_length, ENC_ASCII, pinfo->pool, &aliasname); pn_append_info(pinfo, dcp_item, wmem_strdup_printf(pinfo->pool, ", AliasName:\"%s\"", aliasname)); proto_item_append_text(block_item, "Device/AliasName"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", \"%s\"", aliasname); offset += block_length; break; case PNDCP_SUBOPTION_DEVICE_DEV_INSTANCE: offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_instance_high, &device_instance_high); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_instance_low, &device_instance_low); pn_append_info(pinfo, dcp_item, ", Dev-Instance"); proto_item_append_text(block_item, "Device/Device Instance"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", InstanceHigh: %d, Instance Low: %d", device_instance_high, device_instance_low); break; case PNDCP_SUBOPTION_DEVICE_OEM_DEV_ID: offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_oem_ven_id, &oem_vendor_id); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_device_oem_dev_id, &oem_device_id); pn_append_info(pinfo, dcp_item, ", OEM-Dev-ID"); proto_item_append_text(block_item, "Device/OEM Device ID"); if(have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if(have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", OEMVendorID: 0x%04x / OEMDeviceID: 0x%04x", oem_vendor_id, oem_device_id); break; case PNDCP_SUBOPTION_DEVICE_RSI_PROPERTIES: sub_item = proto_tree_add_item(tree, hf_pn_dcp_rsi_properties_value, tvb, offset, 2, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_dcp_rsi_properties_value); static int* const flags[] = { &hf_pn_dcp_rsi_properties_value_bit0, &hf_pn_dcp_rsi_properties_value_bit1, &hf_pn_dcp_rsi_properties_value_bit2, &hf_pn_dcp_rsi_properties_value_bit3, &hf_pn_dcp_rsi_properties_value_bit4, &hf_pn_dcp_rsi_properties_value_bit5, &hf_pn_dcp_rsi_properties_value_otherbits, NULL }; proto_tree_add_bitmask(sub_tree, tvb, offset, hf_pn_dcp_rsi_properties_value, ett_pn_dcp_rsi_properties_value, flags, ENC_BIG_ENDIAN); offset = offset + 2; if (pinfo->fd->visited == FALSE) { /* Create a conversation between the MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, proto_pn_dcp, station_info); } } pn_append_info(pinfo, dcp_item, ", RSI-Properties"); proto_item_append_text(block_item, "Device/RSI Properties"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } return offset; } /* dissect the "tsn" suboption */ static int dissect_PNDCP_Suboption_TSN(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, proto_item* block_item, proto_item* dcp_item, guint8 service_id, gboolean is_response) { guint8 suboption; guint16 block_length; char *domain_name; guint16 nme_prio; e_guid_t tsn_domain_uuid; e_guid_t nme_parameter_uuid; e_guid_t nme_name_uuid; guint16 vendor_id; guint16 device_id; guint16 block_info = 0; guint16 block_qualifier = 0; gboolean have_block_info = FALSE; gboolean have_block_qualifier = FALSE; guint8 instance_id_high; guint8 instance_id_low; conversation_t* conversation; stationInfo* station_info; gboolean is_zeros = TRUE; /* SuboptionTSN... */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn, &suboption); /* DCPBlockLength */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); /* BlockInfo? */ if (((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); have_block_info = TRUE; block_length -= 2; } /* BlockQualifier? */ if ((service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); have_block_qualifier = TRUE; block_length -= 2; } switch (suboption) { case PNDCP_SUBOPTION_TSN_DOMAIN_NAME: offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_domain_uuid, &tsn_domain_uuid); proto_tree_add_item_ret_display_string(tree, hf_pn_dcp_suboption_tsn_domain_name, tvb, offset, (block_length-16), ENC_ASCII | ENC_NA, pinfo->pool, &domain_name); pn_append_info(pinfo, dcp_item, ", TSN-Domain Name"); proto_item_append_text(block_item, "TSN/TSN-Domain Name"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); pn_append_info(pinfo, dcp_item, wmem_strdup_printf(pinfo->pool, ", DomainName:\"%s\"", domain_name)); proto_item_append_text(block_item, ", \"%s\"", domain_name); offset += (block_length-16); is_zeros = TRUE; for (int i = 0; i < 8; i++) { if (tsn_domain_uuid.data4[i] != 0) { is_zeros = FALSE; break; } } if ((tsn_domain_uuid.data1 == 0) && (tsn_domain_uuid.data2 == 0) && (tsn_domain_uuid.data3 == 0) && (is_zeros)) proto_item_append_text(block_item, ", No TSN domain assigned"); else proto_item_append_text(block_item, ", UUID identifying a TSN domain using SNMP/ LLDP/ DCP"); break; case PNDCP_SUBOPTION_TSN_NME_MANAGER: pn_append_info(pinfo, dcp_item, ", NME-Manager"); proto_item_append_text(block_item, "TSN/NME-Manager"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_nme_prio, &nme_prio); proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); if (nme_prio == 0x0000) proto_item_append_text(block_item, ", Highest priority NME manager"); else if ((0x0001 <= nme_prio) && (nme_prio <= 0x3000)) proto_item_append_text(block_item, ", High priorities for NME manager"); else if ((0x3001 <= nme_prio) && (nme_prio <= 0x9FFF)) proto_item_append_text(block_item, ", Low priorities for NME manager"); else if (0xA000 == nme_prio) proto_item_append_text(block_item, ", Lowest priority for NME manager / Default priority for NME manager"); else proto_item_append_text(block_item, ", Reserved"); } break; case PNDCP_SUBOPTION_TSN_NME_PARAMETER_UUID: pn_append_info(pinfo, dcp_item, ", NME-Parameter UUID"); proto_item_append_text(block_item, "TSN/NME-Parameter UUID"); if (block_length > 0) { offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_nme_parameter_uuid, &nme_parameter_uuid); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); is_zeros = TRUE; for (int i = 0; i < 8; i++) { if (nme_parameter_uuid.data4[i] != 0) { is_zeros = FALSE; break; } } if ((nme_parameter_uuid.data1 == 0) && (nme_parameter_uuid.data2 == 0) && (nme_parameter_uuid.data3 == 0) && (is_zeros)) proto_item_append_text(block_item, ", Unconfigured"); else proto_item_append_text(block_item, ", UUID identifying an NME parameter set within the TSN domain."); } break; case PNDCP_SUBOPTION_TSN_NME_AGENT: pn_append_info(pinfo, dcp_item, ", NME-Agent"); proto_item_append_text(block_item, "TSN/NME-Agent"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_nme_agent, &nme_name_uuid); proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); is_zeros = TRUE; for (int i = 0; i < 8; i++) { if (nme_name_uuid.data4[i] != 0) { is_zeros = FALSE; break; } } if ((nme_name_uuid.data1 == 0) && (nme_name_uuid.data2 == 0) && (nme_name_uuid.data3 == 0) && (is_zeros)) proto_item_append_text(block_item, ", No NME assigned"); else proto_item_append_text(block_item, ", UUID identifying an NME using SNMP / LLDP / DCP"); } break; case PNDCP_SUBOPTION_TSN_CIM_INTERFACE: pn_append_info(pinfo, dcp_item, ", CIM-Interface"); proto_item_append_text(block_item, "TSN/CIM-Interface"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { // CIMVDIValue dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_vendor_id_high, &vendor_id); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_vendor_id_low, &vendor_id); dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_device_id_high, &device_id); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_device_id_low, &device_id); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_instance_id_high, &instance_id_high); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_instance_id_low, &instance_id_low); if (pinfo->fd->visited == FALSE) { /* Create a conversation between the MAC addresses */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation == NULL) { conversation = conversation_new(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); } station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (station_info == NULL) { station_info = wmem_new0(wmem_file_scope(), stationInfo); init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, proto_pn_dcp, station_info); } station_info->u16Vendor_id = vendor_id; station_info->u16Device_id = device_id; } proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); proto_item_append_text(block_item, ", VendorID: 0x%04x / DeviceID: 0x%04x / InstanceIDHigh: 0x%04x / InstanceIDLow: 0x%04x", vendor_id, device_id, instance_id_high, instance_id_low); } break; default: pn_append_info(pinfo, dcp_item, ", TSN/Reserved"); proto_item_append_text(block_item, "TSN/Reserved"); } return offset; } /* dissect the "DHCP" suboption */ static int dissect_PNDCP_Suboption_DHCP(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id _U_, gboolean is_response _U_) { guint8 suboption; guint8 option_code = 0; guint16 block_length; guint16 block_info = 0; guint16 block_qualifier = 0; guint8 dhcpparameterlength = 0; guint8 dhcpparameterdata = 0; guint8 dhcpcontrolparameterdata = 0; gboolean have_block_info = FALSE; gboolean have_block_qualifier = FALSE; int expected_offset; offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp, &suboption); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); expected_offset = offset + block_length; /* BlockInfo? */ if ( ((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); have_block_info=TRUE; block_length -= 2; } /* BlockQualifier? */ if ( (service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); have_block_qualifier=TRUE; block_length -= 2; } switch (suboption) { case PNDCP_SUBOPTION_DHCP_CLIENT_ID: pn_append_info(pinfo, dcp_item, ", DHCP client identifier"); proto_item_append_text(block_item, "DHCP/Client-ID"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_option_code, &option_code); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_length, &dhcpparameterlength); if (dhcpparameterlength > 0) { offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_data, &dhcpparameterdata); if (dhcpparameterlength == 1) { if (dhcpparameterdata == 1) { proto_item_append_text(block_item, ", Client-ID: MAC Address"); } else { proto_item_append_text(block_item, ", Client-ID: Name of Station"); } } else { proto_item_append_text(block_item, ", Client-ID: Arbitrary"); /* * XXX - IEC 61158-6-10 Edition 4.0, section 4.3.1.4.21.5 * "Use of arbitrary client identifier", that this is an * OctetString to be used as a client identifier with DHCP. * * Does that mean it should be FT_BYTES, possibly with * the BASE_SHOW_ASCII_PRINTABLE flag to show it as ASCII * iff it's printable? Or should packet-dhcp.c export * dissect_dhcpopt_client_identifier(), so that we can * use its heuristics? */ proto_tree_add_item(tree, hf_pn_dcp_suboption_dhcp_arbitrary_client_id, tvb, offset, dhcpparameterlength - 1, ENC_ASCII); offset += (dhcpparameterlength-1); } } break; case PNDCP_SUBOPTION_DHCP_CONTROL_FOR_ADDRESS_RES: pn_append_info(pinfo, dcp_item, ", Control DHCP for address resolution"); proto_item_append_text(block_item, "DHCP/Control DHCP for address resolution"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); } if (have_block_info) { proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_option_code, &option_code); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_length, &dhcpparameterlength); offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_control_parameter_data, &dhcpcontrolparameterdata); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } if (expected_offset > offset) { offset = dissect_pn_user_data(tvb, offset, pinfo, tree, expected_offset - offset, "Undefined"); } return offset; } /* dissect the "control" suboption */ static int dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id _U_, gboolean is_response _U_) { guint8 suboption; guint16 block_length; guint16 block_qualifier; guint16 BlockQualifier; guint16 u16SignalValue; gchar *info_str; guint8 block_error; proto_item *item = NULL; offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_control, &suboption); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); if (service_id == PNDCP_SERVICE_ID_SET && block_length == 0) { pn_append_info(pinfo, dcp_item, ", Erroneous DCPSet block"); proto_item_append_text(block_item, "Control/Erroneous DCPSet block"); } else { switch (suboption) { case PNDCP_SUBOPTION_CONTROL_START_TRANS: pn_append_info(pinfo, dcp_item, ", Start-Trans"); proto_item_append_text(block_item, "Control/Start-Transaction"); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); break; case PNDCP_SUBOPTION_CONTROL_END_TRANS: pn_append_info(pinfo, dcp_item, ", End-Trans"); proto_item_append_text(block_item, "Control/End-Transaction"); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); break; case PNDCP_SUBOPTION_CONTROL_SIGNAL: pn_append_info(pinfo, dcp_item, ", Signal"); proto_item_append_text(block_item, "Control/Signal"); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); block_length -= 2; offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_control_signal_value, &u16SignalValue); break; case PNDCP_SUBOPTION_CONTROL_RESPONSE: proto_item_append_text(block_item, "Control/Response"); offset = dissect_PNDCP_Option(tvb, offset, pinfo, tree, block_item, hf_pn_dcp_suboption_control_option, FALSE /* append_col */); block_error = tvb_get_guint8(tvb, offset); if (tree) { item = proto_tree_add_uint(tree, hf_pn_dcp_block_error, tvb, offset, 1, block_error); } offset += 1; if (block_error != 0) { expert_add_info_format(pinfo, item, &ei_pn_dcp_block_error_unknown, "%s", val_to_str_const(block_error, pn_dcp_block_error, "Unknown")); } info_str = wmem_strdup_printf(pinfo->pool, ", Response(%s)", val_to_str_const(block_error, pn_dcp_block_error, "Unknown")); pn_append_info(pinfo, dcp_item, info_str); proto_item_append_text(block_item, ", BlockError: %s", val_to_str_const(block_error, pn_dcp_block_error, "Unknown")); break; case PNDCP_SUBOPTION_CONTROL_FACT_RESET: pn_append_info(pinfo, dcp_item, ", Reset FactorySettings"); proto_item_append_text(block_item, "Control/Reset FactorySettings"); block_length -= 2; offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_blockqualifier, &BlockQualifier); proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(BlockQualifier, pn_dcp_suboption_other, "reserved")); block_length -= 2; break; case PNDCP_SUBOPTION_CONTROL_RESET_TO_FACT: pn_append_info(pinfo, dcp_item, ", Reset to Factory"); proto_item_append_text(block_item, "Reset to FactorySettings"); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_blockqualifier_r2f, &BlockQualifier); proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(BlockQualifier, pn_dcp_BlockQualifier, "reserved")); block_length -= 2; break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } } return offset; } /* dissect the "deviceinitaitve" suboption */ static int dissect_PNDCP_Suboption_DeviceInitiative(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id, gboolean is_response) { guint8 suboption; guint16 block_length; guint16 block_info; guint16 block_qualifier; guint16 value; offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_deviceinitiative, &suboption); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); pn_append_info(pinfo, dcp_item, ", DeviceInitiative"); proto_item_append_text(block_item, "DeviceInitiative/DeviceInitiative"); /* BlockInfo? */ if ( ((service_id == PNDCP_SERVICE_ID_IDENTIFY) && is_response) || ((service_id == PNDCP_SERVICE_ID_HELLO) && !is_response) || ((service_id == PNDCP_SERVICE_ID_GET) && is_response)) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_info, &block_info); proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); block_length -= 2; } /* BlockQualifier? */ if ( (service_id == PNDCP_SERVICE_ID_SET) && !is_response) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_qualifier, &block_qualifier); proto_item_append_text(block_item, ", BlockQualifier: %s", val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); block_length -= 2; } /* DeviceInitiativeValue */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_deviceinitiative_value, &value); return offset; } /* dissect the "all" suboption */ static int dissect_PNDCP_Suboption_All(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id _U_, gboolean is_response _U_) { guint8 suboption; guint16 block_length; offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_all, &suboption); offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); switch (suboption) { case 255: /* All */ pn_append_info(pinfo, dcp_item, ", All"); proto_item_append_text(block_item, "All/All"); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } return offset; } /* dissect the "manufacturer" suboption */ static int dissect_PNDCP_Suboption_Manuf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *block_item, proto_item *dcp_item, guint8 service_id _U_, gboolean is_response _U_) { guint16 block_length; offset = dissect_pn_uint8( tvb, offset, pinfo, tree, hf_pn_dcp_suboption_manuf, NULL); pn_append_info(pinfo, dcp_item, ", Manufacturer Specific"); proto_item_append_text(block_item, "Manufacturer Specific"); if (tvb_reported_length_remaining(tvb, offset)>0) { offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length); offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } return offset; } /* dissect one DCP block */ static int dissect_PNDCP_Block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *dcp_item, guint8 service_id, gboolean is_response) { guint8 option; proto_item *block_item; proto_tree *block_tree; int ori_offset = offset; /* subtree for block */ block_item = proto_tree_add_none_format(tree, hf_pn_dcp_block, tvb, offset, 0, "Block: "); block_tree = proto_item_add_subtree(block_item, ett_pn_dcp_block); offset = dissect_pn_uint8(tvb, offset, pinfo, block_tree, hf_pn_dcp_option, &option); if (option == PNDCP_OPTION_IP) { offset = dissect_PNDCP_Suboption_IP(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_DEVICE) { offset = dissect_PNDCP_Suboption_Device(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_DHCP) { offset = dissect_PNDCP_Suboption_DHCP(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_CONTROL) { offset = dissect_PNDCP_Suboption_Control(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_DEVICEINITIATIVE) { offset = dissect_PNDCP_Suboption_DeviceInitiative(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_TSN) { offset = dissect_PNDCP_Suboption_TSN(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (option == PNDCP_OPTION_ALLSELECTOR) { offset = dissect_PNDCP_Suboption_All(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else if (PNDCP_OPTION_MANUF_X80 <= option && option <= PNDCP_OPTION_MANUF_XFE) { offset = dissect_PNDCP_Suboption_Manuf(tvb, offset, pinfo, block_tree, block_item, dcp_item, service_id, is_response); } else { pn_append_info(pinfo, dcp_item, ", Reserved"); proto_item_append_text(block_item, "Reserved"); /* there isn't a predefined suboption type for reserved option, rest of the block will be seen as padding */ } proto_item_set_len(block_item, offset-ori_offset); if (((offset-ori_offset) & 1) && (tvb_reported_length_remaining(tvb, offset) > 0)) { /* we have an odd number of bytes in this block, add a padding byte */ offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1); } return offset; } /* dissect a whole DCP PDU */ static void dissect_PNDCP_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *dcp_item) { guint8 service_id; guint8 service_type; guint32 xid; guint16 response_delay; guint16 data_length; int offset = 0; gchar *xid_str; gboolean is_response = FALSE; offset = dissect_pn_uint8 (tvb, offset, pinfo, tree, hf_pn_dcp_service_id, &service_id); offset = dissect_pn_uint8 (tvb, offset, pinfo, tree, hf_pn_dcp_service_type, &service_type); proto_tree_add_item_ret_uint(tree, hf_pn_dcp_xid, tvb, offset, 4, ENC_BIG_ENDIAN, &xid); offset += 4; if (service_id == PNDCP_SERVICE_ID_IDENTIFY && service_type == PNDCP_SERVICE_TYPE_REQUEST) { /* multicast header */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_response_delay, &response_delay); } else { /* unicast header */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_reserved16, NULL); } offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_data_length, &data_length); switch (service_id) { case PNDCP_SERVICE_ID_GET: pn_append_info(pinfo, dcp_item, "Get"); break; case PNDCP_SERVICE_ID_SET: pn_append_info(pinfo, dcp_item, "Set"); break; case PNDCP_SERVICE_ID_IDENTIFY: pn_append_info(pinfo, dcp_item, "Ident"); break; case PNDCP_SERVICE_ID_HELLO: pn_append_info(pinfo, dcp_item, "Hello"); break; default: dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset)); return; } switch (service_type) { case PNDCP_SERVICE_TYPE_REQUEST: pn_append_info(pinfo, dcp_item, " Req"); break; case PNDCP_SERVICE_TYPE_RESPONSE_SUCCESS: pn_append_info(pinfo, dcp_item, " Ok "); is_response = TRUE; break; case PNDCP_SERVICE_TYPE_RESPONSE_UNSUPPORTED: pn_append_info(pinfo, dcp_item, " unsupported"); is_response = TRUE; break; default: dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset)); return; } xid_str = wmem_strdup_printf(pinfo->pool, ", Xid:0x%x", xid); pn_append_info(pinfo, dcp_item, xid_str); /* dissect a number of blocks (depending on the remaining length) */ while(data_length) { int ori_offset = offset; if (service_id == PNDCP_SERVICE_ID_GET && service_type == PNDCP_SERVICE_TYPE_REQUEST) { /* Selectors */ offset = dissect_PNDCP_Option(tvb, offset, pinfo, tree, dcp_item, hf_pn_dcp_option, TRUE /* append_col */); } else { offset = dissect_PNDCP_Block(tvb, offset, pinfo, tree, dcp_item, service_id, is_response); } /* prevent an infinite loop */ if (offset <= ori_offset || data_length < (offset - ori_offset)) { proto_tree_add_expert(tree, pinfo, &ei_pn_dcp_block_parse_error, tvb, ori_offset, tvb_captured_length_remaining(tvb, ori_offset)); break; } data_length -= (offset - ori_offset); } } /* possibly dissect a PN-RT packet (frame ID must be in the appropriate range) */ static gboolean dissect_PNDCP_Data_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { /* the tvb will NOT contain the frame_id here, so get it from dissection data! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); proto_item *item; proto_tree *dcp_tree; /* frame id must be in valid range (acyclic Real-Time, DCP) */ if (u16FrameID < FRAME_ID_DCP_HELLO || u16FrameID > FRAME_ID_DCP_IDENT_RES) { /* we are not interested in this packet */ return FALSE; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-DCP"); col_clear(pinfo->cinfo, COL_INFO); /* subtree for DCP */ item = proto_tree_add_protocol_format(tree, proto_pn_dcp, tvb, 0, tvb_get_ntohs(tvb, 8) + 10, "PROFINET DCP, "); dcp_tree = proto_item_add_subtree(item, ett_pn_dcp); /* dissect this PDU */ dissect_PNDCP_PDU(tvb, pinfo, dcp_tree, item); return TRUE; } void proto_register_pn_dcp (void) { static hf_register_info hf[] = { { &hf_pn_dcp_service_id, { "ServiceID", "pn_dcp.service_id", FT_UINT8, BASE_DEC, VALS(pn_dcp_service_id), 0x0, NULL, HFILL }}, { &hf_pn_dcp_service_type, { "ServiceType", "pn_dcp.service_type", FT_UINT8, BASE_DEC, VALS(pn_dcp_service_type), 0x0, NULL, HFILL }}, { &hf_pn_dcp_xid, { "Xid", "pn_dcp.xid", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_reserved8, { "Reserved", "pn_dcp.reserved8", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_reserved16, { "Reserved", "pn_dcp.reserved16", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_response_delay, { "ResponseDelay", "pn_dcp.response_delay", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_data_length, { "DCPDataLength", "pn_dcp.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_block_length, { "DCPBlockLength", "pn_dcp.block_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_option, { "Option", "pn_dcp.option", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(pn_dcp_option), 0x0, NULL, HFILL }}, #if 0 { &hf_pn_dcp_suboption, { "Suboption", "pn_dcp.suboption", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, #endif { &hf_pn_dcp_block_error, { "BlockError", "pn_dcp.block_error", FT_UINT8, BASE_DEC, VALS(pn_dcp_block_error), 0x0, NULL, HFILL }}, { &hf_pn_dcp_block, { "Block", "pn_dcp.block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_block_info, { "BlockInfo", "pn_dcp.block_info", FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(pn_dcp_block_info), 0x0, NULL, HFILL }}, { &hf_pn_dcp_block_qualifier, { "BlockQualifier", "pn_dcp.block_qualifier", FT_UINT16, BASE_DEC, VALS(pn_dcp_block_qualifier), 0x0, NULL, HFILL }}, { &hf_pn_dcp_blockqualifier_r2f, { "BlockQualifier: ResettoFactory", "pn_dcp.block_qualifier_reset", FT_UINT16, BASE_DEC, VALS(pn_dcp_BlockQualifier), 0x0, NULL, HFILL }}, { &hf_pn_dcp_blockqualifier, { "BlockQualifier: ResetFactorySettings", "pn_dcp.block_qualifier_reset", FT_UINT16, BASE_DEC, VALS(pn_dcp_suboption_other), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip, { "Suboption", "pn_dcp.suboption_ip", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_ip), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip_block_info, { "BlockInfo", "pn_dcp.suboption_ip_block_info", FT_UINT16, BASE_DEC, VALS(pn_dcp_suboption_ip_block_info), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip_mac_address, { "MAC Address", "pn_dcp.suboption_ip_mac_address", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip_ip, { "IPaddress", "pn_dcp.suboption_ip_ip", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip_subnetmask, { "Subnetmask", "pn_dcp.suboption_ip_subnetmask", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_ip_standard_gateway, { "StandardGateway", "pn_dcp.suboption_ip_standard_gateway", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device, { "Suboption", "pn_dcp.suboption_device", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_device), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_typeofstation, { "DeviceVendorValue", "pn_dcp.suboption_device_devicevendorvalue", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_nameofstation, { "NameOfStation", "pn_dcp.suboption_device_nameofstation", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_vendor_id, { "VendorID", "pn_dcp.suboption_vendor_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_id, { "DeviceID", "pn_dcp.suboption_device_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_role, { "DeviceRoleDetails", "pn_dcp.suboption_device_role", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_aliasname, { "AliasName", "pn_dcp.suboption_device_aliasname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_instance_high, { "DeviceInstanceHigh", "pn_dcp.suboption_device_instance", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_instance_low, { "DeviceInstanceLow", "pn_dcp.suboption_device_instance", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_oem_ven_id, { "OEMVendorID", "pn_dcp.suboption_device_oem_ven_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_device_oem_dev_id, { "OEMDeviceID", "pn_dcp.suboption_device_oem_dev_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_rsi_properties_value, { "RsiPropertiesValue", "pn_dcp.suboption_device_rsi_properties_value", FT_UINT16, BASE_HEX, 0, 0x0, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit0, { "IP Stack", "pn_dcp.suboption_device_rsi_properties_value.bit0", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0001, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit1, { "CLRPC Interface", "pn_dcp.suboption_device_rsi_properties_value.bit1", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0002, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit2, { "RSI AR Interface", "pn_dcp.suboption_device_rsi_properties_value.bit2", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0004, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit3, { "RSI AR Read Implicit Interface", "pn_dcp.suboption_device_rsi_properties_value.bit3", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0008, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit4, { "RSI CIM Interface", "pn_dcp.suboption_device_rsi_properties_value.bit4", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0010, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_bit5, { "RSI CIM Read Implicit Interface", "pn_dcp.suboption_device_rsi_properties_value.bit5", FT_BOOLEAN, 16, TFS(&pn_dcp_rsi_properties_value_bit), 0x0020, NULL, HFILL } }, { &hf_pn_dcp_rsi_properties_value_otherbits, { "RsiPropertiesValue.Bit6-15", "pn_dcp.suboption_device_rsi_properties_value.otherbits", FT_UINT16, BASE_HEX, NULL, 0xFFC0, NULL, HFILL } }, { &hf_pn_dcp_vendor_id_high, { "VendorIDHigh", "pn_dcp.vendor_id_high", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } }, { &hf_pn_dcp_vendor_id_low, { "VendorIDLow", "pn_dcp.vendor_id_low", FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } }, { &hf_pn_dcp_device_id_high, { "DeviceIDHigh", "pn_dcp.device_id_high", FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL } }, { &hf_pn_dcp_device_id_low, { "DeviceIDLow", "pn_dcp.device_id_low", FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } }, { &hf_pn_dcp_instance_id_high, { "InstanceHigh", "pn_dcp.instance_id_high", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_instance_id_low, { "InstanceLow", "pn_dcp.instance_id_low", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_dhcp, { "Suboption", "pn_dcp.suboption_dhcp", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_dhcp), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_dhcp_option_code, { "Option-Code", "pn_dcp.suboption_dhcp_option_code", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_dhcp), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_dhcp_arbitrary_client_id, { "Client ID", "pn_dcp.suboption_dhcp_client_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_dhcp_parameter_length, { "DHCP Parameter Length", "pn_dcp.suboption_dhcp_parameter_length", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_dhcp_parameter_data, { "DHCP Parameter Data", "pn_dcp.suboption_dhcp_parameter_data", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_dhcp_control_parameter_data, { "DHCP Parameter Data", "pn_dcp.suboption_dhcp_parameter_data", FT_UINT8, BASE_HEX, VALS(pn_dcp_suboption_dhcp_control_parameter_data), 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_control, { "Suboption", "pn_dcp.suboption_control", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_control), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_control_option, { "Option", "pn_dcp.suboption_control_option", FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(pn_dcp_option), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_control_signal_value, { "SignalValue", "pn_dcp.suboption_control_signal_value", FT_UINT16, BASE_HEX, VALS(pn_dcp_suboption_control_signal_value), 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_deviceinitiative, { "Suboption", "pn_dcp.suboption_deviceinitiative", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_deviceinitiative), 0x0, NULL, HFILL }}, { &hf_pn_dcp_deviceinitiative_value, { "DeviceInitiativeValue", "pn_dcp.deviceinitiative_value", FT_UINT16, BASE_DEC, VALS(pn_dcp_deviceinitiative_value), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_tsn, { "Suboption", "pn_dcp.suboption_tsn", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_tsn), 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_tsn_domain_name, { "TSNDomainName", "pn_dcp.suboption_tsn_domain_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_tsn_domain_uuid, { "TSNDomainUUID", "pn_dcp.tsn_domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_tsn_nme_prio, { "NMEPrio", "pn_dcp.suboption_tsn_nme_prio", FT_UINT16, BASE_DEC | BASE_RANGE_STRING, RVALS(pn_dcp_suboption_tsn_nme_prio), 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_tsn_nme_parameter_uuid, { "NMEParameterUUID", "pn_dcp.suboption_tsn_nme_parameter_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_tsn_nme_agent, { "NMEAgent", "pn_dcp.suboption_tsn_nme_agent", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_dcp_suboption_all, { "Suboption", "pn_dcp.suboption_all", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_all), 0x0, NULL, HFILL }}, { &hf_pn_dcp_suboption_manuf, { "Suboption", "pn_dcp.suboption_manuf", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_manuf), 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_pn_dcp, &ett_pn_dcp_block, &ett_pn_dcp_rsi_properties_value }; static ei_register_info ei[] = { { &ei_pn_dcp_block_parse_error, { "pn_dcp.block_error.parse", PI_PROTOCOL, PI_ERROR, "parse error", EXPFILL }}, { &ei_pn_dcp_block_error_unknown, { "pn_dcp.block_error.unknown", PI_RESPONSE_CODE, PI_CHAT, "Unknown", EXPFILL }}, { &ei_pn_dcp_ip_conflict, { "pn_dcp.ip_conflict", PI_RESPONSE_CODE, PI_NOTE, "IP address conflict detected!", EXPFILL }}, }; expert_module_t* expert_pn_dcp; proto_pn_dcp = proto_register_protocol ("PROFINET DCP", "PN-DCP", "pn_dcp"); proto_register_field_array (proto_pn_dcp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); expert_pn_dcp = expert_register_protocol(proto_pn_dcp); expert_register_field_array(expert_pn_dcp, ei, array_length(ei)); } void proto_reg_handoff_pn_dcp (void) { /* register ourself as an heuristic pn-rt payload dissector */ heur_dissector_add("pn_rt", dissect_PNDCP_Data_heur, "PROFINET DCP IO", "pn_dcp_pn_rt", proto_pn_dcp, HEURISTIC_ENABLE); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-mrp.c
/* packet-pn-mrp.c * Routines for PN-MRP (PROFINET Media Redundancy Protocol) * packet dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/oui.h> #include <epan/etypes.h> #include <epan/dissectors/packet-dcerpc.h> #include "packet-pn.h" void proto_register_pn_mrp(void); void proto_reg_handoff_pn_mrp(void); static dissector_handle_t mrp_handle; static int proto_pn_mrp = -1; static int hf_pn_mrp_type = -1; static int hf_pn_mrp_length = -1; static int hf_pn_mrp_version = -1; static int hf_pn_mrp_sequence_id = -1; static int hf_pn_mrp_sa = -1; static int hf_pn_mrp_prio = -1; static int hf_pn_mrp_port_role = -1; static int hf_pn_mrp_ring_state = -1; static int hf_pn_mrp_interval = -1; static int hf_pn_mrp_transition = -1; static int hf_pn_mrp_time_stamp = -1; static int hf_pn_mrp_blocked = -1; static int hf_pn_mrp_domain_uuid = -1; static int hf_pn_mrp_oui = -1; static int hf_pn_mrp_ed1type = -1; static int hf_pn_mrp_ed1_manufacturer_data = -1; static int hf_pn_mrp_sub_tlv_header_type = -1; static int hf_pn_mrp_sub_tlv_header_length = -1; static int hf_pn_mrp_sub_option2 = -1; static int hf_pn_mrp_other_mrm_prio = -1; static int hf_pn_mrp_other_mrm_sa = -1; static int hf_pn_mrp_manufacturer_data = -1; static gint ett_pn_mrp = -1; static gint ett_pn_mrp_type = -1; static gint ett_pn_sub_tlv = -1; static const value_string pn_mrp_block_type_vals[] = { { 0x00, "MRP_End" }, { 0x01, "MRP_Common" }, { 0x02, "MRP_Test" }, { 0x03, "MRP_TopologyChange" }, { 0x04, "MRP_LinkDown" }, { 0x05, "MRP_LinkUp" }, { 0x06, "MRP_InTest" }, { 0x07, "MRP_InTopologyChange" }, { 0x08, "MRP_InLinkDown" }, { 0x09, "MRP_InLinkUp" }, { 0x0A, "MRP_InLinkStatusPoll" }, /*0x0B - 0x7E Reserved */ { 0x7F, "MRP_Option (Organizationally Specific)"}, { 0, NULL }, }; static const value_string pn_mrp_oui_vals[] = { { OUI_PROFINET, "PROFINET" }, { OUI_SIEMENS, "SIEMENS" }, { 0, NULL } }; static const value_string pn_mrp_port_role_vals[] = { { 0x0000, "Primary ring port" }, { 0x0001, "Secondary ring port"}, /*0x0002 - 0xFFFF Reserved */ { 0, NULL } }; #if 0 static const value_string pn_mrp_role_vals[] = { { 0x0000, "Media redundancy disabled" }, { 0x0001, "Media redundancy client" }, { 0x0002, "Media redundancy manager" }, { 0x0003, "Media redundancy manager (auto)" }, /*0x0004 - 0xFFFF Reserved */ { 0, NULL } }; #endif static const value_string pn_mrp_ring_state_vals[] = { { 0x0000, "Ring open" }, { 0x0001, "Ring closed"}, /*0x0002 - 0xFFFF Reserved */ { 0, NULL } }; #if 0 static const value_string pn_mrp_prio_vals[] = { { 0x8000, "Default priority for redundancy manager" }, { 0, NULL } }; #endif static const value_string pn_mrp_sub_tlv_header_type_vals[] = { /* 0x00 Reserved */ { 0x01, "MRP_TestMgrNAck" }, { 0x02, "MRP_TestPropagate" }, { 0x03, "MRP_AutoMgr" }, /* 0x04 - 0xF0 Reserved for IEC specific functions */ { 0xF1, "Manufacturer specific functions" }, { 0xF2, "Manufacturer specific functions" }, { 0xF3, "Manufacturer specific functions" }, { 0xF4, "Manufacturer specific functions" }, { 0xF5, "Manufacturer specific functions" }, { 0xF6, "Manufacturer specific functions" }, { 0xF7, "Manufacturer specific functions" }, { 0xF8, "Manufacturer specific functions" }, { 0xF9, "Manufacturer specific functions" }, { 0xFA, "Manufacturer specific functions" }, { 0xFB, "Manufacturer specific functions" }, { 0xFC, "Manufacturer specific functions" }, { 0xFD, "Manufacturer specific functions" }, { 0xFE, "Manufacturer specific functions" }, { 0xFF, "Manufacturer specific functions" }, { 0, NULL }, }; static int dissect_PNMRP_Common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_) { guint16 sequence_id; e_guid_t uuid; /* MRP_SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_sequence_id, &sequence_id); /* MRP_DomainUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_mrp_domain_uuid, &uuid); return offset; } static int dissect_PNMRP_Link(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_) { guint8 mac[6]; guint16 port_role; guint16 interval; guint16 blocked; proto_item *sub_item; /* MRP_SA */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_mrp_sa, mac); /* MRP_PortRole */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_port_role, &port_role); /* MRP_Interval */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, tree, hf_pn_mrp_interval, &interval, &sub_item); if (tree) { proto_item_append_text(sub_item," Interval for next topology change event (in ms)"); if (interval <0x07D1) proto_item_append_text(sub_item," Mandatory"); else proto_item_append_text(sub_item," Optional"); } /* MRP_Blocked */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, tree, hf_pn_mrp_blocked, &blocked, &sub_item); if (tree) { if (blocked == 0) proto_item_append_text(sub_item," The MRC is not able to receive and forward frames to port in state blocked"); else if (blocked == 1) proto_item_append_text(sub_item," The MRC is able to receive and forward frames to port in state blocked"); else proto_item_append_text(sub_item," Reserved"); } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } static const char * mrp_Prio2msg(guint16 prio) { if (prio == 0x0000) return(" Highest priority redundancy manager"); if ((prio >= 0x1000) && (prio <= 0x7000)) return(" High priorities"); if (prio == 0x8000) return(" Default priority for redundancy manager"); if ((prio >= 0x8001) && (prio <= 0x8FFF)) return(" Low priorities for redundancy manager"); if ((prio >= 0x9000) && (prio <= 0x9FFF)) return(" High priorities for redundancy manager (auto)"); if (prio == 0xA000) return(" Default priority for redundancy manager (auto)"); if ((prio >= 0xA001) && (prio <= 0xF000)) return(" Low priorities for redundancy manager (auto)"); if (prio ==0xFFFF) return(" Lowest priority for redundancy manager (auto)"); return(" Reserved"); } static int dissect_PNMRP_Test(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_) { guint16 prio; guint8 mac[6]; guint16 port_role; guint16 ring_state; guint16 transition; guint32 time_stamp; proto_item *sub_item; /* MRP_Prio */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, tree, hf_pn_mrp_prio, &prio, &sub_item); if (tree) proto_item_append_text(sub_item, "%s", mrp_Prio2msg(prio)); /* MRP_SA */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_mrp_sa, mac); /* MRP_PortRole */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_port_role, &port_role); /* MRP_RingState */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_ring_state, &ring_state); /* MRP_Transition */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_transition, &transition); /* MRP_TimeStamp */ proto_tree_add_item_ret_uint(tree, hf_pn_mrp_time_stamp, tvb, offset, 4, ENC_BIG_ENDIAN, &time_stamp); offset += 4; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } static int dissect_PNMRP_TopologyChange(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_) { guint16 prio; guint8 mac[6]; guint16 interval; proto_item *sub_item; /* MRP_Prio */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, tree, hf_pn_mrp_prio, &prio, &sub_item); if (tree) proto_item_append_text(sub_item, "%s", mrp_Prio2msg(prio)); /* MRP_SA */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_mrp_sa, mac); /* MRP_Interval */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, tree, hf_pn_mrp_interval, &interval, &sub_item); if (tree) { proto_item_append_text(sub_item," Interval for next topology change event (in ms) "); if (interval <0x07D1) proto_item_append_text(sub_item,"Mandatory"); else proto_item_append_text(sub_item,"Optional"); } /* Padding */ /*offset = dissect_pn_align4(tvb, offset, pinfo, tree);*/ return offset; } static int dissect_PNMRP_Ed1ManufacturerData(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *pLength) { guint16 u16MrpEd1ManufacturerData; offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_ed1_manufacturer_data, &u16MrpEd1ManufacturerData); *pLength -= 2; return offset; } static int dissect_PNMRP_SubOption2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint8 u8SubType; guint8 u8Sublength; proto_item *sub_item; proto_tree *sub_tree; guint16 u16Prio; guint16 u16OtherPrio; guint8 mac[6]; guint8 otherMac[6]; sub_item = proto_tree_add_item(tree, hf_pn_mrp_sub_option2, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_sub_tlv); /* MRP_SubTLVHeader (Type=0x01 or Type=0x02, Length = 0x12), MRP_Prio, MRP_SA, MRP_OtherMRMPrio, MRP_OtherMRMSA, Padding (=0x00,0x00) */ /* MRP_SubTLVHeader.Type */ offset = dissect_pn_uint8(tvb, offset, pinfo, sub_tree, hf_pn_mrp_sub_tlv_header_type, &u8SubType); /* MRP_SubTLVHeader.Length */ offset = dissect_pn_uint8(tvb, offset, pinfo, sub_tree, hf_pn_mrp_sub_tlv_header_length, &u8Sublength); if (u8SubType == 0x00) { // IEC area: 0x00: Reserved; return offset; } else if ( u8SubType == 0x01 || u8SubType == 0x02 ) { // IEC area: 0x01: MRP_TestMgrNAck; // IEC area: 0x02: MRP_AutoMgr; /* MRP_Prio */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, sub_tree, hf_pn_mrp_prio, &u16Prio, &sub_item); proto_item_append_text(sub_item, "%s", mrp_Prio2msg(u16Prio)); /* MRP_SA */ offset = dissect_pn_mac(tvb, offset, pinfo, sub_tree, hf_pn_mrp_sa, mac); /* MRP_OtherMRMPrio */ offset = dissect_pn_uint16_ret_item(tvb, offset, pinfo, sub_tree, hf_pn_mrp_other_mrm_prio, &u16OtherPrio, &sub_item); proto_item_append_text(sub_item, "%s", mrp_Prio2msg(u16OtherPrio)); /* MRP_OtherMRMSA */ offset = dissect_pn_mac(tvb, offset, pinfo, sub_tree, hf_pn_mrp_other_mrm_sa, otherMac); offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); } else if ( 0xF1 <= u8SubType ) { proto_tree_add_string_format(sub_tree, hf_pn_mrp_manufacturer_data, tvb, offset, u8Sublength, "data", "Reserved for vendor specific data: %u byte", u8Sublength); offset += u8Sublength; } return offset; } static int dissect_PNMRP_Option(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 length) { guint32 oui; guint8 u8MrpEd1Type; /* OUI (organizational unique id) */ offset = dissect_pn_oid(tvb, offset, pinfo,tree, hf_pn_mrp_oui, &oui); switch (oui) { case OUI_SIEMENS: proto_item_append_text(item, "(SIEMENS)"); length -= 3; offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_mrp_ed1type, &u8MrpEd1Type); length -= 1; switch (u8MrpEd1Type) { case 0x00: offset = dissect_PNMRP_Ed1ManufacturerData(tvb, offset, pinfo, tree, &length); break; case 0x01: case 0x02: case 0x03: break; case 0x04: offset = dissect_PNMRP_Ed1ManufacturerData(tvb, offset, pinfo, tree, &length); break; /* 0x05 to 0xFF*/ default: break; } //offset = dissect_PNMRP_Ed1ManufacturerData(tvb, offset, pinfo, tree, &length); if (length != 0) { offset = dissect_PNMRP_SubOption2(tvb, offset, pinfo, tree); } col_append_str(pinfo->cinfo, COL_INFO, "(Siemens)"); break; default: proto_item_append_text(item, " (Unknown-OUI)"); offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); } /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); return offset; } static int dissect_PNMRP_PDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint16 version; guint8 type; guint8 length; gint i; tvbuff_t *new_tvb; proto_item *sub_item; proto_tree *sub_tree; /* MRP_Version */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrp_version, &version); /* the rest of the packet has 4byte alignment regarding to the beginning of the next TLV block! */ /* XXX - do we have to free this new tvb below? */ new_tvb = tvb_new_subset_remaining(tvb, offset); offset = 0; for(i=0; tvb_reported_length_remaining(tvb, offset) > 0; i++) { sub_item = proto_tree_add_item(tree, hf_pn_mrp_type, new_tvb, offset, 1, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_mrp_type); /* MRP_TLVHeader.Type */ offset = dissect_pn_uint8(new_tvb, offset, pinfo, sub_tree, hf_pn_mrp_type, &type); /* MRP_TLVHeader.Length */ offset = dissect_pn_uint8(new_tvb, offset, pinfo, sub_tree, hf_pn_mrp_length, &length); if (i != 0) { col_append_str(pinfo->cinfo, COL_INFO, ", "); proto_item_append_text(item, ", "); } else { proto_item_append_text(item, " "); } col_append_str(pinfo->cinfo, COL_INFO, val_to_str(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); proto_item_append_text(item, "%s", val_to_str(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); switch(type) { case 0x00: /* no content */ return offset; break; case 0x01: offset = dissect_PNMRP_Common(new_tvb, offset, pinfo, sub_tree, sub_item); break; case 0x02: offset = dissect_PNMRP_Test(new_tvb, offset, pinfo, sub_tree, sub_item); break; case 0x03: offset = dissect_PNMRP_TopologyChange(new_tvb, offset, pinfo, sub_tree, sub_item); break; case 0x04: case 0x05: /* dissection of up and down is identical! */ offset = dissect_PNMRP_Link(new_tvb, offset, pinfo, sub_tree, sub_item); break; case 0x7f: offset = dissect_PNMRP_Option(new_tvb, offset, pinfo, sub_tree, sub_item, length); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, sub_tree, length); } } return offset; } /* Dissect MRP packets */ static int dissect_PNMRP(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *ti = NULL; proto_tree *mrp_tree = NULL; guint32 offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-MRP"); /* Clear the information column on summary display */ col_clear(pinfo->cinfo, COL_INFO); if (tree) { ti = proto_tree_add_item(tree, proto_pn_mrp, tvb, offset, -1, ENC_NA); mrp_tree = proto_item_add_subtree(ti, ett_pn_mrp); } dissect_PNMRP_PDU(tvb, offset, pinfo, mrp_tree, ti); return tvb_captured_length(tvb); } void proto_register_pn_mrp (void) { static hf_register_info hf[] = { { &hf_pn_mrp_type, { "MRP_TLVHeader.Type", "pn_mrp.type", FT_UINT8, BASE_HEX, VALS(pn_mrp_block_type_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrp_length, { "MRP_TLVHeader.Length", "pn_mrp.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_version, { "MRP_Version", "pn_mrp.version", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_sequence_id, { "MRP_SequenceID", "pn_mrp.sequence_id", FT_UINT16, BASE_HEX, NULL, 0x0, "Unique sequence number to each outstanding service request", HFILL }}, { &hf_pn_mrp_sa, { "MRP_SA", "pn_mrp.sa", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_mrp_prio, { "MRP_Prio", "pn_mrp.prio", FT_UINT16, BASE_HEX, 0, 0x0, NULL, HFILL }}, { &hf_pn_mrp_port_role, { "MRP_PortRole", "pn_mrp.port_role", FT_UINT16, BASE_HEX, VALS(pn_mrp_port_role_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrp_ring_state, { "MRP_RingState", "pn_mrp.ring_state", FT_UINT16, BASE_HEX, VALS(pn_mrp_ring_state_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrp_interval, { "MRP_Interval", "pn_mrp.interval", FT_UINT16, BASE_DEC, NULL, 0x0, "Interval for next topology change event (in ms)", HFILL }}, { &hf_pn_mrp_transition, { "MRP_Transition", "pn_mrp.transition", FT_UINT16, BASE_HEX, NULL, 0x0, "Number of transitions between media redundancy lost and ok states", HFILL }}, { &hf_pn_mrp_time_stamp, { "MRP_TimeStamp [ms]", "pn_mrp.time_stamp", FT_UINT32, BASE_HEX, NULL, 0x0, "Actual counter value of 1ms counter", HFILL }}, { &hf_pn_mrp_blocked, { "MRP_Blocked", "pn_mrp.blocked", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_domain_uuid, { "MRP_DomainUUID", "pn_mrp.domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_oui, { "MRP_ManufacturerOUI", "pn_mrp.oui", FT_UINT24, BASE_HEX, VALS(pn_mrp_oui_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrp_ed1type, { "MRP_Ed1Type", "pn_mrp.ed1type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_ed1_manufacturer_data, { "MRP_Ed1ManufacturerData", "pn_mrp.ed1manufacturerdata", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_sub_option2, { "MRP_SubOption2", "pn_mrp.sub_option2", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_mrp_sub_tlv_header_type, { "MRP_SubTLVHeader.Type", "pn_mrp.sub_type", FT_UINT8, BASE_HEX, VALS(pn_mrp_sub_tlv_header_type_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrp_sub_tlv_header_length, { "MRP_SubTLVHeader.Length", "pn_mrp.sub_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrp_other_mrm_prio, { "MRP_OtherMRMPrio", "pn_mrp.other_mrm_prio", FT_UINT16, BASE_HEX, 0, 0x0, NULL, HFILL }}, { &hf_pn_mrp_other_mrm_sa, { "MRP_OtherMRMSA", "pn_mrp.other_mrm_sa", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_mrp_manufacturer_data, { "MRP_ManufacturerData", "pn_mrp.manufacturer_data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }} }; static gint *ett[] = { &ett_pn_mrp, &ett_pn_mrp_type, &ett_pn_sub_tlv }; proto_pn_mrp = proto_register_protocol ("PROFINET MRP", "PN-MRP", "pn_mrp"); proto_register_field_array (proto_pn_mrp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); mrp_handle = register_dissector("pn_mrp", dissect_PNMRP, proto_pn_mrp); } void proto_reg_handoff_pn_mrp (void) { dissector_add_uint("ethertype", ETHERTYPE_MRP, mrp_handle); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-mrrt.c
/* packet-pn-mrrt.c * Routines for PN-MRRT (PROFINET Media Redundancy for cyclic realtime data) * packet dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/dissectors/packet-dcerpc.h> #include "packet-pn.h" void proto_register_pn_mrrt(void); void proto_reg_handoff_pn_mrrt(void); static int proto_pn_mrrt = -1; static int hf_pn_mrrt_sequence_id = -1; static int hf_pn_mrrt_domain_uuid = -1; static int hf_pn_mrrt_type = -1; static int hf_pn_mrrt_length = -1; static int hf_pn_mrrt_version = -1; static int hf_pn_mrrt_sa = -1; static gint ett_pn_mrrt = -1; static const value_string pn_mrrt_block_type_vals[] = { { 0x00, "End" }, { 0x01, "Common" }, { 0x02, "Test" }, /*0x03 - 0x7E Reserved */ { 0x7F, "Organizationally Specific"}, { 0, NULL }, }; static int dissect_PNMRRT_Common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 length _U_) { guint16 sequence_id; e_guid_t uuid; /* MRRT_SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrrt_sequence_id, &sequence_id); /* MRRT_DomainUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_mrrt_domain_uuid, &uuid); col_append_str(pinfo->cinfo, COL_INFO, "Common"); proto_item_append_text(item, "Common"); return offset; } static int dissect_PNMRRT_Test(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 length _U_) { guint8 mac[6]; /* MRRT_SA */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_mrrt_sa, mac); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); col_append_str(pinfo->cinfo, COL_INFO, "Test"); proto_item_append_text(item, "Test"); return offset; } static int dissect_PNMRRT_PDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint16 version; guint8 type; guint8 length; gint i = 0; /* MRRT_Version */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_mrrt_version, &version); while (tvb_reported_length_remaining(tvb, offset) > 0) { /* MRRT_TLVHeader.Type */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_mrrt_type, &type); /* MRRT_TLVHeader.Length */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_mrrt_length, &length); if (i != 0) { col_append_str(pinfo->cinfo, COL_INFO, ", "); proto_item_append_text(item, ", "); } i++; switch(type) { case 0x00: /* no content */ col_append_str(pinfo->cinfo, COL_INFO, "End"); proto_item_append_text(item, "End"); return offset; break; case 0x01: offset = dissect_PNMRRT_Common(tvb, offset, pinfo, tree, item, length); break; case 0x02: offset = dissect_PNMRRT_Test(tvb, offset, pinfo, tree, item, length); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown TLVType 0x%x", type); proto_item_append_text(item, "Unknown TLVType 0x%x", type); break; } } return offset; } /* possibly dissect a PN-RT packet (frame ID must be in the appropriate range) */ static gboolean dissect_PNMRRT_Data_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { /* the tvb will NOT contain the frame_id here, so get it from dissector data! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); proto_item *item; proto_tree *mrrt_tree; int offset = 0; guint32 u32SubStart; /* frame id must be in valid range (MRRT) */ if (u16FrameID != 0xFF60) { /* we are not interested in this packet */ return FALSE; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-MRRT"); col_clear(pinfo->cinfo, COL_INFO); /* subtree for MRRT */ item = proto_tree_add_protocol_format(tree, proto_pn_mrrt, tvb, 0, 0, "PROFINET MRRT, "); mrrt_tree = proto_item_add_subtree(item, ett_pn_mrrt); u32SubStart = offset; offset = dissect_PNMRRT_PDU(tvb, offset, pinfo, mrrt_tree, item); proto_item_set_len(item, offset - u32SubStart); return TRUE; } void proto_register_pn_mrrt (void) { static hf_register_info hf[] = { { &hf_pn_mrrt_type, { "Type", "pn_mrrt.type", FT_UINT8, BASE_HEX, VALS(pn_mrrt_block_type_vals), 0x0, NULL, HFILL }}, { &hf_pn_mrrt_length, { "Length", "pn_mrrt.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrrt_version, { "Version", "pn_mrrt.version", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_mrrt_sequence_id, { "SequenceID", "pn_mrrt.sequence_id", FT_UINT16, BASE_HEX, NULL, 0x0, "Unique sequence number to each outstanding service request", HFILL }}, { &hf_pn_mrrt_sa, { "SA", "pn_mrrt.sa", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_mrrt_domain_uuid, { "DomainUUID", "pn_mrrt.domain_uuid", FT_GUID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_pn_mrrt }; proto_pn_mrrt = proto_register_protocol ("PROFINET MRRT", "PN-MRRT", "pn_mrrt"); proto_register_field_array (proto_pn_mrrt, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); } void proto_reg_handoff_pn_mrrt (void) { /* register ourself as an heuristic pn-rt payload dissector */ heur_dissector_add("pn_rt", dissect_PNMRRT_Data_heur, "PROFINET MRRT IO", "pn_mrrt_pn_rt", proto_pn_mrrt, HEURISTIC_ENABLE); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-ptcp.c
/* packet-pn-ptcp.c * Routines for PN-PTCP (PROFINET Precision Time Clock Protocol) * packet dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/oui.h> #include <epan/dissectors/packet-dcerpc.h> #include "packet-pn.h" void proto_register_pn_ptcp(void); void proto_reg_handoff_pn_ptcp(void); static int proto_pn_ptcp = -1; static int hf_pn_ptcp_header = -1; static int hf_pn_ptcp_block = -1; static int hf_pn_ptcp_block_tlvheader = -1; static int hf_pn_ptcp_res1 = -1; static int hf_pn_ptcp_res2 = -1; static int hf_pn_ptcp_delay10ns = -1; static int hf_pn_ptcp_seq_id = -1; static int hf_pn_ptcp_delay1ns_byte = -1; static int hf_pn_ptcp_delay1ns_fup = -1; static int hf_pn_ptcp_delay1ns = -1; static int hf_pn_ptcp_tl_length = -1; static int hf_pn_ptcp_tl_type = -1; static int hf_pn_ptcp_master_source_address = -1; static int hf_pn_ptcp_subdomain_uuid = -1; static int hf_pn_ptcp_port_mac_address = -1; static int hf_pn_ptcp_t2portrxdelay = -1; static int hf_pn_ptcp_t3porttxdelay = -1; static int hf_pn_ptcp_t2timestamp = -1; static int hf_pn_ptcp_epoch_number = -1; static int hf_pn_ptcp_seconds = -1; static int hf_pn_ptcp_nanoseconds = -1; static int hf_pn_ptcp_flags = -1; static int hf_pn_ptcp_currentutcoffset = -1; static int hf_pn_ptcp_master_priority1 = -1; static int hf_pn_ptcp_master_priority_level = -1; static int hf_pn_ptcp_master_priority1_res = -1; static int hf_pn_ptcp_master_priority1_act =-1; static int hf_pn_ptcp_master_priority2 = -1; static int hf_pn_ptcp_clock_class = -1; static int hf_pn_ptcp_clock_accuracy = -1; static int hf_pn_ptcp_clockvariance = -1; static int hf_pn_ptcp_oui = -1; static int hf_pn_ptcp_profinet_subtype = -1; static int hf_pn_ptcp_irdata_uuid = -1; static gint ett_pn_ptcp = -1; static gint ett_pn_ptcp_header = -1; static gint ett_pn_ptcp_block = -1; static gint ett_pn_ptcp_block_header = -1; #define OUI_PROFINET_MULTICAST 0x010ECF /* PROFIBUS Nutzerorganisation e.V. */ #define PN_PTCP_BT_END 0x00 #define PN_PTCP_BT_SUBDOMAIN 0x01 #define PN_PTCP_BT_TIME 0x02 #define PN_PTCP_BT_TIME_EXTENSION 0x03 #define PN_PTCP_BT_MASTER 0x04 #define PN_PTCP_BT_PORT_PARAMETER 0x05 #define PN_PTCP_BT_DELAY_PARAMETER 0x06 #define PN_PTCP_BT_PORT_TIME 0x07 #define PN_PTCP_BT_OPTION 0x7F #define PN_PTCP_BT_RTDATA 0x7F static const value_string pn_ptcp_block_type[] = { { PN_PTCP_BT_END, "End" }, { PN_PTCP_BT_SUBDOMAIN, "Subdomain"}, { PN_PTCP_BT_TIME, "Time"}, { PN_PTCP_BT_TIME_EXTENSION, "TimeExtension"}, { PN_PTCP_BT_MASTER, "Master"}, { PN_PTCP_BT_PORT_PARAMETER, "PortParameter"}, { PN_PTCP_BT_DELAY_PARAMETER, "DelayParameter"}, { PN_PTCP_BT_PORT_TIME, "PortTime"}, /*0x08 - 0x7E Reserved */ { PN_PTCP_BT_OPTION, "Organizationally Specific"}, { 0, NULL } }; static const value_string pn_ptcp_oui_vals[] = { { OUI_PROFINET, "PROFINET" }, { OUI_PROFINET_MULTICAST, "PROFINET" }, { 0, NULL } }; static const value_string pn_ptcp_master_prio1_vals[] = { { 0x00, "Sync slave" }, { 0x01, "Primary master" }, { 0x02, "Secondary master" }, { 0x03, "Reserved" }, { 0x04, "Reserved" }, { 0x05, "Reserved" }, { 0x06, "Reserved" }, { 0x07, "Reserved" }, { 0, NULL } }; static const value_string pn_ptcp_master_prio1_levels[] = { { 0x00, "Level 0 (highest)" }, { 0x01, "Level 1" }, { 0x02, "Level 2" }, { 0x03, "Level 3" }, { 0x04, "Level 4" }, { 0x05, "Level 5" }, { 0x06, "Level 6" }, { 0x07, "Level 7 (lowest)" }, { 0, NULL } }; static const value_string pn_ptcp_master_prio1_vals_active[] = { { 0x00, "inactive" }, { 0x01, "active" }, { 0, NULL } }; #if 0 static const value_string pn_ptcp_master_prio1_short_vals[] = { { 0x01, "Primary" }, { 0x02, "Secondary" }, { 0, NULL } }; #endif static const value_string pn_ptcp_master_prio2_vals[] = { { 0xFF, "Default" }, { 0, NULL } }; static const value_string pn_ptcp_clock_class_vals[] = { { 0xFF, "Slave-only clock" }, { 0, NULL } }; static const value_string pn_ptcp_clock_accuracy_vals[] = { { 0x20, "25ns" }, { 0x21, "100ns (Default)" }, { 0x22, "250ns" }, { 0x23, "1us" }, { 0x24, "2.5us" }, { 0x25, "10us" }, { 0x26, "25us" }, { 0x27, "100us" }, { 0x28, "250us" }, { 0x29, "1ms" }, { 0xFE, "Unknown" }, { 0, NULL } }; static const value_string pn_ptcp_profinet_subtype_vals[] = { { 0x01, "RTData" }, { 0, NULL } }; static int dissect_PNPTCP_TLVHeader(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 *type, guint16 *length) { guint16 tl_type; guint16 tl_length; /* Type */ dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_ptcp_tl_type, &tl_type); *type = tl_type >> 9; /* Length */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_ptcp_tl_length, &tl_length); *length = tl_length & 0x1FF; return offset; } static int dissect_PNPTCP_Subdomain(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID) { guint8 mac[6]; e_guid_t uuid; /* MasterSourceAddress */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_ptcp_master_source_address, mac); /* SubdomainUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_ptcp_subdomain_uuid, &uuid); if ((u16FrameID == 0xff00) || (u16FrameID == 0xff01)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Master=%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } proto_item_append_text(item, ": MasterSource=%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); proto_item_append_text(item, ", Subdomain=%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid.data1, uuid.data2, uuid.data3, uuid.data4[0], uuid.data4[1], uuid.data4[2], uuid.data4[3], uuid.data4[4], uuid.data4[5], uuid.data4[6], uuid.data4[7]); return offset; } static int dissect_PNPTCP_Time(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint16 EpochNumber; guint32 Seconds; guint32 NanoSeconds; /* EpochNumber */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_ptcp_epoch_number, &EpochNumber); /* Seconds */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_seconds, tvb, offset, 4, ENC_BIG_ENDIAN, &Seconds); offset += 4; /* NanoSeconds */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_nanoseconds, tvb, offset, 4, ENC_BIG_ENDIAN, &NanoSeconds); offset += 4; proto_item_append_text(item, ": Seconds=%u NanoSeconds=%u EpochNumber=%u", Seconds, NanoSeconds, EpochNumber); col_append_fstr(pinfo->cinfo, COL_INFO, ", Time: %4us %09uns, Epoch: %u", Seconds, NanoSeconds, EpochNumber); return offset; } static int dissect_PNPTCP_TimeExtension(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint16 Flags; guint16 CurrentUTCOffset; /* Flags */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_ptcp_flags, &Flags); /* CurrentUTCOffset */ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_ptcp_currentutcoffset, &CurrentUTCOffset); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); proto_item_append_text(item, ": Flags=0x%x, CurrentUTCOffset=%u", Flags, CurrentUTCOffset); return offset; } static int dissect_PNPTCP_Master(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint8 MasterPriority1; guint8 MasterPriority2; guint8 ClockClass; guint8 ClockAccuracy; gint16 ClockVariance; /* MasterPriority1 is a bit field */ /* Bit 0 - 2: PTCP_MasterPriority1.Priority */ dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_master_priority1, &MasterPriority1); /* Bit 3 - 5: PTCP_MasterPriority1.Level */ dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_master_priority_level, &MasterPriority1); /* Bit 6: PTCP_MasterPriority1.Reserved */ dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_master_priority1_res, &MasterPriority1); /* Bit 7: PTCP_MasterPriority1.Active */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_master_priority1_act, &MasterPriority1); /* MasterPriority2 */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_master_priority2, &MasterPriority2); /* ClockClass */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_clock_class, &ClockClass); /* ClockAccuracy */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_clock_accuracy, &ClockAccuracy); /* ClockVariance */ offset = dissect_pn_int16(tvb, offset, pinfo, tree, hf_pn_ptcp_clockvariance, &ClockVariance); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); col_append_fstr(pinfo->cinfo, COL_INFO, ", Prio1=\"%s\"", val_to_str(MasterPriority1 & 0x7, pn_ptcp_master_prio1_vals, "(Reserved: 0x%x)")); if ((MasterPriority1 & 0x80) == 0) { proto_item_append_text(item, ": Prio1=\"%s\", Prio2=%s, Clock: Class=\"%s\", Accuracy=%s, Variance=%d", val_to_str(MasterPriority1 & 0x7, pn_ptcp_master_prio1_vals, "(Reserved: 0x%x)"), val_to_str(MasterPriority2, pn_ptcp_master_prio2_vals, "(Reserved: 0x%x)"), val_to_str(ClockClass, pn_ptcp_clock_class_vals, "(Reserved: 0x%x)"), val_to_str(ClockAccuracy, pn_ptcp_clock_accuracy_vals, "(Reserved: 0x%x)"), ClockVariance); } else { col_append_str(pinfo->cinfo, COL_INFO, " active"); proto_item_append_text(item, ": Prio1=\"%s\" is active, Prio2=%s, Clock: Class=\"%s\", Accuracy=%s, Variance=%d", val_to_str(MasterPriority1 & 0x7, pn_ptcp_master_prio1_vals, "(Reserved: 0x%x)"), val_to_str(MasterPriority2, pn_ptcp_master_prio2_vals, "(Reserved: 0x%x)"), val_to_str(ClockClass, pn_ptcp_clock_class_vals, "(Reserved: 0x%x)"), val_to_str(ClockAccuracy, pn_ptcp_clock_accuracy_vals, "(Reserved: 0x%x)"), ClockVariance); } return offset; } static int dissect_PNPTCP_PortParameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint32 t2portrxdelay; guint32 t3porttxdelay; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* T2PortRxDelay */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_t2portrxdelay, tvb, offset, 4, ENC_BIG_ENDIAN, &t2portrxdelay); offset += 4; /* T3PortTxDelay */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_t3porttxdelay, tvb, offset, 4, ENC_BIG_ENDIAN, &t3porttxdelay); offset += 4; proto_item_append_text(item, ": T2PortRxDelay=%uns, T3PortTxDelay=%uns", t2portrxdelay, t3porttxdelay); col_append_fstr(pinfo->cinfo, COL_INFO, ", T2Rx=%uns, T3Tx=%uns", t2portrxdelay, t3porttxdelay); return offset; } static int dissect_PNPTCP_DelayParameter(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint8 mac[6]; /* PortMACAddress */ offset = dissect_pn_mac(tvb, offset, pinfo, tree, hf_pn_ptcp_port_mac_address, mac); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); proto_item_append_text(item, ": PortMAC=%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); col_append_fstr(pinfo->cinfo, COL_INFO, ", PortMAC=%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return offset; } static int dissect_PNPTCP_PortTime(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item) { guint32 t2timestamp; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* T2TimeStamp */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_t2timestamp, tvb, offset, 4, ENC_BIG_ENDIAN, &t2timestamp); offset += 4; proto_item_append_text(item, ": T2TimeStamp=%uns", t2timestamp); col_append_fstr(pinfo->cinfo, COL_INFO, ", T2TS=%uns", t2timestamp); return offset; } static int dissect_PNPTCP_Option_PROFINET(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length) { guint8 subType; e_guid_t uuid; /* OUI already dissected! */ /* SubType */ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_ptcp_profinet_subtype, &subType); length -= 1; switch (subType) { case 1: /* RTData */ /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); /* IRDataUUID */ offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_ptcp_irdata_uuid, &uuid); proto_item_append_text(item, ": IRDataUUID=%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid.data1, uuid.data2, uuid.data3, uuid.data4[0], uuid.data4[1], uuid.data4[2], uuid.data4[3], uuid.data4[4], uuid.data4[5], uuid.data4[6], uuid.data4[7]); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); break; } return offset; } static int dissect_PNPTCP_Option(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length) { guint32 oui; /* verify remaining TLV length */ if (length < 4) { /* too short */ offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); return (offset); } /* OUI (organizational unique id) */ offset = dissect_pn_oid(tvb, offset, pinfo,tree, hf_pn_ptcp_oui, &oui); length -= 3; switch (oui) { case OUI_PROFINET: case OUI_PROFINET_MULTICAST: proto_item_append_text(item, ": PROFINET"); offset = dissect_PNPTCP_Option_PROFINET(tvb, offset, pinfo, tree, item, length); break; default: /* SubType */ offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); } return (offset); } static int dissect_PNPTCP_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, gboolean *end, guint16 u16FrameID) { guint16 type; guint16 length; proto_item *sub_item; proto_tree *sub_tree; proto_item *tlvheader_item; proto_tree *tlvheader_tree; guint32 u32SubStart; *end = FALSE; /* block subtree */ sub_item = proto_tree_add_item(tree, hf_pn_ptcp_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_ptcp_block); u32SubStart = offset; /* tlvheader subtree */ tlvheader_item = proto_tree_add_item(sub_tree, hf_pn_ptcp_block_tlvheader, tvb, offset, 2 /* len */, ENC_NA); tlvheader_tree = proto_item_add_subtree(tlvheader_item, ett_pn_ptcp_block_header); offset = dissect_PNPTCP_TLVHeader(tvb, offset, pinfo, tlvheader_tree, sub_item, &type, &length); proto_item_set_text(sub_item, "%s", val_to_str_const(type, pn_ptcp_block_type, "Unknown")); proto_item_append_text(tlvheader_item, ": Type=%s (%x), Length=%u", val_to_str_const(type, pn_ptcp_block_type, "Unknown"), type, length); switch (type) { case 0x00: /* End, no content */ *end = TRUE; break; case 0x01: /* Subdomain */ dissect_PNPTCP_Subdomain(tvb, offset, pinfo, sub_tree, sub_item, u16FrameID); break; case 0x02: /* Time */ dissect_PNPTCP_Time(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x03: /* TimeExtension */ dissect_PNPTCP_TimeExtension(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x04: /* Master */ dissect_PNPTCP_Master(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x05: /* PortParameter */ dissect_PNPTCP_PortParameter(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x06: /* DelayParameter */ dissect_PNPTCP_DelayParameter(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x07: /* PortTime */ dissect_PNPTCP_PortTime(tvb, offset, pinfo, sub_tree, sub_item); break; case 0x7F: /* Organizational Specific */ dissect_PNPTCP_Option(tvb, offset, pinfo, sub_tree, sub_item, length); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, length); } offset += length; proto_item_set_len(sub_item, offset - u32SubStart); return offset; } static int dissect_PNPTCP_blocks(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID) { gboolean end = FALSE; /* as long as we have some bytes, try a new block */ while (!end) { offset = dissect_PNPTCP_block(tvb, offset, pinfo, tree, item, &end, u16FrameID); } return offset; } static int dissect_PNPTCP_FollowUpPDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID, const char *name, const char *name_short) { proto_item *header_item; proto_tree *header_tree; guint16 seq_id; gint32 delay1ns_fup; /* dissect the header */ header_item = proto_tree_add_item(tree, hf_pn_ptcp_header, tvb, offset, 20 /* len */, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_pn_ptcp_header); /* Padding 12 bytes */ offset = dissect_pn_padding(tvb, offset, pinfo, header_tree, 12); /* SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, header_tree, hf_pn_ptcp_seq_id, &seq_id); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, header_tree); /* Delay1ns_FUP */ proto_tree_add_item_ret_int(header_tree, hf_pn_ptcp_delay1ns_fup, tvb, offset, 4, ENC_BIG_ENDIAN, &delay1ns_fup); offset += 4; col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq=%3u, Delay=%11dns", name, seq_id, delay1ns_fup); proto_item_append_text(item, "%s: Sequence=%u, Delay=%dns", name_short, seq_id, delay1ns_fup); proto_item_append_text(header_item, ": Sequence=%u, Delay=%dns", seq_id, delay1ns_fup); /* dissect the TLV blocks */ offset = dissect_PNPTCP_blocks(tvb, offset, pinfo, tree, item, u16FrameID); return offset; } static int dissect_PNPTCP_RTSyncPDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID, const char *name, const char *name_short) { proto_item *header_item; proto_tree *header_tree; guint32 delay10ns; guint16 seq_id; guint8 delay1ns_8; guint64 delay1ns_64; guint32 delay1ns_32; guint32 delayms; header_item = proto_tree_add_item(tree, hf_pn_ptcp_header, tvb, offset, 20 /* len */, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_pn_ptcp_header); /* Reserved_1 */ proto_tree_add_item(tree, hf_pn_ptcp_res1, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Reserved_2 */ proto_tree_add_item(tree, hf_pn_ptcp_res2, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Delay10ns */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_delay10ns, tvb, offset, 4, ENC_BIG_ENDIAN, &delay10ns); offset += 4; /* SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, header_tree, hf_pn_ptcp_seq_id, &seq_id); /* Delay1ns */ offset = dissect_pn_uint8(tvb, offset, pinfo, header_tree, hf_pn_ptcp_delay1ns_byte, &delay1ns_8); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, header_tree); /* Delay1ns */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_delay1ns, tvb, offset, 4, ENC_BIG_ENDIAN, &delay1ns_32); offset += 4; /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, tree); delay1ns_64 = ((guint64) delay10ns) * 10 + delay1ns_8 + delay1ns_32; delayms = (guint32) (delay1ns_64 / (1000 * 1000)); col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq=%3u, Delay=%11" PRIu64 "ns", name, seq_id, delay1ns_64); proto_item_append_text(item, "%s: Sequence=%u, Delay=%" PRIu64 "ns", name_short, seq_id, delay1ns_64); proto_item_append_text(header_item, ": Sequence=%u, Delay=%" PRIu64 "ns", seq_id, delay1ns_64); if (delay1ns_64 != 0) proto_item_append_text(header_item, " (%u.%03u,%03u,%03u sec)", delayms / 1000, delayms % 1000, (delay10ns % (1000*100)) / 100, delay10ns % 100 * 10 + delay1ns_8); /* dissect the PDU */ offset = dissect_PNPTCP_blocks(tvb, offset, pinfo, tree, item, u16FrameID); return offset; } static int dissect_PNPTCP_AnnouncePDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID, const char *name, const char *name_short) { proto_item *header_item; proto_tree *header_tree; guint16 seq_id; /* dissect the header */ header_item = proto_tree_add_item(tree, hf_pn_ptcp_header, tvb, offset, 20 /* len */, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_pn_ptcp_header); /* Padding 12 bytes */ offset = dissect_pn_padding(tvb, offset, pinfo, header_tree, 12); /* SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, header_tree, hf_pn_ptcp_seq_id, &seq_id); /* Padding 6 bytes */ offset = dissect_pn_padding(tvb, offset, pinfo, header_tree, 6); col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq=%3u", name, seq_id); proto_item_append_text(item, "%s: Sequence=%u", name_short, seq_id); proto_item_append_text(header_item, ": Sequence=%u", seq_id); /* dissect the PDU */ offset = dissect_PNPTCP_blocks(tvb, offset, pinfo, tree, item, u16FrameID); return offset; } static int dissect_PNPTCP_DelayPDU(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 u16FrameID, const char *name, const char *name_short) { proto_item *header_item; proto_tree *header_tree; guint16 seq_id; guint32 delay1ns; /* dissect the header */ header_item = proto_tree_add_item(tree, hf_pn_ptcp_header, tvb, offset, 20 /* len */, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_pn_ptcp_header); /* Padding 12 bytes */ offset = dissect_pn_padding(tvb, offset, pinfo, header_tree, 12); /* SequenceID */ offset = dissect_pn_uint16(tvb, offset, pinfo, header_tree, hf_pn_ptcp_seq_id, &seq_id); /* Padding */ offset = dissect_pn_align4(tvb, offset, pinfo, header_tree); /* Delay1ns_FUP */ proto_tree_add_item_ret_uint(tree, hf_pn_ptcp_delay1ns, tvb, offset, 4, ENC_BIG_ENDIAN, &delay1ns); offset += 4; col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq=%3u, Delay=%11uns", name, seq_id, delay1ns); proto_item_append_text(item, "%s: Sequence=%u, Delay=%uns", name_short, seq_id, delay1ns); proto_item_append_text(header_item, ": Sequence=%u, Delay=%uns", seq_id, delay1ns); /* dissect the PDU */ offset = dissect_PNPTCP_blocks(tvb, offset, pinfo, tree, item, u16FrameID); return offset; } /* possibly dissect a PN-RT packet (frame ID must be in the appropriate range) */ static gboolean dissect_PNPTCP_Data_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { /* the tvb will NOT contain the frame_id here, so get it from dissector data! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); proto_item *item; proto_tree *ptcp_tree; int offset = 0; guint32 u32SubStart; /* frame id must be in valid range (acyclic Real-Time, PTCP) */ /* 0x0000 - 0x007F: RTSyncPDU (with follow up) */ /* 0x0080 - 0x00FF: RTSyncPDU (without follow up) */ /* 0xFF00 - 0xFF1F: AnnouncePDU */ /* 0xFF20 - 0xFF3F: FollowUpPDU */ /* 0xFF40 - 0xFF5F: Delay...PDU */ if ( ((u16FrameID >= 0x0100) && (u16FrameID < 0xFF00)) || (u16FrameID > 0xFF5F) ) { /* we are not interested in this packet */ return FALSE; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-PTCP"); col_clear(pinfo->cinfo, COL_INFO); /* subtree for PTCP */ item = proto_tree_add_protocol_format(tree, proto_pn_ptcp, tvb, 0, 0, "PROFINET PTCP, "); ptcp_tree = proto_item_add_subtree(item, ett_pn_ptcp); u32SubStart = offset; switch (u16FrameID) { /* range 1 (0x0000 - 0x007F) */ /* 0x0000 - 0x001F reserved */ case 0x0020: offset = dissect_PNPTCP_RTSyncPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "RTSync FU (Clock)", "RTSync FU (Clock)"); break; case 0x0021: offset = dissect_PNPTCP_RTSyncPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "RTSync FU (Time)", "RTSync FU (Time)"); break; /* 0x0022 - 0x007F reserved */ /* range 2 (0x0080 - 0x00FF) */ case 0x0080: offset = dissect_PNPTCP_RTSyncPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "RTSync (Clock)", "RTSync (Clock)"); break; case 0x0081: offset = dissect_PNPTCP_RTSyncPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "RTSync (Time)", "RTSync (Time)"); break; /* 0x0081 - 0x00FF reserved */ /* range 7 (0xFF00 - 0xFF5F) */ case 0xff00: offset = dissect_PNPTCP_AnnouncePDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "Announce (Clock)", "Announce (Clock)"); break; case 0xff01: offset = dissect_PNPTCP_AnnouncePDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "Announce (Time)", "Announce (Time)"); break; /* 0xFF02 - 0xFF1F reserved */ case 0xff20: offset = dissect_PNPTCP_FollowUpPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "FollowUp (Clock)", "FollowUp (Clock)"); break; case 0xff21: offset = dissect_PNPTCP_FollowUpPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "FollowUp (Time)", "FollowUp (Time)"); break; /* 0xFF22 - 0xFF3F reserved */ case 0xff40: offset = dissect_PNPTCP_DelayPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "DelayReq ", "DelayReq"); break; case 0xff41: offset = dissect_PNPTCP_DelayPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "DelayRes ", "DelayRes"); break; case 0xff42: offset = dissect_PNPTCP_DelayPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "DelayFuRes ", "DelayFuRes"); break; case 0xff43: offset = dissect_PNPTCP_DelayPDU(tvb, offset, pinfo, ptcp_tree, item, u16FrameID, "DelayRes ", "DelayRes"); break; /* 0xFF44 - 0xFF5F reserved */ default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset)); col_append_fstr(pinfo->cinfo, COL_INFO, "Reserved FrameID 0x%04x", u16FrameID); proto_item_append_text(item, "Reserved FrameID 0x%04x", u16FrameID); offset += tvb_captured_length_remaining(tvb, offset); break; } proto_item_set_len(item, offset - u32SubStart); return TRUE; } void proto_register_pn_ptcp (void) { static hf_register_info hf[] = { { &hf_pn_ptcp_header, { "Header", "pn_ptcp.header", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_block, { "Block", "pn_ptcp.block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_block_tlvheader, { "TLVHeader", "pn_ptcp.tlvheader", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_res1, { "Reserved 1", "pn_ptcp.res1", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_res2, { "Reserved 2", "pn_ptcp.res2", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_delay10ns, { "Delay10ns", "pn_ptcp.delay10ns", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_seq_id, { "SequenceID", "pn_ptcp.sequence_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_delay1ns_byte, { "Delay1ns_Byte", "pn_ptcp.delay1ns_byte", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_delay1ns, { "Delay1ns", "pn_ptcp.delay1ns", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_delay1ns_fup, { "Delay1ns_FUP", "pn_ptcp.delay1ns_fup", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_tl_length, { "TypeLength.Length", "pn_ptcp.tl_length", FT_UINT16, BASE_DEC, 0x0, 0x01FF, NULL, HFILL }}, { &hf_pn_ptcp_tl_type, { "TypeLength.Type", "pn_ptcp.tl_type", FT_UINT16, BASE_DEC, 0x0, 0xFE00, NULL, HFILL }}, { &hf_pn_ptcp_master_source_address, { "MasterSourceAddress", "pn_ptcp.master_source_address", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_subdomain_uuid, { "SubdomainUUID", "pn_ptcp.subdomain_uuid", FT_GUID, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_port_mac_address, { "PortMACAddress", "pn_ptcp.port_mac_address", FT_ETHER, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_t2portrxdelay, { "T2PortRxDelay (ns)", "pn_ptcp.t2portrxdelay", FT_UINT32, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_t3porttxdelay, { "T3PortTxDelay (ns)", "pn_ptcp.t3porttxdelay", FT_UINT32, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_t2timestamp, { "T2TimeStamp (ns)", "pn_ptcp.t2timestamp", FT_UINT32, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_epoch_number, { "EpochNumber", "pn_ptcp.epoch_number", FT_UINT16, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_seconds, { "Seconds", "pn_ptcp.seconds", FT_UINT32, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_nanoseconds, { "NanoSeconds", "pn_ptcp.nanoseconds", FT_UINT32, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_flags, { "Flags", "pn_ptcp.flags", FT_UINT16, BASE_HEX, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_currentutcoffset, { "CurrentUTCOffset", "pn_ptcp.currentutcoffset", FT_UINT16, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_master_priority1, { "MasterPriority1.Priority", "pn_ptcp.master_priority1_prio", FT_UINT8, BASE_HEX, VALS(pn_ptcp_master_prio1_vals), 0x07, NULL, HFILL }}, { &hf_pn_ptcp_master_priority_level, { "MasterPriority1.Level", "pn_ptcp.master_priority1_level", FT_UINT8, BASE_HEX, VALS(pn_ptcp_master_prio1_levels), 0x38, NULL, HFILL }}, { &hf_pn_ptcp_master_priority1_res, { "MasterPriority1.Reserved", "pn_ptcp.master_priority1_res", FT_UINT8, BASE_HEX, 0x0, 0x40, NULL, HFILL }}, { &hf_pn_ptcp_master_priority1_act, { "MasterPriority1.Active", "pn_ptcp.master_priority1_act", FT_UINT8, BASE_HEX, VALS(pn_ptcp_master_prio1_vals_active), 0x80, NULL, HFILL }}, { &hf_pn_ptcp_master_priority2, { "MasterPriority2", "pn_ptcp.master_priority2", FT_UINT8, BASE_DEC, VALS(pn_ptcp_master_prio2_vals), 0x0, NULL, HFILL }}, { &hf_pn_ptcp_clock_class, { "ClockClass", "pn_ptcp.clock_class", FT_UINT8, BASE_DEC, VALS(pn_ptcp_clock_class_vals), 0x0, NULL, HFILL }}, { &hf_pn_ptcp_clock_accuracy, { "ClockAccuracy", "pn_ptcp.clock_accuracy", FT_UINT8, BASE_DEC, VALS(pn_ptcp_clock_accuracy_vals), 0x0, NULL, HFILL }}, { &hf_pn_ptcp_clockvariance, { "ClockVariance", "pn_ptcp.clockvariance", FT_INT16, BASE_DEC, 0x0, 0x0, NULL, HFILL }}, { &hf_pn_ptcp_oui, { "Organizationally Unique Identifier", "pn_ptcp.oui", FT_UINT24, BASE_HEX, VALS(pn_ptcp_oui_vals), 0x0, NULL, HFILL }}, { &hf_pn_ptcp_profinet_subtype, { "Subtype", "pn_ptcp.subtype", FT_UINT8, BASE_HEX, VALS(pn_ptcp_profinet_subtype_vals), 0x0, "PROFINET Subtype", HFILL }}, { &hf_pn_ptcp_irdata_uuid, { "IRDataUUID", "pn_ptcp.irdata_uuid", FT_GUID, BASE_NONE, 0x0, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_pn_ptcp, &ett_pn_ptcp_header, &ett_pn_ptcp_block, &ett_pn_ptcp_block_header }; proto_pn_ptcp = proto_register_protocol ("PROFINET PTCP", "PN-PTCP", "pn_ptcp"); proto_register_field_array (proto_pn_ptcp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); } void proto_reg_handoff_pn_ptcp (void) { /* register ourself as an heuristic pn-rt payload dissector */ heur_dissector_add("pn_rt", dissect_PNPTCP_Data_heur, "PROFINET PTCP IO", "pn_ptcp_pn_rt", proto_pn_ptcp, HEURISTIC_ENABLE); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-rsi.c
/* packet-pn-rsi.c * Routines for PN-RSI * packet dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <string.h> #include <glib.h> #include <epan/packet.h> #include <epan/exceptions.h> #include <epan/to_str.h> #include <epan/wmem_scopes.h> #include <epan/dissectors/packet-dcerpc.h> #include <epan/expert.h> #include <epan/conversation_filter.h> #include <epan/proto_data.h> #include <epan/reassemble.h> #include <epan/conversation.h> #include <wsutil/file_util.h> #include <epan/prefs.h> #include "packet-pn.h" void proto_register_pn_rsi(void); void proto_reg_handoff_pn_rsi(void); static int proto_pn_rsi = -1; static int hf_pn_rsi_dst_srv_access_point = -1; static int hf_pn_rsi_src_srv_access_point = -1; static int hf_pn_rsi_pdu_type = -1; static int hf_pn_rsi_pdu_type_type = -1; static int hf_pn_rsi_pdu_type_version = -1; static int hf_pn_rsi_add_flags = -1; static int hf_pn_rsi_add_flags_windowsize = -1; static int hf_pn_rsi_add_flags_reserved1 = -1; static int hf_pn_rsi_add_flags_tack = -1; static int hf_pn_rsi_add_flags_morefrag = -1; static int hf_pn_rsi_add_flags_notification = -1; static int hf_pn_rsi_add_flags_reserved2 = -1; static int hf_pn_rsi_send_seq_num = -1; static int hf_pn_rsi_ack_seq_num = -1; static int hf_pn_rsi_var_part_len = -1; static int hf_pn_rsi_f_opnum_offset = -1; static int hf_pn_rsi_f_opnum_offset_offset = -1; static int hf_pn_rsi_f_opnum_offset_opnum = -1; static int hf_pn_rsi_f_opnum_offset_callsequence = -1; static int hf_pn_rsi_conn_block = -1; static int hf_pn_rsi_rsp_max_length = -1; static int hf_pn_rsi_vendor_id = -1; static int hf_pn_rsi_device_id = -1; static int hf_pn_rsi_instance_id = -1; static int hf_pn_rsi_interface = -1; static int hf_pn_rsi_svcs_block = -1; static int hf_pn_rsi_number_of_entries = -1; static int hf_pn_rsi_pd_rsi_instance = -1; static int hf_pn_rsi_device_type = -1; static int hf_pn_rsi_order_id = -1; static int hf_pn_rsi_im_serial_number = -1; static int hf_pn_rsi_hw_revision = -1; static int hf_pn_rsi_sw_revision_prefix = -1; static int hf_pn_rsi_sw_revision = -1; static gint ett_pn_rsi = -1; static gint ett_pn_rsi_pdu_type = -1; static gint ett_pn_rsi_f_opnum_offset = -1; static gint ett_pn_rsi_conn_block = -1; static gint ett_pn_rsi_svcs_block = -1; static gint ett_pn_rsi_add_flags = -1; static gint ett_pn_rsi_rta = -1; static gint ett_pn_io_pd_rsi_instance = -1; static expert_field ei_pn_rsi_error = EI_INIT; static const range_string pn_rsi_alarm_endpoint[] = { { 0x0000, 0x7FFF, "RSI Initiator Instance (ISAP) or RSI Responder Instance (RSAP)" }, { 0x8000, 0xFFFE, "Reserved" }, { 0xFFFF, 0xFFFF, "CON-SAP" }, { 0, 0, NULL } }; static const range_string pn_rsi_pdu_type_type[] = { { 0x00, 0x02, "Reserved" }, { 0x03, 0x03, "RTA_TYPE_ACK" }, { 0x04, 0x04, "RTA_TYPE_ERR" }, { 0x05, 0x05, "RTA_TYPE_FREQ" }, { 0x06, 0x06, "RTA_TYPE_FRSP" }, { 0x07, 0x0F, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_rsi_pdu_type_version[] = { { 0x00, 0x00, "Reserved" }, { 0x01, 0x01, "Version 1 of the protocol" }, { 0x02, 0x02, "Version 2 of the protocol" }, { 0x03, 0X0F, "Reserved" }, { 0, 0, NULL } }; static const value_string pn_rsi_add_flags_windowsize[] = { { 0x00, "Reserved" }, { 0x01, "Unknown WindowSize" }, { 0x02, "Smallest WindowSize" }, { 0x03, "Optional usable WindowSize" }, { 0x04, "Optional usable WindowSize" }, { 0x05, "Optional usable WindowSize" }, { 0x06, "Optional usable WindowSize" }, { 0x07, "Optional usable WindowSize" }, { 0, NULL } }; static const value_string pn_rsi_add_flags_tack[] = { { 0x00, "No immediate acknowledge" }, { 0x01, "Immediate acknowledge" }, { 0, NULL } }; static const value_string pn_rsi_add_flags_morefrag[] = { { 0x00, "Last fragment" }, { 0x01, "More fragments follows" }, { 0, NULL } }; static const value_string pn_rsi_add_flags_notification[] = { { 0x00, "No action necessary" }, { 0x01, "The ApplicationReadyBlock is available for reading with the service ReadNotification" }, { 0, NULL } }; static const range_string pn_rsi_seq_num[] = { { 0x0000, 0x7FFF, "synchronization and transmission between initiator and responder" }, { 0x8000, 0xFFFD, "Reserved" }, { 0xFFFE, 0xFFFE, "synchronize initiator and responder for establishment of an AR" }, { 0xFFFF, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_rsi_var_part_len[] = { { 0x0000, 0x0000, "No RTA-SDU or RSI-SDU exists" }, { 0x0001, 0x0598, "An RTA-SDU or RSI-PDU with VarPartLen octets exists" }, { 0x0599, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_rsi_f_opnum_offset_offset[] = { { 0x00000000, 0x00000000, "First fragment" }, { 0x00000001, 0x00000003, "Reserved" }, { 0x00000004, 0x00FFFFFF, "Not first fragment" }, { 0, 0, NULL } }; static const value_string pn_rsi_f_opnum_offset_opnum[] = { { 0x00, "Connect" }, { 0x01, "Reserved" }, { 0x02, "Read" }, { 0x03, "Write" }, { 0x04, "Control" }, { 0x05, "ReadImplicit" }, { 0x06, "ReadConnectionless" }, { 0x07, "ReadNotification" }, { 0x08, "PrmWriteMore" }, { 0x09, "PrmWriteEnd" }, { 0x0A, "Reserved" }, { 0x0B, "Reserved" }, { 0x0C, "Reserved" }, { 0x0D, "Reserved" }, { 0x0E, "Reserved" }, { 0x0F, "Reserved" }, { 0x1F, "Reserved" }, { 0, NULL } }; static const range_string pn_rsi_f_opnum_offset_callsequence[] = { { 0x00, 0x07, "Allowed values" }, { 0, 0, NULL } }; static const range_string pn_rsi_rsp_max_length[] = { { 0x00000000, 0x00000003, "Reserved" }, { 0x00000004, 0x00FFFFFF, "Usable" }, { 0x01FFFFFF, 0xFFFFFFFF, "Reserved" }, { 0, 0, NULL } }; static const range_string pn_rsi_interface[] = { { 0x00, 0x00, "IO device interface" }, { 0x01, 0x01, "Read Implicit IO device interface" }, { 0x02, 0x02, "CIM device interface" }, { 0x03, 0x03, "Read Implicit CIM device interface" }, { 0x04, 0xFF, "Reserved" }, { 0, 0, NULL } }; static int dissect_FOpnumOffset(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, guint32 *u32FOpnumOffset) { proto_item *sub_item; proto_tree *sub_tree; sub_item = proto_tree_add_item(tree, hf_pn_rsi_f_opnum_offset, tvb, offset, 4, ENC_BIG_ENDIAN); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rsi_f_opnum_offset); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_f_opnum_offset_offset, u32FOpnumOffset); dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_f_opnum_offset_opnum, u32FOpnumOffset); offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_f_opnum_offset_callsequence, u32FOpnumOffset); return offset; } static int hf_pn_rsi_data_payload = -1; static int hf_pn_rsi_segments = -1; static int hf_pn_rsi_segment = -1; //static int hf_pn_rsi_data = -1; static int hf_pn_rsi_segment_overlap = -1; static int hf_pn_rsi_segment_overlap_conflict = -1; static int hf_pn_rsi_segment_multiple_tails = -1; static int hf_pn_rsi_segment_too_long_segment = -1; static int hf_pn_rsi_segment_error = -1; static int hf_pn_rsi_segment_count = -1; static int hf_pn_rsi_reassembled_in = -1; static int hf_pn_rsi_reassembled_length = -1; static reassembly_table pn_rsi_reassembly_table; void pn_rsi_reassemble_init(void) { reassembly_table_register(&pn_rsi_reassembly_table, &addresses_reassembly_table_functions); } static gint ett_pn_rsi_segments = -1; static gint ett_pn_rsi_segment = -1; //static gint ett_pn_rsi_data = -1; static gint ett_pn_rsi_data_payload = -1; static const fragment_items pn_rsi_frag_items = { &ett_pn_rsi_segment, &ett_pn_rsi_segments, &hf_pn_rsi_segments, &hf_pn_rsi_segment, &hf_pn_rsi_segment_overlap, &hf_pn_rsi_segment_overlap_conflict, &hf_pn_rsi_segment_multiple_tails, &hf_pn_rsi_segment_too_long_segment, &hf_pn_rsi_segment_error, &hf_pn_rsi_segment_count, &hf_pn_rsi_reassembled_in, &hf_pn_rsi_reassembled_length, /* Reassembled data field */ NULL, "segments" }; static int dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, guint32 length, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOpnum, int type) { fragment_head *fd_frag; fragment_head *fd_reass; conversation_t *conv; tvbuff_t *next_tvb; proto_item *pn_rsi_tree_item; proto_item *payload_item = NULL; proto_item *payload_tree = NULL; gboolean update_col_info = TRUE; if (pinfo->srcport != 0 && pinfo->destport != 0) { /* COTP over RFC1006/TCP, try reassembling */ conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (!conv) { conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); } /* XXX - don't know if this will work with multiple segmented Ack's in a single TCP stream */ fd_frag = fragment_get(&pn_rsi_reassembly_table, pinfo, conv->conv_index, NULL); fd_reass = fragment_get_reassembled_id(&pn_rsi_reassembly_table, pinfo, conv->conv_index); } else { /* plain COTP transport (without RFC1006/TCP), try reassembling */ conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->clnp_srcref, pinfo->clnp_dstref, 0); if (!conv) { conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->clnp_srcref, pinfo->clnp_dstref, 0); } /* XXX - don't know if this will work with multiple segmented Ack's in a single TCP stream */ fd_frag = fragment_get(&pn_rsi_reassembly_table, pinfo, conv->conv_index, NULL); fd_reass = fragment_get_reassembled_id(&pn_rsi_reassembly_table, pinfo, conv->conv_index); } /* is this packet containing a "standalone" segment? */ if (!u8MoreFrag && !fd_frag && !fd_reass) { /* "standalone" segment, simply show payload and return */ offset = dissect_blocks(tvb, offset, pinfo, tree, drep); return offset; } /* multiple segments */ if (!pinfo->fd->visited && conv != NULL) { /* we haven't seen it before, add to list of segments */ fragment_add_seq_next(&pn_rsi_reassembly_table, tvb, offset, pinfo, conv->conv_index, NULL /*Data comes from tvb as in packet-icmp-template.c */, length, u8MoreFrag); fd_reass = fragment_get_reassembled_id(&pn_rsi_reassembly_table, pinfo, conv->conv_index); } /* update display */ col_append_fstr(pinfo->cinfo, COL_INFO, " [%sPN IO RSI Segment]", u8MoreFrag ? "" : "Last "); /* reassembling completed? */ if (fd_reass != NULL) { /* is this the packet to show the reassembed payload in? */ if (pinfo->fd->num == fd_reass->reassembled_in) { next_tvb = process_reassembled_data(tvb, 0, pinfo, "Reassembled PN IO RSI packet", fd_reass, &pn_rsi_frag_items, &update_col_info, tree); /* XXX - create new parent tree item "Reassembled Data Segments" */ payload_item = proto_tree_add_item(tree, hf_pn_rsi_data_payload, next_tvb, 0, tvb_captured_length(next_tvb), ENC_NA); payload_tree = proto_item_add_subtree(payload_item, ett_pn_rsi_data_payload); offset = dissect_rsi_blocks(next_tvb, 0, pinfo, payload_tree, drep, u32FOpnumOffsetOpnum, type); /* the toplevel fragment subtree is now behind all desegmented data, * move it right behind the DE2 tree item */ // pn_rsi_tree_item = proto_tree_get_parent(tree); } else { /* segment of a multiple segment payload */ proto_item *pi; pn_rsi_tree_item = proto_tree_get_parent(tree); pi = proto_tree_add_uint(pn_rsi_tree_item, hf_pn_rsi_reassembled_in, tvb, 0, 0, fd_reass->reassembled_in); proto_item_set_generated(pi); } } return offset; } /* dissect a PN-IO RSI SVCS block (on top of PN-RT protocol) */ static int dissect_RSI_SVCS_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) { proto_item* sub_item; proto_tree *sub_tree; guint32 u32RsiHeaderSize = 4; guint32 u32RspMaxLength; // PDU.FOpnumOffset.Offset + PDU.VarPartLen - 4 - RsiHeaderSize gint32 length = u32FOpnumOffsetOffset + u16VarPartLen - 4 - u32RsiHeaderSize; sub_item = proto_tree_add_item(tree, hf_pn_rsi_svcs_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rsi_svcs_block); if (u32FOpnumOffsetOffset == 0) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_rsp_max_length, &u32RspMaxLength); } else if (u8MoreFrag == 0) { proto_item_append_text(sub_item, ", RSI Header of SVCS is at first segment"); } if (length > 0) { offset = dissect_pn_rta_remaining_user_data_bytes(tvb, offset, pinfo, sub_tree, drep, tvb_captured_length_remaining(tvb, offset), u8MoreFrag, u32FOpnumOffsetOpnum, PDU_TYPE_REQ); } return offset; } /* dissect a PN-IO RSI CONN block (on top of PN-RT protocol) */ static int dissect_RSI_CONN_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) { proto_item *sub_item; proto_tree *sub_tree; guint32 u32RspMaxLength; guint16 u16VendorId; guint16 u16DeviceId; guint16 u16InstanceId; guint8 u8RsiInterface; guint32 u32RsiHeaderSize = 4; // PDU.FOpnumOffset.Offset + PDU.VarPartLen - 4 - RsiHeaderSize gint32 length = u32FOpnumOffsetOffset + u16VarPartLen - 4 - u32RsiHeaderSize; sub_item = proto_tree_add_item(tree, hf_pn_rsi_conn_block, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rsi_conn_block); if (u32FOpnumOffsetOffset == 0) { offset = dissect_dcerpc_uint32(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_rsp_max_length, &u32RspMaxLength); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_vendor_id, &u16VendorId); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_device_id, &u16DeviceId); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_instance_id, &u16InstanceId); offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_interface, &u8RsiInterface); offset = dissect_pn_padding(tvb, offset, pinfo, sub_tree, 1); } else if (u8MoreFrag == 0) { proto_item_append_text(sub_item, ", RSI Header of CONN is at first segment"); } if (length > 0) { offset = dissect_pn_rta_remaining_user_data_bytes(tvb, offset, pinfo, sub_tree, drep, tvb_captured_length_remaining(tvb, offset), u8MoreFrag, u32FOpnumOffsetOpnum, PDU_TYPE_REQ); } return offset; } /* dissect a PN-IO RSI FREQ RTA PDU (on top of PN-RT protocol) */ static int dissect_FREQ_RTA_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag) { guint32 u32FOpnumOffset; guint32 u32FOpnumOffsetOpnum; guint32 u32FOpnumOffsetOffset; offset = dissect_FOpnumOffset(tvb, offset, pinfo, tree, drep, &u32FOpnumOffset); u32FOpnumOffsetOpnum = (u32FOpnumOffset & 0x1F000000) >> 24; u32FOpnumOffsetOffset = u32FOpnumOffset & 0x00FFFFFF; switch (u32FOpnumOffsetOpnum) { case(0x0): /* RSI-CONN-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "Connect request"); offset = dissect_RSI_CONN_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x1): /* Reserved */ col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb)); break; case(0x2): /* RSI-SVCS-PDU (Only valid with ARUUID<>0) */ col_append_str(pinfo->cinfo, COL_INFO, "Read request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x3): /* RSI-SVCS-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "Write request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x4): /* RSI-SVCS-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "Control request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x5): /* RSI-CONN-PDU (Only valid with ARUUID=0) */ col_append_str(pinfo->cinfo, COL_INFO, "ReadImplicit request"); offset = dissect_RSI_CONN_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x6): /* RSI-CONN-PDU (Only valid with ARUUID<>0) */ col_append_str(pinfo->cinfo, COL_INFO, "ReadConnectionless request"); offset = dissect_RSI_CONN_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x7): /* RSI-SVCS-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "ReadNotification request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x8): /* RSI-SVCS-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "PrmWriteMore request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; case(0x9) : /* RSI-SVCS-PDU */ col_append_str(pinfo->cinfo, COL_INFO, "PrmWriteEnd request"); offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; default: col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb)); break; } return offset; } /* dissect a PN-IO RSI RSP block (on top of PN-RT protocol) */ static int dissect_RSI_RSP_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) { guint32 u32RsiHeaderSize = 4; // PDU.FOpnumOffset.Offset + PDU.VarPartLen - 4 - RsiHeaderSize gint32 length = u32FOpnumOffsetOffset + u16VarPartLen - 4 - u32RsiHeaderSize; if (u32FOpnumOffsetOffset == 0) { offset = dissect_PNIO_status(tvb, offset, pinfo, tree, drep); } else if (u8MoreFrag == 0) { proto_item_append_text(tree, ", RSI Header of RSP is at first fragmented frame"); } if (length > 0) { offset = dissect_pn_rta_remaining_user_data_bytes(tvb, offset, pinfo, tree, drep, tvb_captured_length_remaining(tvb, offset), u8MoreFrag, u32FOpnumOffsetOpnum, PDU_TYPE_RSP); } return offset; } /* dissect a PN-IO RSI FRSP RTA PDU (on top of PN-RT protocol) */ static int dissect_FRSP_RTA_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag) { guint32 u32FOpnumOffset; guint32 u32FOpnumOffsetOpnum; guint32 u32FOpnumOffsetOffset; offset = dissect_FOpnumOffset(tvb, offset, pinfo, tree, drep, &u32FOpnumOffset); u32FOpnumOffsetOpnum = (u32FOpnumOffset & 0x1F000000) >> 24; u32FOpnumOffsetOffset = u32FOpnumOffset & 0x00FFFFFF; switch (u32FOpnumOffsetOpnum) { case(0x0): /* Connect */ col_append_str(pinfo->cinfo, COL_INFO, "Connect response"); break; case(0x1): /* Reserved */ col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); break; case(0x2): /* Read */ col_append_str(pinfo->cinfo, COL_INFO, "Read response"); break; case(0x3): /* Write */ col_append_str(pinfo->cinfo, COL_INFO, "Write response"); break; case(0x4): /* Control */ col_append_str(pinfo->cinfo, COL_INFO, "Control response"); break; case(0x5): /* ReadImplicit */ col_append_str(pinfo->cinfo, COL_INFO, "ReadImplicit response"); break; case(0x6): /* ReadConnectionless */ col_append_str(pinfo->cinfo, COL_INFO, "ReadConnectionless response"); break; case(0x7): /* ReadNotification */ col_append_str(pinfo->cinfo, COL_INFO, "ReadNotification response"); break; case(0x8): /* PrmWriteMore */ col_append_str(pinfo->cinfo, COL_INFO, "PrmWriteMore response"); break; case(0x9) : /* PrmWriteEnd */ col_append_str(pinfo->cinfo, COL_INFO, "PrmWriteEnd response"); break; default: col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); break; } offset = dissect_RSI_RSP_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); return offset; } static int dissect_RSIAdditionalFlags(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, guint8 *u8AddFlags) { guint8 u8WindowSize; guint8 u8Tack; proto_item *sub_item; proto_tree *sub_tree; /* additional flags */ sub_item = proto_tree_add_item(tree, hf_pn_rsi_add_flags, tvb, offset, 1, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rsi_add_flags); /* Bit 0 - 2 : AddFlags.WindowSize */ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_windowsize, u8AddFlags); /* Bit 3: AddFlags.Reserved */ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_reserved1, u8AddFlags); /* Bit 4: AddFlags.TACK */ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_tack, u8AddFlags); /* Bit 5: AddFlags.MoreFrag */ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_morefrag, u8AddFlags); /* Bit 6: AddFlags.Notification */ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_notification, u8AddFlags); /* Bit 7: AddFlags.Reserved */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_add_flags_reserved2, u8AddFlags); u8WindowSize = *u8AddFlags & 0x03; u8Tack = (*u8AddFlags & 0x10); u8Tack = (u8Tack == 0x10) ? 1 : 0; proto_item_append_text(sub_item, ", Window Size: %u, Tack: %u ", u8WindowSize, u8Tack); return offset; } /* dissect a PN-IO RTA RSI PDU (on top of PN-RT protocol) */ int dissect_PNIO_RSI(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint16 u16DestinationServiceAccessPoint; guint16 u16SourceServiceAccessPoint; guint8 u8PDUType; guint8 u8PDUVersion; guint8 u8AddFlags; guint8 u8MoreFrag; guint16 u16SendSeqNum; guint16 u16AckSeqNum; guint16 u16VarPartLen; int start_offset = offset; proto_item *rta_item; proto_tree *rta_tree; proto_item *sub_item; proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO-RSI"); rta_item = proto_tree_add_protocol_format(tree, proto_pn_rsi, tvb, offset, tvb_captured_length(tvb), "PROFINET IO RSI"); rta_tree = proto_item_add_subtree(rta_item, ett_pn_rsi_rta); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_rsi_dst_srv_access_point, &u16DestinationServiceAccessPoint); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_rsi_src_srv_access_point, &u16SourceServiceAccessPoint); //col_append_fstr(pinfo->cinfo, COL_INFO, ", Src: 0x%x, Dst: 0x%x", // u16SourceServiceAccessPoint, u16DestinationServiceAccessPoint); /* PDU type */ sub_item = proto_tree_add_item(rta_tree, hf_pn_rsi_pdu_type, tvb, offset, 1, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rsi_pdu_type); /* PDU type type - version of RTA 2*/ dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_pdu_type_type, &u8PDUType); u8PDUType &= 0x0F; /* PDU type version - version of RTA 2*/ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_pdu_type_version, &u8PDUVersion); u8PDUVersion >>= 4; //proto_item_append_text(sub_item, ", Type: %s, Version: %u", // val_to_str(u8PDUType, pn_rsi_pdu_type_type, "Unknown"), // u8PDUVersion); offset = dissect_RSIAdditionalFlags(tvb, offset, pinfo, rta_tree, drep, &u8AddFlags); u8MoreFrag = (u8AddFlags >> 5) & 0x1; offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_rsi_send_seq_num, &u16SendSeqNum); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_rsi_ack_seq_num, &u16AckSeqNum); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, rta_tree, drep, hf_pn_rsi_var_part_len, &u16VarPartLen); switch (u8PDUType & 0x0F) { case(3): /* ACK-RTA */ col_append_str(pinfo->cinfo, COL_INFO, "ACK-RTA"); if (u8AddFlags & 0x40) { col_append_str(pinfo->cinfo, COL_INFO, ", Application Ready Notification"); } /* no additional data */ break; case(4): /* ERR-RTA */ col_append_str(pinfo->cinfo, COL_INFO, "ERR-RTA"); offset = dissect_PNIO_status(tvb, offset, pinfo, rta_tree, drep); break; case(5): /* FREQ-RTA */ offset = dissect_FREQ_RTA_block(tvb, offset, pinfo, rta_tree, drep, u16VarPartLen, u8MoreFrag); break; case(6): /* FRSP-RTA */ offset = dissect_FRSP_RTA_block(tvb, offset, pinfo, rta_tree, drep, u16VarPartLen, u8MoreFrag); break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, tvb_captured_length(tvb)); break; } proto_item_set_len(rta_item, offset - start_offset); return offset; } int dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) { proto_item *sub_item; proto_tree *sub_tree; guint16 u16NumberOfEntries; guint16 u16VendorId; guint16 u16DeviceId; guint16 u16InstanceId; guint8 u8RsiInterface; const int deviceType_size = 25; const int orderID_size = 20; const int IMserialnumber_size = 16; const int HWrevision_size = 5; const int SWrevisionprefix_size = 1; const int SWrevision_size = 9; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_rsi_error, "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); return offset; } offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_rsi_number_of_entries, &u16NumberOfEntries); proto_item_append_text(item, ": NumberOfEntries:%u", u16NumberOfEntries); while (u16NumberOfEntries > 0) { u16NumberOfEntries--; sub_item = proto_tree_add_item(tree, hf_pn_rsi_pd_rsi_instance, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_pd_rsi_instance); /* VendorID */ /* DeviceID */ /* InstanceID */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_vendor_id, &u16VendorId); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_device_id, &u16DeviceId); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_instance_id, &u16InstanceId); /* RSI Interface */ offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_tree, drep, hf_pn_rsi_interface, &u8RsiInterface); proto_item_append_text(sub_item, ": VendorID:%u, DeviceID:%u, InstanceID:%u, RsiInterface:%u", u16VendorId, u16DeviceId, u16InstanceId, u8RsiInterface); /* Padding */ offset = dissect_pn_padding(tvb, offset, pinfo, sub_tree, 1); } /* SystemIdentification */ /* DeviceType */ proto_tree_add_item(tree, hf_pn_rsi_device_type, tvb, offset, deviceType_size, ENC_UTF_8); offset += deviceType_size + 1; /* Blank */ /* OrderID */ proto_tree_add_item(tree, hf_pn_rsi_order_id, tvb, offset, orderID_size, ENC_UTF_8); offset += orderID_size + 1; /* Blank */ /* IM_Serial_Number */ proto_tree_add_item(tree, hf_pn_rsi_im_serial_number, tvb, offset, IMserialnumber_size, ENC_UTF_8); offset += IMserialnumber_size + 1; /* Blank */ /* HWRevision */ proto_tree_add_item(tree, hf_pn_rsi_hw_revision, tvb, offset, HWrevision_size, ENC_UTF_8); offset += HWrevision_size + 1; /* Blank */ /* SWRevisionPrefix */ proto_tree_add_item(tree, hf_pn_rsi_sw_revision_prefix, tvb, offset, SWrevisionprefix_size, ENC_UTF_8); offset += SWrevisionprefix_size; /* SWRevision */ proto_tree_add_item(tree, hf_pn_rsi_sw_revision, tvb, offset, SWrevision_size, ENC_UTF_8); offset += SWrevision_size; return offset; } void init_pn_rsi(int proto) { static hf_register_info hf[] = { { &hf_pn_rsi_dst_srv_access_point, { "DestinationServiceAccessPoint", "pn_rsi.dst_srv_access_point", FT_UINT16, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_alarm_endpoint), 0x0, NULL, HFILL } }, { &hf_pn_rsi_src_srv_access_point, { "SourceServiceAccessPoint", "pn_rsi.src_srv_access_point", FT_UINT16, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_alarm_endpoint), 0x0, NULL, HFILL } }, { &hf_pn_rsi_pdu_type, { "PDUType", "pn_rsi.pdu_type", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_pdu_type_type, { "Type", "pn_rsi.pdu_type.type", FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_pdu_type_type), 0x0F, NULL, HFILL } }, { &hf_pn_rsi_pdu_type_version, { "Version", "pn_rsi.pdu_type.version", FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_pdu_type_version), 0xF0, NULL, HFILL } }, { &hf_pn_rsi_add_flags, { "AddFlags", "pn_rsi.add_flags", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_add_flags_windowsize, { "WindowSize", "pn_rsi.add_flags_windowsize", FT_UINT8, BASE_HEX, VALS(pn_rsi_add_flags_windowsize), 0x07, NULL, HFILL } }, { &hf_pn_rsi_add_flags_reserved1, { "Reserved", "pn_rsi.add_flags_reserved", FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL } }, { &hf_pn_rsi_add_flags_tack, { "TACK", "pn_rsi.add_flags_tack", FT_UINT8, BASE_HEX, VALS(pn_rsi_add_flags_tack), 0x10, NULL, HFILL } }, { &hf_pn_rsi_add_flags_morefrag, { "MoreFrag", "pn_rsi.add_flags_morefrag", FT_UINT8, BASE_HEX, VALS(pn_rsi_add_flags_morefrag), 0x20, NULL, HFILL } }, { &hf_pn_rsi_add_flags_notification, { "Notification", "pn_rsi.add_flags_notification", FT_UINT8, BASE_HEX, VALS(pn_rsi_add_flags_notification), 0x40, NULL, HFILL } }, { &hf_pn_rsi_add_flags_reserved2, { "Reserved", "pn_rsi.add_flags_reserved", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, { &hf_pn_rsi_send_seq_num, { "SendSeqNum", "pn_rsi.send_seq_num", FT_UINT16, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_seq_num), 0x0, NULL, HFILL } }, { &hf_pn_rsi_ack_seq_num, { "AckSeqNum", "pn_rsi.ack_seq_num", FT_UINT16, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_seq_num), 0x0, NULL, HFILL } }, { &hf_pn_rsi_var_part_len, { "VarPartLen", "pn_rsi.var_part_len", FT_UINT16, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_var_part_len), 0x0, NULL, HFILL } }, { &hf_pn_rsi_f_opnum_offset, { "FOpnumOffset", "pn_rsi.f_opnum_offset", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_f_opnum_offset_offset, { "FOpnumOffset.Offset", "pn_rsi.f_opnum_offset.offset", FT_UINT32, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_f_opnum_offset_offset), 0x00FFFFFF, NULL, HFILL } }, { &hf_pn_rsi_f_opnum_offset_opnum, { "FOpnumOffset.Opnum", "pn_rsi.f_opnum_offset.opnum", FT_UINT32, BASE_HEX, VALS(pn_rsi_f_opnum_offset_opnum), 0x1F000000, NULL, HFILL } }, { &hf_pn_rsi_f_opnum_offset_callsequence, { "FOpnumOffset.CallSequence", "pn_rsi.f_opnum_offset.callsequence", FT_UINT32, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_f_opnum_offset_callsequence), 0xE0000000, NULL, HFILL } }, { &hf_pn_rsi_conn_block, { "RSI CONN Block", "pn_rsi.conn_block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_rsp_max_length, { "RspMaxLength", "pn_rsi.rsp_max_length", FT_UINT32, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_rsp_max_length), 0x0, NULL, HFILL } }, { &hf_pn_rsi_vendor_id, { "VendorID", "pn_rsi.vendor_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_device_id, { "DeviceID", "pn_rsi.device_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_instance_id, { "InstanceID", "pn_rsi.instance_id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_interface, { "RsiInterface", "pn_rsi.interface", FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(pn_rsi_interface), 0x0, NULL, HFILL } }, { &hf_pn_rsi_svcs_block, { "RSI SVCS Block", "pn_rsi.svcs_block", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_number_of_entries, { "NumberOfEntries", "pn_rsi.number_of_entries", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_pd_rsi_instance, { "PDRsiInstance", "pn_rsi.pd_rsi_instance", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_device_type, { "DeviceType", "pn_rsi.device_type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_order_id, { "OrderID", "pn_rsi.order_id", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_im_serial_number, { "IM_Serial_Number", "pn_rsi.im_serial_number", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_hw_revision, { "HWRevision", "pn_rsi.hw_revision", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_sw_revision_prefix, { "SWRevisionPrefix", "pn_rsi.sw_revision_prefix", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_sw_revision, { "SWRevision", "pn_rsi.sw_revision", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /*&hf_pn_rsi_segment_too_long_segment, &hf_pn_rsi_segment_error, &hf_pn_rsi_segment_count, &hf_pn_rsi_reassembled_in, &hf_pn_rsi_reassembled_length,*/ { &hf_pn_rsi_segment, { "RSI Segment", "pn_rsi.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_segments, { "PN RSI Segments", "pn_rsi.segments", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_segment_overlap, { "Segment overlap", "pn_rsi.segment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Segment overlaps with other segments", HFILL } }, { &hf_pn_rsi_segment_overlap_conflict, { "Conflicting data in segment overlap", "pn_rsi.segment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Overlapping segments contained conflicting data", HFILL } }, { &hf_pn_rsi_segment_multiple_tails, { "Multiple tail segments found", "pn_rsi.segment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Several tails were found when reassembling the packet", HFILL } }, { &hf_pn_rsi_segment_too_long_segment, { "Segment too long", "pn_rsi.segment.toolongsegment", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Segment contained data past end of packet", HFILL } }, { &hf_pn_rsi_segment_error, { "Reassembly error", "pn_rsi.segment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "Reassembly error due to illegal segments", HFILL } }, { &hf_pn_rsi_segment_count, { "Segment count", "pn_rsi.segment.count", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_rsi_reassembled_in, { "Reassembled pn_rsi in frame", "pn_rsi.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This pn_rsi packet is reassembled in this frame", HFILL } }, { &hf_pn_rsi_reassembled_length, { "Reassembled pn_rsi length", "pn_rsi.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x0, "The total length of the reassembled payload", HFILL } }, { &hf_pn_rsi_data_payload, { "PN IO RSI Data Payload", "pn_rsi.data_payload", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL } } }; static gint *ett[] = { &ett_pn_rsi, &ett_pn_rsi_pdu_type, &ett_pn_rsi_f_opnum_offset, &ett_pn_rsi_conn_block, &ett_pn_rsi_svcs_block, &ett_pn_rsi_add_flags, &ett_pn_rsi_rta, &ett_pn_io_pd_rsi_instance, &ett_pn_rsi_segments, &ett_pn_rsi_segment, &ett_pn_rsi_data_payload }; static ei_register_info ei[] = { { &ei_pn_rsi_error, { "pn_rsi.error", PI_UNDECODED, PI_NOTE, "Block version not implemented yet!", EXPFILL } } }; expert_module_t* expert_pn_rsi; proto_pn_rsi = proto; proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_pn_rsi = expert_register_protocol(proto_pn_rsi); expert_register_field_array(expert_pn_rsi, ei, array_length(ei)); register_init_routine(pn_rsi_reassemble_init); }
C
wireshark/plugins/epan/profinet/packet-pn-rt.c
/* packet-pn-rt.c * Routines for pn-rt (PROFINET Real-Time) packet dissection. * This is the base for other PROFINET protocols like IO, CBA, DCP, ... * (the "content subdissectors" will register themselves using a heuristic) * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/packet.h> #include <epan/reassemble.h> #include <epan/prefs.h> #include <epan/etypes.h> #include <epan/expert.h> #include <epan/crc16-tvb.h> #include <epan/dissectors/packet-dcerpc.h> #include <wsutil/crc16-plain.h> #include "packet-pn.h" void proto_register_pn_rt(void); void proto_reg_handoff_pn_rt(void); #define PROFINET_UDP_PORT 0x8892 /* Define the pn-rt proto */ static int proto_pn_rt = -1; static gboolean pnio_desegment = TRUE; static dissector_handle_t pn_rt_handle; /* Define many header fields for pn-rt */ static int hf_pn_rt_frame_id = -1; static int hf_pn_rt_cycle_counter = -1; static int hf_pn_rt_transfer_status = -1; static int hf_pn_rt_data_status = -1; static int hf_pn_rt_data_status_ignore = -1; static int hf_pn_rt_frame_info_type = -1; static int hf_pn_rt_frame_info_function_meaning_input_conv = -1; static int hf_pn_rt_frame_info_function_meaning_output_conv = -1; static int hf_pn_rt_data_status_Reserved_2 = -1; static int hf_pn_rt_data_status_ok = -1; static int hf_pn_rt_data_status_operate = -1; static int hf_pn_rt_data_status_res3 = -1; static int hf_pn_rt_data_status_valid = -1; static int hf_pn_rt_data_status_redundancy = -1; static int hf_pn_rt_data_status_redundancy_output_cr = -1; static int hf_pn_rt_data_status_redundancy_input_cr_state_is_backup = -1; static int hf_pn_rt_data_status_redundancy_input_cr_state_is_primary = -1; static int hf_pn_rt_data_status_primary = -1; static int hf_pn_rt_sf_crc16 = -1; static int hf_pn_rt_sf_crc16_status = -1; static int hf_pn_rt_sf = -1; static int hf_pn_rt_sf_position = -1; /* static int hf_pn_rt_sf_position_control = -1; */ static int hf_pn_rt_sf_data_length = -1; static int hf_pn_rt_sf_cycle_counter = -1; static int hf_pn_rt_frag = -1; static int hf_pn_rt_frag_data_length = -1; static int hf_pn_rt_frag_status = -1; static int hf_pn_rt_frag_status_more_follows = -1; static int hf_pn_rt_frag_status_error = -1; static int hf_pn_rt_frag_status_fragment_number = -1; static int hf_pn_rt_frag_data = -1; /* * Define the trees for pn-rt * We need one tree for pn-rt itself and one for the pn-rt data status subtree */ static int ett_pn_rt = -1; static int ett_pn_rt_data_status = -1; static int ett_pn_rt_sf = -1; static int ett_pn_rt_frag = -1; static int ett_pn_rt_frag_status = -1; static expert_field ei_pn_rt_sf_crc16 = EI_INIT; /* * Here are the global variables associated with * the various user definable characteristics of the dissection */ /* Place summary in proto tree */ static gboolean pn_rt_summary_in_tree = TRUE; /* heuristic to find the right pn-rt payload dissector */ static heur_dissector_list_t heur_subdissector_list; #if 0 static const value_string pn_rt_position_control[] = { { 0x00, "CRC16 and CycleCounter shall not be checked" }, { 0x80, "CRC16 and CycleCounter valid" }, { 0, NULL } }; #endif static const true_false_string tfs_pn_rt_ds_redundancy_output_cr = { "Unknown", "Redundancy has no meaning for OutputCRs, it is set to the fixed value of zero" }; static const true_false_string tfs_pn_rt_ds_redundancy_input_cr_state_is_backup = { "None primary AR of a given AR-set is present", "Default - One primary AR of a given AR-set is present" }; static const true_false_string tfs_pn_rt_ds_redundancy_input_cr_state_is_primary = { "The ARState from the IO device point of view is Backup", "Default - The ARState from the IO device point of view is Primary" }; static const value_string pn_rt_frame_info_function_meaning_input_conv[] = { {0x00, "Backup Acknowledge without actual data" }, {0x02, "Primary Missing without actual data" }, {0x04, "Backup Acknowledge with actual data independent from the Arstate" }, {0x05, "Primary Acknowledge"}, {0x06, "Primary Missing with actual data independent from the Arstate" }, {0x07, "Primary Fault" }, {0, NULL} }; static const value_string pn_rt_frame_info_function_meaning_output_conv[] = { { 0x04, "Backup Request" }, { 0x05, "Primary Request" }, { 0, NULL } }; static const true_false_string tfs_pn_rt_ds_redundancy = { "None primary AR of a given AR-set is present", "Redundancy has no meaning for OutputCRs / One primary AR of a given AR-set is present" }; static const value_string pn_rt_frag_status_error[] = { { 0x00, "reserved" }, { 0x01, "reserved: invalid should be zero" }, { 0, NULL } }; static const value_string pn_rt_frag_status_more_follows[] = { { 0x00, "Last fragment" }, { 0x01, "More fragments follow" }, { 0, NULL } }; /* Copied and renamed from proto.c because global value_strings don't work for plugins */ static const value_string plugin_proto_checksum_vals[] = { { PROTO_CHECKSUM_E_BAD, "Bad" }, { PROTO_CHECKSUM_E_GOOD, "Good" }, { PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" }, { PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" }, { 0, NULL } }; static void dissect_DataStatus(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, guint8 u8DataStatus) { proto_item *sub_item; proto_tree *sub_tree; guint8 u8DataValid; guint8 u8Redundancy; guint8 u8State; conversation_t *conversation; gboolean inputFlag = FALSE; gboolean outputFlag = FALSE; apduStatusSwitch *apdu_status_switch; u8State = (u8DataStatus & 0x01); u8Redundancy = (u8DataStatus >> 1) & 0x01; u8DataValid = (u8DataStatus >> 2) & 0x01; /* if PN Connect Request has been read, IOC mac is dl_src and IOD mac is dl_dst */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_UDP, 0, 0, 0); if (conversation != NULL) { apdu_status_switch = (apduStatusSwitch*)conversation_get_proto_data(conversation, proto_pn_io_apdu_status); if (apdu_status_switch != NULL && apdu_status_switch->isRedundancyActive) { /* IOC -> IOD: OutputCR */ if (addresses_equal(&(pinfo->src), conversation_key_addr1(conversation->key_ptr)) && addresses_equal(&(pinfo->dst), conversation_key_addr2(conversation->key_ptr))) { outputFlag = TRUE; inputFlag = FALSE; } /* IOD -> IOC: InputCR */ if (addresses_equal(&(pinfo->dst), conversation_key_addr1(conversation->key_ptr)) && addresses_equal(&(pinfo->src), conversation_key_addr2(conversation->key_ptr))) { inputFlag = TRUE; outputFlag = FALSE; } } } /* input conversation is found */ if (inputFlag) { proto_tree_add_string_format_value(tree, hf_pn_rt_frame_info_type, tvb, offset, 0, "Input", "Input Frame (IO_Device -> IO_Controller)"); } /* output conversation is found. */ else if (outputFlag) { proto_tree_add_string_format_value(tree, hf_pn_rt_frame_info_type, tvb, offset, 0, "Output", "Output Frame (IO_Controller -> IO_Device)"); } sub_item = proto_tree_add_uint_format(tree, hf_pn_rt_data_status, tvb, offset, 1, u8DataStatus, "DataStatus: 0x%02x (Frame: %s and %s, Provider: %s and %s)", u8DataStatus, (u8DataStatus & 0x04) ? "Valid" : "Invalid", (u8DataStatus & 0x01) ? "Primary" : "Backup", (u8DataStatus & 0x20) ? "Ok" : "Problem", (u8DataStatus & 0x10) ? "Run" : "Stop"); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rt_data_status); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_ignore, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_Reserved_2, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_ok, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_operate, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_res3, tvb, offset, 1, u8DataStatus); /* input conversation is found */ if (inputFlag) { proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_valid, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(tree, hf_pn_rt_frame_info_function_meaning_input_conv, tvb, offset, 1, u8DataStatus); if (u8State == 0 && u8Redundancy == 0 && u8DataValid == 1) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_backup, tvb, offset, 1, u8DataStatus); } else if (u8State == 0 && u8Redundancy == 0 && u8DataValid == 0) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_backup, tvb, offset, 1, u8DataStatus); } else if (u8State == 0 && u8Redundancy == 1 && u8DataValid == 1) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_backup, tvb, offset, 1, u8DataStatus); } else if (u8State == 0 && u8Redundancy == 1 && u8DataValid == 0) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_backup, tvb, offset, 1, u8DataStatus); } else if (u8State == 1 && u8Redundancy == 0 && u8DataValid == 1) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_primary, tvb, offset, 1, u8DataStatus); } else if (u8State == 1 && u8Redundancy == 1 && u8DataValid == 1) { proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_input_cr_state_is_primary, tvb, offset, 1, u8DataStatus); } proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_primary, tvb, offset, 1, u8DataStatus); return; } // output conversation is found. else if (outputFlag) { proto_tree_add_uint(tree, hf_pn_rt_frame_info_function_meaning_output_conv, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_valid, tvb, offset, 1, u8DataStatus); proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy_output_cr, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_primary, tvb, offset, 1, u8DataStatus); return; } // If no conversation is found proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_valid, tvb, offset, 1, u8DataStatus); proto_tree_add_boolean(sub_tree, hf_pn_rt_data_status_redundancy, tvb, offset, 1, u8DataStatus); proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_primary, tvb, offset, 1, u8DataStatus); } static gboolean IsDFP_Frame(tvbuff_t *tvb, packet_info *pinfo, guint16 u16FrameID) { guint16 u16SFCRC16; guint8 u8SFPosition; guint8 u8SFDataLength = 255; int offset = 0; guint32 u32SubStart; guint16 crc; gint tvb_len = 0; unsigned char virtualFramebuffer[16]; /* try to build a temporaray buffer for generating this CRC */ if (!pinfo->src.data || !pinfo->dst.data || pinfo->dst.type != AT_ETHER || pinfo->src.type != AT_ETHER) { /* if we don't have src/dst mac addresses then we assume it's not * to avoid various crashes */ return FALSE; } memcpy(&virtualFramebuffer[0], pinfo->dst.data, 6); memcpy(&virtualFramebuffer[6], pinfo->src.data, 6); virtualFramebuffer[12] = 0x88; virtualFramebuffer[13] = 0x92; virtualFramebuffer[15] = (unsigned char) (u16FrameID &0xff); virtualFramebuffer[14] = (unsigned char) (u16FrameID>>8); crc = crc16_plain_init(); crc = crc16_plain_update(crc, &virtualFramebuffer[0], 16); crc = crc16_plain_finalize(crc); /* can check this CRC only by having built a temporary data buffer out of the pinfo data */ u16SFCRC16 = tvb_get_letohs(tvb, offset); if (u16SFCRC16 != 0) /* no crc! */ { if (u16SFCRC16 != crc) { return(FALSE); } } /* end of first CRC check */ offset += 2; /*Skip first crc */ tvb_len = tvb_captured_length(tvb); if (offset + 4 > tvb_len) return FALSE; if (tvb_get_letohs(tvb, offset) == 0) return FALSE; /* no valid DFP frame */ while (1) { u32SubStart = offset; u8SFPosition = tvb_get_guint8(tvb, offset); offset += 1; u8SFDataLength = tvb_get_guint8(tvb, offset); offset += 1; if (u8SFDataLength == 0) { break; } offset += 2; offset += u8SFDataLength; if (offset > tvb_len) return /*TRUE; */FALSE; u16SFCRC16 = tvb_get_letohs(tvb, offset); if (u16SFCRC16 != 0) { if (u8SFPosition & 0x80) { crc = crc16_plain_tvb_offset_seed(tvb, u32SubStart, offset-u32SubStart, 0); if (crc != u16SFCRC16) { return FALSE; } else { } } else { } } offset += 2; } return TRUE; } /* possibly dissect a CSF_SDU related PN-RT packet */ gboolean dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { /* the sub tvb will NOT contain the frame_id here! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); guint16 u16SFCRC16; guint8 u8SFPosition; guint8 u8SFDataLength = 255; guint8 u8SFCycleCounter; guint8 u8SFDataStatus; gint offset = 0; guint32 u32SubStart; proto_item *sub_item; proto_tree *sub_tree; guint16 crc; /* possible FrameID ranges for DFP */ if ((u16FrameID < 0x0100) || (u16FrameID > 0x3FFF)) return (FALSE); if (IsDFP_Frame(tvb, pinfo, u16FrameID)) { /* can't check this CRC, as the checked data bytes are not available */ u16SFCRC16 = tvb_get_letohs(tvb, offset); if (u16SFCRC16 != 0) { /* Checksum verify will always succeed */ /* XXX - should we combine the two calls to always show "unverified"? */ proto_tree_add_checksum(tree, tvb, offset, hf_pn_rt_sf_crc16, hf_pn_rt_sf_crc16_status, &ei_pn_rt_sf_crc16, pinfo, u16SFCRC16, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { proto_tree_add_checksum(tree, tvb, offset, hf_pn_rt_sf_crc16, hf_pn_rt_sf_crc16_status, &ei_pn_rt_sf_crc16, pinfo, 0, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; while (1) { sub_item = proto_tree_add_item(tree, hf_pn_rt_sf, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rt_sf); u32SubStart = offset; u8SFPosition = tvb_get_guint8(tvb, offset); proto_tree_add_uint(sub_tree, hf_pn_rt_sf_position, tvb, offset, 1, u8SFPosition); offset += 1; u8SFDataLength = tvb_get_guint8(tvb, offset); proto_tree_add_uint(sub_tree, hf_pn_rt_sf_data_length, tvb, offset, 1, u8SFDataLength); offset += 1; if (u8SFDataLength == 0) { proto_item_append_text(sub_item, ": Pos:%u, Length:%u", u8SFPosition, u8SFDataLength); proto_item_set_len(sub_item, offset - u32SubStart); break; } u8SFCycleCounter = tvb_get_guint8(tvb, offset); proto_tree_add_uint(sub_tree, hf_pn_rt_sf_cycle_counter, tvb, offset, 1, u8SFCycleCounter); offset += 1; u8SFDataStatus = tvb_get_guint8(tvb, offset); dissect_DataStatus(tvb, offset, sub_tree, pinfo, u8SFDataStatus); offset += 1; offset = dissect_pn_user_data(tvb, offset, pinfo, sub_tree, u8SFDataLength, "DataItem"); u16SFCRC16 = tvb_get_letohs(tvb, offset); if (u16SFCRC16 != 0 /* "old check": u8SFPosition & 0x80 */) { crc = crc16_plain_tvb_offset_seed(tvb, u32SubStart, offset-u32SubStart, 0); proto_tree_add_checksum(tree, tvb, offset, hf_pn_rt_sf_crc16, hf_pn_rt_sf_crc16_status, &ei_pn_rt_sf_crc16, pinfo, crc, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { proto_tree_add_checksum(tree, tvb, offset, hf_pn_rt_sf_crc16, hf_pn_rt_sf_crc16_status, &ei_pn_rt_sf_crc16, pinfo, 0, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; proto_item_append_text(sub_item, ": Pos:%u, Length:%u, Cycle:%u, Status: 0x%02x (%s,%s,%s,%s)", u8SFPosition, u8SFDataLength, u8SFCycleCounter, u8SFDataStatus, (u8SFDataStatus & 0x04) ? "Valid" : "Invalid", (u8SFDataStatus & 0x01) ? "Primary" : "Backup", (u8SFDataStatus & 0x20) ? "Ok" : "Problem", (u8SFDataStatus & 0x10) ? "Run" : "Stop"); proto_item_set_len(sub_item, offset - u32SubStart); } return TRUE; } else { dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset), "PROFINET IO Cyclic Service Data Unit"); } return FALSE; } /* for reasemble processing we need some inits.. */ /* Register PNIO defrag table init routine. */ static reassembly_table pdu_reassembly_table; static GHashTable *reasembled_frag_table = NULL; static dissector_table_t ethertype_subdissector_table; static guint32 start_frag_OR_ID[16]; static void pnio_defragment_init(void) { guint32 i; for (i=0; i < 16; i++) /* init the reasemble help array */ start_frag_OR_ID[i] = 0; reasembled_frag_table = g_hash_table_new(NULL, NULL); } static void pnio_defragment_cleanup(void) { g_hash_table_destroy(reasembled_frag_table); } /* possibly dissect a FRAG_PDU related PN-RT packet */ static gboolean dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { /* the sub tvb will NOT contain the frame_id here! */ guint16 u16FrameID = GPOINTER_TO_UINT(data); int offset = 0; /* possible FrameID ranges for FRAG_PDU */ if (u16FrameID >= 0xFF80 && u16FrameID <= 0xFF8F) { proto_item *sub_item; proto_tree *sub_tree; proto_item *status_item; proto_tree *status_tree; guint8 u8FragDataLength; guint8 u8FragStatus; gboolean bMoreFollows; guint8 uFragNumber; sub_item = proto_tree_add_item(tree, hf_pn_rt_frag, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_rt_frag); u8FragDataLength = tvb_get_guint8(tvb, offset); proto_tree_add_uint(sub_tree, hf_pn_rt_frag_data_length, tvb, offset, 1, u8FragDataLength); offset += 1; status_item = proto_tree_add_item(sub_tree, hf_pn_rt_frag_status, tvb, offset, 1, ENC_NA); status_tree = proto_item_add_subtree(status_item, ett_pn_rt_frag_status); u8FragStatus = tvb_get_guint8(tvb, offset); proto_tree_add_uint(status_tree, hf_pn_rt_frag_status_more_follows, tvb, offset, 1, u8FragStatus); proto_tree_add_uint(status_tree, hf_pn_rt_frag_status_error, tvb, offset, 1, u8FragStatus); proto_tree_add_uint(status_tree, hf_pn_rt_frag_status_fragment_number, tvb, offset, 1, u8FragStatus); offset += 1; uFragNumber = u8FragStatus & 0x3F; /* bits 0 to 5 */ bMoreFollows = (u8FragStatus & 0x80) != 0; proto_item_append_text(status_item, ": Number: %u, %s", uFragNumber, val_to_str_const( (u8FragStatus & 0x80) >> 7, pn_rt_frag_status_more_follows, "Unknown")); /* Is this a string or a bunch of bytes? Should it be FT_BYTES? */ proto_tree_add_string_format(sub_tree, hf_pn_rt_frag_data, tvb, offset, tvb_captured_length_remaining(tvb, offset), "data", "Fragment Length: %d bytes", tvb_captured_length_remaining(tvb, offset)); col_append_fstr(pinfo->cinfo, COL_INFO, " Fragment Length: %d bytes", tvb_captured_length_remaining(tvb, offset)); dissect_pn_user_data_bytes(tvb, offset, pinfo, sub_tree, tvb_captured_length_remaining(tvb, offset), FRAG_DATA); if ((guint)tvb_captured_length_remaining(tvb, offset) < (guint)(u8FragDataLength *8)) { proto_item_append_text(status_item, ": FragDataLength out of Framerange -> discarding!"); return (TRUE); } /* defragmentation starts here */ if (pnio_desegment) { guint32 u32FragID; guint32 u32ReasembleID /*= 0xfedc ??*/; fragment_head *pdu_frag; u32FragID = (u16FrameID & 0xf); if (uFragNumber == 0) { /* this is the first "new" fragment, so set up a new key Id */ guint32 u32FrameKey; u32FrameKey = (pinfo->num << 2) | u32FragID; /* store it in the array */ start_frag_OR_ID[u32FragID] = u32FrameKey; } u32ReasembleID = start_frag_OR_ID[u32FragID]; /* use frame data instead of "pnio fraglen" which sets 8 octet steps */ pdu_frag = fragment_add_seq(&pdu_reassembly_table, tvb, offset, pinfo, u32ReasembleID, NULL, uFragNumber, (tvb_captured_length_remaining(tvb, offset))/*u8FragDataLength*8*/, bMoreFollows, 0); if (pdu_frag && !bMoreFollows) /* PDU is complete! and last fragment */ { /* store this fragment as the completed fragment in hash table */ g_hash_table_insert(reasembled_frag_table, GUINT_TO_POINTER(pinfo->num), pdu_frag); start_frag_OR_ID[u32FragID] = 0; /* reset the starting frame counter */ } if (!bMoreFollows) /* last fragment */ { pdu_frag = (fragment_head *)g_hash_table_lookup(reasembled_frag_table, GUINT_TO_POINTER(pinfo->num)); if (pdu_frag) /* found a matching fragment; dissect it */ { guint16 type; tvbuff_t *pdu_tvb; /* create the new tvb for defragmented frame */ pdu_tvb = tvb_new_chain(tvb, pdu_frag->tvb_data); /* add the defragmented data to the data source list */ add_new_data_source(pinfo, pdu_tvb, "Reassembled Profinet Frame"); /* PDU is complete: look for the Ethertype and give it to the appropriate dissection routine */ type = tvb_get_ntohs(pdu_tvb, 0); pdu_tvb = tvb_new_subset_remaining(pdu_tvb, 2); if (!dissector_try_uint(ethertype_subdissector_table, type, pdu_tvb, pinfo, tree)) call_data_dissector(pdu_tvb, pinfo, tree); } } return TRUE; } else return TRUE; } return FALSE; } /* * dissect_pn_rt - The dissector for the Soft-Real-Time protocol */ static int dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { gint pdu_len; gint data_len; guint16 u16FrameID; guint8 u8DataStatus; guint8 u8TransferStatus; guint16 u16CycleCounter; const gchar *pszProtAddInfo; const gchar *pszProtShort; const gchar *pszProtSummary; const gchar *pszProtComment; proto_tree *pn_rt_tree, *ti; gchar szFieldSummary[100]; tvbuff_t *next_tvb; gboolean bCyclic; heur_dtbl_entry_t *hdtbl_entry; conversation_t* conversation; guint8 isTimeAware = FALSE; /* If the link-layer dissector for the protocol above us knows whether * the packet, as handed to it, includes a link-layer FCS, what it * hands to us should not include the FCS; if that's not the case, * that's a bug in that dissector, and should be fixed there. * * If the link-layer dissector for the protocol above us doesn't know * whether the packet, as handed to us, includes a link-layer FCS, * there are limits as to what can be done there; the dissector * ultimately needs a "yes, it has an FCS" preference setting, which * both the Ethernet and 802.11 dissectors do. If that's not the case * for a dissector, that's a deficiency in that dissector, and should * be fixed there. * * Therefore, we assume we are not handed a packet that includes an * FCS. If we are ever handed such a packet, either the link-layer * dissector needs to be fixed or the link-layer dissector's preference * needs to be set for your capture (even if that means adding such * a preference). This dissector (and other dissectors for protcols * running atop the link layer) should not attempt to process the * FCS themselves, as that will just break things. */ /* Initialize variables */ pn_rt_tree = NULL; ti = NULL; /* * Set the columns now, so that they'll be set correctly if we throw * an exception. We can set them (or append things) later again .... */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PN-RT"); col_set_str(pinfo->cinfo, COL_INFO, "PROFINET Real-Time"); pdu_len = tvb_reported_length(tvb); if (pdu_len < 6) { dissect_pn_malformed(tvb, 0, pinfo, tree, pdu_len); return 0; } /* TimeAwareness Information needed for differentiating RTC3 - RTSteam frames */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); if (conversation != NULL) { isTimeAware = GPOINTER_TO_UINT(conversation_get_proto_data(conversation, proto_pn_io_time_aware_status)); } /* build some "raw" data */ u16FrameID = tvb_get_ntohs(tvb, 0); if (u16FrameID <= 0x001F) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x0000-0x001F: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x0021) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "Synchronization, "; pszProtSummary = "Real-Time"; pszProtComment = "0x0020-0x0021: Real-Time: Sync (with follow up)"; bCyclic = FALSE; } else if (u16FrameID <= 0x007F) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x0022-0x007F: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x0081) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "Synchronization, "; pszProtSummary = "Isochronous-Real-Time"; pszProtComment = "0x0080-0x0081: Real-Time: Sync (without follow up)"; bCyclic = FALSE; } else if (u16FrameID <= 0x00FF) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x0082-0x00FF: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x6FF && !isTimeAware) { pszProtShort = "PN-RTC3"; pszProtAddInfo = "RTC3, "; pszProtSummary = "Isochronous-Real-Time"; pszProtComment = "0x0100-0x06FF: RED: Real-Time(class=3): non redundant, normal or DFP"; bCyclic = TRUE; } else if (u16FrameID <= 0x0FFF && !isTimeAware) { pszProtShort = "PN-RTC3"; pszProtAddInfo = "RTC3, "; pszProtSummary = "Isochronous-Real-Time"; pszProtComment = "0x0700-0x0FFF: RED: Real-Time(class=3): redundant, normal or DFP"; bCyclic = TRUE; } else if (u16FrameID <= 0x7FFF && !isTimeAware) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x1000-0x7FFF: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x0FFF && isTimeAware) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x0100-0x0FFF: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x2FFF && isTimeAware) { pszProtShort = "PN-RTCS"; pszProtAddInfo = "RT_STREAM, "; pszProtSummary = "Real-Time"; pszProtComment = "0x1000-0x2FFF: RT_CLASS_STREAM"; bCyclic = TRUE; } else if (u16FrameID <= 0x37FF && isTimeAware) { pszProtShort = "PN-RT"; pszProtAddInfo = "reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0x3000-0x37FF: Reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0x3FFF && isTimeAware) { pszProtShort = "PN-RTCS"; pszProtAddInfo = "RT_STREAM, "; pszProtSummary = "Real-Time"; pszProtComment = "0x3800-0x3FFF: RT_CLASS_STREAM"; bCyclic = TRUE; } else if (u16FrameID <= 0xBBFF) { pszProtShort = "PN-RTC1"; pszProtAddInfo = "RTC1, "; pszProtSummary = "cyclic Real-Time"; pszProtComment = "0x8000-0xBBFF: Real-Time(class=1 unicast): non redundant, normal"; bCyclic = TRUE; } else if (u16FrameID <= 0xBFFF) { pszProtShort = "PN-RTC1"; pszProtAddInfo = "RTC1, "; pszProtSummary = "cyclic Real-Time"; pszProtComment = "0xBC00-0xBFFF: Real-Time(class=1 multicast): non redundant, normal"; bCyclic = TRUE; } else if (u16FrameID <= 0xF7FF) { /* check if udp frame on PNIO port */ if (pinfo->destport == 0x8892) { /* UDP frame */ pszProtShort = "PN-RTCUDP,"; pszProtAddInfo = "RT_CLASS_UDP, "; pszProtComment = "0xC000-0xF7FF: Real-Time(UDP unicast): Cyclic"; } else { /* layer 2 frame */ pszProtShort = "PN-RT"; pszProtAddInfo = "RTC1(legacy), "; pszProtComment = "0xC000-0xF7FF: Real-Time(class=1 unicast): Cyclic"; } pszProtSummary = "cyclic Real-Time"; bCyclic = TRUE; } else if (u16FrameID <= 0xFBFF) { if (pinfo->destport == 0x8892) { /* UDP frame */ pszProtShort = "PN-RTCUDP,"; pszProtAddInfo = "RT_CLASS_UDP, "; pszProtComment = "0xF800-0xFBFF:: Real-Time(UDP multicast): Cyclic"; } else { /* layer 2 frame */ pszProtShort = "PN-RT"; pszProtAddInfo = "RTC1(legacy), "; pszProtComment = "0xF800-0xFBFF: Real-Time(class=1 multicast): Cyclic"; } pszProtSummary = "cyclic Real-Time"; bCyclic = TRUE; } else if (u16FrameID <= 0xFDFF) { pszProtShort = "PN-RTA"; pszProtAddInfo = "Reserved, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFC00-0xFDFF: Reserved"; bCyclic = FALSE; if (u16FrameID == 0xfc01) { pszProtShort = "PN-RTA"; pszProtAddInfo = "Alarm High, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: Acyclic PN-IO Alarm high priority"; } } else if (u16FrameID <= 0xFEFF) { pszProtShort = "PN-RTA"; pszProtAddInfo = "Reserved, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFE00-0xFEFF: Real-Time: Reserved"; bCyclic = FALSE; if (u16FrameID == 0xFE01) { pszProtShort = "PN-RTA"; pszProtAddInfo = "Alarm Low, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: Acyclic PN-IO Alarm low priority"; } if (u16FrameID == 0xFE02) { pszProtShort = "PN-RSI"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: Acyclic PN-IO RSI"; } if (u16FrameID == FRAME_ID_DCP_HELLO) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol) hello"; } if (u16FrameID == FRAME_ID_DCP_GETORSET) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol) get/set"; } if (u16FrameID == FRAME_ID_DCP_IDENT_REQ) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol) identify multicast request"; } if (u16FrameID == FRAME_ID_DCP_IDENT_RES) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol) identify response"; } } else if (u16FrameID <= 0xFF01) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "RTA Sync, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFF00-0xFF01: PTCP Announce"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF1F) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "RTA Sync, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFF02-0xFF1F: Reserved"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF21) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "Follow Up, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFF20-0xFF21: PTCP Follow Up"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF22) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "Follow Up, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFF22-0xFF3F: Reserved"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF43) { pszProtShort = "PN-PTCP"; pszProtAddInfo = "Delay, "; pszProtSummary = "acyclic Real-Time"; pszProtComment = "0xFF40-0xFF43: Acyclic Real-Time: Delay"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF7F) { pszProtShort = "PN-RT"; pszProtAddInfo = "Reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0xFF44-0xFF7F: reserved ID"; bCyclic = FALSE; } else if (u16FrameID <= 0xFF8F) { pszProtShort = "PN-RT"; pszProtAddInfo = ""; pszProtSummary = "Fragmentation"; pszProtComment = "0xFF80-0xFF8F: Fragmentation"; bCyclic = FALSE; } else { pszProtShort = "PN-RT"; pszProtAddInfo = "Reserved, "; pszProtSummary = "Real-Time"; pszProtComment = "0xFF90-0xFFFF: reserved ID"; bCyclic = FALSE; } /* decode optional cyclic fields at the packet end and build the summary line */ if (bCyclic) { /* cyclic transfer has cycle counter, data status and transfer status fields at the end */ u16CycleCounter = tvb_get_ntohs(tvb, pdu_len - 4); u8DataStatus = tvb_get_guint8(tvb, pdu_len - 2); u8TransferStatus = tvb_get_guint8(tvb, pdu_len - 1); snprintf (szFieldSummary, sizeof(szFieldSummary), "%sID:0x%04x, Len:%4u, Cycle:%5u (%s,%s,%s,%s)", pszProtAddInfo, u16FrameID, pdu_len - 2 - 4, u16CycleCounter, (u8DataStatus & 0x04) ? "Valid" : "Invalid", (u8DataStatus & 0x01) ? "Primary" : "Backup", (u8DataStatus & 0x20) ? "Ok" : "Problem", (u8DataStatus & 0x10) ? "Run" : "Stop"); /* user data length is packet len - frame id - optional cyclic status fields */ data_len = pdu_len - 2 - 4; } else { /* satisfy the gcc compiler, so it won't throw an "uninitialized" warning */ u16CycleCounter = 0; u8DataStatus = 0; u8TransferStatus = 0; /* acyclic transfer has no fields at the end */ snprintf (szFieldSummary, sizeof(szFieldSummary), "%sID:0x%04x, Len:%4u", pszProtAddInfo, u16FrameID, pdu_len - 2); /* user data length is packet len - frame id field */ data_len = pdu_len - 2; } /* build protocol tree only, if tree is really used */ if (tree) { /* build pn_rt protocol tree with summary line */ if (pn_rt_summary_in_tree) { ti = proto_tree_add_protocol_format(tree, proto_pn_rt, tvb, 0, pdu_len, "PROFINET %s, %s", pszProtSummary, szFieldSummary); } else { ti = proto_tree_add_item(tree, proto_pn_rt, tvb, 0, pdu_len, ENC_NA); } pn_rt_tree = proto_item_add_subtree(ti, ett_pn_rt); /* add frame ID */ proto_tree_add_uint_format(pn_rt_tree, hf_pn_rt_frame_id, tvb, 0, 2, u16FrameID, "FrameID: 0x%04x (%s)", u16FrameID, pszProtComment); if (bCyclic) { /* add cycle counter */ proto_tree_add_uint_format(pn_rt_tree, hf_pn_rt_cycle_counter, tvb, pdu_len - 4, 2, u16CycleCounter, "CycleCounter: %u", u16CycleCounter); /* add data status subtree */ dissect_DataStatus(tvb, pdu_len - 2, pn_rt_tree, pinfo, u8DataStatus); /* add transfer status */ if (u8TransferStatus) { proto_tree_add_uint_format(pn_rt_tree, hf_pn_rt_transfer_status, tvb, pdu_len - 1, 1, u8TransferStatus, "TransferStatus: 0x%02x (ignore this frame)", u8TransferStatus); } else { proto_tree_add_uint_format(pn_rt_tree, hf_pn_rt_transfer_status, tvb, pdu_len - 1, 1, u8TransferStatus, "TransferStatus: 0x%02x (OK)", u8TransferStatus); } } } /* update column info now */ if (u16FrameID == 0xFE02) { snprintf(szFieldSummary, sizeof(szFieldSummary), "%s", ""); } col_add_str(pinfo->cinfo, COL_INFO, szFieldSummary); col_set_str(pinfo->cinfo, COL_PROTOCOL, pszProtShort); /* get frame user data tvb (without header and footer) */ next_tvb = tvb_new_subset_length(tvb, 2, data_len); /* ask heuristics, if some sub-dissector is interested in this packet payload */ if (!dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, GUINT_TO_POINTER( (guint32) u16FrameID))) { /*col_set_str(pinfo->cinfo, COL_INFO, "Unknown");*/ /* Oh, well, we don't know this; dissect it as data. */ dissect_pn_undecoded(next_tvb, 0, pinfo, tree, tvb_captured_length(next_tvb)); } return tvb_captured_length(tvb); } /* Register all the bits needed by the filtering engine */ void proto_register_pn_rt(void) { static hf_register_info hf[] = { { &hf_pn_rt_frame_id, { "FrameID", "pn_rt.frame_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_cycle_counter, { "CycleCounter", "pn_rt.cycle_counter", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_data_status, { "DataStatus", "pn_rt.ds", FT_UINT8, BASE_HEX, 0, 0x0, NULL, HFILL }}, { &hf_pn_rt_data_status_ignore, { "Ignore (1:Ignore/0:Evaluate)", "pn_rt.ds_ignore", FT_UINT8, BASE_HEX, 0, 0x80, NULL, HFILL }}, { &hf_pn_rt_frame_info_type, { "PN Frame Type", "pn_rt.ds_frame_info_type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_frame_info_function_meaning_input_conv, { "Function/Meaning", "pn_rt.ds_frame_info_meaning", FT_UINT8, BASE_HEX, VALS(pn_rt_frame_info_function_meaning_input_conv), 0x7, NULL, HFILL } }, { &hf_pn_rt_frame_info_function_meaning_output_conv, { "Function/Meaning", "pn_rt.ds_frame_info_meaning", FT_UINT8, BASE_HEX, VALS(pn_rt_frame_info_function_meaning_output_conv), 0x7, NULL, HFILL } }, { &hf_pn_rt_data_status_Reserved_2, { "Reserved_2 (should be zero)", "pn_rt.ds_Reserved_2", FT_UINT8, BASE_HEX, 0, 0x40, NULL, HFILL }}, { &hf_pn_rt_data_status_ok, { "StationProblemIndicator (1:Ok/0:Problem)", "pn_rt.ds_ok", FT_UINT8, BASE_HEX, 0, 0x20, NULL, HFILL }}, { &hf_pn_rt_data_status_operate, { "ProviderState (1:Run/0:Stop)", "pn_rt.ds_operate", FT_UINT8, BASE_HEX, 0, 0x10, NULL, HFILL }}, { &hf_pn_rt_data_status_res3, { "Reserved_3 (should be zero)", "pn_rt.ds_res3", FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }}, { &hf_pn_rt_data_status_valid, { "DataValid (1:Valid/0:Invalid)", "pn_rt.ds_valid", FT_UINT8, BASE_HEX, 0, 0x04, NULL, HFILL }}, { &hf_pn_rt_data_status_redundancy, { "Redundancy", "pn_rt.ds_redundancy", FT_BOOLEAN, 8, TFS(&tfs_pn_rt_ds_redundancy), 0x02, NULL, HFILL }}, { &hf_pn_rt_data_status_redundancy_output_cr, { "Redundancy", "pn_rt.ds_redundancy", FT_BOOLEAN, 8, TFS(&tfs_pn_rt_ds_redundancy_output_cr), 0x02, NULL, HFILL }}, { &hf_pn_rt_data_status_redundancy_input_cr_state_is_backup, { "Redundancy", "pn_rt.ds_redundancy", FT_BOOLEAN, 8, TFS(&tfs_pn_rt_ds_redundancy_input_cr_state_is_backup), 0x02, NULL, HFILL }}, { &hf_pn_rt_data_status_redundancy_input_cr_state_is_primary, { "Redundancy", "pn_rt.ds_redundancy", FT_BOOLEAN, 8, TFS(&tfs_pn_rt_ds_redundancy_input_cr_state_is_primary), 0x02, NULL, HFILL }}, { &hf_pn_rt_data_status_primary, { "State (1:Primary/0:Backup)", "pn_rt.ds_primary", FT_UINT8, BASE_HEX, 0, 0x01, NULL, HFILL }}, { &hf_pn_rt_transfer_status, { "TransferStatus", "pn_rt.transfer_status", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_sf, { "SubFrame", "pn_rt.sf", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_sf_crc16, { "SFCRC16", "pn_rt.sf.crc16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_sf_crc16_status, { "SFCRC16 status", "pn_rt.sf.crc16.status", FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_pn_rt_sf_position, { "Position", "pn_rt.sf.position", FT_UINT8, BASE_DEC, NULL, 0x7F, NULL, HFILL }}, #if 0 { &hf_pn_rt_sf_position_control, { "Control", "pn_rt.sf.position_control", FT_UINT8, BASE_DEC, VALS(pn_rt_position_control), 0x80, NULL, HFILL }}, #endif { &hf_pn_rt_sf_data_length, { "DataLength", "pn_rt.sf.data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_sf_cycle_counter, { "CycleCounter", "pn_rt.sf.cycle_counter", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_frag, { "PROFINET Fragment", "pn_rt.frag", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_frag_data_length, { "FragDataLength", "pn_rt.frag_data_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_frag_status, { "FragStatus", "pn_rt.frag_status", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_pn_rt_frag_status_more_follows, { "MoreFollows", "pn_rt.frag_status.more_follows", FT_UINT8, BASE_HEX, VALS(pn_rt_frag_status_more_follows), 0x80, NULL, HFILL }}, { &hf_pn_rt_frag_status_error, { "Reserved", "pn_rt.frag_status.error", FT_UINT8, BASE_HEX, VALS(pn_rt_frag_status_error), 0x40, NULL, HFILL }}, { &hf_pn_rt_frag_status_fragment_number, { "FragmentNumber (zero based)", "pn_rt.frag_status.fragment_number", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }}, /* Is this a string or a bunch of bytes? Should it be FT_BYTES? */ { &hf_pn_rt_frag_data, { "FragData", "pn_rt.frag_data", FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL }}, }; static gint *ett[] = { &ett_pn_rt, &ett_pn_rt_data_status, &ett_pn_rt_sf, &ett_pn_rt_frag, &ett_pn_rt_frag_status }; static ei_register_info ei[] = { { &ei_pn_rt_sf_crc16, { "pn_rt.sf.crc16_bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *pn_rt_module; expert_module_t* expert_pn_rt; proto_pn_rt = proto_register_protocol("PROFINET Real-Time Protocol", "PN-RT", "pn_rt"); pn_rt_handle = register_dissector("pn_rt", dissect_pn_rt, proto_pn_rt); proto_register_field_array(proto_pn_rt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_pn_rt = expert_register_protocol(proto_pn_rt); expert_register_field_array(expert_pn_rt, ei, array_length(ei)); /* Register our configuration options */ pn_rt_module = prefs_register_protocol(proto_pn_rt, NULL); prefs_register_bool_preference(pn_rt_module, "summary_in_tree", "Show PN-RT summary in protocol tree", "Whether the PN-RT summary line should be shown in the protocol tree", &pn_rt_summary_in_tree); prefs_register_bool_preference(pn_rt_module, "desegment", "reassemble PNIO Fragments", "Reassemble PNIO Fragments and get them decoded", &pnio_desegment); /* register heuristics anchor for payload dissectors */ heur_subdissector_list = register_heur_dissector_list("pn_rt", proto_pn_rt); init_pn (proto_pn_rt); register_init_routine(pnio_defragment_init); register_cleanup_routine(pnio_defragment_cleanup); reassembly_table_register(&pdu_reassembly_table, &addresses_reassembly_table_functions); } /* The registration hand-off routine is called at startup */ void proto_reg_handoff_pn_rt(void) { dissector_add_uint("ethertype", ETHERTYPE_PROFINET, pn_rt_handle); dissector_add_uint_with_preference("udp.port", PROFINET_UDP_PORT, pn_rt_handle); heur_dissector_add("pn_rt", dissect_CSF_SDU_heur, "PROFINET CSF_SDU IO", "pn_csf_sdu_pn_rt", proto_pn_rt, HEURISTIC_ENABLE); heur_dissector_add("pn_rt", dissect_FRAG_PDU_heur, "PROFINET Frag PDU IO", "pn_frag_pn_rt", proto_pn_rt, HEURISTIC_ENABLE); ethertype_subdissector_table = find_dissector_table("ethertype"); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn-rtc-one.c
/* packet-pn-rtc-one.c * Routines for PROFINET IO - RTC1 dissection. * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* * The PN-IO protocol is a field bus protocol related to decentralized * periphery and is developed by the PROFIBUS Nutzerorganisation e.V. (PNO), * see: www.profibus.com * * * PN-IO is based on the common DCE-RPC and the "lightweight" PN-RT * (ethernet type 0x8892) protocols. * * The context manager (CM) part is handling context information * (like establishing, ...) and is using DCE-RPC as its underlying * protocol. * * The actual cyclic data transfer and acyclic notification uses the * "lightweight" PN-RT protocol. * * There are some other related PROFINET protocols (e.g. PN-DCP, which is * handling addressing topics). * * Please note: the PROFINET CBA protocol is independent of the PN-IO protocol! */ /* * Cyclic PNIO RTC1 Data Dissection: * * To dissect cyclic PNIO RTC1 frames, this plug-in has to collect important module * information out of "Ident OK", "Connect Request" and "Write Response" * frames first. * * The data of Stationname-, -type and -id will be gained out of * packet-pn-dcp.c. The header packet-pn.h will transfer those data between * those two files. * * This file is used as a "addon" for packet-dcerpc-pn-io.c. Within "packet-dcerpc-pn-io.c" * the defined structures in "packet-pn.h" will be filled with all necessary information. * Those informations will be used in thise file to dissect cyclic PNIO RTC1 and PROFIsafe * frames. Furthermore since RTC1 is a special frame type of PNIO, this dissection uses the * already defined protocol PNIO. * * Overview for cyclic PNIO RTC1 data dissection functions: * -> dissect_PNIO_C_SDU_RTC1 (general dissection of RTC1) */ #include "config.h" #include <stdio.h> #include <string.h> #include <glib.h> #include <epan/packet.h> #include <epan/dissectors/packet-dcerpc.h> #include <epan/proto.h> #include <epan/expert.h> #include "packet-pn.h" #define F_MESSAGE_TRAILER_4BYTE 4 /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte in PROFIsafe 2.4 */ #define F_MESSAGE_TRAILER_5BYTE 5 /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte in PROFIsafe 2.6 */ #define PN_INPUT_CR 1 /* PROFINET Input Connect Request value */ #define PN_INPUT_DATADESCRITPION 1 /* PROFINET Input Data Description value */ #define PA_PROFILE_API 0x9700u static int proto_pn_io_rtc1 = -1; /* General module information */ static int hf_pn_io_frame_info_type = -1; static int hf_pn_io_frame_info_vendor = -1; static int hf_pn_io_frame_info_nameofstation = -1; static int hf_pn_io_frame_info_gsd_found = -1; static int hf_pn_io_frame_info_gsd_error = -1; static int hf_pn_io_frame_info_gsd_path = -1; static int hf_pn_io_io_data_object = -1; static int hf_pn_io_io_data_object_info_module_diff = -1; static int hf_pn_io_io_data_object_info_moduleidentnumber = -1; static int hf_pn_io_io_data_object_info_submoduleidentnumber = -1; static int hf_pn_io_iocs = -1; static int hf_pn_io_iops = -1; static int hf_pn_io_ioxs_extension = -1; static int hf_pn_io_ioxs_res14 = -1; static int hf_pn_io_ioxs_instance = -1; static int hf_pn_io_ioxs_datastate = -1; /* PROFIsafe statusbyte and controlbyte */ static int hf_pn_io_ps_sb = -1; static int hf_pn_io_ps_sb_iparOK = -1; static int hf_pn_io_ps_sb_DeviceFault = -1; static int hf_pn_io_ps_sb_CECRC = -1; static int hf_pn_io_ps_sb_WDtimeout = -1; static int hf_pn_io_ps_sb_FVactivated = -1; static int hf_pn_io_ps_sb_Toggle_d = -1; static int hf_pn_io_ps_sb_ConsNr_reset = -1; static int hf_pn_io_ps_sb_res = -1; static int hf_pn_io_ps_sb_toggelBitChanged = -1; static int hf_pn_io_ps_sb_toggelBitChange_slot_nr = -1; static int hf_pn_io_ps_sb_toggelBitChange_subslot_nr = -1; static int hf_pn_io_ps_cb = -1; static int hf_pn_io_ps_cb_iparEN = -1; static int hf_pn_io_ps_cb_OAReq = -1; static int hf_pn_io_ps_cb_resetConsNr = -1; static int hf_pn_io_ps_cb_useTO2 = -1; static int hf_pn_io_ps_cb_activateFV = -1; static int hf_pn_io_ps_cb_Toggle_h = -1; static int hf_pn_io_ps_cb_Chf_ACK = -1; static int hf_pn_io_ps_cb_loopcheck = -1; static int hf_pn_io_ps_cb_toggelBitChanged = -1; static int hf_pn_io_ps_cb_toggelBitChange_slot_nr = -1; static int hf_pn_io_ps_cb_toggelBitChange_subslot_nr = -1; /* PROFIsafe */ static int hf_pn_io_ps_f_dest_adr = -1; static int hf_pn_io_ps_f_data = -1; /* PA Profile 4.02 */ static int hf_pn_pa_profile_status = -1; static int hf_pn_pa_profile_status_quality = -1; static int hf_pn_pa_profile_status_substatus_bad = -1; static int hf_pn_pa_profile_status_substatus_uncertain = -1; static int hf_pn_pa_profile_status_substatus_good = -1; static int hf_pn_pa_profile_status_update_event = -1; static int hf_pn_pa_profile_status_simulate = -1; static int hf_pn_pa_profile_value_8bit = -1; static int hf_pn_pa_profile_value_16bit = -1; static int hf_pn_pa_profile_value_float = -1; static gint ett_pn_io_rtc = -1; static gint ett_pn_io_ioxs = -1; static gint ett_pn_io_io_data_object = -1; static gint ett_pn_pa_profile_status = -1; static expert_field ei_pn_io_too_many_data_objects = EI_INIT; static const value_string pn_io_ioxs_extension[] = { { 0x00 /* 0*/, "No IOxS octet follows" }, { 0x01 /* 1*/, "One more IOxS octet follows" }, { 0, NULL } }; static const value_string pn_io_ioxs_instance[] = { { 0x00 /* 0*/, "Detected by subslot" }, { 0x01 /* 1*/, "Detected by slot" }, { 0x02 /* 2*/, "Detected by IO device" }, { 0x03 /* 3*/, "Detected by IO controller" }, { 0, NULL } }; static const value_string pn_io_ioxs_datastate[] = { { 0x00 /* 0*/, "Bad" }, { 0x01 /* 1*/, "Good" }, { 0, NULL } }; static const value_string pn_pa_profile_status_quality[] = { { 0x00 /* 0*/, "BAD" }, { 0x01 /* 1*/, "UNCERTAIN" }, { 0x02 /* 2*/, "GOOD" }, { 0, NULL } }; static const value_string pn_pa_profile_status_substatus_bad[] = { { 0x0, "Non specific" }, { 0x2, "Not connected" }, { 0x8, "Passivated" }, { 0x9, "Maintenance alarm, more diagnosis" }, { 0xA, "Process related, no maintenance" }, { 0xF, "Function check, value not usable" }, { 0, NULL } }; static const value_string pn_pa_profile_status_substatus_uncertain[] = { { 0x2, "Substitute set" }, { 0x3, "Initial value" }, { 0xA, "Maintenance demanded" }, { 0xE, "Process related, no maintenance" }, { 0, NULL } }; static const value_string pn_pa_profile_status_substatus_good[] = { { 0x0, "Good" }, { 0x7, "Local override" }, { 0x8, "Initial fail safe" }, { 0x9, "Maintenance required" }, { 0xA, "Maintenance demanded" }, { 0xF, "Function check" }, { 0, NULL } }; static const value_string pn_pa_profile_status_update_event[] = { { 0x0, "No event" }, { 0x1, "Update event" }, { 0, NULL } }; static const value_string pn_pa_profile_status_simulate[] = { { 0x0, "Simulation off" }, { 0x1, "Simulation active" }, { 0, NULL } }; static int * const ps_sb_fields[] = { &hf_pn_io_ps_sb_res, &hf_pn_io_ps_sb_ConsNr_reset, &hf_pn_io_ps_sb_Toggle_d, &hf_pn_io_ps_sb_FVactivated, &hf_pn_io_ps_sb_WDtimeout, &hf_pn_io_ps_sb_CECRC, &hf_pn_io_ps_sb_DeviceFault, &hf_pn_io_ps_sb_iparOK, NULL }; static int * const ps_cb_fields[] = { &hf_pn_io_ps_cb_loopcheck, &hf_pn_io_ps_cb_Chf_ACK, &hf_pn_io_ps_cb_Toggle_h, &hf_pn_io_ps_cb_activateFV, &hf_pn_io_ps_cb_useTO2, &hf_pn_io_ps_cb_resetConsNr, &hf_pn_io_ps_cb_OAReq, &hf_pn_io_ps_cb_iparEN, NULL }; static int * const ioxs_fields[] = { &hf_pn_io_ioxs_datastate, &hf_pn_io_ioxs_instance, &hf_pn_io_ioxs_res14, &hf_pn_io_ioxs_extension, NULL }; /* static int * const pa_profile_status_fields[] = { &hf_pn_pa_profile_status_quality, &hf_pn_pa_profile_status_substatus_bad, &hf_pn_pa_profile_status_substatus_uncertain, &hf_pn_pa_profile_status_substatus_good, &hf_pn_pa_profile_status_update_event, &hf_pn_pa_profile_status_simulate, NULL }; */ /* Dissector for PROFIsafe Status Byte */ static int dissect_pn_io_ps_SB(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex, int * const *fields) { if (tree) { guint8 u8StatusByte; proto_item *sb_item; u8StatusByte = tvb_get_guint8(tvb, offset); /* Add Status Byte subtree */ sb_item = proto_tree_add_bitmask_with_flags(tree, tvb, offset, hfindex, ett_pn_io_ioxs, fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND); proto_item_append_text(sb_item, " (%s)", ((u8StatusByte == 0x20) || (u8StatusByte == 0x00)) ? "normal" : "unnormal"); } return offset + 1; } /* Dissector for PROFIsafe Control Byte */ static int dissect_pn_io_ps_CB(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex, int * const *fields) { if (tree) { guint8 u8ControlByte; proto_item *cb_item; u8ControlByte = tvb_get_guint8(tvb, offset); /* Add Status Byte subtree */ cb_item = proto_tree_add_bitmask_with_flags(tree, tvb, offset, hfindex, ett_pn_io_ioxs, fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND); proto_item_append_text(cb_item, " (%s)", ((u8ControlByte == 0x20) || (u8ControlByte == 0x00) || (u8ControlByte == 0xa0) || (u8ControlByte == 0x80)) ? "normal" : "unnormal"); } return offset + 1; } /* Dissector for IOCS (As each IOCS stands for a specific Slot & Subslot) */ static int dissect_PNIO_IOCS(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex, guint16 slotNr, guint16 subSlotNr, int * const *fields) { if (tree) { guint8 u8IOxS; proto_item *ioxs_item; u8IOxS = tvb_get_guint8(tvb, offset); /* Add ioxs subtree */ ioxs_item = proto_tree_add_bitmask_with_flags(tree, tvb, offset, hfindex, ett_pn_io_ioxs, fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND); proto_item_append_text(ioxs_item, " (%s%s), Slot: 0x%x, Subslot: 0x%x", (u8IOxS & 0x01) ? "another IOxS follows " : "", (u8IOxS & 0x80) ? "good" : "bad", slotNr, subSlotNr); } return offset + 1; } /* dissect the IOxS (IOCS, IOPS) field */ static int dissect_PNIO_IOxS(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep _U_, int hfindex, int * const *fields) { if (tree) { guint8 u8IOxS; proto_item *ioxs_item; u8IOxS = tvb_get_guint8(tvb, offset); /* Add ioxs subtree */ ioxs_item = proto_tree_add_bitmask_with_flags(tree, tvb, offset, hfindex, ett_pn_io_ioxs, fields, ENC_LITTLE_ENDIAN, BMT_NO_APPEND); proto_item_append_text(ioxs_item, " (%s%s)", (u8IOxS & 0x01) ? "another IOxS follows " : "", (u8IOxS & 0x80) ? "good" : "bad"); } return offset + 1; } /* Universel dissector for flexibel PROFIsafe Data 8 to 64 Bits */ static int dissect_pn_io_ps_uint(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, guint8 *drep, int hfindex, guint8 bytelength, guint64 *pdata) { guint64 data; gboolean generalDissection; generalDissection = FALSE; switch (bytelength) { case 1: /* 8 Bit Safety IO Data */ data = tvb_get_guint8(tvb, offset); if (pdata) *pdata = data; break; case 2: /* 16 Bit Safety IO Data */ data = tvb_get_letohs(tvb, offset); if (pdata) *pdata = data; break; case 3: /* 24 Bit Safety IO Data */ data = tvb_get_letoh24(tvb, offset); if (pdata) *pdata = data; break; case 4: /* 32 Bit Safety IO Data */ data = tvb_get_letohl(tvb, offset); if (pdata) *pdata = data; break; case 5: /* 40 Bit Safety IO Data */ data = tvb_get_letoh40(tvb, offset); if (pdata) *pdata = data; break; case 6: /* 48 Bit Safety IO Data */ data = tvb_get_letoh48(tvb, offset); if (pdata) *pdata = data; break; case 7: /* 56 Bit Safety IO Data */ data = tvb_get_letoh56(tvb, offset); if (pdata) *pdata = data; break; case 8: /* 64 Bit Safety IO Data */ data = tvb_get_letoh64(tvb, offset); if (pdata) *pdata = data; break; default: /* Safety IO Data is too big to save it into one variable */ dissect_pn_user_data(tvb, offset, pinfo, tree, bytelength, "Safety IO Data"); generalDissection = TRUE; break; } if (tree && generalDissection == FALSE) { proto_tree_add_item(tree, hfindex, tvb, offset, bytelength, DREP_ENC_INTEGER(drep)); } return offset + bytelength; } /* dissect a PN-IO RTC1 Cyclic Service Data Unit */ int dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep _U_, guint16 frameid) { proto_tree *data_tree = NULL; /* Count & offset for comparation of the arrays */ guint16 frameOffset; guint32 objectCounter; gboolean inputFlag; gboolean outputFlag; gboolean psInfoText; /* Used to display only once per frame the info text "PROFIsafe Device" */ proto_item *data_item; proto_item *IODataObject_item; proto_item *IODataObject_item_info; proto_tree *IODataObject_tree; proto_item *ModuleID_item; proto_item *ModuleDiff_item; wmem_strbuf_t *moduleName; guint8 toggleBitSb; guint8 toggleBitCb; guint64 f_data; guint8 statusbyte; guint8 controlbyte; guint8 safety_io_data_length; guint16 number_io_data_objects_input_cr; guint16 number_iocs_input_cr; guint16 number_io_data_objects_output_cr; guint16 number_iocs_output_cr; conversation_t *conversation; stationInfo *station_info = NULL; iocsObject *iocs_object; ioDataObject *io_data_object; moduleDiffInfo *module_diff_info; wmem_list_frame_t *frame; wmem_list_frame_t *frame_diff; /* Initial */ frameOffset = 0; f_data = 0; inputFlag = FALSE; outputFlag = FALSE; psInfoText = FALSE; number_io_data_objects_input_cr = 0; number_iocs_input_cr = 0; number_io_data_objects_output_cr = 0; number_iocs_output_cr = 0; wmem_list_frame_t *aruuid_frame; ARUUIDFrame *current_aruuid_frame = NULL; guint32 current_aruuid = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO"); /* set protocol name */ data_item = proto_tree_add_protocol_format(tree, proto_pn_io_rtc1, tvb, offset, tvb_captured_length(tvb), "PROFINET IO Cyclic Service Data Unit: %u bytes", tvb_captured_length(tvb)); data_tree = proto_item_add_subtree(data_item, ett_pn_io_rtc); /* dissect_dcerpc_uint16(tvb, offset, pinfo, data_tree, drep, hf_pn_io_packedframe_SFCRC, &u16SFCRC); */ if (!(dissect_CSF_SDU_heur(tvb, pinfo, data_tree, NULL) == FALSE)) return(tvb_captured_length(tvb)); /* Only dissect cyclic RTC1 frames, if PN Connect Request has been read */ conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, CONVERSATION_NONE, 0, 0, 0); /* Detect input data package and output data package */ if (conversation != NULL) { if (aruuid_frame_setup_list != NULL) { for (aruuid_frame = wmem_list_tail(aruuid_frame_setup_list); aruuid_frame != NULL; aruuid_frame = wmem_list_frame_prev(aruuid_frame)) { current_aruuid_frame = (ARUUIDFrame*)wmem_list_frame_data(aruuid_frame); /* There are prerequisites to dissect RTC frame data */ /* Current station info must be found before RTC frame dissection starts */ /* if RTC frame has setup frame and setup frame number is less than RTC frame number AND if RTC frame has release frame and release frame number is greater than RTC frame number */ /* if RTC frame has setup frame and setup frame number is less than RTC frame number AND RTC frame does not have release frame yet! */ /* then, get AR UUID of current station info */ if ((current_aruuid_frame->setupframe && current_aruuid_frame->setupframe < pinfo->num) && ((current_aruuid_frame->releaseframe && current_aruuid_frame->releaseframe > pinfo->num) || !current_aruuid_frame->releaseframe)) { if (current_aruuid_frame->inputframe == frameid) { current_aruuid = current_aruuid_frame->aruuid.data1; break; } else if (current_aruuid_frame->outputframe == frameid) { current_aruuid = current_aruuid_frame->aruuid.data1; break; } } } } station_info = (stationInfo*)conversation_get_proto_data(conversation, current_aruuid); if (station_info != NULL) { pn_find_dcp_station_info(station_info, conversation); if (pnio_ps_selection == TRUE) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "PNIO_PS"); /* set PROFISsafe protocol name */ } if (addresses_equal(&(pinfo->src), conversation_key_addr1(conversation->key_ptr)) && addresses_equal(&(pinfo->dst), conversation_key_addr2(conversation->key_ptr))) { inputFlag = TRUE; outputFlag = FALSE; number_io_data_objects_input_cr = station_info->ioDataObjectNr_in; number_iocs_input_cr = station_info->iocsNr_in; } if (addresses_equal(&(pinfo->dst), conversation_key_addr1(conversation->key_ptr)) && addresses_equal(&(pinfo->src), conversation_key_addr2(conversation->key_ptr))) { outputFlag = TRUE; inputFlag = FALSE; number_io_data_objects_output_cr = station_info->ioDataObjectNr_out; number_iocs_output_cr = station_info->iocsNr_out; } } } /* ------- Input (PNIO) / Response (PNIO_PS) Frame Handling ------- */ if (inputFlag) { if (pnio_ps_selection == TRUE) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_type, tvb, offset, 0, "Response", "Response Frame (IO_Device -> IO_Controller)"); } else { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_type, tvb, offset, 0, "Input", "Input Frame (IO_Device -> IO_Controller)"); } if (station_info != NULL) { if (station_info->typeofstation != NULL) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_vendor, tvb, 0, 0, station_info->typeofstation, "\"%s\"", station_info->typeofstation); } if (station_info->nameofstation != NULL) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0, 0, station_info->nameofstation, "\"%s\"", station_info->nameofstation); } if (station_info->gsdPathLength == TRUE) { /* given path isn't too long for the array */ if (station_info->gsdFound == TRUE) { /* found a GSD-file */ if (station_info->gsdLocation != NULL) { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_found, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, ": \"%s\"", station_info->gsdLocation); } } else { if (station_info->gsdLocation != NULL) { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please place relevant GSD-file under \"%s\"", station_info->gsdLocation); } } } else { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)"); } } /* ---- Input IOData-/IOCS-Object Handling ---- */ objectCounter = number_io_data_objects_input_cr + number_iocs_input_cr; if (objectCounter > (guint)tvb_reported_length_remaining(tvb, offset)) { expert_add_info_format(pinfo, data_item, &ei_pn_io_too_many_data_objects, "Too many data objects: %d", objectCounter); return(tvb_captured_length(tvb)); } while (objectCounter--) { /* ---- Input IO Data Object Handling ---- */ if (station_info != NULL) { for (frame = wmem_list_head(station_info->ioobject_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (io_data_object->frameOffset == frameOffset) { /* Found following object */ IODataObject_item = proto_tree_add_item(data_tree, hf_pn_io_io_data_object, tvb, offset, 0, ENC_NA); IODataObject_tree = proto_item_add_subtree(IODataObject_item, ett_pn_io_io_data_object); /* Control: the Device still uses the correct ModuleIdentNumber? */ for (frame_diff = wmem_list_head(station_info->diff_module); frame_diff != NULL; frame_diff = wmem_list_frame_next(frame_diff)) { module_diff_info = (moduleDiffInfo*)wmem_list_frame_data(frame_diff); if (io_data_object->moduleIdentNr != module_diff_info->modulID) { ModuleDiff_item = proto_tree_add_item(IODataObject_tree, hf_pn_io_io_data_object_info_module_diff, tvb, 0, 0, ENC_NA); proto_item_append_text(ModuleDiff_item, ": Device using ModuleIdentNumber 0x%08x instead of 0x%08x", module_diff_info->modulID, io_data_object->moduleIdentNr); break; } } proto_tree_add_uint(IODataObject_tree, hf_pn_io_io_data_object_info_moduleidentnumber, tvb, 0, 0, io_data_object->moduleIdentNr); proto_tree_add_uint(IODataObject_tree, hf_pn_io_io_data_object_info_submoduleidentnumber, tvb, 0, 0, io_data_object->subModuleIdentNr); /* PROFIsafe Supported Inputmodule handling */ if (io_data_object->profisafeSupported == TRUE && pnio_ps_selection == TRUE) { if (io_data_object->profisafeSupported == TRUE && psInfoText == FALSE) { /* Only add one information string per device to the infotext */ col_append_str(pinfo->cinfo, COL_INFO, ", PROFIsafe Device"); /* Add string to wireshark infotext */ psInfoText = TRUE; } proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_f_dest_adr, tvb, 0, 0, io_data_object->f_dest_adr); /* Get Safety IO Data */ if (io_data_object->f_crc_seed == FALSE) { safety_io_data_length = io_data_object->length - F_MESSAGE_TRAILER_4BYTE; } else { safety_io_data_length = io_data_object->length - F_MESSAGE_TRAILER_5BYTE; } if (safety_io_data_length > 0) { offset = dissect_pn_io_ps_uint(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_ps_f_data, safety_io_data_length, &f_data); } /* ---- Check for new PNIO data using togglebit ---- */ statusbyte = tvb_get_guint8(tvb, offset); toggleBitSb = statusbyte & 0x20; /* get ToggleBit of StatusByte */ if (io_data_object->lastToggleBit != toggleBitSb) { /* ToggleBit has changed --> new Data incoming */ /* Special Filter for ToggleBit within Statusbyte */ ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_sb_toggelBitChanged, tvb, offset, 0, toggleBitSb); proto_item_set_hidden(ModuleID_item); ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_sb_toggelBitChange_slot_nr, tvb, offset, 0, io_data_object->slotNr); proto_item_set_hidden(ModuleID_item); ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_sb_toggelBitChange_subslot_nr, tvb, offset, 0, io_data_object->subSlotNr); proto_item_set_hidden(ModuleID_item); } offset = dissect_pn_io_ps_SB(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_ps_sb, ps_sb_fields); offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->f_crc_len, "CRC"); io_data_object->last_sb_cb = statusbyte; /* save the value of current statusbyte */ io_data_object->lastToggleBit = toggleBitSb; /* save the value of current togglebit within statusbyte */ } /* END of PROFIsafe Module Handling */ else { /* Module is not PROFIsafe supported */ if (io_data_object->api == PA_PROFILE_API) { offset = dissect_pn_pa_profile_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); } else { offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); } } if (io_data_object->discardIOXS == FALSE) { offset = dissect_PNIO_IOxS(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_iops, ioxs_fields); proto_item_set_len(IODataObject_item, io_data_object->length + 1); /* Length = Databytes + IOXS Byte */ } else { proto_item_set_len(IODataObject_item, io_data_object->length); /* Length = Databytes */ } proto_item_append_text(IODataObject_item, ": Slot: 0x%x Subslot: 0x%x", io_data_object->slotNr, io_data_object->subSlotNr); /* ModuleIdentNr appears not only once in GSD-file -> set module name more generally */ if (io_data_object->amountInGSDML > 1) { /* if ModuleIdentNr only appears once in GSD-file, use the found GSD-file-ModuleName, else ... */ if (io_data_object->slotNr == 0) { moduleName = wmem_strbuf_new(pinfo->pool, "Headstation"); } else { moduleName = wmem_strbuf_new(pinfo->pool, "Module"); } if (io_data_object->profisafeSupported == TRUE) { /* PROFIsafe */ if (io_data_object->length >= 5) { /* 5 due to 3 CRC bytes & 1 status byte & (at least) 1 data byte */ wmem_strbuf_append(moduleName, ", DI"); } else { wmem_strbuf_append(moduleName, ", DO"); } } else { /* PROFINET */ if (io_data_object->length > 0) { wmem_strbuf_append(moduleName, ", DI"); } else { wmem_strbuf_append(moduleName, ", DO"); } } io_data_object->moduleNameStr = wmem_strdup(wmem_file_scope(), wmem_strbuf_get_str(moduleName)); } proto_item_append_text(IODataObject_item, " ModuleName: \"%s\"", io_data_object->moduleNameStr); /* emphasize the PROFIsafe supported Modul */ if (io_data_object->profisafeSupported == TRUE && pnio_ps_selection == TRUE) { (proto_item_append_text(IODataObject_item, " (PROFIsafe Module)")); } /* Set frameOffset to its new value, to find the next object */ frameOffset = frameOffset + io_data_object->length; /* frameOffset = current value + data bytes */ if (io_data_object->discardIOXS == FALSE) { frameOffset = frameOffset + 1; /* frameOffset = current value + iops byte */ } } } } /* ---- Input IOCS Object Handling ---- */ if (station_info != NULL) { for (frame = wmem_list_head(station_info->iocs_data_in); frame != NULL; frame = wmem_list_frame_next(frame)) { iocs_object = (iocsObject*)wmem_list_frame_data(frame); if (iocs_object->frameOffset == frameOffset) { offset = dissect_PNIO_IOCS(tvb, offset, pinfo, data_tree, drep, hf_pn_io_iocs, iocs_object->slotNr, iocs_object->subSlotNr, ioxs_fields); /* Set frameOffset to its new value, to find the next object */ frameOffset = frameOffset + 1; /* frameOffset = current value + iops byte */ break; } } } } /* Dissect padding */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset), "GAP and RTCPadding"); } /* END of Input Frame Handling */ /* ----- Output (PNIO) / Request (PNIO_PS) Frame Handling ------ */ else if (outputFlag) { if (pnio_ps_selection == TRUE) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_type, tvb, offset, 0, "Request", "Request Frame (IO_Controller -> IO_Device)"); } else { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_type, tvb, offset, 0, "Output", "Output Frame (IO_Controller -> IO_Device)"); } if (station_info != NULL) { if (station_info->typeofstation != NULL) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_vendor, tvb, 0, 0, station_info->typeofstation, "\"%s\"", station_info->typeofstation); } if (station_info->nameofstation != NULL) { proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0, 0, station_info->nameofstation, "\"%s\"", station_info->nameofstation); } if (station_info->gsdPathLength == TRUE) { /* given path isn't too long for the array */ if (station_info->gsdFound == TRUE) { /* found a GSD-file */ if (station_info->gsdLocation != NULL) { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_found, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, ": \"%s\"", station_info->gsdLocation); } } else { if (station_info->gsdLocation != NULL) { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please place relevant GSD-file under \"%s\"", station_info->gsdLocation); } } } else { IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)"); } } /* ---- Output IOData-/IOCS-Object Handling ---- */ objectCounter = number_io_data_objects_output_cr + number_iocs_output_cr; if (objectCounter > (guint)tvb_reported_length_remaining(tvb, offset)) { expert_add_info_format(pinfo, data_item, &ei_pn_io_too_many_data_objects, "Too many data objects: %d", objectCounter); return(tvb_captured_length(tvb)); } while (objectCounter--) { /* ---- Output IO Data Object Handling ---- */ if (station_info != NULL) { for (frame = wmem_list_head(station_info->ioobject_data_out); frame != NULL; frame = wmem_list_frame_next(frame)) { io_data_object = (ioDataObject*)wmem_list_frame_data(frame); if (io_data_object != NULL && io_data_object->frameOffset == frameOffset) { /* Found following object */ IODataObject_item = proto_tree_add_item(data_tree, hf_pn_io_io_data_object, tvb, offset, 0, ENC_NA); IODataObject_tree = proto_item_add_subtree(IODataObject_item, ett_pn_io_io_data_object); /* Control: the Device still uses the correct ModuleIdentNumber? */ for (frame_diff = wmem_list_head(station_info->diff_module); frame_diff != NULL; frame_diff = wmem_list_frame_next(frame_diff)) { module_diff_info = (moduleDiffInfo*)wmem_list_frame_data(frame_diff); if (io_data_object->moduleIdentNr != module_diff_info->modulID) { ModuleDiff_item = proto_tree_add_item(IODataObject_tree, hf_pn_io_io_data_object_info_module_diff, tvb, 0, 0, ENC_NA); proto_item_append_text(ModuleDiff_item, ": Device using ModuleIdentNumber 0x%08x instead of 0x%08x", module_diff_info->modulID, io_data_object->moduleIdentNr); break; } } proto_tree_add_uint(IODataObject_tree, hf_pn_io_io_data_object_info_moduleidentnumber, tvb, 0, 0, io_data_object->moduleIdentNr); proto_tree_add_uint(IODataObject_tree, hf_pn_io_io_data_object_info_submoduleidentnumber, tvb, 0, 0, io_data_object->subModuleIdentNr); if (io_data_object->profisafeSupported == TRUE && pnio_ps_selection == TRUE) { if (io_data_object->profisafeSupported == TRUE && psInfoText == FALSE) { /* Only add one information string per device to the infotext */ col_append_str(pinfo->cinfo, COL_INFO, ", PROFIsafe Device"); /* Add string to wireshark infotext */ psInfoText = TRUE; } proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_f_dest_adr, tvb, 0, 0, io_data_object->f_dest_adr); /* Get Safety IO Data */ if (io_data_object->f_crc_seed == FALSE) { safety_io_data_length = io_data_object->length - F_MESSAGE_TRAILER_4BYTE; } else { safety_io_data_length = io_data_object->length - F_MESSAGE_TRAILER_5BYTE; } if (safety_io_data_length > 0) { offset = dissect_pn_io_ps_uint(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_ps_f_data, safety_io_data_length, &f_data); } /* ---- Check for new PNIO data using togglebit ---- */ controlbyte = tvb_get_guint8(tvb, offset); toggleBitCb = controlbyte & 0x20; /* get ToggleBit of Controlbyte */ if (io_data_object->lastToggleBit != toggleBitCb) { /* ToggleBit has changed --> new Data incoming */ /* Special Filter for ToggleBit within Controlbyte */ ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_cb_toggelBitChanged, tvb, offset, 0, toggleBitCb); proto_item_set_hidden(ModuleID_item); ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_cb_toggelBitChange_slot_nr, tvb, offset, 0, io_data_object->slotNr); proto_item_set_hidden(ModuleID_item); ModuleID_item = proto_tree_add_uint(IODataObject_tree, hf_pn_io_ps_cb_toggelBitChange_subslot_nr, tvb, offset, 0, io_data_object->subSlotNr); proto_item_set_hidden(ModuleID_item); } offset = dissect_pn_io_ps_CB(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_ps_cb, ps_cb_fields); offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->f_crc_len, "CRC"); io_data_object->last_sb_cb = controlbyte; /* save the value of current controlbyte */ io_data_object->lastToggleBit = toggleBitCb; /* save the value of current togglebit within controlbyte */ } /* End of PROFIsafe Module Handling */ else { /* Module is not PROFIsafe supported */ if (io_data_object->api == PA_PROFILE_API) { offset = dissect_pn_pa_profile_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); } else { offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); } } if (io_data_object->discardIOXS == FALSE) { offset = dissect_PNIO_IOxS(tvb, offset, pinfo, IODataObject_tree, drep, hf_pn_io_iops, ioxs_fields); proto_item_set_len(IODataObject_item, io_data_object->length + 1); /* Length = Databytes + IOXS Byte */ } else { proto_item_set_len(IODataObject_item, io_data_object->length); /* Length = Databytes */ } proto_item_append_text(IODataObject_item, ": Slot: 0x%x Subslot: 0x%x", io_data_object->slotNr, io_data_object->subSlotNr); /* ModuleIdentNr appears not only once in GSD-file -> set module name more generally */ if (io_data_object->amountInGSDML > 1) { /* if ModuleIdentNr only appears once in GSD-file, use the found GSD-file-ModuleName, else ... */ if (io_data_object->slotNr == 0) { moduleName = wmem_strbuf_new(pinfo->pool, "Headstation"); } else { moduleName = wmem_strbuf_new(pinfo->pool, "Module"); } if (io_data_object->profisafeSupported == TRUE) { /* PROFIsafe */ if (io_data_object->length >= 5) { /* 5 due to 3 CRC bytes & 1 status byte & (at least) 1 data byte */ wmem_strbuf_append(moduleName, ", DO"); } else { wmem_strbuf_append(moduleName, ", DI"); } } else { /* PROFINET */ if (io_data_object->length > 0) { wmem_strbuf_append(moduleName, ", DO"); } else { wmem_strbuf_append(moduleName, ", DI"); } } io_data_object->moduleNameStr = wmem_strdup(wmem_file_scope(), wmem_strbuf_get_str(moduleName)); } proto_item_append_text(IODataObject_item, " ModuleName: \"%s\"", io_data_object->moduleNameStr); /* emphasize the PROFIsafe supported Modul */ if (io_data_object->profisafeSupported == TRUE && pnio_ps_selection == TRUE) { proto_item_append_text(IODataObject_item, " (PROFIsafe Module)"); } /* Set frameOffset to its new value, to find the next object */ frameOffset = frameOffset + io_data_object->length; /* frameOffset = current value + data bytes */ if (io_data_object->discardIOXS == FALSE) { frameOffset = frameOffset + 1; /* frameOffset = current value + iops byte */ } } } } /* ---- Output IOCS Object Handling ---- */ if (station_info != NULL) { for (frame = wmem_list_head(station_info->iocs_data_out); frame != NULL; frame = wmem_list_frame_next(frame)) { iocs_object = (iocsObject*)wmem_list_frame_data(frame); if (iocs_object->frameOffset == frameOffset) { offset = dissect_PNIO_IOCS(tvb, offset, pinfo, data_tree, drep, hf_pn_io_iocs, iocs_object->slotNr, iocs_object->subSlotNr, ioxs_fields); /* Set frameOffset to its new value, to find the next object */ frameOffset = frameOffset + 1; /* frameOffset = current value + iops byte */ break; } } } } /* Dissect padding */ offset = dissect_pn_user_data(tvb, offset, pinfo, tree, tvb_captured_length_remaining(tvb, offset), "GAP and RTCPadding"); } /* END of Output Frame Handling */ return offset; } /* dissect the PA Profile status field */ static int dissect_pn_pa_profile_status(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex) { if (tree) { guint8 u8status; guint8 quality; proto_item *status_item; proto_tree *status_tree; const gchar* quality_name = NULL; u8status = tvb_get_guint8(tvb, offset); quality = (u8status >> 6u) & 0x3u; /* add status subtree */ status_item = proto_tree_add_uint(tree, hfindex, tvb, offset, 1, u8status); quality_name = try_val_to_str(quality, pn_pa_profile_status_quality); proto_item_append_text(status_item, " (%s)", (quality_name != NULL) ? quality_name : "invalid"); status_tree = proto_item_add_subtree(status_item, ett_pn_pa_profile_status); proto_tree_add_item(status_tree, hf_pn_pa_profile_status_quality, tvb, offset, 1, ENC_NA); switch(quality) { case 0: proto_tree_add_item(status_tree, hf_pn_pa_profile_status_substatus_bad, tvb, offset, 1, ENC_NA); break; case 1: proto_tree_add_item(status_tree, hf_pn_pa_profile_status_substatus_uncertain, tvb, offset, 1, ENC_NA); break; case 2: proto_tree_add_item(status_tree, hf_pn_pa_profile_status_substatus_good, tvb, offset, 1, ENC_NA); break; default: break; } proto_tree_add_item(status_tree, hf_pn_pa_profile_status_update_event, tvb, offset, 1, ENC_NA); proto_tree_add_item(status_tree, hf_pn_pa_profile_status_simulate, tvb, offset, 1, ENC_NA); } return offset + 1; } int dissect_pn_pa_profile_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, const char *text) { (void)text; /* All PA Profile submodules carry an 8-bit "status" plus the real data, which currently is a float, an 8-bit integer or a 16-bit integer. So we will have either 2, 3 or 5 bytes. */ if (length == 2u) { proto_tree_add_item(tree, hf_pn_pa_profile_value_8bit, tvb, offset, 1, ENC_BIG_ENDIAN); dissect_pn_pa_profile_status(tvb, offset+1, pinfo, tree, hf_pn_pa_profile_status); } else if (length == 3u) { proto_tree_add_item(tree, hf_pn_pa_profile_value_16bit, tvb, offset, 2, ENC_BIG_ENDIAN); dissect_pn_pa_profile_status(tvb, offset+2, pinfo, tree, hf_pn_pa_profile_status); } else if (length == 5u) { proto_tree_add_item(tree, hf_pn_pa_profile_value_float, tvb, offset, 4, ENC_BIG_ENDIAN); dissect_pn_pa_profile_status(tvb, offset+4, pinfo, tree, hf_pn_pa_profile_status); } else { /* Delegate to standard user data if unknown */ (void)dissect_pn_user_data(tvb, offset, pinfo, tree, length, "IO Data"); } return offset + length; } void init_pn_io_rtc1(int proto) { static hf_register_info hf[] = { { &hf_pn_io_io_data_object, { "IODataObject", "pn_io.io_data_object", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_data_object_info_module_diff, { "Difference", "pn_io.io_data_object.diff_module", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_data_object_info_moduleidentnumber, { "ModuleIdentNumber", "pn_io.io_data_object.module_nr", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_io_data_object_info_submoduleidentnumber, { "SubmoduleIdentNumber", "pn_io.io_data_object.submodule_nr", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_type, { "PN Frame Type", "pn_io.frame_info.type", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_vendor, { "DeviceVendorValue", "pn_io.frame_info.vendor", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_nameofstation, { "NameOfStation", "pn_io.frame_info.nameofstation", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_gsd_found, { "GSD-file found", "pn_io.frame_info.gsd_found", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_gsd_error, { "GSD-file not found.", "pn_io.frame_info.gsd_error", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_frame_info_gsd_path, { "GSD-file networkpath failure!", "pn_io.frame_info.gsd_path", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iocs, { "IOCS", "pn_io.ioxs", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_iops, { "IOPS", "pn_io.ioxs", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ioxs_extension, { "Extension", "pn_io.ioxs.extension", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs_extension), 0x01, NULL, HFILL } }, { &hf_pn_io_ioxs_res14, { "Reserved", "pn_io.ioxs.res14", FT_UINT8, BASE_HEX, NULL, 0x1E, NULL, HFILL } }, { &hf_pn_io_ioxs_instance, { "Instance", "pn_io.ioxs.instance", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs_instance), 0x60, NULL, HFILL } }, { &hf_pn_io_ioxs_datastate, { "DataState", "pn_io.ioxs.datastate", FT_UINT8, BASE_HEX, VALS(pn_io_ioxs_datastate), 0x80, NULL, HFILL } }, /* PROFIsafe parameter */ /* Status Byte & Control Byte for PROFIsafe --- dissector handle */ { &hf_pn_io_ps_sb, { "Status Byte", "pn_io.ps.sb", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_sb_toggelBitChanged, { "Status Byte", "pn_io.ps.sb.toggle_d_changed", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL } }, { &hf_pn_io_ps_sb_toggelBitChange_slot_nr, { "Slot_Number", "pn_io.ps.sb.toggle_d_changed.slot", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_sb_toggelBitChange_subslot_nr, { "Sub_Slot_Number", "pn_io.ps.sb.toggle_d_changed.subslot", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_cb, { "Control Byte", "pn_io.ps.cb", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_cb_toggelBitChanged, { "Control Byte", "pn_io.ps.cb.toggle_h_changed", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL } }, { &hf_pn_io_ps_cb_toggelBitChange_slot_nr, { "Slot_Number", "pn_io.ps.cb.toggle_h_changed.slot", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_cb_toggelBitChange_subslot_nr, { "Sub_Slot_Number", "pn_io.ps.cb.toggle_h_changed.subslot", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* Structures for dissecting Status Byte & Control Byte PROFIsafe ---dissector details */ { &hf_pn_io_ps_sb_iparOK, { "iPar_OK - F-Device has new iParameter values assigned", "pn_io.ps.sb.iPar_OK", FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL } }, { &hf_pn_io_ps_sb_DeviceFault, { "Device_Fault - Failure exists in F-Device or F-Module", "pn_io.ps.sb.DeviceFault", FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL } }, { &hf_pn_io_ps_sb_CECRC, { "CE_CRC - CRC Communication fault", "pn_io.ps.sb.CE_CRC", FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL } }, { &hf_pn_io_ps_sb_WDtimeout, { "WD_timeout - WatchDog timeout Communication fault", "pn_io.ps.sb.WD_timeout", FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL } }, { &hf_pn_io_ps_sb_FVactivated, { "FV_activated - Fail-safe values (FV) activated", "pn_io.ps.sb.FV_activated", FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL } }, { &hf_pn_io_ps_sb_Toggle_d, { "Toggle_d - Device-based Toggle Bit", "pn_io.ps.sb.Toggle_d", FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL } }, { &hf_pn_io_ps_sb_ConsNr_reset, { "cons_nr_R - F-Device has reset its consecutive number counter", "pn_io.ps.sb.cons_nr_R", FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL } }, { &hf_pn_io_ps_sb_res, { "Bit7 - reserved for future releases", "pn_io.ps.sb.bit7", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, { &hf_pn_io_ps_cb_iparEN, { "iPar_EN - iParameter assignment deblocked", "pn_io.ps.cb.iparEN", FT_UINT8, BASE_HEX, NULL, 0x01, NULL, HFILL } }, { &hf_pn_io_ps_cb_OAReq, { "OA_Req - Operator acknowledge requested", "pn_io.ps.cb.OA_Req", FT_UINT8, BASE_HEX, NULL, 0x02, NULL, HFILL } }, { &hf_pn_io_ps_cb_resetConsNr, { "R_cons_nr - Set the Virtual Consecutive Number within the F-Device to be \"0\"", "pn_io.ps.cb.R_cons_nr", FT_UINT8, BASE_HEX, NULL, 0x04, NULL, HFILL } }, { &hf_pn_io_ps_cb_useTO2, { "Bit3 - Reserved or Use the secondary watchdog (Use_TO2)", "pn_io.ps.cb.bit3", FT_UINT8, BASE_HEX, NULL, 0x08, NULL, HFILL } }, { &hf_pn_io_ps_cb_activateFV, { "activate_FV - Fail-safe values (FV) to be activated", "pn_io.ps.cb.activate_FV", FT_UINT8, BASE_HEX, NULL, 0x10, NULL, HFILL } }, { &hf_pn_io_ps_cb_Toggle_h, { "Toggle_h - Host-based Toggle Bit", "pn_io.ps.cb.Toggle_h", FT_UINT8, BASE_HEX, NULL, 0x20, NULL, HFILL } }, { &hf_pn_io_ps_cb_Chf_ACK, { "Bit6 - Reserved or Operator acknowledge after cleared channel fault (ChF_Ack)", "pn_io.ps.cb.bit6", FT_UINT8, BASE_HEX, NULL, 0x40, NULL, HFILL } }, { &hf_pn_io_ps_cb_loopcheck, { "Bit7 - Reserved or Loop-back check (Loopcheck, shall be set to 1)", "pn_io.ps.cb.bit7", FT_UINT8, BASE_HEX, NULL, 0x80, NULL, HFILL } }, /* PROFIsafe */ { &hf_pn_io_ps_f_dest_adr, { "F_Dest_Add", "pn_io.ps.f_dest_add", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_f_data, { "SafetyIO Data", "pn_io.ps.f_data", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_pa_profile_status, { "Status", "pn_io.pa.status", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_pa_profile_status_quality, { "Quality", "pn_io.pa.status.quality", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_quality), 0xC0, NULL, HFILL } }, { &hf_pn_pa_profile_status_substatus_bad, { "Substatus", "pn_io.pa.status.substatus", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_substatus_bad), 0x3C, NULL, HFILL } }, { &hf_pn_pa_profile_status_substatus_uncertain, { "Substatus", "pn_io.pa.status.substatus", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_substatus_uncertain), 0x3C, NULL, HFILL } }, { &hf_pn_pa_profile_status_substatus_good, { "Substatus", "pn_io.pa.status.substatus", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_substatus_good), 0x3C, NULL, HFILL } }, { &hf_pn_pa_profile_status_update_event, { "Update Event", "pn_io.pa.status.update", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_update_event), 0x02, NULL, HFILL } }, { &hf_pn_pa_profile_status_simulate, { "Simulate", "pn_io.pa.status.simulate", FT_UINT8, BASE_HEX, VALS(pn_pa_profile_status_simulate), 0x01, NULL, HFILL } }, { &hf_pn_pa_profile_value_8bit, { "Value", "pn_io.pa.value", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_pa_profile_value_16bit, { "Value", "pn_io.pa.value", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_pn_pa_profile_value_float, { "Value", "pn_io.pa.value.float", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { &ett_pn_io_rtc, &ett_pn_io_ioxs, &ett_pn_io_io_data_object, &ett_pn_pa_profile_status }; static ei_register_info ei[] = { { &ei_pn_io_too_many_data_objects, { "pn_io.too_many_data_objects", PI_MALFORMED, PI_ERROR, "Too many data objects", EXPFILL }}, }; expert_module_t* expert_pn_io; proto_pn_io_rtc1 = proto; proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_pn_io = expert_register_protocol(proto_pn_io_rtc1); expert_register_field_array(expert_pn_io, ei, array_length(ei)); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C
wireshark/plugins/epan/profinet/packet-pn.c
/* packet-pn.c * Common functions for other PROFINET protocols like IO, CBA, DCP, ... * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <string.h> #include <epan/packet.h> #include <epan/expert.h> #include <epan/wmem_scopes.h> #include <epan/dissectors/packet-dcerpc.h> #include "packet-pn.h" static int hf_pn_padding = -1; static int hf_pn_undecoded_data = -1; static int hf_pn_user_data = -1; static int hf_pn_user_bytes = -1; static int hf_pn_frag_bytes = -1; static int hf_pn_malformed = -1; static int hf_pn_io_status = -1; static int hf_pn_io_error_code = -1; static int hf_pn_io_error_decode = -1; static int hf_pn_io_error_code1 = -1; static int hf_pn_io_error_code1_pniorw = -1; static int hf_pn_io_error_code1_pnio = -1; static int hf_pn_io_error_code2 = -1; static int hf_pn_io_error_code2_pniorw = -1; static int hf_pn_io_error_code2_pnio_1 = -1; static int hf_pn_io_error_code2_pnio_2 = -1; static int hf_pn_io_error_code2_pnio_3 = -1; static int hf_pn_io_error_code2_pnio_4 = -1; static int hf_pn_io_error_code2_pnio_5 = -1; static int hf_pn_io_error_code2_pnio_6 = -1; static int hf_pn_io_error_code2_pnio_7 = -1; static int hf_pn_io_error_code2_pnio_8 = -1; static int hf_pn_io_error_code2_pnio_13 = -1; static int hf_pn_io_error_code2_pnio_20 = -1; static int hf_pn_io_error_code2_pnio_21 = -1; static int hf_pn_io_error_code2_pnio_22 = -1; static int hf_pn_io_error_code2_pnio_23 = -1; static int hf_pn_io_error_code2_pnio_40 = -1; static int hf_pn_io_error_code2_pnio_60 = -1; static int hf_pn_io_error_code2_pnio_61 = -1; static int hf_pn_io_error_code2_pnio_62 = -1; static int hf_pn_io_error_code2_pnio_63 = -1; static int hf_pn_io_error_code2_pnio_64 = -1; static int hf_pn_io_error_code2_pnio_65 = -1; static int hf_pn_io_error_code2_pnio_66 = -1; static int hf_pn_io_error_code2_pnio_70 = -1; static int hf_pn_io_error_code2_pnio_71 = -1; static int hf_pn_io_error_code2_pnio_72 = -1; static int hf_pn_io_error_code2_pnio_73 = -1; static int hf_pn_io_error_code2_pnio_74 = -1; static int hf_pn_io_error_code2_pnio_75 = -1; static int hf_pn_io_error_code2_pnio_76 = -1; static int hf_pn_io_error_code2_pnio_77 = -1; static int hf_pn_io_error_code2_pnio_253 = -1; static int hf_pn_io_error_code2_pnio_255 = -1; static gint ett_pn_io_status = -1; static expert_field ei_pn_undecoded_data = EI_INIT; static expert_field ei_pn_io_error_code1 = EI_INIT; static expert_field ei_pn_io_error_code2 = EI_INIT; static const value_string pn_io_error_code[] = { { 0x00, "OK" }, { 0x81, "PNIO" }, { 0xCF, "RTA error" }, { 0xDA, "AlarmAck" }, { 0xDB, "IODConnectRes" }, { 0xDC, "IODReleaseRes" }, { 0xDD, "IODControlRes" }, { 0xDE, "IODReadRes" }, { 0xDF, "IODWriteRes" }, { 0, NULL } }; static const value_string pn_io_error_decode[] = { { 0x00, "OK" }, { 0x80, "PNIORW" }, { 0x81, "PNIO" }, { 0, NULL } }; /* dummy for unknown decode */ static const value_string pn_io_error_code1[] = { { 0x00, "OK" }, { 0, NULL } }; /* dummy for unknown decode/code1 combination */ static const value_string pn_io_error_code2[] = { { 0x00, "OK" }, { 0, NULL } }; static const value_string pn_io_error_code1_pniorw[] = { /* high nibble 0-9 not specified -> legacy codes */ { 0xa0, "application: read error" }, { 0xa1, "application: write error" }, { 0xa2, "application: module failure" }, { 0xa3, "application: not specified" }, { 0xa4, "application: not specified" }, { 0xa5, "application: not specified" }, { 0xa6, "application: not specified" }, { 0xa7, "application: busy" }, { 0xa8, "application: version conflict" }, { 0xa9, "application: feature not supported" }, { 0xaa, "application: User specific 1" }, { 0xab, "application: User specific 2" }, { 0xac, "application: User specific 3" }, { 0xad, "application: User specific 4" }, { 0xae, "application: User specific 5" }, { 0xaf, "application: User specific 6" }, { 0xb0, "access: invalid index" }, { 0xb1, "access: write length error" }, { 0xb2, "access: invalid slot/subslot" }, { 0xb3, "access: type conflict" }, { 0xb4, "access: invalid area" }, { 0xb5, "access: state conflict" }, { 0xb6, "access: access denied" }, { 0xb7, "access: invalid range" }, { 0xb8, "access: invalid parameter" }, { 0xb9, "access: invalid type" }, { 0xba, "access: backup" }, { 0xbb, "access: User specific 7" }, { 0xbc, "access: User specific 8" }, { 0xbd, "access: User specific 9" }, { 0xbe, "access: User specific 10" }, { 0xbf, "access: User specific 11" }, { 0xc0, "resource: read constrain conflict" }, { 0xc1, "resource: write constrain conflict" }, { 0xc2, "resource: resource busy" }, { 0xc3, "resource: resource unavailable" }, { 0xc4, "resource: not specified" }, { 0xc5, "resource: not specified" }, { 0xc6, "resource: not specified" }, { 0xc7, "resource: not specified" }, { 0xc8, "resource: User specific 12" }, { 0xc9, "resource: User specific 13" }, { 0xca, "resource: User specific 14" }, { 0xcb, "resource: User specific 15" }, { 0xcc, "resource: User specific 16" }, { 0xcd, "resource: User specific 17" }, { 0xce, "resource: User specific 18" }, { 0xcf, "resource: User specific 19" }, /* high nibble d-f user specific */ { 0, NULL } }; static const value_string pn_io_error_code2_pniorw[] = { /* all values are user specified */ { 0, NULL } }; static const value_string pn_io_error_code1_pnio[] = { { 0x00 /* 0*/, "Reserved" }, { 0x01 /* 1*/, "Connect: Faulty ARBlockReq" }, { 0x02 /* 2*/, "Connect: Faulty IOCRBlockReq" }, { 0x03 /* 3*/, "Connect: Faulty ExpectedSubmoduleBlockReq" }, { 0x04 /* 4*/, "Connect: Faulty AlarmCRBlockReq" }, { 0x05 /* 5*/, "Connect: Faulty PrmServerBlockReq" }, { 0x06 /* 6*/, "Connect: Faulty MCRBlockReq" }, { 0x07 /* 7*/, "Connect: Faulty ARRPCBlockReq" }, { 0x08 /* 8*/, "Read/Write Record: Faulty Record" }, { 0x09 /* 9*/, "Connect: Faulty IRInfoBlock" }, { 0x0A /* 10*/, "Connect: Faulty SRInfoBlock" }, { 0x0B /* 11*/, "Connect: Faulty ARFSUBlock" }, { 0x0C /* 12*/, "Connect: Faulty ARVendorBlockReq" }, { 0x0D /* 13*/, "Connect: Faulty RSInfoBlock" }, { 0x14 /* 20*/, "IODControl: Faulty ControlBlockConnect" }, { 0x15 /* 21*/, "IODControl: Faulty ControlBlockPlug" }, { 0x16 /* 22*/, "IOXControl: Faulty ControlBlock after a connect est." }, { 0x17 /* 23*/, "IOXControl: Faulty ControlBlock a plug alarm" }, { 0x18 /* 24*/, "IOXControl: Faulty ControlBlockPrmBegin" }, { 0x19 /* 25*/, "IOXControl: Faulty SubmoduleListBlock" }, { 0x28 /* 40*/, "Release: Faulty ReleaseBlock" }, { 0x32 /* 50*/, "Response: Faulty ARBlockRes" }, { 0x33 /* 51*/, "Response: Faulty IOCRBlockRes" }, { 0x34 /* 52*/, "Response: Faulty AlarmCRBlockRes" }, { 0x35 /* 53*/, "Response: Faulty ModuleDifflock" }, { 0x36 /* 54*/, "Response: Faulty ARRPCBlockRes" }, { 0x37 /* 55*/, "Response: Faulty ARServerBlockRes" }, { 0x38 /* 56*/, "Response: Faulty ARVendorBlockRes" }, { 0x3c /* 60*/, "AlarmAck Error Codes" }, { 0x3d /* 61*/, "CMDEV" }, { 0x3e /* 62*/, "CMCTL" }, { 0x3f /* 63*/, "CTLDINA" }, { 0x40 /* 64*/, "CMRPC" }, { 0x41 /* 65*/, "ALPMI" }, { 0x42 /* 66*/, "ALPMR" }, { 0x43 /* 67*/, "LMPM" }, { 0x44 /* 68*/, "MAC" }, { 0x45 /* 69*/, "RPC" }, { 0x46 /* 70*/, "APMR" }, { 0x47 /* 71*/, "APMS" }, { 0x48 /* 72*/, "CPM" }, { 0x49 /* 73*/, "PPM" }, { 0x4a /* 74*/, "DCPUCS" }, { 0x4b /* 75*/, "DCPUCR" }, { 0x4c /* 76*/, "DCPMCS" }, { 0x4d /* 77*/, "DCPMCR" }, { 0x4e /* 78*/, "FSPM" }, { 0x4f /* 79*/, "RSI" }, { 0x50 /* 80*/, "RSIR" }, { 0x64 /*100*/, "CTLSM" }, { 0x65 /*101*/, "CTLRDI" }, { 0x66 /*102*/, "CTLRDR" }, { 0x67 /*103*/, "CTLWRI" }, { 0x68 /*104*/, "CTLWRR" }, { 0x69 /*105*/, "CTLIO" }, { 0x6a /*106*/, "CTLSU" }, { 0x6b /*107*/, "CTLRPC" }, { 0x6c /*108*/, "CTLBE" }, { 0x6d /*109*/, "CTLSRL" }, { 0x6e /*110*/, "NME" }, { 0x6f /*111*/, "TDE" }, { 0x70 /*112*/, "PCE" }, { 0x71 /*113*/, "NCE" }, { 0x72 /*114*/, "NUE" }, { 0x73 /*115*/, "BNME" }, { 0x74 /*116*/, "CTLSAM" }, { 0xc8 /*200*/, "CMSM" }, { 0xca /*202*/, "CMRDR" }, { 0xcc /*204*/, "CMWRR" }, { 0xcd /*205*/, "CMIO" }, { 0xce /*206*/, "CMSU" }, { 0xd0 /*208*/, "CMINA" }, { 0xd1 /*209*/, "CMPBE" }, { 0xd2 /*210*/, "CMSRL" }, { 0xd3 /*211*/, "CMDMC" }, { 0xd4 /*212*/, "CMSAM" }, { 0xfd /*253*/, "RTA_ERR_CLS_PROTOCOL" }, { 0xff /*255*/, "User specific" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_1[] = { /* CheckingRules for ARBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter ARType" }, { 5, "Error in Parameter ARUUID" }, { 7, "Error in Parameter CMInitiatorMACAddress" }, { 8, "Error in Parameter CMInitiatorObjectUUID" }, { 9, "Error in Parameter ARProperties" }, { 10, "Error in Parameter CMInitiatorActivityTimeoutFactor" }, { 11, "Error in Parameter InitiatorUDPRTPort" }, { 12, "Error in Parameter StationNameLength" }, { 13, "Error in Parameter CMInitiatorStationName" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_2[] = { /* CheckingRules for IOCRBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter IOCRType" }, { 5, "Error in Parameter IOCRReference" }, { 6, "Error in Parameter LT" }, { 7, "Error in Parameter IOCRProperties" }, { 8, "Error in Parameter DataLength" }, { 9, "Error in Parameter FrameID" }, { 10, "Error in Parameter SendClockFactor" }, { 11, "Error in Parameter ReductionRatio" }, { 12, "Error in Parameter Phase" }, { 14, "Error in Parameter FrameSendOffset" }, { 15, "Error in Parameter WatchdogFactor" }, { 16, "Error in Parameter DataHoldFactor" }, { 17, "Error in Parameter IOCRTagHeader" }, { 18, "Error in Parameter IOCRMulticastMacAddress" }, { 19, "Error in Parameter NumberOfAPI" }, { 20, "Error in Parameter API" }, { 21, "Error in Parameter NumberOfIODataObjects" }, { 22, "Error in Parameter SlotNumber" }, { 23, "Error in Parameter SubslotNumber" }, { 24, "Error in Parameter IODataObjectFrameOffset" }, { 25, "Error in Parameter NumberOfIOCS" }, { 26, "Error in Parameter SlotNumber" }, { 27, "Error in Parameter SubslotNumber" }, { 28, "Error in Parameter IOCSFrameOffset" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_3[] = { /* CheckingRules for ExpectedSubmoduleBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter NumberOfAPI" }, { 5, "Error in Parameter API" }, { 6, "Error in Parameter SlotNumber" }, { 7, "Error in Parameter ModuleIdentNumber" }, { 8, "Error in Parameter ModuleProperties" }, { 9, "Error in Parameter NumberOfSubmodules" }, { 10, "Error in Parameter SubslotNumber" }, { 12, "Error in Parameter SubmoduleProperties" }, { 13, "Error in Parameter DataDescription" }, { 14, "Error in Parameter SubmoduleDataLength" }, { 15, "Error in Parameter LengthIOPS" }, { 16, "Error in Parameter LengthIOCS" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_4[] = { /* CheckingRules for AlarmCRBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter AlarmCRType" }, { 5, "Error in Parameter LT" }, { 6, "Error in Parameter AlarmCRProperties" }, { 7, "Error in Parameter RTATimeoutFactor" }, { 8, "Error in Parameter RTARetries" }, { 10, "Error in Parameter MaxAlarmDataLength" }, { 11, "Error in Parameter AlarmCRTagHeaderHigh" }, { 12, "Error in Parameter AlarmCRTagHeaderLow" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_5[] = { /* CheckingRules for PrmServerBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 6, "Error in Parameter CMInitiatorActivityTimeoutFactor" }, { 7, "Error in Parameter StationNameLength" }, { 8, "Error in Parameter ParameterServerStationName" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_6[] = { /* CheckingRules for MCRBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter IOCRReference" }, { 5, "Error in Parameter AddressResolutionProperties" }, { 6, "Error in Parameter MCITimeoutFactor" }, { 7, "Error in Parameter StationNameLength" }, { 8, "Error in Parameter ProviderStationName" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_7[] = { /* CheckingRules for MCRBlockReq */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter InitiatorRPCServerPort" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_8[] = { /* CheckingRules for Read/Write ParameterReqHeader */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 5, "Error in Parameter ARUUID" }, { 6, "Error in Parameter API" }, { 7, "Error in Parameter SlotNumber" }, { 8, "Error in Parameter SubslotNumber" }, { 9, "Error in Parameter Padding" }, { 10, "Error in Parameter Index" }, { 11, "Error in Parameter RecordDataLength" }, { 12, "Error in Parameter TargetARUUID" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_13[] = { /* CheckingRules for RSInfoBlock */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 5, "Error in Parameter RSProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_20[] = { /* CheckingRules for ControlBlockConnect */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 6, "Error in Parameter SessionKey" }, { 7, "Error in Parameter Padding" }, { 8, "Error in Parameter ControlCommand" }, { 9, "Error in Parameter ControlBlockProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_21[] = { /* CheckingRules for ControlBlockPlug */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 6, "Error in Parameter SessionKey" }, { 7, "Error in Parameter AlarmSequenceNumber" }, { 8, "Error in Parameter ControlCommand" }, { 9, "Error in Parameter ControlBlockProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_22[] = { /* CheckingRule for ControlBlockConnect */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 6, "Error in Parameter SessionKey" }, { 7, "Error in Parameter Padding" }, { 8, "Error in Parameter ControlCommand" }, { 9, "Error in Parameter ControlBlockProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_23[] = { /* CheckingRules for ControlBlockPlug */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 6, "Error in Parameter SessionKey" }, { 7, "Error in Parameter AlarmSequenceNumber" }, { 8, "Error in Parameter ControlCommand" }, { 9, "Error in Parameter ControlBlockProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_40[] = { /* CheckingRules for ReleaseBlock */ { 0, "Error in Parameter BlockType" }, { 1, "Error in Parameter BlockLength" }, { 2, "Error in Parameter BlockVersionHigh" }, { 3, "Error in Parameter BlockVersionLow" }, { 4, "Error in Parameter Padding" }, { 6, "Error in Parameter SessionKey" }, { 7, "Error in Parameter Padding" }, { 8, "Error in Parameter ControlCommand" }, { 9, "Error in Parameter ControlBlockProperties" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_60[] = { /* AlarmAck Error Codes */ { 0, "Alarm Type Not Supported" }, { 1, "Wrong Submodule State" }, { 2, "IOCARSR Backup - Alarm not executed" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_61[] = { /* CMDEV */ { 0, "State Conflict" }, { 1, "Resources" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_62[] = { /* CMCTL */ { 0, "State Conflict" }, { 1, "Timeout" }, { 2, "No data send" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_63[] = { /* NRPM */ { 0, "No DCP active" }, { 1, "DNS Unknown_RealStationName" }, { 2, "DCP No_RealStationName" }, { 3, "DCP Multiple_RealStationName" }, { 4, "DCP No_StationName" }, { 5, "No_IP_Addr" }, { 6, "DCP_Set_Error" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_64[] = { /* RMPM */ { 0, "ArgsLength invalid" }, { 1, "Unknown Blocks" }, { 2, "IOCR Missing" }, { 3, "Wrong AlarmCRBlock count" }, { 4, "Out of AR Resources" }, { 5, "AR UUID unknown" }, { 6, "State conflict" }, { 7, "Out of Provider, Consumer or Alarm Resources" }, { 8, "Out of Memory" }, { 9, "Pdev already owned" }, { 10, "ARset State conflict during connection establishment" }, { 11, "ARset Parameter conflict during connection establishment" }, { 12, "Pdev, port(s) without interface" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_65[] = { /* ALPMI */ { 0, "Invalid State" }, { 1, "Wrong ACK-PDU" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_66[] = { /* ALPMR */ { 0, "Invalid State" }, { 1, "Wrong Notification PDU" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_70[] = { /* APMR */ { 0, "Invalid State" }, { 1, "LMPM signaled error" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_71[] = { /* APMS */ { 0, "Invalid State" }, { 1, "LMPM signaled error" }, { 2, "Timeout" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_72[] = { /* CPM */ { 1, "Invalid State" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_73[] = { /* PPM */ { 1, "Invalid State" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_74[] = { /* DCPUCS */ { 0, "Invalid State" }, { 1, "LMPM signaled an error" }, { 2, "Timeout" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_75[] = { /* DCPUCR */ { 0, "Invalid State" }, { 1, "LMPM signaled an error" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_76[] = { /* DCPMCS */ { 0, "Invalid State" }, { 1, "LMPM signaled an error" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_77[] = { /* DCPMCR */ { 0, "Invalid State" }, { 1, "LMPM signaled an error" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_253[] = { { 0, "reserved" }, { 1, "Error within the coordination of sequence numbers (RTA_ERR_CODE_SEQ) error" }, { 2, "Instance closed (RTA_ERR_ABORT)" }, { 3, "AR out of memory (RTA_ERR_ABORT)" }, { 4, "AR add provider or consumer failed (RTA_ERR_ABORT)" }, { 5, "AR consumer DHT/WDT expired (RTA_ERR_ABORT)" }, { 6, "AR cmi timeout (RTA_ERR_ABORT)" }, { 7, "AR alarm-open failed (RTA_ERR_ABORT)" }, { 8, "AR alarm-send.cnf(-) (RTA_ERR_ABORT)" }, { 9, "AR alarm-ack-send.cnf(-) (RTA_ERR_ABORT)" }, { 10, "AR alarm data too long (RTA_ERR_ABORT)" }, { 11, "AR alarm.ind(err) (RTA_ERR_ABORT)" }, { 12, "AR rpc-client call.cnf(-) (RTA_ERR_ABORT)" }, { 13, "AR abort.req (RTA_ERR_ABORT)" }, { 14, "AR re-run aborts existing (RTA_ERR_ABORT)" }, { 15, "AR release.ind received (RTA_ERR_ABORT)" }, { 16, "AR device deactivated (RTA_ERR_ABORT)" }, { 17, "AR removed (RTA_ERR_ABORT)" }, { 18, "AR protocol violation (RTA_ERR_ABORT)" }, { 19, "AR name resolution error (RTA_ERR_ABORT)" }, { 20, "AR RPC-Bind error (RTA_ERR_ABORT)" }, { 21, "AR RPC-Connect error (RTA_ERR_ABORT)" }, { 22, "AR RPC-Read error (RTA_ERR_ABORT)" }, { 23, "AR RPC-Write error (RTA_ERR_ABORT)" }, { 24, "AR RPC-Control error (RTA_ERR_ABORT)" }, { 25, "AR forbidden pull or plug after check.rsp and before in-data.ind (RTA_ERR_ABORT)" }, { 26, "AR AP removed (RTA_ERR_ABORT)" }, { 27, "AR link down (RTA_ERR_ABORT)" }, { 28, "AR could not register multicast-mac address (RTA_ERR_ABORT)" }, { 29, "not synchronized (cannot start companion-ar) (RTA_ERR_ABORT)" }, { 30, "wrong topology (cannot start companion-ar) (RTA_ERR_ABORT)" }, { 31, "dcp, station-name changed (RTA_ERR_ABORT)" }, { 32, "dcp, reset to factory-settings (RTA_ERR_ABORT)" }, { 33, "cannot start companion-AR because a 0x8ipp submodule in the first AR... (RTA_ERR_ABORT)" }, { 34, "no irdata record yet (RTA_ERR_ABORT)" }, { 35, "PDEV (RTA_ERROR_ABORT)" }, { 36, "PDEV, no port offers required speed/duplexity (RTA_ERROR_ABORT)" }, { 37, "IP-Suite [of the IOC] changed by means of DCP_Set(IPParameter) or local engineering (RTA_ERROR_ABORT)" }, { 38, "IOCARSR, RDHT expired" }, { 39, "IOCARSR, Pdev, parameterization impossible" }, { 40, "Remote application ready timeout expired" }, { 41, "IOCARSR, Redundant interface list or access to the peripherals impossible" }, { 42, "IOCARSR, MTOT expired" }, { 43, "IOCARSR, AR protocol violation" }, { 44, "PDEV, plug port without CombinedObjectContainer" }, { 45, "NME, no or wrong configuration" }, { 0, NULL } }; static const value_string pn_io_error_code2_pnio_255[] = { /* User specific */ { 255, "User abort" }, { 0, NULL } }; /* Initialize PNIO RTC1 stationInfo memory */ void init_pnio_rtc1_station(stationInfo *station_info) { station_info->iocs_data_in = wmem_list_new(wmem_file_scope()); station_info->iocs_data_out = wmem_list_new(wmem_file_scope()); station_info->ioobject_data_in = wmem_list_new(wmem_file_scope()); station_info->ioobject_data_out = wmem_list_new(wmem_file_scope()); station_info->diff_module = wmem_list_new(wmem_file_scope()); } /* dissect an 8 bit unsigned integer */ int dissect_pn_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint8 *pdata) { guint8 data; data = tvb_get_guint8 (tvb, offset); proto_tree_add_uint(tree, hfindex, tvb, offset, 1, data); if (pdata) *pdata = data; return offset + 1; } /* dissect a 16 bit unsigned integer; return the item through a pointer as well */ int dissect_pn_uint16_ret_item(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint16 *pdata, proto_item ** new_item) { guint16 data; proto_item *item = NULL; data = tvb_get_ntohs (tvb, offset); item = proto_tree_add_uint(tree, hfindex, tvb, offset, 2, data); if (pdata) *pdata = data; if (new_item) *new_item = item; return offset + 2; } /* dissect a 16 bit unsigned integer */ int dissect_pn_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint16 *pdata) { guint16 data; data = tvb_get_ntohs (tvb, offset); proto_tree_add_uint(tree, hfindex, tvb, offset, 2, data); if (pdata) *pdata = data; return offset + 2; } /* dissect a 16 bit signed integer */ int dissect_pn_int16(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, gint16 *pdata) { gint16 data; data = tvb_get_ntohs (tvb, offset); proto_tree_add_int(tree, hfindex, tvb, offset, 2, data); if (pdata) *pdata = data; return offset + 2; } /* dissect a 24bit OUI (IEC organizational unique id) */ int dissect_pn_oid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint32 *pdata) { guint32 data; data = tvb_get_ntoh24(tvb, offset); proto_tree_add_uint(tree, hfindex, tvb, offset, 3, data); if (pdata) *pdata = data; return offset + 3; } /* dissect a 6 byte MAC address */ int dissect_pn_mac(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint8 *pdata) { guint8 data[6]; tvb_memcpy(tvb, data, offset, 6); proto_tree_add_ether(tree, hfindex, tvb, offset, 6, data); if (pdata) memcpy(pdata, data, 6); return offset + 6; } /* dissect an IPv4 address */ int dissect_pn_ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint32 *pdata) { guint32 data; data = tvb_get_ipv4(tvb, offset); proto_tree_add_ipv4(tree, hfindex, tvb, offset, 4, data); if (pdata) *pdata = data; return offset + 4; } /* dissect a 16 byte UUID address */ int dissect_pn_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, e_guid_t *uuid) { guint8 drep[2] = { 0,0 }; offset = dissect_dcerpc_uuid_t(tvb, offset, pinfo, tree, drep, hfindex, uuid); return offset; } /* "dissect" some bytes still undecoded (with Expert warning) */ int dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length) { proto_item *item; item = proto_tree_add_string_format(tree, hf_pn_undecoded_data, tvb, offset, length, "data", "Undecoded Data: %d bytes", length); expert_add_info_format(pinfo, item, &ei_pn_undecoded_data, "Undecoded Data, %u bytes", length); return offset + length; } /* "dissect" some user bytes */ int dissect_pn_user_data_bytes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, int iSelect) { if(iSelect == FRAG_DATA) proto_tree_add_item(tree, hf_pn_frag_bytes, tvb, offset, length, ENC_NA); else proto_tree_add_item(tree, hf_pn_user_bytes, tvb, offset, length, ENC_NA); return offset + length; } int dissect_pn_user_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, const char *text) { if (length != 0) { proto_tree_add_string_format(tree, hf_pn_user_data, tvb, offset, length, "data", "%s: %d byte", text, length); } return offset + length; } /* packet is malformed, mark it as such */ int dissect_pn_malformed(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length) { proto_tree_add_item(tree, hf_pn_malformed, tvb, 0, 10000, ENC_NA); return offset + length; } /* dissect some padding data (with the given length) */ int dissect_pn_padding(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int length) { proto_tree_add_string_format(tree, hf_pn_padding, tvb, offset, length, "data", "Padding: %u byte", length); return offset + length; } /* align offset to 4 */ int dissect_pn_align4(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint padding = 0; if (offset % 4) { padding = 4 - (offset % 4); proto_tree_add_string_format(tree, hf_pn_padding, tvb, offset, padding, "data", "Padding: %u byte", padding); } return offset + padding; } /* dissect the four status (error) fields */ int dissect_PNIO_status(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) { guint8 u8ErrorCode; guint8 u8ErrorDecode; guint8 u8ErrorCode1; guint8 u8ErrorCode2; proto_item *sub_item; proto_tree *sub_tree; guint32 u32SubStart; int bytemask = (drep[0] & DREP_LITTLE_ENDIAN) ? 3 : 0; const value_string *error_code1_vals; const value_string *error_code2_vals = pn_io_error_code2; /* defaults */ /* status */ sub_item = proto_tree_add_item(tree, hf_pn_io_status, tvb, offset, 0, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_pn_io_status); u32SubStart = offset; /* the PNIOStatus field is existing in both the RPC and the application data, * depending on the current PDU. * As the byte representation of these layers are different, this has to be handled * in a somewhat different way than elsewhere. */ dissect_dcerpc_uint8(tvb, offset + (0 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code, &u8ErrorCode); dissect_dcerpc_uint8(tvb, offset + (1 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_decode, &u8ErrorDecode); switch (u8ErrorDecode) { case(0x80): /* PNIORW */ dissect_dcerpc_uint8(tvb, offset + (2 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code1_pniorw, &u8ErrorCode1); error_code1_vals = pn_io_error_code1_pniorw; /* u8ErrorCode2 for PNIORW is always user specific */ dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pniorw, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pniorw; break; case(0x81): /* PNIO */ dissect_dcerpc_uint8(tvb, offset + (2 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code1_pnio, &u8ErrorCode1); error_code1_vals = pn_io_error_code1_pnio; switch (u8ErrorCode1) { case(1): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_1, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_1; break; case(2): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_2, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_2; break; case(3): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_3, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_3; break; case(4): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_4, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_4; break; case(5): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_5, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_5; break; case(6): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_6, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_6; break; case(7): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_7, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_7; break; case(8): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_8, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_8; break; case(13): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_13, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_13; break; case(20): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_20, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_20; break; case(21): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_21, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_21; break; case(22): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_22, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_22; break; case(23): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_23, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_23; break; case(40): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_40, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_40; break; case(60): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_60, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_60; break; case(61): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_61, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_61; break; case(62): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_62, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_62; break; case(63): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_63, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_63; break; case(64): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_64, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_64; break; case(65): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_65, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_65; break; case(66): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_66, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_66; break; case(70): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_70, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_70; break; case(71): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_71, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_71; break; case(72): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_72, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_72; break; case(73): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_73, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_73; break; case(74): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_74, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_74; break; case(75): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_75, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_75; break; case(76): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_76, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_76; break; case(77): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_77, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_77; break; case(253): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_253, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_253; break; case(255): dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2_pnio_255, &u8ErrorCode2); error_code2_vals = pn_io_error_code2_pnio_255; break; default: /* don't know this u8ErrorCode1 for PNIO, use defaults */ dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2, &u8ErrorCode2); expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code1, "Unknown ErrorCode1 0x%x (for ErrorDecode==PNIO)", u8ErrorCode1); break; } break; default: dissect_dcerpc_uint8(tvb, offset + (2 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code1, &u8ErrorCode1); if (u8ErrorDecode != 0) { expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code1, "Unknown ErrorDecode 0x%x", u8ErrorDecode); } error_code1_vals = pn_io_error_code1; /* don't know this u8ErrorDecode, use defaults */ dissect_dcerpc_uint8(tvb, offset + (3 ^ bytemask), pinfo, sub_tree, drep, hf_pn_io_error_code2, &u8ErrorCode2); if (u8ErrorDecode != 0) { expert_add_info_format(pinfo, sub_item, &ei_pn_io_error_code2, "Unknown ErrorDecode 0x%x", u8ErrorDecode); } } offset += 4; if ((u8ErrorCode == 0) && (u8ErrorDecode == 0) && (u8ErrorCode1 == 0) && (u8ErrorCode2 == 0)) { proto_item_append_text(sub_item, ": OK"); col_append_str(pinfo->cinfo, COL_INFO, ", OK"); } else { proto_item_append_text(sub_item, ": Error: \"%s\", \"%s\", \"%s\", \"%s\"", val_to_str(u8ErrorCode, pn_io_error_code, "(0x%x)"), val_to_str(u8ErrorDecode, pn_io_error_decode, "(0x%x)"), val_to_str(u8ErrorCode1, error_code1_vals, "(0x%x)"), val_to_str(u8ErrorCode2, error_code2_vals, "(0x%x)")); col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: \"%s\", \"%s\", \"%s\", \"%s\"", val_to_str(u8ErrorCode, pn_io_error_code, "(0x%x)"), val_to_str(u8ErrorDecode, pn_io_error_decode, "(0x%x)"), val_to_str(u8ErrorCode1, error_code1_vals, "(0x%x)"), val_to_str(u8ErrorCode2, error_code2_vals, "(0x%x)")); } proto_item_set_len(sub_item, offset - u32SubStart); return offset; } /* append the given info text to item and column */ void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text) { col_append_str(pinfo->cinfo, COL_INFO, text); proto_item_append_text(dcp_item, "%s", text); } void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, guint32 setup) { ARUUIDFrame* aruuid_frame; aruuid_frame = wmem_new0(wmem_file_scope(), ARUUIDFrame); aruuid_frame->aruuid = aruuid; aruuid_frame->setupframe = setup; aruuid_frame->releaseframe = 0; aruuid_frame->inputframe = 0; aruuid_frame->outputframe = 0; wmem_list_append(aruuid_frame_setup_list, aruuid_frame); } ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo) { wmem_list_frame_t* aruuid_frame; ARUUIDFrame* current_aruuid_frame = NULL; if (aruuid_frame_setup_list != NULL) { for (aruuid_frame = wmem_list_head(aruuid_frame_setup_list); aruuid_frame != NULL; aruuid_frame = wmem_list_frame_next(aruuid_frame)) { current_aruuid_frame = (ARUUIDFrame*)wmem_list_frame_data(aruuid_frame); if (current_aruuid_frame->setupframe == pinfo->num) { break; } } } return current_aruuid_frame; } void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation) { stationInfo* dcp_station_info = NULL; /* search for DCP Station Info */ dcp_station_info = (stationInfo*)conversation_get_proto_data(conversation, proto_pn_dcp); if (dcp_station_info != NULL) { if (dcp_station_info->typeofstation != NULL) { if (station_info->typeofstation == NULL || strcmp(dcp_station_info->typeofstation, station_info->typeofstation) != 0) { station_info->typeofstation = wmem_strdup(wmem_file_scope(), dcp_station_info->typeofstation); } } if (dcp_station_info->nameofstation != NULL) { if (station_info->nameofstation == NULL || strcmp(dcp_station_info->nameofstation, station_info->nameofstation) != 0) { station_info->nameofstation = wmem_strdup(wmem_file_scope(), dcp_station_info->nameofstation); } } if (dcp_station_info->u16Vendor_id != station_info->u16Vendor_id || dcp_station_info->u16Device_id != station_info->u16Device_id) { station_info->u16Vendor_id = dcp_station_info->u16Vendor_id; station_info->u16Device_id = dcp_station_info->u16Device_id; } } } void init_pn (int proto) { static hf_register_info hf[] = { { &hf_pn_padding, { "Padding", "pn.padding", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_undecoded_data, { "Undecoded Data", "pn.undecoded", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_user_data, { "User Data", "pn.user_data", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_user_bytes, { "Substitute Data", "pn.user_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_frag_bytes, { "Fragment Data", "pn.frag_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_malformed, { "Malformed", "pn_rt.malformed", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_status, { "Status", "pn_io.status", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_error_code, { "ErrorCode", "pn_io.error_code", FT_UINT8, BASE_HEX, VALS(pn_io_error_code), 0x0, NULL, HFILL } }, { &hf_pn_io_error_decode, { "ErrorDecode", "pn_io.error_decode", FT_UINT8, BASE_HEX, VALS(pn_io_error_decode), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code1, { "ErrorCode1", "pn_io.error_code1", FT_UINT8, BASE_DEC, VALS(pn_io_error_code1), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code1_pniorw, { "ErrorCode1", "pn_io.error_code1", FT_UINT8, BASE_DEC, VALS(pn_io_error_code1_pniorw), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pniorw, { "ErrorCode2 for PNIORW is user specified!", "pn_io.error_code2", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_error_code1_pnio, { "ErrorCode1", "pn_io.error_code1", FT_UINT8, BASE_DEC, VALS(pn_io_error_code1_pnio), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_1, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_1), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_2, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_2), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_3, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_3), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_4, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_4), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_5, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_5), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_6, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_6), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_7, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_7), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_8, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_8), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_13, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_13), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_20, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_20), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_21, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_21), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_22, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_22), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_23, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_23), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_40, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_40), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_60, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_60), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_61, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_61), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_62, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_62), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_63, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_63), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_64, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_64), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_65, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_65), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_66, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_66), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_70, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_70), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_71, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_71), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_72, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_72), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_73, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_73), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_74, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_74), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_75, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_75), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_76, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_76), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_77, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_77), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_253, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_253), 0x0, NULL, HFILL } }, { &hf_pn_io_error_code2_pnio_255, { "ErrorCode2", "pn_io.error_code2", FT_UINT8, BASE_DEC, VALS(pn_io_error_code2_pnio_255), 0x0, NULL, HFILL } }, }; static gint *ett[] = { &ett_pn_io_status }; static ei_register_info ei[] = { { &ei_pn_undecoded_data, { "pn.undecoded_data", PI_UNDECODED, PI_WARN, "Undecoded Data", EXPFILL }}, { &ei_pn_io_error_code1, { "pn_io.error_code1.expert", PI_UNDECODED, PI_WARN, "Unknown ErrorCode1", EXPFILL }}, { &ei_pn_io_error_code2, { "pn_io.error_code2.expert", PI_UNDECODED, PI_WARN, "Unknown ErrorDecode", EXPFILL } }, }; expert_module_t* expert_pn; proto_register_field_array (proto, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); expert_pn = expert_register_protocol(proto); expert_register_field_array(expert_pn, ei, array_length(ei)); } /* Read a string from an "xml" file, dropping xml comment blocks */ char *pn_fgets(char *str, int n, FILE *stream, wmem_allocator_t *scope) { const char XML_COMMENT_START[] = "<!--"; const char XML_COMMENT_END[] = "-->"; char *retVal = fgets(str, n, stream); if (retVal == NULL) { /* No input, we're done */ return retVal; } /* Search for the XML begin comment marker */ char *comment_start = strstr(str, XML_COMMENT_START); char *common_start_end = comment_start + sizeof(XML_COMMENT_START) - 1; if(comment_start == NULL) { /* No comment start, we're done */ return retVal; } /* Terminate the input buffer at the comment start */ *comment_start = '\0'; size_t used_space = comment_start - str; size_t remaining_space = n - used_space; /* Read more data looking for the comment end */ char *comment_end = strstr(common_start_end, XML_COMMENT_END); if (comment_end == NULL) { // Not found in this line, read more lines until we do find it */ char *temp = (char*)wmem_alloc(scope, MAX_LINE_LENGTH); char *next_line = temp; while((comment_end == NULL) && (next_line != NULL)) { next_line = fgets(temp, MAX_LINE_LENGTH, stream); if (next_line == NULL) { /* No more data, exit now */ break; } comment_end = strstr(next_line, XML_COMMENT_END); } } if (comment_end == NULL) { /* We didn't find the comment end, return what we have */ return retVal; } /* We did find a comment end, skip past the comment */ char *comment_end_end = comment_end + sizeof(XML_COMMENT_END) - 1; /* Check we have space left in the buffer to move the trailing bytes after the comment end */ size_t remaining_bytes = strlen(comment_end_end) + 1; if (remaining_bytes < remaining_space) { (void) g_strlcat(str, comment_end_end, n); } else { /* Seek the file back to the comment end so the next read picks it up */ fseek(stream, -(long)(remaining_bytes), SEEK_CUR); } return retVal; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
C/C++
wireshark/plugins/epan/profinet/packet-pn.h
/* packet-pn.h * Common functions for other PROFINET protocols like DCP, MRP, ... * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1999 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ /* * Cyclic PNIO RTC1 Data Dissection: * * Added new structures to packet-pn.h to transfer the gained data of * packet-pn-dcp.c and packet-dcerpc-pn-io.c to packet-pn-rtc-one.c for * detailled dissection of cyclic PNIO RTC1 dataframes. * */ #define FRAME_ID_DCP_HELLO 0xfefc #define FRAME_ID_DCP_GETORSET 0xfefd #define FRAME_ID_DCP_IDENT_REQ 0xfefe #define FRAME_ID_DCP_IDENT_RES 0xfeff /* ---- Structures for pnio_rtc1 ---- */ extern int proto_pn_dcp; extern int proto_pn_io_apdu_status; extern int proto_pn_io_time_aware_status; extern gboolean pnio_ps_selection; /* given by pnio preferences */ /* Structure for general station information */ typedef struct tagStationInfo { /* general information */ gchar *typeofstation; gchar *nameofstation; guint16 u16Vendor_id; guint16 u16Device_id; /* frame structure */ guint16 ioDataObjectNr_in; guint16 ioDataObjectNr_out; guint16 iocsNr_in; guint16 iocsNr_out; /* GSDfile station information */ gboolean gsdFound; gboolean gsdPathLength; gchar *gsdLocation; /* IOCS object data */ wmem_list_t *iocs_data_in; wmem_list_t *iocs_data_out; /* IOData object data */ wmem_list_t *ioobject_data_in; wmem_list_t *ioobject_data_out; /* Different ModuleIdentnumber */ wmem_list_t *diff_module; } stationInfo; typedef struct tagApduStatusSwitch { gboolean isRedundancyActive; address dl_dst; address dl_src; }apduStatusSwitch; /* Structure for IOCS Frames */ typedef struct tagIocsObject { guint16 slotNr; guint16 subSlotNr; guint16 frameOffset; } iocsObject; /* Structure for IO Data Objects */ typedef struct tagIoDataObject { guint16 slotNr; guint16 subSlotNr; guint32 api; guint32 moduleIdentNr; guint32 subModuleIdentNr; guint16 frameOffset; guint16 length; guint16 amountInGSDML; guint32 fParameterIndexNr; guint16 f_par_crc1; guint16 f_src_adr; guint16 f_dest_adr; gboolean f_crc_seed; guint8 f_crc_len; address srcAddr; address dstAddr; gboolean profisafeSupported; gboolean discardIOXS; gchar *moduleNameStr; tvbuff_t *tvb_slot; tvbuff_t *tvb_subslot; /* Status- or Controlbyte data*/ guint8 last_sb_cb; guint8 lastToggleBit; } ioDataObject; /* Structure for Modules with different ModuleIdentnumber */ typedef struct tagModuleDiffInfo { guint16 slotNr; guint32 modulID; } moduleDiffInfo; typedef struct tagARUUIDFrame { e_guid_t aruuid; guint32 setupframe; guint32 releaseframe; guint16 outputframe; guint16 inputframe; } ARUUIDFrame; extern wmem_list_t *aruuid_frame_setup_list; extern void init_pn(int proto); extern void init_pn_io_rtc1(int proto); extern void init_pn_rsi(int proto); extern void pn_rsi_reassemble_init(void); extern void init_pnio_rtc1_station(stationInfo *station_info); extern int dissect_pn_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, int hfindex, guint8 *pdata); extern int dissect_pn_uint16_ret_item(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint16 *pdata, proto_item ** new_item); extern int dissect_pn_uint16(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, int hfindex, guint16 *pdata); extern int dissect_pn_int16(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, int hfindex, gint16 *pdata); extern int dissect_pn_oid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex, guint32 *pdata); extern int dissect_pn_mac(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex, guint8 *pdata); extern int dissect_pn_ipv4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex, guint32 *pdata); extern int dissect_pn_uuid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hfindex, e_guid_t *uuid); extern int dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint32 length); extern int dissect_pn_user_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, const char *text); extern int dissect_pn_pa_profile_data(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, const char *text); extern int dissect_blocks(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep); #define PDU_TYPE_REQ 0x05 #define PDU_TYPE_RSP 0x06 extern int dissect_rsi_blocks(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, guint8* drep, guint32 u32FOpnumOffsetOpnum, int type); #define SUBST_DATA 1 #define FRAG_DATA 2 extern int dissect_pn_user_data_bytes(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, guint32 length, int iSelect); extern int dissect_pn_malformed(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint32 length); extern int dissect_pn_padding(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int length); extern int dissect_pn_align4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); extern int dissect_PNIO_status(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep); extern int dissect_PNIO_C_SDU_RTC1(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree, guint8* drep _U_, guint16 frameid); extern int dissect_PNIO_RSI(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep); extern int dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow); extern void pn_append_info(packet_info *pinfo, proto_item *dcp_item, const char *text); extern void pn_init_append_aruuid_frame_setup_list(e_guid_t aruuid, guint32 setup); extern ARUUIDFrame* pn_find_aruuid_frame_setup(packet_info* pinfo); extern void pn_find_dcp_station_info(stationInfo* station_info, conversation_t* conversation); extern gboolean dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data); #define MAX_LINE_LENGTH 1024 /* used for fgets() */ /* Read a string from an "xml" file, dropping xml comment blocks */ #include <stdio.h> extern char *pn_fgets(char *str, int n, FILE *stream, wmem_allocator_t *scope);
Text
wireshark/plugins/epan/stats_tree/CMakeLists.txt
# CMakeLists.txt # # Wireshark - Network traffic analyzer # By Gerald Combs <[email protected]> # Copyright 1998 Gerald Combs # # SPDX-License-Identifier: GPL-2.0-or-later # include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) set_module_info(stats_tree 0 0 1 0) set(TAP_SRC pinfo_stats_tree.c ) set(PLUGIN_FILES plugin.c ${TAP_SRC} ) set_source_files_properties( ${PLUGIN_FILES} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin_tap ${TAP_SRC} ) add_wireshark_plugin_library(stats_tree epan) target_link_libraries(stats_tree epan) install_plugin(stats_tree epan) file(GLOB TAP_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.h") CHECKAPI( NAME stats_tree SWITCHES SOURCES ${TAP_SRC} ${TAP_HEADERS} ) # # Editor modelines - https://www.wireshark.org/tools/modelines.html # # Local variables: # c-basic-offset: 8 # tab-width: 8 # indent-tabs-mode: t # End: # # vi: set shiftwidth=8 tabstop=8 noexpandtab: # :indentSize=8:tabSize=8:noTabs=false: #
C
wireshark/plugins/epan/stats_tree/pinfo_stats_tree.c
/* pinfo_stats_tree.c * Stats tree for ethernet frames * * (c) 2005, Luis E. G. Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include "config.h" #include <epan/stats_tree.h> #include <epan/prefs.h> #include <epan/uat-int.h> #include <epan/to_str.h> #include "pinfo_stats_tree.h" /*------------------------------------- * UAT for Packet Lengths *------------------------------------- */ typedef struct { range_t *packet_range; } uat_plen_record_t; static range_t default_range[10] = { {1, {{0, 19}}}, {1, {{20, 39}}}, {1, {{40, 79}}}, {1, {{80, 159}}}, {1, {{160, 319}}}, {1, {{320, 639}}}, {1, {{640, 1279}}}, {1, {{1280, 2559}}}, {1, {{2560, 5119}}}, {1, {{5120, 0xFFFFFFFF}}} }; static uat_plen_record_t *uat_plen_records = NULL; static uat_t *plen_uat = NULL; static guint num_plen_uat = 0; void register_tap_listener_pinfo_stat_tree(void); static void *uat_plen_record_copy_cb(void *n, const void *o, size_t siz _U_) { const uat_plen_record_t *r = (const uat_plen_record_t *)o; uat_plen_record_t *rn = (uat_plen_record_t *)n; if (r->packet_range) rn->packet_range = range_copy(NULL, r->packet_range); return n; } static gboolean uat_plen_record_update_cb(void *r, char **err) { uat_plen_record_t *rec = (uat_plen_record_t*)r; if (rec->packet_range->nranges < 1) { *err = g_strdup("Invalid range string"); return FALSE; } *err = NULL; return TRUE; } static void uat_plen_record_free_cb(void*r) { uat_plen_record_t *record = (uat_plen_record_t*)r; if (record->packet_range) wmem_free(NULL, record->packet_range); } static void uat_plen_record_post_update_cb(void) { guint i, num_default; uat_plen_record_t rec; /* If there are no records, create default list */ if (num_plen_uat == 0) { num_default = sizeof(default_range)/sizeof(range_t); /* default values for packet lengths */ for (i = 0; i < num_default; i++) { rec.packet_range = &default_range[i]; uat_add_record(plen_uat, &rec, TRUE); } } } UAT_RANGE_CB_DEF(uat_plen_records, packet_range, uat_plen_record_t) /* ip host stats_tree -- basic test */ static int st_node_ipv4 = -1; static int st_node_ipv6 = -1; static const gchar *st_str_ipv4 = "IPv4 Statistics/All Addresses"; static const gchar *st_str_ipv6 = "IPv6 Statistics/All Addresses"; static void ipv4_hosts_stats_tree_init(stats_tree *st) { st_node_ipv4 = stats_tree_create_node(st, st_str_ipv4, 0, STAT_DT_INT, TRUE); } static void ipv6_hosts_stats_tree_init(stats_tree *st) { st_node_ipv6 = stats_tree_create_node(st, st_str_ipv6, 0, STAT_DT_INT, TRUE); } static tap_packet_status ip_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) { tick_stat_node(st, st_str, 0, FALSE); tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_src), st_node, FALSE); tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), st_node, FALSE); return TAP_PACKET_REDRAW; } static tap_packet_status ipv4_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return ip_hosts_stats_tree_packet(st, pinfo, st_node_ipv4, st_str_ipv4); } static tap_packet_status ipv6_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return ip_hosts_stats_tree_packet(st, pinfo, st_node_ipv6, st_str_ipv6); } /* ip host stats_tree -- separate source and dest, test stats_tree flags */ static int st_node_ipv4_src = -1; static int st_node_ipv4_dst = -1; static int st_node_ipv6_src = -1; static int st_node_ipv6_dst = -1; static const gchar *st_str_ipv4_srcdst = "IPv4 Statistics/Source and Destination Addresses"; static const gchar *st_str_ipv6_srcdst = "IPv6 Statistics/Source and Destination Addresses"; static const gchar *st_str_ipv4_src = "Source IPv4 Addresses"; static const gchar *st_str_ipv4_dst = "Destination IPv4 Addresses"; static const gchar *st_str_ipv6_src = "Source IPv6 Addresses"; static const gchar *st_str_ipv6_dst = "Destination IPv6 Addresses"; static void ip_srcdst_stats_tree_init(stats_tree *st, const gchar *st_str_src, int *st_node_src_ptr, const gchar *st_str_dst, int *st_node_dst_ptr) { /* create one tree branch for source */ *st_node_src_ptr = stats_tree_create_node(st, st_str_src, 0, STAT_DT_INT, TRUE); /* set flag so this branch will always be sorted to top of tree */ stat_node_set_flags(st, st_str_src, 0, FALSE, ST_FLG_SORT_TOP); /* creat another top level node for destination branch */ *st_node_dst_ptr = stats_tree_create_node(st, st_str_dst, 0, STAT_DT_INT, TRUE); /* set flag so this branch will not be expanded by default */ stat_node_set_flags(st, st_str_dst, 0, FALSE, ST_FLG_DEF_NOEXPAND); } static void ipv4_srcdst_stats_tree_init(stats_tree *st) { ip_srcdst_stats_tree_init(st, st_str_ipv4_src, &st_node_ipv4_src, st_str_ipv4_dst, &st_node_ipv4_dst); } static void ipv6_srcdst_stats_tree_init(stats_tree *st) { ip_srcdst_stats_tree_init(st, st_str_ipv6_src, &st_node_ipv6_src, st_str_ipv6_dst, &st_node_ipv6_dst); } static tap_packet_status ip_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node_src, const gchar *st_str_src, int st_node_dst, const gchar *st_str_dst) { /* update source branch */ tick_stat_node(st, st_str_src, 0, FALSE); tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_src), st_node_src, FALSE); /* update destination branch */ tick_stat_node(st, st_str_dst, 0, FALSE); tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), st_node_dst, FALSE); return TAP_PACKET_REDRAW; } static tap_packet_status ipv4_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return ip_srcdst_stats_tree_packet(st, pinfo, st_node_ipv4_src, st_str_ipv4_src, st_node_ipv4_dst, st_str_ipv4_dst); } static tap_packet_status ipv6_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return ip_srcdst_stats_tree_packet(st, pinfo, st_node_ipv6_src, st_str_ipv6_src, st_node_ipv6_dst, st_str_ipv6_dst); } /* packet type stats_tree -- test pivot node */ static int st_node_ipv4_ptype = -1; static int st_node_ipv6_ptype = -1; static const gchar *st_str_ipv4_ptype = "IPv4 Statistics/IP Protocol Types"; static const gchar *st_str_ipv6_ptype = "IPv6 Statistics/IP Protocol Types"; static void ipv4_ptype_stats_tree_init(stats_tree *st) { st_node_ipv4_ptype = stats_tree_create_pivot(st, st_str_ipv4_ptype, 0); } static void ipv6_ptype_stats_tree_init(stats_tree *st) { st_node_ipv6_ptype = stats_tree_create_pivot(st, st_str_ipv6_ptype, 0); } static tap_packet_status ipv4_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { stats_tree_tick_pivot(st, st_node_ipv4_ptype, port_type_to_str(pinfo->ptype)); return TAP_PACKET_REDRAW; } static tap_packet_status ipv6_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { stats_tree_tick_pivot(st, st_node_ipv6_ptype, port_type_to_str(pinfo->ptype)); return TAP_PACKET_REDRAW; } /* a tree example - IP - PROTO - PORT */ static int st_node_ipv4_dsts = -1; static int st_node_ipv6_dsts = -1; static const gchar *st_str_ipv4_dsts = "IPv4 Statistics/Destinations and Ports"; static const gchar *st_str_ipv6_dsts = "IPv6 Statistics/Destinations and Ports"; static void ipv4_dsts_stats_tree_init(stats_tree *st) { st_node_ipv4_dsts = stats_tree_create_node(st, st_str_ipv4_dsts, 0, STAT_DT_INT, TRUE); } static void ipv6_dsts_stats_tree_init(stats_tree *st) { st_node_ipv6_dsts = stats_tree_create_node(st, st_str_ipv6_dsts, 0, STAT_DT_INT, TRUE); } static tap_packet_status dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) { static gchar str[128]; int ip_dst_node; int protocol_node; tick_stat_node(st, st_str, 0, FALSE); ip_dst_node = tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), st_node, TRUE); protocol_node = tick_stat_node(st, port_type_to_str(pinfo->ptype), ip_dst_node, TRUE); snprintf(str, sizeof(str) - 1, "%u", pinfo->destport); tick_stat_node(st, str, protocol_node, TRUE); return TAP_PACKET_REDRAW; } static tap_packet_status ipv4_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return dsts_stats_tree_packet(st, pinfo, st_node_ipv4_dsts, st_str_ipv4_dsts); } static tap_packet_status ipv6_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { return dsts_stats_tree_packet(st, pinfo, st_node_ipv6_dsts, st_str_ipv6_dsts); } /* packet length stats_tree -- test range node */ static int st_node_plen = -1; static const gchar *st_str_plen = "Packet Lengths"; static void plen_stats_tree_init(stats_tree *st) { guint i; char **str_range_array = (char **)wmem_alloc(NULL, num_plen_uat*sizeof(char*)); /* Convert the ranges to strings for the stats tree API */ for (i = 0; i < num_plen_uat - 1; i++) { str_range_array[i] = range_convert_range(NULL, uat_plen_records[i].packet_range); } str_range_array[num_plen_uat - 1] = ws_strdup_printf("%u and greater", uat_plen_records[num_plen_uat - 1].packet_range->ranges[0].low); st_node_plen = stats_tree_create_range_node_string(st, st_str_plen, 0, num_plen_uat, str_range_array); for (i = 0; i < num_plen_uat; i++) { wmem_free(NULL, str_range_array[i]); } } static tap_packet_status plen_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_, tap_flags_t flags _U_) { tick_stat_node(st, st_str_plen, 0, FALSE); stats_tree_tick_range(st, st_str_plen, 0, pinfo->fd->pkt_len); return TAP_PACKET_REDRAW; } /* register all pinfo trees */ void register_tap_listener_pinfo_stat_tree(void) { module_t *stat_module; static uat_field_t plen_uat_flds[] = { UAT_FLD_RANGE(uat_plen_records, packet_range, "Packet Range", 0xFFFFFFFF, "Range of packet sizes to count"), UAT_END_FIELDS }; stats_tree_register_plugin("ip", "ip_hosts", st_str_ipv4, 0, ipv4_hosts_stats_tree_packet, ipv4_hosts_stats_tree_init, NULL ); stats_tree_register_plugin("ip", "ip_srcdst", st_str_ipv4_srcdst, 0, ipv4_srcdst_stats_tree_packet, ipv4_srcdst_stats_tree_init, NULL ); stats_tree_register_plugin("ip", "ptype", st_str_ipv4_ptype, 0, ipv4_ptype_stats_tree_packet, ipv4_ptype_stats_tree_init, NULL ); stats_tree_register_plugin("ip", "dests", st_str_ipv4_dsts, 0, ipv4_dsts_stats_tree_packet, ipv4_dsts_stats_tree_init, NULL ); stats_tree_register_plugin("ipv6", "ipv6_hosts", st_str_ipv6, 0, ipv6_hosts_stats_tree_packet, ipv6_hosts_stats_tree_init, NULL ); stats_tree_register_plugin("ipv6", "ipv6_srcdst", st_str_ipv6_srcdst, 0, ipv6_srcdst_stats_tree_packet, ipv6_srcdst_stats_tree_init, NULL ); stats_tree_register_plugin("ipv6", "ipv6_ptype", st_str_ipv6_ptype, 0, ipv6_ptype_stats_tree_packet, ipv6_ptype_stats_tree_init, NULL ); stats_tree_register_plugin("ipv6", "ipv6_dests", st_str_ipv6_dsts, 0, ipv6_dsts_stats_tree_packet, ipv6_dsts_stats_tree_init, NULL ); stats_tree_register_with_group("frame", "plen", st_str_plen, 0, plen_stats_tree_packet, plen_stats_tree_init, NULL, REGISTER_STAT_GROUP_GENERIC); stat_module = prefs_register_stat("stat_tree", "Stats Tree", "Stats Tree", NULL); plen_uat = uat_new("Packet Lengths", sizeof(uat_plen_record_t), /* record size */ "packet_lengths", /* filename */ TRUE, /* from_profile */ &uat_plen_records, /* data_ptr */ &num_plen_uat, /* numitems_ptr */ 0, /* not a dissector, so affects neither dissection nor fields */ NULL, /* help */ uat_plen_record_copy_cb, /* copy callback */ uat_plen_record_update_cb, /* update callback */ uat_plen_record_free_cb, /* free callback */ uat_plen_record_post_update_cb, /* post update callback */ NULL, /* reset callback */ plen_uat_flds); /* UAT field definitions */ prefs_register_uat_preference(stat_module, "packet_lengths", "Packet Lengths", "Delineated packet sizes to count", plen_uat); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=8 tabstop=8 noexpandtab: * :indentSize=8:tabSize=8:noTabs=false: */
C/C++
wireshark/plugins/epan/stats_tree/pinfo_stats_tree.h
/* pinfo_stats_tree.h * Stats tree for ethernet frames * * (c) 2005, Luis E. G. Ontanon <[email protected]> * * Wireshark - Network traffic analyzer * By Gerald Combs <[email protected]> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ extern void register_pinfo_stat_trees(void);