diff options
Diffstat (limited to 'plugins/epan')
134 files changed, 15936 insertions, 8112 deletions
diff --git a/plugins/epan/dfilter/ipaddr/CMakeLists.txt b/plugins/epan/dfilter/ipaddr/CMakeLists.txt new file mode 100644 index 0000000000..f140b5aefc --- /dev/null +++ b/plugins/epan/dfilter/ipaddr/CMakeLists.txt @@ -0,0 +1,46 @@ +# CMakeLists.txt +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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(ipaddr 0 1 0 0) + +set(DISSECTOR_SRC + ipaddr.c +) + +set(PLUGIN_FILES + ${DISSECTOR_SRC} +) + +set_source_files_properties( + ${PLUGIN_FILES} + PROPERTIES + COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" +) + +add_wireshark_epan_plugin_library(ipaddr) + +target_link_libraries(ipaddr epan) + +install_plugin(ipaddr epan) + +# +# 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: +# diff --git a/plugins/epan/dfilter/ipaddr/ipaddr.c b/plugins/epan/dfilter/ipaddr/ipaddr.c new file mode 100644 index 0000000000..53b7abc54b --- /dev/null +++ b/plugins/epan/dfilter/ipaddr/ipaddr.c @@ -0,0 +1,360 @@ +/* ipaddr.c + * + * Copyright 2023, João Valverde <j@v6e.pt> + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#define WS_BUILD_DLL +#include <wireshark.h> +#include <wsutil/plugins.h> +#include <epan/dfilter/dfilter-plugin.h> +#include <epan/iana-ip.h> + +#ifndef PLUGIN_VERSION +#define PLUGIN_VERSION "0.0.0" +#endif + +typedef bool (*ip_is_func_t)(fvalue_t *); + +static const struct ws_iana_ip_special_block * +lookup_block(fvalue_t *fv) +{ + switch (fvalue_type_ftenum(fv)) { + case FT_IPv4: + return ws_iana_ipv4_special_block_lookup(fvalue_get_ipv4(fv)->addr); + case FT_IPv6: + return ws_iana_ipv6_special_block_lookup(&fvalue_get_ipv6(fv)->addr); + default: + break; + } + ws_assert_not_reached(); +} + +static bool +df_func_ip_special_name(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + GPtrArray *arg; + fvalue_t *fv_res; + const struct ws_iana_ip_special_block *ptr; + + ws_assert(arg_count == 1); + arg = stack->data; + if (arg == NULL) + return false; + + for (unsigned i = 0; i < arg->len; i++) { + ptr = lookup_block(arg->pdata[i]); + if (ptr == NULL) + continue; + fv_res = fvalue_new(FT_STRING); + fvalue_set_string(fv_res, ptr->name); + df_cell_append(retval, fv_res); + } + + return !df_cell_is_empty(retval); +} + +static bool +df_func_ip_special_mask(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + GPtrArray *arg; + fvalue_t *fv_res; + const struct ws_iana_ip_special_block *ptr; + uint32_t mask; + + ws_assert(arg_count == 1); + arg = stack->data; + if (arg == NULL) + return false; + + for (unsigned i = 0; i < arg->len; i++) { + ptr = lookup_block(arg->pdata[i]); + if (ptr == NULL) + continue; + mask = 0; + if (ptr->reserved > 0) + mask |= (1UL << 0); + if (ptr->global > 0) + mask |= (1UL << 1); + if (ptr->forwardable > 0) + mask |= (1UL << 2); + if (ptr->destination > 0) + mask |= (1UL << 3); + if (ptr->source > 0) + mask |= (1UL << 4); + fv_res = fvalue_new(FT_UINT32); + fvalue_set_uinteger(fv_res, mask); + df_cell_append(retval, fv_res); + } + + return !df_cell_is_empty(retval); +} + +static bool +ip_is_link_local(fvalue_t *fv) +{ + switch (fvalue_type_ftenum(fv)) { + case FT_IPv4: + return in4_addr_is_link_local(fvalue_get_ipv4(fv)->addr); + case FT_IPv6: + return in6_addr_is_linklocal(&fvalue_get_ipv6(fv)->addr); + default: + break; + } + ws_assert_not_reached(); +} + +static bool +ip_is_multicast(fvalue_t *fv) +{ + switch (fvalue_type_ftenum(fv)) { + case FT_IPv4: + return in4_addr_is_multicast(fvalue_get_ipv4(fv)->addr); + case FT_IPv6: + return in6_addr_is_multicast(&fvalue_get_ipv6(fv)->addr); + default: + break; + } + ws_assert_not_reached(); +} + +static bool +ipv4_is_rfc1918(fvalue_t *fv) +{ + switch (fvalue_type_ftenum(fv)) { + case FT_IPv4: + return in4_addr_is_private(fvalue_get_ipv4(fv)->addr); + case FT_IPv6: + return false; + default: + break; + } + ws_assert_not_reached(); + +} + +static bool +ipv6_is_ula(fvalue_t *fv) +{ + switch (fvalue_type_ftenum(fv)) { + case FT_IPv4: + return false; + case FT_IPv6: + return in6_addr_is_uniquelocal(&fvalue_get_ipv6(fv)->addr); + default: + break; + } + ws_assert_not_reached(); +} + +static bool +df_func_ip_is_any(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval, ip_is_func_t is_func) +{ + GPtrArray *arg; + fvalue_t *fv_res; + + ws_assert(arg_count == 1); + arg = stack->data; + if (arg == NULL) + return false; + + for (unsigned i = 0; i < arg->len; i++) { + fv_res = fvalue_new(FT_BOOLEAN); + fvalue_set_uinteger64(fv_res, is_func(arg->pdata[i])); + df_cell_append(retval, fv_res); + } + + return !df_cell_is_empty(retval); +} + +static bool +df_func_ip_is_link_local(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + return df_func_ip_is_any(stack, arg_count, retval, ip_is_link_local); +} + +static bool +df_func_ip_is_multicast(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + return df_func_ip_is_any(stack, arg_count, retval, ip_is_multicast); +} + +static bool +df_func_ip_is_rfc1918(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + return df_func_ip_is_any(stack, arg_count, retval, ipv4_is_rfc1918); +} + +static bool +df_func_ip_is_ula(GSList *stack, uint32_t arg_count _U_, df_cell_t *retval) +{ + return df_func_ip_is_any(stack, arg_count, retval, ipv6_is_ula); +} + +#define IPv4 1 +#define IPv6 2 +#define Both 3 + +static bool +check_which(ftenum_t ftype, int which) +{ + switch (which) { + case IPv4: return ftype == FT_IPv4; + case IPv6: return ftype == FT_IPv6; + case Both: return ftype == FT_IPv4 || ftype == FT_IPv6; + default: + break; + } + ws_assert_not_reached(); +} + +static const char * +print_which(int which) +{ + switch (which) { + case IPv4: return "IPv4"; + case IPv6: return "IPv6"; + case Both: return "IPv4/IPv6"; + default: + break; + } + ws_assert_not_reached(); +} + +static void +check_ip_field(dfwork_t *dfw, const char *func_name, ftenum_t logical_ftype, + GSList *param_list, df_loc_t func_loc, int which) +{ + ws_assert(g_slist_length(param_list) == 1); + stnode_t *param = param_list->data; + ftenum_t ftype; + + if (stnode_type_id(param) == STTYPE_FIELD) { + ftype = df_semcheck_param(dfw, func_name, logical_ftype, param, func_loc); + if (check_which(ftype, which)) { + return; + } + } + dfunc_fail(dfw, param, "Only %s fields can be used as parameter for %s()", + print_which(which), func_name); +} + +static ftenum_t +semcheck_ip_special_name(dfwork_t *dfw, const char *func_name, ftenum_t logical_ftype, + GSList *param_list, df_loc_t func_loc) +{ + check_ip_field(dfw, func_name, logical_ftype, param_list, func_loc, Both); + return FT_STRING; +} + +static ftenum_t +semcheck_ip_special_mask(dfwork_t *dfw, const char *func_name, ftenum_t logical_ftype, + GSList *param_list, df_loc_t func_loc) +{ + check_ip_field(dfw, func_name, logical_ftype, param_list, func_loc, Both); + return FT_UINT32; +} + +static ftenum_t +semcheck_is_ip_field(dfwork_t *dfw, const char *func_name, ftenum_t logical_ftype, + GSList *param_list, df_loc_t func_loc) +{ + check_ip_field(dfw, func_name, logical_ftype, param_list, func_loc, Both); + return FT_BOOLEAN; +} + +static df_func_def_t func_ip_special_name = { + "ip_special_name", + df_func_ip_special_name, + 1, 1, + FT_STRING, + semcheck_ip_special_name, +}; + +static df_func_def_t func_ip_special_mask = { + "ip_special_mask", + df_func_ip_special_mask, + 1, 1, + FT_UINT32, + semcheck_ip_special_mask, +}; + +static df_func_def_t func_ip_is_link_local = { + "ip_linklocal", + df_func_ip_is_link_local, + 1, 1, + FT_BOOLEAN, + semcheck_is_ip_field, +}; + +static df_func_def_t func_ip_is_multicast = { + "ip_multicast", + df_func_ip_is_multicast, + 1, 1, + FT_BOOLEAN, + semcheck_is_ip_field, +}; + +static df_func_def_t func_ip_is_rfc1918 = { + "ip_rfc1918", + df_func_ip_is_rfc1918, + 1, 1, + FT_BOOLEAN, + semcheck_is_ip_field, +}; + +static df_func_def_t func_ip_is_ula = { + "ip_ula", + df_func_ip_is_ula, + 1, 1, + FT_BOOLEAN, + semcheck_is_ip_field, +}; + +static void +init(void) +{ + df_func_register(&func_ip_special_name); + df_func_register(&func_ip_special_mask); + df_func_register(&func_ip_is_link_local); + df_func_register(&func_ip_is_multicast); + df_func_register(&func_ip_is_rfc1918); + df_func_register(&func_ip_is_ula); +} + +static void +cleanup(void) +{ + df_func_deregister(&func_ip_special_name); + df_func_deregister(&func_ip_special_mask); + df_func_deregister(&func_ip_is_link_local); + df_func_deregister(&func_ip_is_multicast); + df_func_deregister(&func_ip_is_rfc1918); + df_func_deregister(&func_ip_is_ula); +} + +static void +plugin_register(void) +{ + static dfilter_plugin plug; + + plug.init = init; + plug.cleanup = cleanup; + dfilter_plugins_register(&plug); +} + +static struct ws_module module = { + .flags = WS_PLUGIN_DESC_DFUNCTION, + .version = PLUGIN_VERSION, + .spdx_id = WS_PLUGIN_SPDX_GPLv2, + .home_url = WS_PLUGIN_GITLAB_URL, + .blurb = "Display filter functions to test IP addresses", + .register_cb = &plugin_register, +}; + +WIRESHARK_PLUGIN_REGISTER_EPAN(&module, 0) diff --git a/plugins/epan/ethercat/CMakeLists.txt b/plugins/epan/ethercat/CMakeLists.txt index 3211c28742..3c38643733 100644 --- a/plugins/epan/ethercat/CMakeLists.txt +++ b/plugins/epan/ethercat/CMakeLists.txt @@ -35,10 +35,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "EtherCAT (Ethernet for Control Automation Technology) dissection" ${DISSECTOR_SRC} ) -add_plugin_library(ethercat epan) +add_wireshark_epan_plugin_library(ethercat) target_link_libraries(ethercat epan) diff --git a/plugins/epan/ethercat/packet-ams.c b/plugins/epan/ethercat/packet-ams.c index 2c9a7f7b9f..4372648b62 100644 --- a/plugins/epan/ethercat/packet-ams.c +++ b/plugins/epan/ethercat/packet-ams.c @@ -24,96 +24,98 @@ void proto_reg_handoff_ams(void); #define AMS_TCP_PORT 48898 /* Not IANA registered */ /* Define the ams proto */ -int proto_ams = -1; +int proto_ams; + +static dissector_handle_t amstcp_handle; /* Define the tree for ams */ -static int ett_ams = -1; -static int ett_ams_stateflags = -1; -static int ett_ams_adsreadrequest = -1; -static int ett_ams_adsreadresponse = -1; -static int ett_ams_adswriterequest = -1; -static int ett_ams_adswriteresponse = -1; -static int ett_ams_adsreadwriterequest = -1; -static int ett_ams_adsreadwriteresponse = -1; -static int ett_ams_adsreadstaterequest = -1; -static int ett_ams_adsreadstateresponse = -1; -static int ett_ams_adswritectrlrequest = -1; -static int ett_ams_adswritectrlresponse = -1; -static int ett_ams_adsreaddinforequest = -1; -static int ett_ams_adsreaddinforesponse = -1; -static int ett_ams_adsadddnrequest = -1; -static int ett_ams_adsadddnresponse = -1; -static int ett_ams_adsdeldnrequest = -1; -static int ett_ams_adsdeldnresponse = -1; -static int ett_ams_adsdnrequest = -1; - -static int hf_ams_sendernetid = -1; -static int hf_ams_senderport = -1; -static int hf_ams_targetnetid = -1; -static int hf_ams_targetport = -1; -static int hf_ams_cmdid = -1; -static int hf_ams_stateflags = -1; -static int hf_ams_stateresponse = -1; -static int hf_ams_statenoreturn = -1; -static int hf_ams_stateadscmd = -1; -static int hf_ams_statesyscmd = -1; -static int hf_ams_statehighprio = -1; -static int hf_ams_statetimestampadded = -1; -static int hf_ams_stateudp = -1; -static int hf_ams_stateinitcmd = -1; -static int hf_ams_statebroadcast = -1; -static int hf_ams_cbdata = -1; -static int hf_ams_errorcode = -1; -static int hf_ams_invokeid = -1; -static int hf_ams_data = -1; +static int ett_ams; +static int ett_ams_stateflags; +static int ett_ams_adsreadrequest; +static int ett_ams_adsreadresponse; +static int ett_ams_adswriterequest; +static int ett_ams_adswriteresponse; +static int ett_ams_adsreadwriterequest; +static int ett_ams_adsreadwriteresponse; +static int ett_ams_adsreadstaterequest; +static int ett_ams_adsreadstateresponse; +static int ett_ams_adswritectrlrequest; +static int ett_ams_adswritectrlresponse; +static int ett_ams_adsreaddinforequest; +static int ett_ams_adsreaddinforesponse; +static int ett_ams_adsadddnrequest; +static int ett_ams_adsadddnresponse; +static int ett_ams_adsdeldnrequest; +static int ett_ams_adsdeldnresponse; +static int ett_ams_adsdnrequest; + +static int hf_ams_sendernetid; +static int hf_ams_senderport; +static int hf_ams_targetnetid; +static int hf_ams_targetport; +static int hf_ams_cmdid; +static int hf_ams_stateflags; +static int hf_ams_stateresponse; +static int hf_ams_statenoreturn; +static int hf_ams_stateadscmd; +static int hf_ams_statesyscmd; +static int hf_ams_statehighprio; +static int hf_ams_statetimestampadded; +static int hf_ams_stateudp; +static int hf_ams_stateinitcmd; +static int hf_ams_statebroadcast; +static int hf_ams_cbdata; +static int hf_ams_errorcode; +static int hf_ams_invokeid; +static int hf_ams_data; /*ads Commands */ -static int hf_ams_adsindexgroup = -1; -static int hf_ams_adsindexoffset = -1; -static int hf_ams_adscblength = -1; -static int hf_ams_adsreadrequest = -1; -static int hf_ams_adsreadresponse = -1; -static int hf_ams_adsinvokeid = -1; -static int hf_ams_adsresult = -1; -static int hf_ams_adsdata = -1; -static int hf_ams_adswriterequest = -1; -static int hf_ams_adswriteresponse = -1; -static int hf_ams_adsreadwriterequest = -1; -static int hf_ams_adsreadwriteresponse = -1; -static int hf_ams_adscbreadlength = -1; -static int hf_ams_adscbwritelength = -1; -static int hf_ams_adsstate = -1; -static int hf_ams_adsdevicestate = -1; -static int hf_ams_adsnotificationhandle = -1; -static int hf_ams_adsreadstaterequest = -1; -static int hf_ams_adsreadstateresponse = -1; -static int hf_ams_adswritectrlrequest = -1; -static int hf_ams_adswritectrlresponse = -1; -static int hf_ams_adsreaddinforequest = -1; -static int hf_ams_adsreaddinforesponse = -1; -static int hf_ams_adsadddnrequest = -1; -static int hf_ams_adsadddnresponse = -1; -static int hf_ams_adsdeldnrequest = -1; -static int hf_ams_adsdeldnresponse = -1; -static int hf_ams_adsdnrequest = -1; -/* static int hf_ams_adsdnresponse = -1; */ -/* static int hf_ams_adsnoteattrib = -1; */ -/* static int hf_ams_adsnoteblocks = -1; */ -/* static int hf_ams_adsversion = -1; */ -static int hf_ams_adsdevicename = -1; -static int hf_ams_adsversionversion = -1; -static int hf_ams_adsversionrevision = -1; -static int hf_ams_adsversionbuild = -1; -static int hf_ams_adsnoteblocksstamps = -1; -/* static int hf_ams_adsnoteblocksstamp = -1; */ -/* static int hf_ams_adstimestamp = -1; */ -/* static int hf_ams_adssamplecnt = -1; */ -/* static int hf_ams_adsnoteblockssample = -1; */ -static int hf_ams_adstransmode = -1; -static int hf_ams_adsmaxdelay = -1; -static int hf_ams_adscycletime = -1; -/* static int hf_ams_adscmpmax = -1; */ -/* static int hf_ams_adscmpmin = -1; */ +static int hf_ams_adsindexgroup; +static int hf_ams_adsindexoffset; +static int hf_ams_adscblength; +static int hf_ams_adsreadrequest; +static int hf_ams_adsreadresponse; +static int hf_ams_adsinvokeid; +static int hf_ams_adsresult; +static int hf_ams_adsdata; +static int hf_ams_adswriterequest; +static int hf_ams_adswriteresponse; +static int hf_ams_adsreadwriterequest; +static int hf_ams_adsreadwriteresponse; +static int hf_ams_adscbreadlength; +static int hf_ams_adscbwritelength; +static int hf_ams_adsstate; +static int hf_ams_adsdevicestate; +static int hf_ams_adsnotificationhandle; +static int hf_ams_adsreadstaterequest; +static int hf_ams_adsreadstateresponse; +static int hf_ams_adswritectrlrequest; +static int hf_ams_adswritectrlresponse; +static int hf_ams_adsreaddinforequest; +static int hf_ams_adsreaddinforesponse; +static int hf_ams_adsadddnrequest; +static int hf_ams_adsadddnresponse; +static int hf_ams_adsdeldnrequest; +static int hf_ams_adsdeldnresponse; +static int hf_ams_adsdnrequest; +/* static int hf_ams_adsdnresponse; */ +/* static int hf_ams_adsnoteattrib; */ +/* static int hf_ams_adsnoteblocks; */ +/* static int hf_ams_adsversion; */ +static int hf_ams_adsdevicename; +static int hf_ams_adsversionversion; +static int hf_ams_adsversionrevision; +static int hf_ams_adsversionbuild; +static int hf_ams_adsnoteblocksstamps; +/* static int hf_ams_adsnoteblocksstamp; */ +/* static int hf_ams_adstimestamp; */ +/* static int hf_ams_adssamplecnt; */ +/* static int hf_ams_adsnoteblockssample; */ +static int hf_ams_adstransmode; +static int hf_ams_adsmaxdelay; +static int hf_ams_adscycletime; +/* static int hf_ams_adscmpmax; */ +/* static int hf_ams_adscmpmin; */ static dissector_handle_t ams_handle; @@ -372,7 +374,7 @@ static const value_string AMS_CommandId_vals[] = static void NetIdFormater(tvbuff_t *tvb, guint offset, char *szText, gint nMax) { - g_snprintf ( szText, nMax, "%d.%d.%d.%d.%d.%d", tvb_get_guint8(tvb, offset), + snprintf ( szText, nMax, "%d.%d.%d.%d.%d.%d", tvb_get_guint8(tvb, offset), tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2), tvb_get_guint8(tvb, offset+3), @@ -1218,15 +1220,13 @@ void proto_register_ams(void) proto_register_subtree_array(ett, array_length(ett)); ams_handle = register_dissector("ams", dissect_ams, proto_ams); + amstcp_handle = register_dissector("ams.tcp", dissect_amstcp, proto_ams ); } /* The registration hand-off routing */ void proto_reg_handoff_ams(void) { - dissector_handle_t amstcp_handle; - - amstcp_handle = create_dissector_handle( dissect_amstcp, proto_ams ); dissector_add_uint_with_preference("tcp.port", AMS_TCP_PORT, amstcp_handle); dissector_add_uint("ecatf.type", 2, ams_handle); } diff --git a/plugins/epan/ethercat/packet-ecatmb.c b/plugins/epan/ethercat/packet-ecatmb.c index 8192d3e523..183734b059 100644 --- a/plugins/epan/ethercat/packet-ecatmb.c +++ b/plugins/epan/ethercat/packet-ecatmb.c @@ -32,163 +32,163 @@ static dissector_handle_t ams_handle; static dissector_handle_t ecat_mailbox_handle; /* Define the EtherCAT mailbox proto */ -int proto_ecat_mailbox = -1; - -static int ett_ecat_mailbox = -1; -static int ett_ecat_mailbox_eoe = -1; -static int ett_ecat_mailbox_eoe_init = -1; -static int ett_ecat_mailbox_eoe_macfilter = -1; -static int ett_ecat_mailbox_eoe_macfilter_filter = -1; -static int ett_ecat_mailbox_eoe_macfilter_filtermask = -1; -static int ett_ecat_mailbox_coe = -1; -static int ett_ecat_mailbox_sdo = -1; -static int ett_ecat_mailbox_coe_sdoccs = -1; -static int ett_ecat_mailbox_coe_sdoscs = -1; -static int ett_ecat_mailbox_foe = -1; -static int ett_ecat_mailbox_foe_efw = -1; -static int ett_ecat_mailbox_soeflag = -1; -static int ett_ecat_mailbox_soe = -1; -static int ett_ecat_mailbox_fraghead = -1; -static int ett_ecat_mailbox_header = -1; - -static int hf_ecat_mailboxlength = -1; -static int hf_ecat_mailboxaddress = -1; -static int hf_ecat_mailboxpriority = -1; -static int hf_ecat_mailboxtype = -1; -static int hf_ecat_mailboxcounter = -1; -static int hf_ecat_mailbox_eoe = -1; -static int hf_ecat_mailbox_eoe_fraghead = -1; -static int hf_ecat_mailbox_eoe_type = -1; -static int hf_ecat_mailbox_eoe_fragno = -1; -static int hf_ecat_mailbox_eoe_offset = -1; -static int hf_ecat_mailbox_eoe_frame = -1; -static int hf_ecat_mailbox_eoe_last = -1; -static int hf_ecat_mailbox_eoe_timestampreq = -1; -static int hf_ecat_mailbox_eoe_timestampapp = -1; -static int hf_ecat_mailbox_eoe_fragment = -1; -static int hf_ecat_mailbox_eoe_init = -1; -static int hf_ecat_mailbox_eoe_init_contains_macaddr = -1; -static int hf_ecat_mailbox_eoe_init_contains_ipaddr = -1; -static int hf_ecat_mailbox_eoe_init_contains_subnetmask = -1; -static int hf_ecat_mailbox_eoe_init_contains_defaultgateway = -1; -static int hf_ecat_mailbox_eoe_init_contains_dnsserver = -1; -static int hf_ecat_mailbox_eoe_init_contains_dnsname = -1; -static int hf_ecat_mailbox_eoe_init_append_timestamp = -1; -static int hf_ecat_mailbox_eoe_init_macaddr = -1; -static int hf_ecat_mailbox_eoe_init_ipaddr = -1; -static int hf_ecat_mailbox_eoe_init_subnetmask = -1; -static int hf_ecat_mailbox_eoe_init_defaultgateway = -1; -static int hf_ecat_mailbox_eoe_init_dnsserver = -1; -static int hf_ecat_mailbox_eoe_init_dnsname = -1; -static int hf_ecat_mailbox_eoe_macfilter = -1; -static int hf_ecat_mailbox_eoe_macfilter_macfiltercount = -1; -static int hf_ecat_mailbox_eoe_macfilter_maskcount = -1; -static int hf_ecat_mailbox_eoe_macfilter_nobroadcasts = -1; +int proto_ecat_mailbox; + +static int ett_ecat_mailbox; +static int ett_ecat_mailbox_eoe; +static int ett_ecat_mailbox_eoe_init; +static int ett_ecat_mailbox_eoe_macfilter; +static int ett_ecat_mailbox_eoe_macfilter_filter; +static int ett_ecat_mailbox_eoe_macfilter_filtermask; +static int ett_ecat_mailbox_coe; +static int ett_ecat_mailbox_sdo; +static int ett_ecat_mailbox_coe_sdoccs; +static int ett_ecat_mailbox_coe_sdoscs; +static int ett_ecat_mailbox_foe; +static int ett_ecat_mailbox_foe_efw; +static int ett_ecat_mailbox_soeflag; +static int ett_ecat_mailbox_soe; +static int ett_ecat_mailbox_fraghead; +static int ett_ecat_mailbox_header; + +static int hf_ecat_mailboxlength; +static int hf_ecat_mailboxaddress; +static int hf_ecat_mailboxpriority; +static int hf_ecat_mailboxtype; +static int hf_ecat_mailboxcounter; +static int hf_ecat_mailbox_eoe; +static int hf_ecat_mailbox_eoe_fraghead; +static int hf_ecat_mailbox_eoe_type; +static int hf_ecat_mailbox_eoe_fragno; +static int hf_ecat_mailbox_eoe_offset; +static int hf_ecat_mailbox_eoe_frame; +static int hf_ecat_mailbox_eoe_last; +static int hf_ecat_mailbox_eoe_timestampreq; +static int hf_ecat_mailbox_eoe_timestampapp; +static int hf_ecat_mailbox_eoe_fragment; +static int hf_ecat_mailbox_eoe_init; +static int hf_ecat_mailbox_eoe_init_contains_macaddr; +static int hf_ecat_mailbox_eoe_init_contains_ipaddr; +static int hf_ecat_mailbox_eoe_init_contains_subnetmask; +static int hf_ecat_mailbox_eoe_init_contains_defaultgateway; +static int hf_ecat_mailbox_eoe_init_contains_dnsserver; +static int hf_ecat_mailbox_eoe_init_contains_dnsname; +static int hf_ecat_mailbox_eoe_init_append_timestamp; +static int hf_ecat_mailbox_eoe_init_macaddr; +static int hf_ecat_mailbox_eoe_init_ipaddr; +static int hf_ecat_mailbox_eoe_init_subnetmask; +static int hf_ecat_mailbox_eoe_init_defaultgateway; +static int hf_ecat_mailbox_eoe_init_dnsserver; +static int hf_ecat_mailbox_eoe_init_dnsname; +static int hf_ecat_mailbox_eoe_macfilter; +static int hf_ecat_mailbox_eoe_macfilter_macfiltercount; +static int hf_ecat_mailbox_eoe_macfilter_maskcount; +static int hf_ecat_mailbox_eoe_macfilter_nobroadcasts; static int hf_ecat_mailbox_eoe_macfilter_filter; -static int hf_ecat_mailbox_eoe_macfilter_filters[16] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; -static int hf_ecat_mailbox_eoe_macfilter_filtermask = -1; -static int hf_ecat_mailbox_eoe_macfilter_filtermasks[4] = {-1,-1,-1,-1}; -static int hf_ecat_mailbox_eoe_timestamp = -1; -static int hf_ecat_mailbox_coe = -1; -static int hf_ecat_mailbox_coe_number = -1; -static int hf_ecat_mailbox_coe_type = -1; -static int hf_ecat_mailbox_coe_sdoreq = -1; -static int hf_ecat_mailbox_coe_sdoccsid = -1; -static int hf_ecat_mailbox_coe_sdoccsid_sizeind = -1; -static int hf_ecat_mailbox_coe_sdoccsid_expedited = -1; -static int hf_ecat_mailbox_coe_sdoccsid_size0= -1; -static int hf_ecat_mailbox_coe_sdoccsid_size1= -1; -static int hf_ecat_mailbox_coe_sdoccsid_complete = -1; -static int hf_ecat_mailbox_coe_sdoccsds = -1; -static int hf_ecat_mailbox_coe_sdoccsds_lastseg = -1; -static int hf_ecat_mailbox_coe_sdoccsds_size = -1; -static int hf_ecat_mailbox_coe_sdoccsds_toggle = -1; -static int hf_ecat_mailbox_coe_sdoccsus = -1; -static int hf_ecat_mailbox_coe_sdoccsus_toggle = -1; -static int hf_ecat_mailbox_coe_sdoccsiu = -1; -/* static int hf_ecat_mailbox_coe_sdoccsiu_complete = -1; */ -static int hf_ecat_mailbox_coe_sdoidx = -1; -static int hf_ecat_mailbox_coe_sdoabortcode = -1; -static int hf_ecat_mailbox_coe_sdosub = -1; -static int hf_ecat_mailbox_coe_sdodata = -1; -static int hf_ecat_mailbox_coe_sdodata1 = -1; -static int hf_ecat_mailbox_coe_sdodata2 = -1; -static int hf_ecat_mailbox_coe_sdoldata = -1; -static int hf_ecat_mailbox_coe_sdolength = -1; -/* static int hf_ecat_mailbox_coe_sdoerror = -1; */ -static int hf_ecat_mailbox_coe_sdores = -1; -static int hf_ecat_mailbox_coe_sdoscsds = -1; -static int hf_ecat_mailbox_coe_sdoscsds_toggle = -1; -static int hf_ecat_mailbox_coe_sdoscsiu = -1; -static int hf_ecat_mailbox_coe_sdoscsiu_sizeind = -1; -static int hf_ecat_mailbox_coe_sdoscsiu_expedited = -1; -static int hf_ecat_mailbox_coe_sdoscsiu_size0 = -1; -static int hf_ecat_mailbox_coe_sdoscsiu_size1 = -1; -static int hf_ecat_mailbox_coe_sdoscsiu_complete = -1; -static int hf_ecat_mailbox_coe_sdoscsus = -1; -static int hf_ecat_mailbox_coe_sdoscsus_lastseg = -1; -static int hf_ecat_mailbox_coe_sdoscsus_bytes = -1; -static int hf_ecat_mailbox_coe_sdoscsus_toggle = -1; -static int hf_ecat_mailbox_coe_sdoinfoopcode = -1; -static int hf_ecat_mailbox_coe_sdoinfofrag = -1; -static int hf_ecat_mailbox_coe_sdoinfolisttype = -1; -static int hf_ecat_mailbox_coe_sdoinfolist = -1; -static int hf_ecat_mailbox_coe_sdoinfoindex = -1; -static int hf_ecat_mailbox_coe_sdoinfosubindex = -1; -static int hf_ecat_mailbox_coe_sdoinfovalueinfo = -1; -static int hf_ecat_mailbox_coe_sdoinfoerrorcode = -1; -static int hf_ecat_mailbox_coe_sdoinfodatatype = -1; -static int hf_ecat_mailbox_coe_sdoinfomaxsub = -1; -static int hf_ecat_mailbox_coe_sdoinfoobjcode = -1; -static int hf_ecat_mailbox_coe_sdoinfoname = -1; -static int hf_ecat_mailbox_coe_sdoinfobitlen = -1; -static int hf_ecat_mailbox_coe_sdoinfoobjaccess = -1; -static int hf_ecat_mailbox_coe_sdoinfounittype = -1; -static int hf_ecat_mailbox_coe_sdoinfodefaultvalue = -1; -static int hf_ecat_mailbox_coe_sdoinfominvalue = -1; -static int hf_ecat_mailbox_coe_sdoinfomaxvalue = -1; -static int hf_ecat_mailboxdata = -1; -static int hf_ecat_mailbox_foe = -1; -static int hf_ecat_mailbox_foe_opmode = -1; -static int hf_ecat_mailbox_foe_filelength = -1; -static int hf_ecat_mailbox_foe_filename = -1; -static int hf_ecat_mailbox_foe_packetno = -1; -static int hf_ecat_mailbox_foe_errcode = -1; -static int hf_ecat_mailbox_foe_errtext = -1; -static int hf_ecat_mailbox_foe_busydone = -1; -static int hf_ecat_mailbox_foe_busyentire = -1; -static int hf_ecat_mailbox_foe_data = -1; -static int hf_ecat_mailbox_foe_efw = -1; -static int hf_ecat_mailbox_foe_efw_cmd = -1; -static int hf_ecat_mailbox_foe_efw_size = -1; -static int hf_ecat_mailbox_foe_efw_addresslw = -1; -static int hf_ecat_mailbox_foe_efw_addresshw = -1; -static int hf_ecat_mailbox_foe_efw_data = -1; -static int hf_ecat_mailbox_soe = -1; -static int hf_ecat_mailbox_soe_header = -1; - -static int hf_ecat_mailbox_soe_header_opcode = -1; -static int hf_ecat_mailbox_soe_header_incomplete = -1; -static int hf_ecat_mailbox_soe_header_error = -1; -static int hf_ecat_mailbox_soe_header_driveno = -1; -static int hf_ecat_mailbox_soe_header_datastate = -1; -static int hf_ecat_mailbox_soe_header_name = -1; -static int hf_ecat_mailbox_soe_header_attribute = -1; -static int hf_ecat_mailbox_soe_header_unit = -1; -static int hf_ecat_mailbox_soe_header_min = -1; -static int hf_ecat_mailbox_soe_header_max = -1; -static int hf_ecat_mailbox_soe_header_value = -1; -static int hf_ecat_mailbox_soe_header_reserved = -1; -static int hf_ecat_mailbox_soe_idn = -1; -static int hf_ecat_mailbox_soe_data = -1; -static int hf_ecat_mailbox_soe_frag = -1; -static int hf_ecat_mailbox_soe_error = -1; - -static expert_field ei_ecat_mailbox_error = EI_INIT; -static expert_field ei_ecat_mailbox_coe_error = EI_INIT; -static expert_field ei_ecat_mailbox_eoe_error = EI_INIT; -static expert_field ei_ecat_mailbox_soe_error = EI_INIT; -static expert_field ei_ecat_mailbox_foe_error = EI_INIT; +static int hf_ecat_mailbox_eoe_macfilter_filters[16]; +static int hf_ecat_mailbox_eoe_macfilter_filtermask; +static int hf_ecat_mailbox_eoe_macfilter_filtermasks[4]; +static int hf_ecat_mailbox_eoe_timestamp; +static int hf_ecat_mailbox_coe; +static int hf_ecat_mailbox_coe_number; +static int hf_ecat_mailbox_coe_type; +static int hf_ecat_mailbox_coe_sdoreq; +static int hf_ecat_mailbox_coe_sdoccsid; +static int hf_ecat_mailbox_coe_sdoccsid_sizeind; +static int hf_ecat_mailbox_coe_sdoccsid_expedited; +static int hf_ecat_mailbox_coe_sdoccsid_size0; +static int hf_ecat_mailbox_coe_sdoccsid_size1; +static int hf_ecat_mailbox_coe_sdoccsid_complete; +static int hf_ecat_mailbox_coe_sdoccsds; +static int hf_ecat_mailbox_coe_sdoccsds_lastseg; +static int hf_ecat_mailbox_coe_sdoccsds_size; +static int hf_ecat_mailbox_coe_sdoccsds_toggle; +static int hf_ecat_mailbox_coe_sdoccsus; +static int hf_ecat_mailbox_coe_sdoccsus_toggle; +static int hf_ecat_mailbox_coe_sdoccsiu; +/* static int hf_ecat_mailbox_coe_sdoccsiu_complete; */ +static int hf_ecat_mailbox_coe_sdoidx; +static int hf_ecat_mailbox_coe_sdoabortcode; +static int hf_ecat_mailbox_coe_sdosub; +static int hf_ecat_mailbox_coe_sdodata; +static int hf_ecat_mailbox_coe_sdodata1; +static int hf_ecat_mailbox_coe_sdodata2; +static int hf_ecat_mailbox_coe_sdoldata; +static int hf_ecat_mailbox_coe_sdolength; +/* static int hf_ecat_mailbox_coe_sdoerror; */ +static int hf_ecat_mailbox_coe_sdores; +static int hf_ecat_mailbox_coe_sdoscsds; +static int hf_ecat_mailbox_coe_sdoscsds_toggle; +static int hf_ecat_mailbox_coe_sdoscsiu; +static int hf_ecat_mailbox_coe_sdoscsiu_sizeind; +static int hf_ecat_mailbox_coe_sdoscsiu_expedited; +static int hf_ecat_mailbox_coe_sdoscsiu_size0; +static int hf_ecat_mailbox_coe_sdoscsiu_size1; +static int hf_ecat_mailbox_coe_sdoscsiu_complete; +static int hf_ecat_mailbox_coe_sdoscsus; +static int hf_ecat_mailbox_coe_sdoscsus_lastseg; +static int hf_ecat_mailbox_coe_sdoscsus_bytes; +static int hf_ecat_mailbox_coe_sdoscsus_toggle; +static int hf_ecat_mailbox_coe_sdoinfoopcode; +static int hf_ecat_mailbox_coe_sdoinfofrag; +static int hf_ecat_mailbox_coe_sdoinfolisttype; +static int hf_ecat_mailbox_coe_sdoinfolist; +static int hf_ecat_mailbox_coe_sdoinfoindex; +static int hf_ecat_mailbox_coe_sdoinfosubindex; +static int hf_ecat_mailbox_coe_sdoinfovalueinfo; +static int hf_ecat_mailbox_coe_sdoinfoerrorcode; +static int hf_ecat_mailbox_coe_sdoinfodatatype; +static int hf_ecat_mailbox_coe_sdoinfomaxsub; +static int hf_ecat_mailbox_coe_sdoinfoobjcode; +static int hf_ecat_mailbox_coe_sdoinfoname; +static int hf_ecat_mailbox_coe_sdoinfobitlen; +static int hf_ecat_mailbox_coe_sdoinfoobjaccess; +static int hf_ecat_mailbox_coe_sdoinfounittype; +static int hf_ecat_mailbox_coe_sdoinfodefaultvalue; +static int hf_ecat_mailbox_coe_sdoinfominvalue; +static int hf_ecat_mailbox_coe_sdoinfomaxvalue; +static int hf_ecat_mailboxdata; +static int hf_ecat_mailbox_foe; +static int hf_ecat_mailbox_foe_opmode; +static int hf_ecat_mailbox_foe_filelength; +static int hf_ecat_mailbox_foe_filename; +static int hf_ecat_mailbox_foe_packetno; +static int hf_ecat_mailbox_foe_errcode; +static int hf_ecat_mailbox_foe_errtext; +static int hf_ecat_mailbox_foe_busydone; +static int hf_ecat_mailbox_foe_busyentire; +static int hf_ecat_mailbox_foe_data; +static int hf_ecat_mailbox_foe_efw; +static int hf_ecat_mailbox_foe_efw_cmd; +static int hf_ecat_mailbox_foe_efw_size; +static int hf_ecat_mailbox_foe_efw_addresslw; +static int hf_ecat_mailbox_foe_efw_addresshw; +static int hf_ecat_mailbox_foe_efw_data; +static int hf_ecat_mailbox_soe; +static int hf_ecat_mailbox_soe_header; + +static int hf_ecat_mailbox_soe_header_opcode; +static int hf_ecat_mailbox_soe_header_incomplete; +static int hf_ecat_mailbox_soe_header_error; +static int hf_ecat_mailbox_soe_header_driveno; +static int hf_ecat_mailbox_soe_header_datastate; +static int hf_ecat_mailbox_soe_header_name; +static int hf_ecat_mailbox_soe_header_attribute; +static int hf_ecat_mailbox_soe_header_unit; +static int hf_ecat_mailbox_soe_header_min; +static int hf_ecat_mailbox_soe_header_max; +static int hf_ecat_mailbox_soe_header_value; +static int hf_ecat_mailbox_soe_header_reserved; +static int hf_ecat_mailbox_soe_idn; +static int hf_ecat_mailbox_soe_data; +static int hf_ecat_mailbox_soe_frag; +static int hf_ecat_mailbox_soe_error; + +static expert_field ei_ecat_mailbox_error; +static expert_field ei_ecat_mailbox_coe_error; +static expert_field ei_ecat_mailbox_eoe_error; +static expert_field ei_ecat_mailbox_soe_error; +static expert_field ei_ecat_mailbox_foe_error; static const value_string EcMBoxType[] = @@ -266,6 +266,7 @@ static const value_string CANopenType[] = { ETHERCAT_COE_TYPE_RXPDO, "RxPDO" }, { ETHERCAT_COE_TYPE_TXPDO_RTR, "TxPDO_RTR" }, { ETHERCAT_COE_TYPE_RXPDO_RTR, "RxPDO_RTR" }, + { ETHERCAT_COE_TYPE_SDOINFO, "SDO Information" }, { 0, NULL } }; @@ -338,30 +339,29 @@ static void CANopenSdoReqFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint switch ( pSdo->anSdoHeaderUnion.Idq.Ccs ) { case SDO_CCS_INITIATE_DOWNLOAD: - g_snprintf ( szText, nMax, "SDO Req : 'Initiate Download' (%d) Idx=0x%x Sub=%d", pSdo->anSdoHeaderUnion.Idq.Ccs, pSdo->Index, pSdo->SubIndex); + snprintf ( szText, nMax, "SDO Req : 'Initiate Download' (%d) Idx=0x%x Sub=%d", pSdo->anSdoHeaderUnion.Idq.Ccs, pSdo->Index, pSdo->SubIndex); break; case SDO_CCS_INITIATE_UPLOAD: - g_snprintf ( szText, nMax, "SDO Req : 'Initiate Upload' (%d) Idx=0x%x Sub=%d", pSdo->anSdoHeaderUnion.Idq.Ccs, pSdo->Index, pSdo->SubIndex); + snprintf ( szText, nMax, "SDO Req : 'Initiate Upload' (%d) Idx=0x%x Sub=%d", pSdo->anSdoHeaderUnion.Idq.Ccs, pSdo->Index, pSdo->SubIndex); break; case SDO_CCS_DOWNLOAD_SEGMENT: - g_snprintf ( szText, nMax, "SDO Req : 'Download Segment' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); + snprintf ( szText, nMax, "SDO Req : 'Download Segment' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); break; case SDO_CCS_UPLOAD_SEGMENT: - g_snprintf ( szText, nMax, "SDO Req : 'Upload Segment' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); + snprintf ( szText, nMax, "SDO Req : 'Upload Segment' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); break; case SDO_CCS_ABORT_TRANSFER: - g_snprintf ( szText, nMax, "SDO Req : 'Abort Transfer' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); + snprintf ( szText, nMax, "SDO Req : 'Abort Transfer' (%d)", pSdo->anSdoHeaderUnion.Idq.Ccs); break; default: - g_snprintf ( szText, nMax, "SDO Req : Ccs %d", pSdo->anSdoHeaderUnion.Idq.Ccs); + snprintf ( szText, nMax, "SDO Req : Ccs %d", pSdo->anSdoHeaderUnion.Idq.Ccs); } } -static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, guint foe_length) +static void FoeFormatter(tvbuff_t *tvb, wmem_allocator_t *scope, gint offset, char *szText, gint nMax, guint foe_length) { ETHERCAT_FOE_HEADER foe; - char tmp[50]; - memset(tmp, 0, sizeof(tmp)); + char *tmp = NULL; init_foe_header(&foe, tvb, offset); @@ -370,45 +370,46 @@ static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, gu case ECAT_FOE_OPMODE_RRQ: case ECAT_FOE_OPMODE_WRQ: case ECAT_FOE_OPMODE_ERR: - if ( foe_length > ETHERCAT_FOE_HEADER_LEN ) - tvb_memcpy(tvb, tmp, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, sizeof(tmp)-1)); + if ( foe_length > ETHERCAT_FOE_HEADER_LEN ) { + tmp = tvb_get_string_enc(scope, tvb, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, 49), ENC_ASCII); + } break; } switch ( foe.OpMode ) { case ECAT_FOE_OPMODE_RRQ: - g_snprintf ( szText, nMax, "FoE RRQ (%d) : '%s'", foe.aFoeHeaderDataUnion.FileLength, tmp); + snprintf ( szText, nMax, "FoE RRQ (%d) : '%s'", foe.aFoeHeaderDataUnion.FileLength, tmp ? tmp : ""); break; case ECAT_FOE_OPMODE_WRQ: - g_snprintf ( szText, nMax, "FoE WRQ (%d) : '%s'", foe.aFoeHeaderDataUnion.FileLength, tmp); + snprintf ( szText, nMax, "FoE WRQ (%d) : '%s'", foe.aFoeHeaderDataUnion.FileLength, tmp ? tmp : ""); break; case ECAT_FOE_OPMODE_DATA: - g_snprintf ( szText, nMax, "FoE DATA (%d) : %d Bytes", foe.aFoeHeaderDataUnion.v.PacketNo, foe_length-ETHERCAT_FOE_HEADER_LEN); + snprintf ( szText, nMax, "FoE DATA (%d) : %d Bytes", foe.aFoeHeaderDataUnion.v.PacketNo, foe_length-ETHERCAT_FOE_HEADER_LEN); break; case ECAT_FOE_OPMODE_ACK: - g_snprintf ( szText, nMax, "FoE ACK (%d)", foe.aFoeHeaderDataUnion.v.PacketNo); + snprintf ( szText, nMax, "FoE ACK (%d)", foe.aFoeHeaderDataUnion.v.PacketNo); break; case ECAT_FOE_OPMODE_ERR: - g_snprintf ( szText, nMax, "FoE ERR (%d) : '%s'", foe.aFoeHeaderDataUnion.ErrorCode, tmp); + snprintf ( szText, nMax, "FoE ERR (%d) : '%s'", foe.aFoeHeaderDataUnion.ErrorCode, tmp ? tmp : ""); break; case ECAT_FOE_OPMODE_BUSY: if ( foe.aFoeHeaderDataUnion.v2.Entire > 0 ) - g_snprintf ( szText, nMax, "FoE BUSY (%d%%)", ((guint32)foe.aFoeHeaderDataUnion.v2.Done*100)/foe.aFoeHeaderDataUnion.v2.Entire); + snprintf ( szText, nMax, "FoE BUSY (%d%%)", ((guint32)foe.aFoeHeaderDataUnion.v2.Done*100)/foe.aFoeHeaderDataUnion.v2.Entire); else - g_snprintf ( szText, nMax, "FoE BUSY (%d/%d)", foe.aFoeHeaderDataUnion.v2.Done, foe.aFoeHeaderDataUnion.v2.Entire); + snprintf ( szText, nMax, "FoE BUSY (%d/%d)", foe.aFoeHeaderDataUnion.v2.Done, foe.aFoeHeaderDataUnion.v2.Entire); break; default: - g_snprintf ( szText, nMax, "FoE Unknown"); + snprintf ( szText, nMax, "FoE Unknown"); } } static void SoEIdToString( char* txt, guint16 id, int nMax) { if ( id & 0x8000 ) - g_snprintf(txt, nMax, "P-%d-%04d", (id>>12) & 0x0007, id & 0x0FFF ); + snprintf(txt, nMax, "P-%d-%04d", (id>>12) & 0x0007, id & 0x0FFF ); else - g_snprintf(txt, nMax, "S-%d-%04d", id>>12, id & 0x0FFF ); + snprintf(txt, nMax, "S-%d-%04d", id>>12, id & 0x0FFF ); } static void SoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, guint soe_length) @@ -444,32 +445,32 @@ static void SoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, gu switch ( soe.anSoeHeaderControlUnion.v.OpCode ) { case ECAT_SOE_OPCODE_RRQ: - g_snprintf ( szText, nMax, "SoE: RRQ (%s, '%s')", tmp, elm); + snprintf ( szText, nMax, "SoE: RRQ (%s, '%s')", tmp, elm); break; case ECAT_SOE_OPCODE_RRS: - g_snprintf ( szText, nMax, "SoE: RRS (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); + snprintf ( szText, nMax, "SoE: RRS (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); break; case ECAT_SOE_OPCODE_WRS: - g_snprintf ( szText, nMax, "SoE: WRS (%s, '%s')", tmp, elm); + snprintf ( szText, nMax, "SoE: WRS (%s, '%s')", tmp, elm); break; case ECAT_SOE_OPCODE_WRQ: - g_snprintf ( szText, nMax, "SoE: WRQ (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); + snprintf ( szText, nMax, "SoE: WRQ (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); break; case ECAT_SOE_OPCODE_NFC: - g_snprintf ( szText, nMax, "SoE: NFC (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); + snprintf ( szText, nMax, "SoE: NFC (%s, '%s') : %u Bytes", tmp, elm, (guint)(soe_length-ETHERCAT_SOE_HEADER_LEN)); break; case 6: - g_snprintf ( szText, nMax, "SoE: EMGCY"); + snprintf ( szText, nMax, "SoE: EMGCY"); break; default: - g_snprintf ( szText, nMax, "SoE:"); + snprintf ( szText, nMax, "SoE:"); } } else - g_snprintf ( szText, nMax, "SoE: FragmentsLeft %d", soe.anSoeHeaderDataUnion.FragmentsLeft); + snprintf ( szText, nMax, "SoE: FragmentsLeft %d", soe.anSoeHeaderDataUnion.FragmentsLeft); } else - g_snprintf ( szText, nMax, "SoE: Error %04x", tvb_get_letohs(tvb, offset)); + snprintf ( szText, nMax, "SoE: Error %04x", tvb_get_letohs(tvb, offset)); } /* ethercat mailbox */ @@ -1097,7 +1098,7 @@ static void dissect_ecat_foe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro if( foe_length >= ETHERCAT_FOE_HEADER_LEN ) { - FoeFormatter(tvb, offset, szText, nMax, foe_length); + FoeFormatter(tvb, pinfo->pool, offset, szText, nMax, foe_length); col_append_str(pinfo->cinfo, COL_INFO, szText); if( tree ) @@ -1790,7 +1791,7 @@ void proto_register_ecat_mailbox(void) FT_UINT8, BASE_HEX, VALS(FoEOpMode), 0x0, "Op modes", HFILL } }, { &hf_ecat_mailbox_foe_filelength, - { "Foe FileLength" , "ecat_mailbox.foe_filelength", + { "Foe FileLength", "ecat_mailbox.foe_filelength", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_ecat_mailbox_foe_filename, diff --git a/plugins/epan/ethercat/packet-esl.c b/plugins/epan/ethercat/packet-esl.c index 9b8ca0bd9b..b0d197efb6 100644 --- a/plugins/epan/ethercat/packet-esl.c +++ b/plugins/epan/ethercat/packet-esl.c @@ -84,14 +84,14 @@ static dissector_handle_t eth_withoutfcs_handle; void proto_reg_handoff_esl(void); /* Define the esl proto */ -int proto_esl = -1; +int proto_esl; -static int ett_esl = -1; +static int ett_esl; -static int hf_esl_timestamp = -1; -static int hf_esl_port = -1; -static int hf_esl_crcerror = -1; -static int hf_esl_alignerror = -1; +static int hf_esl_timestamp; +static int hf_esl_port; +static int hf_esl_crcerror; +static int hf_esl_alignerror; /* Note: using external tfs strings apparently doesn't work in a plugin */ static const true_false_string flags_yes_no = { @@ -238,6 +238,7 @@ static void modify_times(tvbuff_t *tvb, gint offset, packet_info *pinfo) nstime_delta(&ts_delta, &ts, &pinfo->abs_ts); pinfo->abs_ts = ts; + pinfo->fd->abs_ts = ts; nstime_add(&pinfo->rel_ts, &ts_delta); } } diff --git a/plugins/epan/ethercat/packet-ethercat-datagram.c b/plugins/epan/ethercat/packet-ethercat-datagram.c index 09ae5faa0b..e1d98d1095 100644 --- a/plugins/epan/ethercat/packet-ethercat-datagram.c +++ b/plugins/epan/ethercat/packet-ethercat-datagram.c @@ -8,6 +8,8 @@ * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later + * + * https://download.beckhoff.com/download/document/io/ethercat-development-products/ethercat_esc_datasheet_sec1_technology_2i3.pdf */ /* Include files */ @@ -23,421 +25,422 @@ void proto_register_ecat(void); void proto_reg_handoff_ecat(void); static heur_dissector_list_t heur_subdissector_list; +static dissector_handle_t ecat_handle; static dissector_handle_t ecat_mailbox_handle; /* Define the EtherCAT proto */ -static int proto_ecat_datagram = -1; +static int proto_ecat_datagram; /* Define the tree for EtherCAT */ -static int ett_ecat = -1; -static int ett_ecat_header = -1; -static int ett_ecat_dc = -1; -static int ett_ecat_length = -1; -static int ett_ecat_padding = -1; -static int ett_ecat_datagram_subtree = -1; -static int ett_ecat_reg_esc_features = -1; -static int ett_ecat_reg_dlctrl1 = -1; -static int ett_ecat_reg_dlctrl2 = -1; -static int ett_ecat_reg_dlctrl3 = -1; -static int ett_ecat_reg_dlctrl4 = -1; -static int ett_ecat_reg_dlstatus1 = -1; -static int ett_ecat_reg_dlstatus2 = -1; -static int ett_ecat_reg_alctrl = -1; -static int ett_ecat_reg_alstatus = -1; -static int ett_ecat_reg_pdictrl1 = -1; -static int ett_ecat_reg_pdictrl2 = -1; -static int ett_ecat_reg_ecat_mask = -1; -static int ett_ecat_reg_pdiL = -1; -static int ett_ecat_reg_ecat = -1; -static int ett_ecat_reg_pdi1 = -1; -static int ett_ecat_reg_crc0 = -1; -static int ett_ecat_reg_crc1 = -1; -static int ett_ecat_reg_crc2 = -1; -static int ett_ecat_reg_crc3 = -1; -static int ett_ecat_reg_wd_status = -1; -static int ett_ecat_reg_eeprom_assign = -1; -static int ett_ecat_reg_ctrlstat = -1; -static int ett_ecat_reg_mio_ctrlstat = -1; -static int ett_ecat_mio_addr = -1; -static int ett_ecat_mio_access = -1; -static int ett_ecat_mio_status0 = -1; -static int ett_ecat_mio_status1 = -1; -static int ett_ecat_mio_status2 = -1; -static int ett_ecat_mio_status3 = -1; -static int ett_ecat_reg_fmmu = -1; -static int ett_ecat_reg_syncman = -1; -static int ett_ecat_reg_syncman_ctrlstatus = -1; -static int ett_ecat_reg_syncman_sm_enable = -1; -static int ett_ecat_reg_dc_cycunitctrl = -1; -static int ett_ecat_dc_activation = -1; -static int ett_ecat_dc_activationstat = -1; -static int ett_ecat_dc_sync0_status = -1; -static int ett_ecat_dc_sync1_status = -1; -static int ett_ecat_dc_latch0_ctrl = -1; -static int ett_ecat_dc_latch1_ctrl = -1; -static int ett_ecat_dc_latch0_status = -1; -static int ett_ecat_dc_latch1_status = -1; +static int ett_ecat; +static int ett_ecat_header; +static int ett_ecat_dc; +static int ett_ecat_length; +static int ett_ecat_padding; +static int ett_ecat_datagram_subtree; +static int ett_ecat_reg_esc_features; +static int ett_ecat_reg_dlctrl1; +static int ett_ecat_reg_dlctrl2; +static int ett_ecat_reg_dlctrl3; +static int ett_ecat_reg_dlctrl4; +static int ett_ecat_reg_dlstatus1; +static int ett_ecat_reg_dlstatus2; +static int ett_ecat_reg_alctrl; +static int ett_ecat_reg_alstatus; +static int ett_ecat_reg_pdictrl1; +static int ett_ecat_reg_pdictrl2; +static int ett_ecat_reg_ecat_mask; +static int ett_ecat_reg_pdiL; +static int ett_ecat_reg_ecat; +static int ett_ecat_reg_pdi1; +static int ett_ecat_reg_crc0; +static int ett_ecat_reg_crc1; +static int ett_ecat_reg_crc2; +static int ett_ecat_reg_crc3; +static int ett_ecat_reg_wd_status; +static int ett_ecat_reg_eeprom_assign; +static int ett_ecat_reg_ctrlstat; +static int ett_ecat_reg_mio_ctrlstat; +static int ett_ecat_mio_addr; +static int ett_ecat_mio_access; +static int ett_ecat_mio_status0; +static int ett_ecat_mio_status1; +static int ett_ecat_mio_status2; +static int ett_ecat_mio_status3; +static int ett_ecat_reg_fmmu; +static int ett_ecat_reg_syncman; +static int ett_ecat_reg_syncman_ctrlstatus; +static int ett_ecat_reg_syncman_sm_enable; +static int ett_ecat_reg_dc_cycunitctrl; +static int ett_ecat_dc_activation; +static int ett_ecat_dc_activationstat; +static int ett_ecat_dc_sync0_status; +static int ett_ecat_dc_sync1_status; +static int ett_ecat_dc_latch0_ctrl; +static int ett_ecat_dc_latch1_ctrl; +static int ett_ecat_dc_latch0_status; +static int ett_ecat_dc_latch1_status; static int hf_ecat_sub; -static int hf_ecat_sub_data[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_cmd[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_idx[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_cnt[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_ado[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_adp[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_lad[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - -/* static int hf_ecat_header = -1; */ -static int hf_ecat_data = -1; -static int hf_ecat_cnt = -1; -static int hf_ecat_cmd = -1; -static int hf_ecat_idx = -1; -static int hf_ecat_adp = -1; -static int hf_ecat_ado = -1; -static int hf_ecat_lad = -1; -/* static int hf_ecat_len = -1; */ -static int hf_ecat_int = -1; - -static int hf_ecat_sub_dc_diff_da[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_dc_diff_bd[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_dc_diff_cb[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_dc_diff_cd[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_dc_diff_ba[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; -static int hf_ecat_sub_dc_diff_ca[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - -static int hf_ecat_dc_diff_da = -1; -static int hf_ecat_dc_diff_bd = -1; -static int hf_ecat_dc_diff_cb = -1; -static int hf_ecat_dc_diff_cd = -1; -static int hf_ecat_dc_diff_ba = -1; -static int hf_ecat_dc_diff_ca = -1; - -static int hf_ecat_length_len = -1; -static int hf_ecat_length_r = -1; -static int hf_ecat_length_c = -1; -static int hf_ecat_length_m = -1; - -static int hf_ecat_padding = -1; - -static int hf_ecat_reg_revision = -1; -static int hf_ecat_reg_esc_type = -1; -static int hf_ecat_reg_esc_build = -1; -static int hf_ecat_reg_esc_fmmucnt = -1; -static int hf_ecat_reg_esc_smcnt = -1; -static int hf_ecat_reg_esc_ports = -1; -static int hf_ecat_reg_esc_dpram = -1; -static int hf_ecat_reg_esc_features = -1; -static int hf_ecat_reg_esc_features_fmmurestrict = -1; -static int hf_ecat_reg_esc_features_smaddrrestrict = -1; -static int hf_ecat_reg_esc_features_dcsupport = -1; -static int hf_ecat_reg_esc_features_dc64support = -1; -static int hf_ecat_reg_esc_features_ebuslowjitter = -1; -static int hf_ecat_reg_esc_features_ebusextlinkdetect = -1; -static int hf_ecat_reg_esc_features_miiextlinkdetect = -1; -static int hf_ecat_reg_esc_features_crcext = -1; -static int hf_ecat_reg_physaddr = -1; -static int hf_ecat_reg_physaddr2 = -1; -static int hf_ecat_reg_dlctrl1 = -1; -static int hf_ecat_reg_dlctrl1_killnonecat = -1; -static int hf_ecat_reg_dlctrl1_port0extlinkdetect = -1; -static int hf_ecat_reg_dlctrl1_port1extlinkdetect = -1; -static int hf_ecat_reg_dlctrl1_port2extlinkdetect = -1; -static int hf_ecat_reg_dlctrl1_port3extlinkdetect = -1; -static int hf_ecat_reg_dlctrl2 = -1; -static int hf_ecat_reg_dlctrl2_port0 = -1; -static int hf_ecat_reg_dlctrl2_port1 = -1; -static int hf_ecat_reg_dlctrl2_port2 = -1; -static int hf_ecat_reg_dlctrl2_port3 = -1; -static int hf_ecat_reg_dlctrl3 = -1; -static int hf_ecat_reg_dlctrl3_fifosize = -1; -static int hf_ecat_reg_dlctrl3_lowebusjit = -1; -static int hf_ecat_reg_dlctrl4 = -1; -static int hf_ecat_reg_dlctrl4_2ndaddress = -1; -static int hf_ecat_reg_dlstatus1 = -1; -static int hf_ecat_reg_dlstatus1_operation = -1; -static int hf_ecat_reg_dlstatus1_pdiwatchdog = -1; -static int hf_ecat_reg_dlstatus1_enhlinkdetect = -1; -static int hf_ecat_reg_dlstatus1_physlink_port0 = -1; -static int hf_ecat_reg_dlstatus1_physlink_port1 = -1; -static int hf_ecat_reg_dlstatus1_physlink_port2 = -1; -static int hf_ecat_reg_dlstatus1_physlink_port3 = -1; -static int hf_ecat_reg_dlstatus2 = -1; -static int hf_ecat_reg_dlstatus2_port0 = -1; -static int hf_ecat_reg_dlstatus2_port1 = -1; -static int hf_ecat_reg_dlstatus2_port2 = -1; -static int hf_ecat_reg_dlstatus2_port3 = -1; -static int hf_ecat_reg_regprotect = -1; -static int hf_ecat_reg_accessprotect = -1; -static int hf_ecat_reg_resetecat = -1; -static int hf_ecat_reg_resetpdi = -1; -static int hf_ecat_reg_regphysrwoffs = -1; -static int hf_ecat_reg_alctrl = -1; -static int hf_ecat_reg_alctrl_ctrl = -1; -static int hf_ecat_reg_alctrl_errack = -1; -static int hf_ecat_reg_alctrl_id = -1; -static int hf_ecat_reg_alstatus = -1; -static int hf_ecat_reg_alstatus_status = -1; -static int hf_ecat_reg_alstatus_err = -1; -static int hf_ecat_reg_alstatus_id = -1; -static int hf_ecat_reg_pdictrl1 = -1; -static int hf_ecat_reg_pdictrl1_pdi = -1; -static int hf_ecat_reg_pdictrl2 = -1; -static int hf_ecat_reg_pdictrl2_devemul = -1; -static int hf_ecat_reg_pdictrl2_enhlnkdetect = -1; -static int hf_ecat_reg_pdictrl2_dcsyncout = -1; -static int hf_ecat_reg_pdictrl2_dcsyncin = -1; -static int hf_ecat_reg_pdictrl2_enhlnkdetect0 = -1; -static int hf_ecat_reg_pdictrl2_enhlnkdetect1 = -1; -static int hf_ecat_reg_pdictrl2_enhlnkdetect2 = -1; -static int hf_ecat_reg_pdictrl2_enhlnkdetect3 = -1; -static int hf_ecat_reg_alstatuscode = -1; -static int hf_ecat_reg_ecat_mask = -1; -static int hf_ecat_reg_ecat_mask_latchevt = -1; -static int hf_ecat_reg_ecat_mask_escstatevt = -1; -static int hf_ecat_reg_ecat_mask_alstatevt = -1; -static int hf_ecat_reg_ecat_mask_sm0irq = -1; -static int hf_ecat_reg_ecat_mask_sm1irq = -1; -static int hf_ecat_reg_ecat_mask_sm2irq = -1; -static int hf_ecat_reg_ecat_mask_sm3irq = -1; -static int hf_ecat_reg_ecat_mask_sm4irq = -1; -static int hf_ecat_reg_ecat_mask_sm5irq = -1; -static int hf_ecat_reg_ecat_mask_sm6irq = -1; -static int hf_ecat_reg_ecat_mask_sm7irq = -1; -static int hf_ecat_reg_pdiL = -1; -static int hf_ecat_reg_pdiL_alctrl = -1; -static int hf_ecat_reg_pdiL_latchin = -1; -static int hf_ecat_reg_pdiL_sync0 = -1; -static int hf_ecat_reg_pdiL_sync1 = -1; -static int hf_ecat_reg_pdiL_smchg = -1; -static int hf_ecat_reg_pdiL_eepromcmdpen = -1; -static int hf_ecat_reg_pdiL_sm0 = -1; -static int hf_ecat_reg_pdiL_sm1 = -1; -static int hf_ecat_reg_pdiL_sm2 = -1; -static int hf_ecat_reg_pdiL_sm3 = -1; -static int hf_ecat_reg_pdiL_sm4 = -1; -static int hf_ecat_reg_pdiL_sm5 = -1; -static int hf_ecat_reg_pdiL_sm6 = -1; -static int hf_ecat_reg_pdiL_sm7 = -1; -static int hf_ecat_reg_pdiH = -1; -static int hf_ecat_reg_ecat = -1; -static int hf_ecat_reg_ecat_latchevt = -1; -static int hf_ecat_reg_ecat_escstatevt = -1; -static int hf_ecat_reg_ecat_alstatevt = -1; -static int hf_ecat_reg_ecat_sm0irq = -1; -static int hf_ecat_reg_ecat_sm1irq = -1; -static int hf_ecat_reg_ecat_sm2irq = -1; -static int hf_ecat_reg_ecat_sm3irq = -1; -static int hf_ecat_reg_ecat_sm4irq = -1; -static int hf_ecat_reg_ecat_sm5irq = -1; -static int hf_ecat_reg_ecat_sm6irq = -1; -static int hf_ecat_reg_ecat_sm7irq = -1; -static int hf_ecat_reg_pdi1 = -1; -static int hf_ecat_reg_pdi1_alctrl = -1; -static int hf_ecat_reg_pdi1_latchin = -1; -static int hf_ecat_reg_pdi1_sync0 = -1; -static int hf_ecat_reg_pdi1_sync1 = -1; -static int hf_ecat_reg_pdi1_smchg = -1; -static int hf_ecat_reg_pdi1_eepromcmdpen = -1; -static int hf_ecat_reg_pdi1_sm0 = -1; -static int hf_ecat_reg_pdi1_sm1 = -1; -static int hf_ecat_reg_pdi1_sm2 = -1; -static int hf_ecat_reg_pdi1_sm3 = -1; -static int hf_ecat_reg_pdi1_sm4 = -1; -static int hf_ecat_reg_pdi1_sm5 = -1; -static int hf_ecat_reg_pdi1_sm6 = -1; -static int hf_ecat_reg_pdi1_sm7 = -1; -static int hf_ecat_reg_pdi2 = -1; -static int hf_ecat_reg_crc0 = -1; -static int hf_ecat_reg_crc0_frame = -1; -static int hf_ecat_reg_crc0_rx = -1; -static int hf_ecat_reg_crc1 = -1; -static int hf_ecat_reg_crc1_frame = -1; -static int hf_ecat_reg_crc1_rx = -1; -static int hf_ecat_reg_crc2 = -1; -static int hf_ecat_reg_crc2_frame = -1; -static int hf_ecat_reg_crc2_rx = -1; -static int hf_ecat_reg_crc3 = -1; -static int hf_ecat_reg_crc3_frame = -1; -static int hf_ecat_reg_crc3_rx = -1; -static int hf_ecat_reg_crc_fwd0 = -1; -static int hf_ecat_reg_crc_fwd1 = -1; -static int hf_ecat_reg_crc_fwd2 = -1; -static int hf_ecat_reg_crc_fwd3 = -1; -static int hf_ecat_reg_processuniterr = -1; -static int hf_ecat_reg_pdierr = -1; -static int hf_ecat_reg_linklost0 = -1; -static int hf_ecat_reg_linklost1 = -1; -static int hf_ecat_reg_linklost2 = -1; -static int hf_ecat_reg_linklost3 = -1; -static int hf_ecat_reg_wd_divisor = -1; -static int hf_ecat_reg_wd_timepdi = -1; -static int hf_ecat_reg_wd_timesm = -1; -static int hf_ecat_reg_wd_status = -1; -static int hf_ecat_reg_wd_status_pdwatchdog = -1; -static int hf_ecat_reg_wd_cntsm = -1; -static int hf_ecat_reg_wd_cntpdi = -1; -static int hf_ecat_reg_eeprom_assign = -1; -static int hf_ecat_reg_eeprom_assign_ctrl = -1; -static int hf_ecat_reg_eeprom_assign_pdiaccess = -1; -static int hf_ecat_reg_eeprom_assign_status = -1; -static int hf_ecat_reg_ctrlstat = -1; -static int hf_ecat_reg_ctrlstat_wraccess = -1; -static int hf_ecat_reg_ctrlstat_eepromemul = -1; -static int hf_ecat_reg_ctrlstat_8bacc = -1; -static int hf_ecat_reg_ctrlstat_2bacc = -1; -static int hf_ecat_reg_ctrlstat_rdacc = -1; -static int hf_ecat_reg_ctrlstat_wracc = -1; -static int hf_ecat_reg_ctrlstat_reloadacc = -1; -static int hf_ecat_reg_ctrlstat_crcerr = -1; -static int hf_ecat_reg_ctrlstat_lderr = -1; -static int hf_ecat_reg_ctrlstat_cmderr = -1; -static int hf_ecat_reg_ctrlstat_wrerr = -1; -static int hf_ecat_reg_ctrlstat_busy = -1; -static int hf_ecat_reg_addrl = -1; -static int hf_ecat_reg_addrh = -1; -static int hf_ecat_reg_data0 = -1; -static int hf_ecat_reg_data1 = -1; -static int hf_ecat_reg_data2 = -1; -static int hf_ecat_reg_data3 = -1; -static int hf_ecat_reg_mio_ctrlstat = -1; -static int hf_ecat_reg_mio_ctrlstat_wracc1 = -1; -static int hf_ecat_reg_mio_ctrlstat_offsphy = -1; -static int hf_ecat_reg_mio_ctrlstat_rdacc = -1; -static int hf_ecat_reg_mio_ctrlstat_wracc2 = -1; -static int hf_ecat_reg_mio_ctrlstat_wrerr = -1; -static int hf_ecat_reg_mio_ctrlstat_busy = -1; -static int hf_ecat_reg_mio_addr = -1; -static int hf_ecat_reg_mio_addr_phyaddr = -1; -static int hf_ecat_reg_mio_addr_mioaddr = -1; -static int hf_ecat_reg_mio_data = -1; -static int hf_ecat_reg_mio_access = -1; -static int hf_ecat_reg_mio_access_ecatacc = -1; -static int hf_ecat_reg_mio_access_pdiacc = -1; -static int hf_ecat_reg_mio_access_forcereset = -1; -static int hf_ecat_reg_mio_status0 = -1; -static int hf_ecat_reg_mio_status0_physlink = -1; -static int hf_ecat_reg_mio_status0_link = -1; -static int hf_ecat_reg_mio_status0_linkstatuserr = -1; -static int hf_ecat_reg_mio_status0_readerr = -1; -static int hf_ecat_reg_mio_status0_linkpartnererr = -1; -static int hf_ecat_reg_mio_status0_phycfgupdated = -1; -static int hf_ecat_reg_mio_status1 = -1; -static int hf_ecat_reg_mio_status1_physlink = -1; -static int hf_ecat_reg_mio_status1_link = -1; -static int hf_ecat_reg_mio_status1_linkstatuserr = -1; -static int hf_ecat_reg_mio_status1_readerr = -1; -static int hf_ecat_reg_mio_status1_linkpartnererr = -1; -static int hf_ecat_reg_mio_status1_phycfgupdated = -1; -static int hf_ecat_reg_mio_status2 = -1; -static int hf_ecat_reg_mio_status2_physlink = -1; -static int hf_ecat_reg_mio_status2_link = -1; -static int hf_ecat_reg_mio_status2_linkstatuserr = -1; -static int hf_ecat_reg_mio_status2_readerr = -1; -static int hf_ecat_reg_mio_status2_linkpartnererr = -1; -static int hf_ecat_reg_mio_status2_phycfgupdated = -1; -static int hf_ecat_reg_mio_status3 = -1; -static int hf_ecat_reg_mio_status3_physlink = -1; -static int hf_ecat_reg_mio_status3_link = -1; -static int hf_ecat_reg_mio_status3_linkstatuserr = -1; -static int hf_ecat_reg_mio_status3_readerr = -1; -static int hf_ecat_reg_mio_status3_linkpartnererr = -1; -static int hf_ecat_reg_mio_status3_phycfgupdated = -1; -static int hf_ecat_reg_fmmu = -1; -static int hf_ecat_reg_fmmu_lstart = -1; -static int hf_ecat_reg_fmmu_llen = -1; -static int hf_ecat_reg_fmmu_lstartbit = -1; -static int hf_ecat_reg_fmmu_lendbit = -1; -static int hf_ecat_reg_fmmu_pstart = -1; -static int hf_ecat_reg_fmmu_pstartbit = -1; -static int hf_ecat_reg_fmmu_type = -1; -static int hf_ecat_reg_fmmu_typeread = -1; -static int hf_ecat_reg_fmmu_typewrite = -1; -static int hf_ecat_reg_fmmu_activate = -1; -static int hf_ecat_reg_fmmu_activate0 = -1; -static int hf_ecat_reg_syncman_ctrlstatus = -1; -static int hf_ecat_reg_syncman_pmode = -1; -static int hf_ecat_reg_syncman_access = -1; -static int hf_ecat_reg_syncman_irq_ecat = -1; -static int hf_ecat_reg_syncman_irq_pdi = -1; -static int hf_ecat_reg_syncman_wdt = -1; -static int hf_ecat_reg_syncman_irq_write = -1; -static int hf_ecat_reg_syncman_irq_read = -1; -static int hf_ecat_reg_syncman_1bufstate = -1; -static int hf_ecat_reg_syncman_3bufstate = -1; -static int hf_ecat_reg_syncman_sm_enable = -1; -static int hf_ecat_reg_syncman_enable = -1; -static int hf_ecat_reg_syncman_repeatreq = -1; -static int hf_ecat_reg_syncman_latchsmchg_ecat = -1; -static int hf_ecat_reg_syncman_latchsmchg_pdi = -1; -static int hf_ecat_reg_syncman_deactivate = -1; -static int hf_ecat_reg_syncman_repeatack = -1; -static int hf_ecat_reg_syncman = -1; -static int hf_ecat_reg_syncman_start = -1; -static int hf_ecat_reg_syncman_len = -1; -static int hf_ecat_reg_dc_recv0 = -1; -static int hf_ecat_reg_dc_recv1 = -1; -static int hf_ecat_reg_dc_recv2 = -1; -static int hf_ecat_reg_dc_recv3 = -1; -static int hf_ecat_reg_dc_systime = -1; -static int hf_ecat_reg_dc_systimeL = -1; -static int hf_ecat_reg_dc_systimeH = -1; -static int hf_ecat_reg_dc_recvtime64 = -1; -static int hf_ecat_reg_dc_systimeoffs = -1; -static int hf_ecat_reg_dc_systimeoffsl = -1; -static int hf_ecat_reg_dc_systimeoffsh = -1; -static int hf_ecat_reg_dc_systimedelay = -1; -static int hf_ecat_reg_dc_ctrlerr = -1; -static int hf_ecat_reg_dc_speedstart = -1; -static int hf_ecat_reg_dc_speeddiff = -1; -static int hf_ecat_reg_dc_fltdepth_systimediff = -1; -static int hf_ecat_reg_dc_fltdepth_speedcnt = -1; -static int hf_ecat_reg_dc_cycunitctrl = -1; -static int hf_ecat_reg_dc_cycunitctrl_access_cyclic = -1; -static int hf_ecat_reg_dc_cycunitctrl_access_latch0 = -1; -static int hf_ecat_reg_dc_cycunitctrl_access_latch1 = -1; -static int hf_ecat_reg_dc_activation = -1; -static int hf_ecat_reg_dc_activation_enablecyclic = -1; -static int hf_ecat_reg_dc_activation_gen_sync0 = -1; -static int hf_ecat_reg_dc_activation_gen_sync1 = -1; -static int hf_ecat_reg_dc_activation_autoactivation = -1; -static int hf_ecat_reg_dc_activation_stimeext = -1; -static int hf_ecat_reg_dc_activation_stimecheck = -1; -static int hf_ecat_reg_dc_activation_hlfrange = -1; -static int hf_ecat_reg_dc_activation_dblrange = -1; -static int hf_ecat_reg_dc_cycimpuls = -1; -static int hf_ecat_reg_dc_activationstat = -1; -static int hf_ecat_reg_dc_activationstat_sync0pend = -1; -static int hf_ecat_reg_dc_activationstat_sync1pend = -1; -static int hf_ecat_reg_dc_activationstat_stimeoutofrange = -1; -static int hf_ecat_reg_dc_sync0_status = -1; -static int hf_ecat_reg_dc_sync0_status_triggered = -1; -static int hf_ecat_reg_dc_sync1_status = -1; -static int hf_ecat_reg_dc_sync1_status_triggered = -1; -static int hf_ecat_reg_dc_starttime0 = -1; -static int hf_ecat_reg_dc_starttime1 = -1; -static int hf_ecat_reg_dc_cyctime0 = -1; -static int hf_ecat_reg_dc_cyctime1 = -1; -static int hf_ecat_reg_dc_latch0_ctrl_pos = -1; -static int hf_ecat_reg_dc_latch0_ctrl_neg = -1; -static int hf_ecat_reg_dc_latch1_ctrl_pos = -1; -static int hf_ecat_reg_dc_latch1_ctrl_neg = -1; -static int hf_ecat_reg_dc_latch0_status_eventpos = -1; -static int hf_ecat_reg_dc_latch0_status_eventneg = -1; -static int hf_ecat_reg_dc_latch0_status_pinstate = -1; -static int hf_ecat_reg_dc_latch1_status_eventpos = -1; -static int hf_ecat_reg_dc_latch1_status_eventneg = -1; -static int hf_ecat_reg_dc_latch1_status_pinstate = -1; -static int hf_ecat_reg_dc_latch0_ctrl = -1; -static int hf_ecat_reg_dc_latch1_ctrl = -1; -static int hf_ecat_reg_dc_latch0_status = -1; -static int hf_ecat_reg_dc_latch1_status = -1; -static int hf_ecat_reg_dc_latch0_pos = -1; -static int hf_ecat_reg_dc_latch0_neg = -1; -static int hf_ecat_reg_dc_latch1_pos = -1; -static int hf_ecat_reg_dc_latch1_neg = -1; -static int hf_ecat_reg_dc_rcvsyncmanchg = -1; -static int hf_ecat_reg_dc_pdismstart = -1; -static int hf_ecat_reg_dc_pdismchg = -1; +static int hf_ecat_sub_data[10]; +static int hf_ecat_sub_cmd[10]; +static int hf_ecat_sub_idx[10]; +static int hf_ecat_sub_cnt[10]; +static int hf_ecat_sub_ado[10]; +static int hf_ecat_sub_adp[10]; +static int hf_ecat_sub_lad[10]; + +/* static int hf_ecat_header; */ +static int hf_ecat_data; +static int hf_ecat_cnt; +static int hf_ecat_cmd; +static int hf_ecat_idx; +static int hf_ecat_adp; +static int hf_ecat_ado; +static int hf_ecat_lad; +/* static int hf_ecat_len; */ +static int hf_ecat_int; + +static int hf_ecat_sub_dc_diff_da[10]; +static int hf_ecat_sub_dc_diff_bd[10]; +static int hf_ecat_sub_dc_diff_cb[10]; +static int hf_ecat_sub_dc_diff_cd[10]; +static int hf_ecat_sub_dc_diff_ba[10]; +static int hf_ecat_sub_dc_diff_ca[10]; + +static int hf_ecat_dc_diff_da; +static int hf_ecat_dc_diff_bd; +static int hf_ecat_dc_diff_cb; +static int hf_ecat_dc_diff_cd; +static int hf_ecat_dc_diff_ba; +static int hf_ecat_dc_diff_ca; + +static int hf_ecat_length_len; +static int hf_ecat_length_r; +static int hf_ecat_length_c; +static int hf_ecat_length_m; + +static int hf_ecat_padding; + +static int hf_ecat_reg_revision; +static int hf_ecat_reg_esc_type; +static int hf_ecat_reg_esc_build; +static int hf_ecat_reg_esc_fmmucnt; +static int hf_ecat_reg_esc_smcnt; +static int hf_ecat_reg_esc_ports; +static int hf_ecat_reg_esc_dpram; +static int hf_ecat_reg_esc_features; +static int hf_ecat_reg_esc_features_fmmurestrict; +static int hf_ecat_reg_esc_features_smaddrrestrict; +static int hf_ecat_reg_esc_features_dcsupport; +static int hf_ecat_reg_esc_features_dc64support; +static int hf_ecat_reg_esc_features_ebuslowjitter; +static int hf_ecat_reg_esc_features_ebusextlinkdetect; +static int hf_ecat_reg_esc_features_miiextlinkdetect; +static int hf_ecat_reg_esc_features_crcext; +static int hf_ecat_reg_physaddr; +static int hf_ecat_reg_physaddr2; +static int hf_ecat_reg_dlctrl1; +static int hf_ecat_reg_dlctrl1_killnonecat; +static int hf_ecat_reg_dlctrl1_port0extlinkdetect; +static int hf_ecat_reg_dlctrl1_port1extlinkdetect; +static int hf_ecat_reg_dlctrl1_port2extlinkdetect; +static int hf_ecat_reg_dlctrl1_port3extlinkdetect; +static int hf_ecat_reg_dlctrl2; +static int hf_ecat_reg_dlctrl2_port0; +static int hf_ecat_reg_dlctrl2_port1; +static int hf_ecat_reg_dlctrl2_port2; +static int hf_ecat_reg_dlctrl2_port3; +static int hf_ecat_reg_dlctrl3; +static int hf_ecat_reg_dlctrl3_fifosize; +static int hf_ecat_reg_dlctrl3_lowebusjit; +static int hf_ecat_reg_dlctrl4; +static int hf_ecat_reg_dlctrl4_2ndaddress; +static int hf_ecat_reg_dlstatus1; +static int hf_ecat_reg_dlstatus1_operation; +static int hf_ecat_reg_dlstatus1_pdiwatchdog; +static int hf_ecat_reg_dlstatus1_enhlinkdetect; +static int hf_ecat_reg_dlstatus1_physlink_port0; +static int hf_ecat_reg_dlstatus1_physlink_port1; +static int hf_ecat_reg_dlstatus1_physlink_port2; +static int hf_ecat_reg_dlstatus1_physlink_port3; +static int hf_ecat_reg_dlstatus2; +static int hf_ecat_reg_dlstatus2_port0; +static int hf_ecat_reg_dlstatus2_port1; +static int hf_ecat_reg_dlstatus2_port2; +static int hf_ecat_reg_dlstatus2_port3; +static int hf_ecat_reg_regprotect; +static int hf_ecat_reg_accessprotect; +static int hf_ecat_reg_resetecat; +static int hf_ecat_reg_resetpdi; +static int hf_ecat_reg_regphysrwoffs; +static int hf_ecat_reg_alctrl; +static int hf_ecat_reg_alctrl_ctrl; +static int hf_ecat_reg_alctrl_errack; +static int hf_ecat_reg_alctrl_id; +static int hf_ecat_reg_alstatus; +static int hf_ecat_reg_alstatus_status; +static int hf_ecat_reg_alstatus_err; +static int hf_ecat_reg_alstatus_id; +static int hf_ecat_reg_pdictrl1; +static int hf_ecat_reg_pdictrl1_pdi; +static int hf_ecat_reg_pdictrl2; +static int hf_ecat_reg_pdictrl2_devemul; +static int hf_ecat_reg_pdictrl2_enhlnkdetect; +static int hf_ecat_reg_pdictrl2_dcsyncout; +static int hf_ecat_reg_pdictrl2_dcsyncin; +static int hf_ecat_reg_pdictrl2_enhlnkdetect0; +static int hf_ecat_reg_pdictrl2_enhlnkdetect1; +static int hf_ecat_reg_pdictrl2_enhlnkdetect2; +static int hf_ecat_reg_pdictrl2_enhlnkdetect3; +static int hf_ecat_reg_alstatuscode; +static int hf_ecat_reg_ecat_mask; +static int hf_ecat_reg_ecat_mask_latchevt; +static int hf_ecat_reg_ecat_mask_escstatevt; +static int hf_ecat_reg_ecat_mask_alstatevt; +static int hf_ecat_reg_ecat_mask_sm0irq; +static int hf_ecat_reg_ecat_mask_sm1irq; +static int hf_ecat_reg_ecat_mask_sm2irq; +static int hf_ecat_reg_ecat_mask_sm3irq; +static int hf_ecat_reg_ecat_mask_sm4irq; +static int hf_ecat_reg_ecat_mask_sm5irq; +static int hf_ecat_reg_ecat_mask_sm6irq; +static int hf_ecat_reg_ecat_mask_sm7irq; +static int hf_ecat_reg_pdiL; +static int hf_ecat_reg_pdiL_alctrl; +static int hf_ecat_reg_pdiL_latchin; +static int hf_ecat_reg_pdiL_sync0; +static int hf_ecat_reg_pdiL_sync1; +static int hf_ecat_reg_pdiL_smchg; +static int hf_ecat_reg_pdiL_eepromcmdpen; +static int hf_ecat_reg_pdiL_sm0; +static int hf_ecat_reg_pdiL_sm1; +static int hf_ecat_reg_pdiL_sm2; +static int hf_ecat_reg_pdiL_sm3; +static int hf_ecat_reg_pdiL_sm4; +static int hf_ecat_reg_pdiL_sm5; +static int hf_ecat_reg_pdiL_sm6; +static int hf_ecat_reg_pdiL_sm7; +static int hf_ecat_reg_pdiH; +static int hf_ecat_reg_ecat; +static int hf_ecat_reg_ecat_latchevt; +static int hf_ecat_reg_ecat_escstatevt; +static int hf_ecat_reg_ecat_alstatevt; +static int hf_ecat_reg_ecat_sm0irq; +static int hf_ecat_reg_ecat_sm1irq; +static int hf_ecat_reg_ecat_sm2irq; +static int hf_ecat_reg_ecat_sm3irq; +static int hf_ecat_reg_ecat_sm4irq; +static int hf_ecat_reg_ecat_sm5irq; +static int hf_ecat_reg_ecat_sm6irq; +static int hf_ecat_reg_ecat_sm7irq; +static int hf_ecat_reg_pdi1; +static int hf_ecat_reg_pdi1_alctrl; +static int hf_ecat_reg_pdi1_latchin; +static int hf_ecat_reg_pdi1_sync0; +static int hf_ecat_reg_pdi1_sync1; +static int hf_ecat_reg_pdi1_smchg; +static int hf_ecat_reg_pdi1_eepromcmdpen; +static int hf_ecat_reg_pdi1_sm0; +static int hf_ecat_reg_pdi1_sm1; +static int hf_ecat_reg_pdi1_sm2; +static int hf_ecat_reg_pdi1_sm3; +static int hf_ecat_reg_pdi1_sm4; +static int hf_ecat_reg_pdi1_sm5; +static int hf_ecat_reg_pdi1_sm6; +static int hf_ecat_reg_pdi1_sm7; +static int hf_ecat_reg_pdi2; +static int hf_ecat_reg_crc0; +static int hf_ecat_reg_crc0_frame; +static int hf_ecat_reg_crc0_rx; +static int hf_ecat_reg_crc1; +static int hf_ecat_reg_crc1_frame; +static int hf_ecat_reg_crc1_rx; +static int hf_ecat_reg_crc2; +static int hf_ecat_reg_crc2_frame; +static int hf_ecat_reg_crc2_rx; +static int hf_ecat_reg_crc3; +static int hf_ecat_reg_crc3_frame; +static int hf_ecat_reg_crc3_rx; +static int hf_ecat_reg_crc_fwd0; +static int hf_ecat_reg_crc_fwd1; +static int hf_ecat_reg_crc_fwd2; +static int hf_ecat_reg_crc_fwd3; +static int hf_ecat_reg_processuniterr; +static int hf_ecat_reg_pdierr; +static int hf_ecat_reg_linklost0; +static int hf_ecat_reg_linklost1; +static int hf_ecat_reg_linklost2; +static int hf_ecat_reg_linklost3; +static int hf_ecat_reg_wd_divisor; +static int hf_ecat_reg_wd_timepdi; +static int hf_ecat_reg_wd_timesm; +static int hf_ecat_reg_wd_status; +static int hf_ecat_reg_wd_status_pdwatchdog; +static int hf_ecat_reg_wd_cntsm; +static int hf_ecat_reg_wd_cntpdi; +static int hf_ecat_reg_eeprom_assign; +static int hf_ecat_reg_eeprom_assign_ctrl; +static int hf_ecat_reg_eeprom_assign_pdiaccess; +static int hf_ecat_reg_eeprom_assign_status; +static int hf_ecat_reg_ctrlstat; +static int hf_ecat_reg_ctrlstat_wraccess; +static int hf_ecat_reg_ctrlstat_eepromemul; +static int hf_ecat_reg_ctrlstat_8bacc; +static int hf_ecat_reg_ctrlstat_2bacc; +static int hf_ecat_reg_ctrlstat_rdacc; +static int hf_ecat_reg_ctrlstat_wracc; +static int hf_ecat_reg_ctrlstat_reloadacc; +static int hf_ecat_reg_ctrlstat_crcerr; +static int hf_ecat_reg_ctrlstat_lderr; +static int hf_ecat_reg_ctrlstat_cmderr; +static int hf_ecat_reg_ctrlstat_wrerr; +static int hf_ecat_reg_ctrlstat_busy; +static int hf_ecat_reg_addrl; +static int hf_ecat_reg_addrh; +static int hf_ecat_reg_data0; +static int hf_ecat_reg_data1; +static int hf_ecat_reg_data2; +static int hf_ecat_reg_data3; +static int hf_ecat_reg_mio_ctrlstat; +static int hf_ecat_reg_mio_ctrlstat_wracc1; +static int hf_ecat_reg_mio_ctrlstat_offsphy; +static int hf_ecat_reg_mio_ctrlstat_rdacc; +static int hf_ecat_reg_mio_ctrlstat_wracc2; +static int hf_ecat_reg_mio_ctrlstat_wrerr; +static int hf_ecat_reg_mio_ctrlstat_busy; +static int hf_ecat_reg_mio_addr; +static int hf_ecat_reg_mio_addr_phyaddr; +static int hf_ecat_reg_mio_addr_mioaddr; +static int hf_ecat_reg_mio_data; +static int hf_ecat_reg_mio_access; +static int hf_ecat_reg_mio_access_ecatacc; +static int hf_ecat_reg_mio_access_pdiacc; +static int hf_ecat_reg_mio_access_forcereset; +static int hf_ecat_reg_mio_status0; +static int hf_ecat_reg_mio_status0_physlink; +static int hf_ecat_reg_mio_status0_link; +static int hf_ecat_reg_mio_status0_linkstatuserr; +static int hf_ecat_reg_mio_status0_readerr; +static int hf_ecat_reg_mio_status0_linkpartnererr; +static int hf_ecat_reg_mio_status0_phycfgupdated; +static int hf_ecat_reg_mio_status1; +static int hf_ecat_reg_mio_status1_physlink; +static int hf_ecat_reg_mio_status1_link; +static int hf_ecat_reg_mio_status1_linkstatuserr; +static int hf_ecat_reg_mio_status1_readerr; +static int hf_ecat_reg_mio_status1_linkpartnererr; +static int hf_ecat_reg_mio_status1_phycfgupdated; +static int hf_ecat_reg_mio_status2; +static int hf_ecat_reg_mio_status2_physlink; +static int hf_ecat_reg_mio_status2_link; +static int hf_ecat_reg_mio_status2_linkstatuserr; +static int hf_ecat_reg_mio_status2_readerr; +static int hf_ecat_reg_mio_status2_linkpartnererr; +static int hf_ecat_reg_mio_status2_phycfgupdated; +static int hf_ecat_reg_mio_status3; +static int hf_ecat_reg_mio_status3_physlink; +static int hf_ecat_reg_mio_status3_link; +static int hf_ecat_reg_mio_status3_linkstatuserr; +static int hf_ecat_reg_mio_status3_readerr; +static int hf_ecat_reg_mio_status3_linkpartnererr; +static int hf_ecat_reg_mio_status3_phycfgupdated; +static int hf_ecat_reg_fmmu; +static int hf_ecat_reg_fmmu_lstart; +static int hf_ecat_reg_fmmu_llen; +static int hf_ecat_reg_fmmu_lstartbit; +static int hf_ecat_reg_fmmu_lendbit; +static int hf_ecat_reg_fmmu_pstart; +static int hf_ecat_reg_fmmu_pstartbit; +static int hf_ecat_reg_fmmu_type; +static int hf_ecat_reg_fmmu_typeread; +static int hf_ecat_reg_fmmu_typewrite; +static int hf_ecat_reg_fmmu_activate; +static int hf_ecat_reg_fmmu_activate0; +static int hf_ecat_reg_syncman_ctrlstatus; +static int hf_ecat_reg_syncman_pmode; +static int hf_ecat_reg_syncman_access; +static int hf_ecat_reg_syncman_irq_ecat; +static int hf_ecat_reg_syncman_irq_pdi; +static int hf_ecat_reg_syncman_wdt; +static int hf_ecat_reg_syncman_irq_write; +static int hf_ecat_reg_syncman_irq_read; +static int hf_ecat_reg_syncman_1bufstate; +static int hf_ecat_reg_syncman_3bufstate; +static int hf_ecat_reg_syncman_sm_enable; +static int hf_ecat_reg_syncman_enable; +static int hf_ecat_reg_syncman_repeatreq; +static int hf_ecat_reg_syncman_latchsmchg_ecat; +static int hf_ecat_reg_syncman_latchsmchg_pdi; +static int hf_ecat_reg_syncman_deactivate; +static int hf_ecat_reg_syncman_repeatack; +static int hf_ecat_reg_syncman; +static int hf_ecat_reg_syncman_start; +static int hf_ecat_reg_syncman_len; +static int hf_ecat_reg_dc_recv0; +static int hf_ecat_reg_dc_recv1; +static int hf_ecat_reg_dc_recv2; +static int hf_ecat_reg_dc_recv3; +static int hf_ecat_reg_dc_systime; +static int hf_ecat_reg_dc_systimeL; +static int hf_ecat_reg_dc_systimeH; +static int hf_ecat_reg_dc_recvtime64; +static int hf_ecat_reg_dc_systimeoffs; +static int hf_ecat_reg_dc_systimeoffsl; +static int hf_ecat_reg_dc_systimeoffsh; +static int hf_ecat_reg_dc_systimedelay; +static int hf_ecat_reg_dc_ctrlerr; +static int hf_ecat_reg_dc_speedstart; +static int hf_ecat_reg_dc_speeddiff; +static int hf_ecat_reg_dc_fltdepth_systimediff; +static int hf_ecat_reg_dc_fltdepth_speedcnt; +static int hf_ecat_reg_dc_cycunitctrl; +static int hf_ecat_reg_dc_cycunitctrl_access_cyclic; +static int hf_ecat_reg_dc_cycunitctrl_access_latch0; +static int hf_ecat_reg_dc_cycunitctrl_access_latch1; +static int hf_ecat_reg_dc_activation; +static int hf_ecat_reg_dc_activation_enablecyclic; +static int hf_ecat_reg_dc_activation_gen_sync0; +static int hf_ecat_reg_dc_activation_gen_sync1; +static int hf_ecat_reg_dc_activation_autoactivation; +static int hf_ecat_reg_dc_activation_stimeext; +static int hf_ecat_reg_dc_activation_stimecheck; +static int hf_ecat_reg_dc_activation_hlfrange; +static int hf_ecat_reg_dc_activation_dblrange; +static int hf_ecat_reg_dc_cycimpuls; +static int hf_ecat_reg_dc_activationstat; +static int hf_ecat_reg_dc_activationstat_sync0pend; +static int hf_ecat_reg_dc_activationstat_sync1pend; +static int hf_ecat_reg_dc_activationstat_stimeoutofrange; +static int hf_ecat_reg_dc_sync0_status; +static int hf_ecat_reg_dc_sync0_status_triggered; +static int hf_ecat_reg_dc_sync1_status; +static int hf_ecat_reg_dc_sync1_status_triggered; +static int hf_ecat_reg_dc_starttime0; +static int hf_ecat_reg_dc_starttime1; +static int hf_ecat_reg_dc_cyctime0; +static int hf_ecat_reg_dc_cyctime1; +static int hf_ecat_reg_dc_latch0_ctrl_pos; +static int hf_ecat_reg_dc_latch0_ctrl_neg; +static int hf_ecat_reg_dc_latch1_ctrl_pos; +static int hf_ecat_reg_dc_latch1_ctrl_neg; +static int hf_ecat_reg_dc_latch0_status_eventpos; +static int hf_ecat_reg_dc_latch0_status_eventneg; +static int hf_ecat_reg_dc_latch0_status_pinstate; +static int hf_ecat_reg_dc_latch1_status_eventpos; +static int hf_ecat_reg_dc_latch1_status_eventneg; +static int hf_ecat_reg_dc_latch1_status_pinstate; +static int hf_ecat_reg_dc_latch0_ctrl; +static int hf_ecat_reg_dc_latch1_ctrl; +static int hf_ecat_reg_dc_latch0_status; +static int hf_ecat_reg_dc_latch1_status; +static int hf_ecat_reg_dc_latch0_pos; +static int hf_ecat_reg_dc_latch0_neg; +static int hf_ecat_reg_dc_latch1_pos; +static int hf_ecat_reg_dc_latch1_neg; +static int hf_ecat_reg_dc_rcvsyncmanchg; +static int hf_ecat_reg_dc_pdismstart; +static int hf_ecat_reg_dc_pdismchg; static const value_string EcCmdShort[] = @@ -1330,26 +1333,26 @@ static void EcSummaryFormater(guint32 datalength, tvbuff_t *tvb, gint offset, ch { guint16 len = ecFirst.len&0x07ff; guint16 cnt = get_wc(&ecFirst, tvb, offset); - g_snprintf ( szText, nMax, "'%s': Len: %d, Adp 0x%x, Ado 0x%x, Wc %d ", + snprintf ( szText, nMax, "'%s': Len: %d, Adp 0x%x, Ado 0x%x, Wc %d ", convertEcCmdToText(ecFirst.cmd, EcCmdShort), len, ecFirst.anAddrUnion.a.adp, ecFirst.anAddrUnion.a.ado, cnt ); } else if ( nSub == 2 ) { - g_snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d ", + snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d ", nSub, convertEcCmdToText(nCmds[0], EcCmdShort), nLens[0], convertEcCmdToText(nCmds[1], EcCmdShort), nLens[1]); } else if ( nSub == 3 ) { - g_snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d, '%s': len %d", + snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d, '%s': len %d", nSub, convertEcCmdToText(nCmds[0], EcCmdShort), nLens[0], convertEcCmdToText(nCmds[1], EcCmdShort), nLens[1], convertEcCmdToText(nCmds[2], EcCmdShort), nLens[2]); } else if ( nSub == 4 ) { - g_snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d, '%s': len %d, '%s': len %d", + snprintf ( szText, nMax, "%d Cmds, '%s': len %d, '%s': len %d, '%s': len %d, '%s': len %d", nSub, convertEcCmdToText(nCmds[0], EcCmdShort), nLens[0], convertEcCmdToText(nCmds[1], EcCmdShort), nLens[1], convertEcCmdToText(nCmds[2], EcCmdShort), nLens[2], convertEcCmdToText(nCmds[3], EcCmdShort), nLens[3]); } else - g_snprintf ( szText, nMax, "%d Cmds, SumLen %d, '%s'... ", + snprintf ( szText, nMax, "%d Cmds, SumLen %d, '%s'... ", nSub, nLen, convertEcCmdToText(ecFirst.cmd, EcCmdShort)); } @@ -1359,9 +1362,9 @@ static void EcCmdFormatter(guint8 cmd, char *szText, gint nMax) const gchar *szCmd = try_val_to_str_idx((guint32)cmd, EcCmdLong, &idx); if ( idx != -1 ) - g_snprintf(szText, nMax, "Cmd : %d (%s)", cmd, szCmd); + snprintf(szText, nMax, "Cmd : %d (%s)", cmd, szCmd); else - g_snprintf(szText, nMax, "Cmd : %d (Unknown command)", cmd); + snprintf(szText, nMax, "Cmd : %d (Unknown command)", cmd); } @@ -1388,20 +1391,20 @@ static void EcSubFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax) case EC_CMD_TYPE_BRW: case EC_CMD_TYPE_ARMW: case EC_CMD_TYPE_FRMW: - g_snprintf ( szText, nMax, "EtherCAT datagram: Cmd: '%s' (%d), Len: %d, Adp 0x%x, Ado 0x%x, Cnt %d", + snprintf ( szText, nMax, "EtherCAT datagram: Cmd: '%s' (%d), Len: %d, Adp 0x%x, Ado 0x%x, Cnt %d", convertEcCmdToText(ecParser.cmd, EcCmdShort), ecParser.cmd, len, ecParser.anAddrUnion.a.adp, ecParser.anAddrUnion.a.ado, cnt); break; case EC_CMD_TYPE_LRD: case EC_CMD_TYPE_LWR: case EC_CMD_TYPE_LRW: - g_snprintf ( szText, nMax, "EtherCAT datagram: Cmd: '%s' (%d), Len: %d, Addr 0x%x, Cnt %d", + snprintf ( szText, nMax, "EtherCAT datagram: Cmd: '%s' (%d), Len: %d, Addr 0x%x, Cnt %d", convertEcCmdToText(ecParser.cmd, EcCmdShort), ecParser.cmd, len, ecParser.anAddrUnion.addr, cnt); break; case EC_CMD_TYPE_EXT: - g_snprintf ( szText, nMax, "EtherCAT datagram: Cmd: 'EXT' (%d), Len: %d", ecParser.cmd, len); + snprintf ( szText, nMax, "EtherCAT datagram: Cmd: 'EXT' (%d), Len: %d", ecParser.cmd, len); break; default: - g_snprintf ( szText, nMax, "EtherCAT datagram: Cmd: 'Unknown' (%d), Len: %d", ecParser.cmd, len); + snprintf ( szText, nMax, "EtherCAT datagram: Cmd: 'Unknown' (%d), Len: %d", ecParser.cmd, len); } } @@ -2592,11 +2595,11 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_alctrl_errack, {"Error Ack", "ecat.reg.alctrl.errack", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x10, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0010, NULL, HFILL } }, { &hf_ecat_reg_alctrl_id, {"Id", "ecat.reg.alctrl.id", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x20, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0020, NULL, HFILL } }, { &hf_ecat_reg_alstatus, {"AL Status (0x130)", "ecat.reg.alstatus", @@ -2604,15 +2607,15 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_alstatus_status, {"Al Status", "ecat.reg.alstatus.status", - FT_UINT16, BASE_HEX, VALS(vals_esc_reg_120), 0x0f, NULL, HFILL } + FT_UINT16, BASE_HEX, VALS(vals_esc_reg_120), 0x000f, NULL, HFILL } }, { &hf_ecat_reg_alstatus_err, {"Error", "ecat.reg.alstatus.err", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x10, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0010, NULL, HFILL } }, { &hf_ecat_reg_alstatus_id, {"Id", "ecat.reg.alstatus.id", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x20, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0020, NULL, HFILL } }, { &hf_ecat_reg_alstatuscode, {"AL Status Code (0x134)", "ecat.reg.alstatuscode", @@ -2720,23 +2723,23 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_pdiL_latchin, {"Latch input", "ecat.reg.irqmask.pdiL.latchin", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x02, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0002, NULL, HFILL } }, { &hf_ecat_reg_pdiL_sync0, {"SYNC 0", "ecat.reg.irqmask.pdiL.sync0", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x04, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0004, NULL, HFILL } }, { &hf_ecat_reg_pdiL_sync1, {"SYNC 1", "ecat.reg.irqmask.pdiL.sync1", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x08, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0008, NULL, HFILL } }, { &hf_ecat_reg_pdiL_smchg, {"SM changed", "ecat.reg.irqmask.pdiL.smchg", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x10, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0010, NULL, HFILL } }, { &hf_ecat_reg_pdiL_eepromcmdpen, {"EEPROM command pending", "ecat.reg.irqmask.pdiL.eepromcmdpen", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x20, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0020, NULL, HFILL } }, { &hf_ecat_reg_pdiL_sm0, {"SM 0", "ecat.reg.irqmask.pdiL.sm0", @@ -2828,27 +2831,27 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_pdi1_alctrl, {"AL Ctrl", "ecat.reg.irq.pdi1.alctrl", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x1, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0001, NULL, HFILL } }, { &hf_ecat_reg_pdi1_latchin, {"Latch input", "ecat.reg.irq.pdi1.latchin", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x02, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0002, NULL, HFILL } }, { &hf_ecat_reg_pdi1_sync0, {"SYNC 0", "ecat.reg.irq.pdi1.sync0", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x04, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0004, NULL, HFILL } }, { &hf_ecat_reg_pdi1_sync1, {"SYNC 1", "ecat.reg.irq.pdi1.sync1", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x08, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0008, NULL, HFILL } }, { &hf_ecat_reg_pdi1_smchg, {"SM changed", "ecat.reg.irq.pdi1.smchg", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x10, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0010, NULL, HFILL } }, { &hf_ecat_reg_pdi1_eepromcmdpen, {"EEPROM command pending", "ecat.reg.irq.pdi1.eepromcmdpen", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x20, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0020, NULL, HFILL } }, { &hf_ecat_reg_pdi1_sm0, {"SM 0", "ecat.reg.irq.pdi1.sm0", @@ -3024,19 +3027,20 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_ctrlstat_wraccess, {"Write access", "ecat.reg.ctrlstat.wraccess", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x1000, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0001, NULL, HFILL } }, + /* Next 4 bits reserved */ { &hf_ecat_reg_ctrlstat_eepromemul, {"EEPROM emulation", "ecat.reg.ctrlstat.eepromemul", - FT_BOOLEAN, 16, TFS(&tfs_esc_reg_502_5), 0x2000, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_esc_reg_502_5), 0x0020, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_8bacc, {"8 byte access", "ecat.reg.ctrlstat.8bacc", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x4000, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0040, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_2bacc, {"2 byte address", "ecat.reg.ctrlstat.2bacc", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x8000, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0080, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_rdacc, {"Read access", "ecat.reg.ctrlstat.rdacc", @@ -3056,19 +3060,19 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_ctrlstat_lderr, {"Load error", "ecat.reg.ctrlstat.lderr", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0010, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x1000, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_cmderr, {"Cmd error", "ecat.reg.ctrlstat.cmderr", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0020, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x2000, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_wrerr, {"Write error", "ecat.reg.ctrlstat.wrerr", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0040, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x4000, NULL, HFILL } }, { &hf_ecat_reg_ctrlstat_busy, {"Busy", "ecat.reg.ctrlstat.busy", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0080, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x8000, NULL, HFILL } }, { &hf_ecat_reg_addrl, {"EEPROM Address Lo (0x504)", "ecat.reg.addrl", @@ -3094,10 +3098,13 @@ void proto_register_ecat(void) {"EEPROM Data 3 (0x50e)", "ecat.reg.data3", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } }, + { &hf_ecat_reg_mio_ctrlstat, {"Phy MIO Ctrl/Status (0x510)", "ecat.reg.mio.ctrlstat", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } }, + /* TODO: check these masks (ecat_esc_reg_510) against spec. + * In particular hf_ecat_reg_mio_ctrlstat_offsphy is non-contiguous and overlaps wracc1 */ { &hf_ecat_reg_mio_ctrlstat_wracc1, {"Write access", "ecat.reg.mio.ctrlstat.wracc1", FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0001, NULL, HFILL } @@ -3122,6 +3129,7 @@ void proto_register_ecat(void) {"Busy", "ecat.reg.mio.ctrlstat.busy", FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x8000, NULL, HFILL } }, + { &hf_ecat_reg_mio_addr, {"Phy MIO Address (0x512)", "ecat.reg.mio.addr", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } @@ -3372,19 +3380,19 @@ void proto_register_ecat(void) }, { &hf_ecat_reg_syncman_enable, {"Enable", "ecat.syncman.enable", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x1, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0001, NULL, HFILL } }, { &hf_ecat_reg_syncman_repeatreq, {"Repeat request", "ecat.syncman.repeatreq", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x02, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0002, NULL, HFILL } }, { &hf_ecat_reg_syncman_latchsmchg_ecat, {"Latch SyncMan Change ECAT", "ecat.syncman.latchsmchg.ecat", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x40, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0040, NULL, HFILL } }, { &hf_ecat_reg_syncman_latchsmchg_pdi, {"Latch SyncMan Change PDI", "ecat.syncman.latchsmchg.pdi", - FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x80, NULL, HFILL } + FT_BOOLEAN, 16, TFS(&tfs_local_true_false), 0x0080, NULL, HFILL } }, { &hf_ecat_reg_syncman_deactivate, {"Deactivate", "ecat.syncman.deactivate", @@ -3503,7 +3511,7 @@ void proto_register_ecat(void) FT_BOOLEAN, 8, TFS(&tfs_local_true_false), 0x10, NULL, HFILL } }, { &hf_ecat_reg_dc_activation_stimecheck, - {"Start time chheck", "ecat.reg.dc.activation.stimecheck", + {"Start time check", "ecat.reg.dc.activation.stimecheck", FT_BOOLEAN, 8, TFS(&tfs_local_true_false), 0x20, NULL, HFILL } }, { &hf_ecat_reg_dc_activation_hlfrange, @@ -3707,19 +3715,17 @@ void proto_register_ecat(void) proto_ecat_datagram = proto_register_protocol("EtherCAT datagram(s)", "ECAT", "ecat"); proto_register_field_array(proto_ecat_datagram, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + ecat_handle = register_dissector("ecat", dissect_ecat_datagram, proto_ecat_datagram); /* Sub dissector code */ - heur_subdissector_list = register_heur_dissector_list("ecat.data", proto_ecat_datagram); + heur_subdissector_list = register_heur_dissector_list_with_description("ecat.data", "EtherCAT payload", proto_ecat_datagram); } /* The registration hand-off routing */ void proto_reg_handoff_ecat(void) { - dissector_handle_t ecat_handle; - /* Register this dissector as a sub dissector to EtherCAT frame based on ether type. */ - ecat_handle = create_dissector_handle(dissect_ecat_datagram, proto_ecat_datagram); dissector_add_uint("ecatf.type", 1 /* EtherCAT type */, ecat_handle); ecat_mailbox_handle = find_dissector_add_dependency("ecat_mailbox", proto_ecat_datagram); diff --git a/plugins/epan/ethercat/packet-ethercat-frame.c b/plugins/epan/ethercat/packet-ethercat-frame.c index 3de059424a..275fc4fcd1 100644 --- a/plugins/epan/ethercat/packet-ethercat-frame.c +++ b/plugins/epan/ethercat/packet-ethercat-frame.c @@ -23,17 +23,17 @@ void proto_register_ethercat_frame(void); void proto_reg_handoff_ethercat_frame(void); /* Define the Ethercat frame proto */ -static int proto_ethercat_frame = -1; +static int proto_ethercat_frame; static dissector_table_t ethercat_frame_dissector_table; static dissector_handle_t ethercat_frame_handle; /* Define the tree for the EtherCAT frame */ -static int ett_ethercat_frame = -1; -static int hf_ethercat_frame_length = -1; -static int hf_ethercat_frame_reserved = -1; -static int hf_ethercat_frame_type = -1; +static int ett_ethercat_frame; +static int hf_ethercat_frame_length; +static int hf_ethercat_frame_reserved; +static int hf_ethercat_frame_type; static const value_string EthercatFrameTypes[] = { diff --git a/plugins/epan/ethercat/packet-ioraw.c b/plugins/epan/ethercat/packet-ioraw.c index 273e085918..739417ed11 100644 --- a/plugins/epan/ethercat/packet-ioraw.c +++ b/plugins/epan/ethercat/packet-ioraw.c @@ -22,18 +22,20 @@ void proto_register_ioraw(void); void proto_reg_handoff_ioraw(void); /* Define the ioraw proto */ -int proto_ioraw = -1; +int proto_ioraw; -static int ett_ioraw = -1; +static int ett_ioraw; -/* static int hf_ioraw_summary = -1; */ -static int hf_ioraw_header = -1; -static int hf_ioraw_data = -1; +static dissector_handle_t ioraw_handle; + +/* static int hf_ioraw_summary; */ +static int hf_ioraw_header; +static int hf_ioraw_data; /*ioraw*/ static void IoRawSummaryFormater( char *szText, int nMax) { - g_snprintf ( szText, nMax, "Raw IO Data" ); + snprintf ( szText, nMax, "Raw IO Data" ); } static int dissect_ioraw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -95,14 +97,11 @@ void proto_register_ioraw(void) "IO-RAW","ioraw"); proto_register_field_array(proto_ioraw,hf,array_length(hf)); proto_register_subtree_array(ett,array_length(ett)); + ioraw_handle = register_dissector("ioraw", dissect_ioraw, proto_ioraw); } void proto_reg_handoff_ioraw(void) { - dissector_handle_t ioraw_handle; - - ioraw_handle = create_dissector_handle(dissect_ioraw, proto_ioraw); - dissector_add_uint("ecatf.type", 3, ioraw_handle); } diff --git a/plugins/epan/ethercat/packet-nv.c b/plugins/epan/ethercat/packet-nv.c index d66f2d2578..8f904c3c22 100644 --- a/plugins/epan/ethercat/packet-nv.c +++ b/plugins/epan/ethercat/packet-nv.c @@ -22,32 +22,34 @@ void proto_register_nv(void); void proto_reg_handoff_nv(void); /* Define the nv proto */ -int proto_nv = -1; - -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; +int proto_nv; + +static dissector_handle_t nv_handle; + +static int ett_nv; +static int ett_nv_header; +static int ett_nv_var; +static int ett_nv_varheader; + +/* static int hf_nv_summary; */ +static int hf_nv_header; +static int hf_nv_publisher; +static int hf_nv_count; +static int hf_nv_cycleindex; +static int hf_nv_variable; +static int hf_nv_varheader; +static int hf_nv_id; +static int hf_nv_hash; +static int hf_nv_length; +static int hf_nv_quality; +static int hf_nv_data; /*nv*/ static void NvSummaryFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax) { guint32 nvOffset = offset; - g_snprintf ( szText, nMax, "Network Vars from %d.%d.%d.%d.%d.%d - %d Var(s)", + 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), @@ -61,7 +63,7 @@ static void NvPublisherFormater(tvbuff_t *tvb, gint offset, char *szText, int nM { guint32 nvOffset = offset; - g_snprintf ( szText, nMax, "Publisher %d.%d.%d.%d.%d.%d", + 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), @@ -72,7 +74,7 @@ static void NvPublisherFormater(tvbuff_t *tvb, gint offset, char *szText, int nM static void NvVarHeaderFormater(tvbuff_t *tvb, gint offset, char *szText, int nMax) { - g_snprintf ( szText, nMax, "Variable - Id = %d, Length = %d", + snprintf ( szText, nMax, "Variable - Id = %d, Length = %d", tvb_get_letohs(tvb, offset), tvb_get_letohs(tvb, offset+4)); } @@ -213,17 +215,14 @@ void proto_register_nv(void) &ett_nv_varheader }; - proto_nv = proto_register_protocol("TwinCAT NV", - "TC-NV","tc_nv"); + 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_handle_t nv_handle; - - nv_handle = create_dissector_handle(dissect_nv, proto_nv); dissector_add_uint("ecatf.type", 4, nv_handle); } diff --git a/plugins/epan/falco_bridge/AUTHORS b/plugins/epan/falco_bridge/AUTHORS new file mode 100644 index 0000000000..2265263fa5 --- /dev/null +++ b/plugins/epan/falco_bridge/AUTHORS @@ -0,0 +1,2 @@ +Author : +Loris Degioanni
\ No newline at end of file diff --git a/plugins/epan/falco_bridge/CMakeLists.txt b/plugins/epan/falco_bridge/CMakeLists.txt new file mode 100644 index 0000000000..2e369e2ee5 --- /dev/null +++ b/plugins/epan/falco_bridge/CMakeLists.txt @@ -0,0 +1,84 @@ +# CMakeLists.txt +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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 + "Implements a bridge between Falco plugins and Wireshark" + ${DISSECTOR_SRC} +) + +add_logray_epan_plugin_library(falco-bridge) + +# 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} + ${ZLIB_INCLUDE_DIR} +) + +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: +# diff --git a/plugins/epan/falco_bridge/README.md b/plugins/epan/falco_bridge/README.md new file mode 100644 index 0000000000..331e80b26d --- /dev/null +++ b/plugins/epan/falco_bridge/README.md @@ -0,0 +1,56 @@ +# 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" one level above 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. diff --git a/plugins/epan/falco_bridge/packet-falco-bridge.c b/plugins/epan/falco_bridge/packet-falco-bridge.c new file mode 100644 index 0000000000..a5c252aea6 --- /dev/null +++ b/plugins/epan/falco_bridge/packet-falco-bridge.c @@ -0,0 +1,1339 @@ +/* packet-falco-bridge.c + * + * By Loris Degioanni + * Copyright (C) 2021 Sysdig, Inc. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * 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. +// - Add syscall IP address conversation support + +#include "config.h" + +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> + +#ifndef _WIN32 +#include <unistd.h> +#include <dlfcn.h> +#endif + +#include <wiretap/wtap.h> + +#include <epan/exceptions.h> +#include <epan/follow.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/proto.h> +#include <epan/proto_data.h> +#include <epan/conversation.h> +#include <epan/conversation_filter.h> +#include <epan/stats_tree.h> +#include <epan/stat_tap_ui.h> +#include <epan/tap.h> + +#include <epan/dissectors/packet-sysdig-event.h> + +#include <wsutil/file_util.h> +#include <wsutil/filesystem.h> +#include <wsutil/inet_addr.h> +#include <wsutil/report_message.h> +#include <wsutil/strtoi.h> + +#include "sinsp-span.h" + +#define FALCO_PPME_PLUGINEVENT_E 322 + +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; + +typedef struct falco_conv_filter_fields { + const char* container_id; + int64_t pid; + int64_t tid; + int64_t fd; + const char* fd_containername; +} falco_conv_filter_fields; + +typedef struct fd_follow_tap_info { + const char* data; + int32_t datalen; + bool is_write; +} fd_follow_tap_info; + +typedef struct container_io_tap_info { + const char* container_id; + const char* proc_name; + const char* fd_name; + int32_t io_bytes; + bool is_write; +} container_io_tap_info; + +static int proto_falco_bridge; +static int proto_syscalls[NUM_SINSP_SYSCALL_CATEGORIES]; + +static int ett_falco_bridge; +static int ett_syscalls[NUM_SINSP_SYSCALL_CATEGORIES]; +static int ett_lineage[N_PROC_LINEAGE_ENTRIES]; + +static int ett_sinsp_enriched; +static int ett_sinsp_span; +static int ett_address; + +static int container_io_tap; + +static gboolean pref_show_internal = false; + +static dissector_table_t ptype_dissector_table; + +static int fd_follow_tap; + +static int dissect_sinsp_enriched(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *bi_ptr, sysdig_event_param_data *event_param_data); +static int dissect_sinsp_plugin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *bi_ptr); +static bridge_info* get_bridge_info(guint32 source_id); +const char* get_str_value(sinsp_field_extract_t *sinsp_fields, uint32_t sf_idx); + +/* + * 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; +static int hf_sdp_lengths; +static int hf_sdp_source_id; + +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 } + }, +}; + +static void +falco_bridge_cleanup(void) { + close_sinsp_capture(sinsp_span); +} + +// Returns true if the field might contain an IPv4 or IPv6 address. +// XXX This should probably be a preference. +static bool +is_string_address_field(enum ftenum ftype, const char *abbrev) { + if (ftype != FT_STRINGZ) { + return false; + } + 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); +} + +static void +create_source_hfids(bridge_info* bi) +{ + /* + * 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.is_numeric_address || is_string_address_field(sfi.type, 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_alloc0(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_alloc0(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_alloc0(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++) + { + get_sinsp_source_field_info(bi->ssi, j, &sfi); + + if (sfi.is_hidden) { + /* + * Skip the fields that are marked as hidden + */ + continue; + } + + ws_assert(fld_cnt < bi->visible_fields); + bi->field_ids[fld_cnt] = (int) j; + bi->field_flags[fld_cnt] = BFF_NONE; + + enum ftenum ftype = sfi.type; + int fdisplay = BASE_NONE; + switch (sfi.type) { + case FT_STRINGZ: + case FT_BOOLEAN: + case FT_BYTES: + break; + case FT_RELATIVE_TIME: + case FT_ABSOLUTE_TIME: + fdisplay = BASE_DEC; + break; + case FT_INT8: + case FT_INT16: + case FT_INT32: + case FT_INT64: + case FT_DOUBLE: + // This differs from libsinsp + fdisplay = BASE_DEC; + break; + case FT_UINT8: + case FT_UINT16: + case FT_UINT32: + case 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 source %s: format %d for field %s is not supported", + get_sinsp_source_name(bi->ssi), sfi.display_format, sfi.abbrev); + } + break; + default: + ftype = FT_NONE; + ws_warning("plugin %s: type of field %s (%d) is not supported", + get_sinsp_source_name(bi->ssi), + sfi.abbrev, sfi.type); + } + + 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 + } + }; + bi->hf[fld_cnt] = finfo; + + if (sfi.is_conversation) { + ws_assert(conv_fld_cnt < bi->num_conversation_filters); + bi->field_flags[fld_cnt] |= BFF_CONVERSATION; + bi->conversation_filters[conv_fld_cnt].field_info = &bi->hf[fld_cnt]; + 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, bi->hf[fld_cnt].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.is_numeric_address || is_string_address_field(sfi.type, sfi.abbrev)) { + ws_assert(addr_fld_cnt < addr_fields); + bi->hf_id_to_addr_id[fld_cnt] = 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 + } + }; + bi->hf_v4[addr_fld_cnt] = finfo_v4; + + 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_IPv6, BASE_NONE, + NULL, 0x0, + wmem_strdup_printf(wmem_epan_scope(), "%s (IPv6)", sfi.description), HFILL + } + }; + bi->hf_v6[addr_fld_cnt] = 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_plugin_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; + } + + create_source_hfids(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, source_name, source_name); + + static dissector_handle_t ct_handle; + ct_handle = create_dissector_handle(dissect_sinsp_plugin, 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; +} + +static gboolean +extract_syscall_conversation_fields (packet_info *pinfo, falco_conv_filter_fields* args) { + args->container_id = NULL; + args->pid = -1; + args->tid = -1; + args->fd = -1; + args->fd_containername = NULL; + + // Syscalls are always the bridge with source_id 0. + bridge_info* bi = get_bridge_info(0); + + sinsp_field_extract_t *sinsp_fields = NULL; + uint32_t sinsp_fields_count = 0; + void* sinp_evt_info; + bool rc = get_extracted_syscall_source_fields(sinsp_span, pinfo->fd->num, &sinsp_fields, &sinsp_fields_count, &sinp_evt_info); + + if (!rc) { + REPORT_DISSECTOR_BUG("cannot extract falco conversation fields for event %" PRIu32, pinfo->fd->num); + } + + for (uint32_t hf_idx = 0, sf_idx = 0; hf_idx < bi->visible_fields && sf_idx < sinsp_fields_count; hf_idx++) { + if (sinsp_fields[sf_idx].field_idx != hf_idx) { + continue; + } + + header_field_info* hfinfo = &(bi->hf[hf_idx].hfinfo); + + if (strcmp(hfinfo->abbrev, "container.id") == 0) { + args->container_id = get_str_value(sinsp_fields, sf_idx); + // if (args->container_id == NULL) { + // REPORT_DISSECTOR_BUG("cannot extract the container ID for event %" PRIu32, pinfo->fd->num); + // } + } + + if (strcmp(hfinfo->abbrev, "proc.pid") == 0) { + args->pid = sinsp_fields[sf_idx].res.u64; + } + + if (strcmp(hfinfo->abbrev, "thread.tid") == 0) { + args->tid = sinsp_fields[sf_idx].res.u64; + } + + if (strcmp(hfinfo->abbrev, "fd.num") == 0) { + args->fd = sinsp_fields[sf_idx].res.u64; + } + + if (strcmp(hfinfo->abbrev, "fd.containername") == 0) { + args->fd_containername = get_str_value(sinsp_fields, sf_idx); + } + + sf_idx++; + } + + // args->fd=-1 means that either there's no FD (e.g. a clone syscall), or that the FD is not a valid one (e.g., failed open). + if (args->fd == -1) { + return false; + } + + return true; +} + +static gboolean sysdig_syscall_filter_valid(packet_info *pinfo, void *user_data _U_) { + if (!proto_is_frame_protocol(pinfo->layers, "sysdig")) { + return false; + } + + // This only supports the syscall source. + if (pinfo->rec->rec_header.syscall_header.event_type == FALCO_PPME_PLUGINEVENT_E) { + return false; + } + + return true; +} + +static gboolean sysdig_syscall_container_filter_valid(packet_info *pinfo, void *user_data) { + if (!sysdig_syscall_filter_valid(pinfo, user_data)) { + return false; + } + + falco_conv_filter_fields cff; + if (!extract_syscall_conversation_fields(pinfo, &cff)) { + return false; + } + + return cff.container_id != NULL; +} + +static gboolean sysdig_syscall_fd_filter_valid(packet_info *pinfo, void *user_data) { + if (!sysdig_syscall_filter_valid(pinfo, user_data)) { + return false; + } + + falco_conv_filter_fields cff; + return extract_syscall_conversation_fields(pinfo, &cff); +} + +static gchar* sysdig_container_build_filter(packet_info *pinfo, void *user_data _U_) { + falco_conv_filter_fields cff; + extract_syscall_conversation_fields(pinfo, &cff); + return ws_strdup_printf("container.id==\"%s\"", cff.container_id); +} + +static gchar* sysdig_proc_build_filter(packet_info *pinfo, void *user_data _U_) { + falco_conv_filter_fields cff; + extract_syscall_conversation_fields(pinfo, &cff); + if (cff.container_id) { + return ws_strdup_printf("container.id==\"%s\" && proc.pid==%" PRId64, cff.container_id, cff.pid); + } else { + return ws_strdup_printf("proc.pid==%" PRId64, cff.pid); + } +} + +static gchar* sysdig_procdescendants_build_filter(packet_info *pinfo, void *user_data _U_) { + falco_conv_filter_fields cff; + extract_syscall_conversation_fields(pinfo, &cff); + + if (cff.container_id) { + return ws_strdup_printf("container.id==\"%s\" && (proc.pid==%" PRId64 " || proc.apid.1==%" PRId64 " || proc.apid.2==%" PRId64 " || proc.apid.3==%" PRId64 " || proc.apid.4==%" PRId64 ")", + cff.container_id, + cff.pid, + cff.pid, + cff.pid, + cff.pid, + cff.pid); + } else { + return ws_strdup_printf("proc.pid==%" PRId64 " || proc.apid.1==%" PRId64 " || proc.apid.2==%" PRId64 " || proc.apid.3==%" PRId64 " || proc.apid.4==%" PRId64, + cff.pid, + cff.pid, + cff.pid, + cff.pid, + cff.pid); + } +} + +static gchar* sysdig_thread_build_filter(packet_info *pinfo, void *user_data _U_) { + falco_conv_filter_fields cff; + extract_syscall_conversation_fields(pinfo, &cff); + if (cff.container_id) { + return ws_strdup_printf("container.id==\"%s\" && thread.tid==%" PRIu64, cff.container_id, cff.tid); + } else { + return ws_strdup_printf("thread.tid==%" PRId64, cff.tid); + } +} + +static gchar* sysdig_fd_build_filter(packet_info *pinfo, void *user_data _U_) { + falco_conv_filter_fields cff; + extract_syscall_conversation_fields(pinfo, &cff); + if (cff.container_id) { + return ws_strdup_printf("container.id==\"%s\" && thread.tid==%" PRId64 " && fd.containername==\"%s\"", + cff.container_id, + cff.tid, + cff.fd_containername); + } else { + return ws_strdup_printf("thread.tid==%" PRId64, cff.tid); + } +} + +static gchar *fd_follow_conv_filter(epan_dissect_t *edt _U_, packet_info *pinfo _U_, guint *stream _U_, guint *sub_stream _U_) +{ + return sysdig_fd_build_filter(pinfo, NULL); +} + +static gchar *fd_follow_index_filter(guint stream _U_, guint sub_stream _U_) +{ + return NULL; +} + +static gchar *fd_follow_address_filter(address *src_addr _U_, address *dst_addr _U_, int src_port _U_, int dst_port _U_) +{ + return NULL; +} + +gchar * +fd_port_to_display(wmem_allocator_t *allocator _U_, guint port _U_) +{ + return NULL; +} + +tap_packet_status +fd_tap_listener(void *tapdata, packet_info *pinfo, + epan_dissect_t *edt _U_, const void *data, tap_flags_t flags _U_) +{ + follow_record_t *follow_record; + follow_info_t *follow_info = (follow_info_t *)tapdata; + fd_follow_tap_info *tap_info = (fd_follow_tap_info *)data; + gboolean is_server; + + is_server = tap_info->is_write; + + follow_record = g_new0(follow_record_t, 1); + follow_record->is_server = is_server; + follow_record->packet_num = pinfo->fd->num; + follow_record->abs_ts = pinfo->fd->abs_ts; + follow_record->data = g_byte_array_append(g_byte_array_new(), + tap_info->data, + tap_info->datalen); + + follow_info->bytes_written[is_server] += follow_record->data->len; + follow_info->payload = g_list_prepend(follow_info->payload, follow_record); + + return TAP_PACKET_DONT_REDRAW; +} + +guint32 get_fd_stream_count(void) +{ + // This effectively disables the "streams" dropdown, which is we don't really care about for the moment in logray. + return 1; +} + + + +static bridge_info* +get_bridge_info(guint32 source_id) +{ + if (source_id == 0) { + return &bridges[0]; + } + + for(size_t 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 *epd_p) +{ + int encoding = pinfo->rec->rec_header.syscall_header.byte_order == G_BIG_ENDIAN ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN; + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "Falco Bridge"); + + // https://github.com/falcosecurity/libs/blob/9c942f27/userspace/libscap/scap.c#L1900 + + guint32 source_id = 0; + if (pinfo->rec->rec_header.syscall_header.event_type == FALCO_PPME_PLUGINEVENT_E) { + source_id = tvb_get_guint32(tvb, 8, encoding); + } + + bridge_info* bi = get_bridge_info(source_id); + + if (bi && bi->source_id == 0) { + sysdig_event_param_data *event_param_data = (sysdig_event_param_data *) epd_p; + dissect_sinsp_enriched(tvb, pinfo, tree, bi, event_param_data); + } else { + 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, encoding); + proto_tree_add_item(fb_tree, hf_sdp_lengths, tvb, 4, 4, encoding); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo,COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, "Plugin ID: %u", source_id); + + proto_item *idti = proto_tree_add_item(fb_tree, hf_sdp_source_id, tvb, 8, 4, encoding); + 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); + + tvbuff_t* plugin_tvb = tvb_new_subset_length(tvb, 12, tvb_captured_length(tvb) - 12); + dissect_sinsp_plugin(plugin_tvb, pinfo, fb_tree, bi); + } + + return tvb_captured_length(tvb); +} + +int extract_lineage_number(const char *fld_name) { + char *last_dot = strrchr(fld_name, '.'); + if (last_dot != NULL) { + return atoi(last_dot + 1); + } + return -1; +} + +const char* get_str_value(sinsp_field_extract_t *sinsp_fields, uint32_t sf_idx) { + const char *res_str; + if (sinsp_fields[sf_idx].res_len < SFE_SMALL_BUF_SIZE) { + res_str = sinsp_fields[sf_idx].res.small_str; + } else { + if (sinsp_fields[sf_idx].res.str == NULL) { + ws_debug("Field %u has NULL result string", sf_idx); + return NULL; + } + res_str = sinsp_fields[sf_idx].res.str; + } + + return res_str; +} + +static int +dissect_sinsp_enriched(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* bi_ptr, sysdig_event_param_data *event_param_data) +{ + bridge_info* bi = (bridge_info *) bi_ptr; + + if (!pinfo->fd->visited) { + if (pinfo->fd->num == 1) { + // Open the capture file using libsinsp, which reads the meta events + // at the beginning of the file. We can't call this via register_init_routine + // because we don't have the file path at that point. + open_sinsp_capture(sinsp_span, pinfo->rec->rec_header.syscall_header.pathname); + } + } + + sinsp_field_extract_t *sinsp_fields = NULL; + uint32_t sinsp_fields_count = 0; + void* sinp_evt_info; + bool rc = extract_syscall_source_fields(sinsp_span, bi->ssi, pinfo->fd->num, &sinsp_fields, &sinsp_fields_count, &sinp_evt_info); + + if (!rc) { + REPORT_DISSECTOR_BUG("Falco plugin %s extract error: %s", get_sinsp_source_name(bi->ssi), get_sinsp_source_last_error(bi->ssi)); + } + + if (sinsp_fields_count == 0) { + col_append_str(pinfo->cinfo, COL_INFO, " [Internal event]"); + if (!pref_show_internal) { + pinfo->fd->passed_dfilter = false; + } + return tvb_captured_length(tvb); + } + + proto_tree *parent_trees[NUM_SINSP_SYSCALL_CATEGORIES] = {0}; + proto_tree *lineage_trees[N_PROC_LINEAGE_ENTRIES] = {0}; + bool is_io_write = false; + const char* io_buffer = NULL; + uint32_t io_buffer_len = 0; + + const char *container_id = "host"; + const char *proc_name = NULL; + const char *fd_name = NULL; + + // Conversation discoverable through conversation_filter_from_pinfo. + // Used for related event indicators in the packet list. + // Fields should match sysdig_proc_build_filter. + conversation_element_t *pinfo_conv_els = NULL; // thread.tid hfid + thread.tid + container.id hfid + container.id + CONVERSATION_LOG + + for (uint32_t hf_idx = 0, sf_idx = 0; hf_idx < bi->visible_fields && sf_idx < sinsp_fields_count; hf_idx++) { + if (sinsp_fields[sf_idx].field_idx != hf_idx) { + continue; + } + + header_field_info* hfinfo = &(bi->hf[hf_idx].hfinfo); + + proto_tree *ti; + + + // XXX Should we add this back? +// if (sinsp_fields[sf_idx].type != hfinfo->type) { +// REPORT_DISSECTOR_BUG("Field %s has an unrecognized or mismatched type %u != %u", +// hfinfo->abbrev, sinsp_fields[sf_idx].type, hfinfo->type); +// } + + sinsp_syscall_category_e parent_category = get_syscall_parent_category(bi->ssi, sinsp_fields[sf_idx].field_idx); + if (!parent_trees[parent_category]) { + int bytes_offset = 0; + uint32_t bytes_length = 0; + if (parent_category == SSC_FD) { + bytes_offset = event_param_data->data_bytes_offset; + bytes_length = event_param_data->data_bytes_length; + } + ti = proto_tree_add_item(tree, proto_syscalls[parent_category], tvb, bytes_offset, bytes_length, BASE_NONE); + parent_trees[parent_category] = proto_item_add_subtree(ti, ett_syscalls[parent_category]); + } + proto_tree *parent_tree = parent_trees[parent_category]; + + if (parent_category == SSC_PROCLINEAGE) { + int32_t lnum = extract_lineage_number(hfinfo->abbrev); + if (lnum == -1) { + ws_error("Invalid lineage field name %s", hfinfo->abbrev); + } + + if (!lineage_trees[lnum]) { + const char* res_str = get_str_value(sinsp_fields, sf_idx); + if (res_str == NULL) { + ws_error("empty value for field %s", hfinfo->abbrev); + } + + lineage_trees[lnum] = proto_tree_add_subtree_format(parent_tree, tvb, 0, 0, ett_lineage[0], NULL, "%" PRIu32 ". %s", lnum, res_str); + sf_idx++; + continue; + } + + parent_tree = lineage_trees[lnum]; + } + + int32_t arg_num; +#define EVT_ARG_PFX "evt.arg." + if (! (g_str_has_prefix(hfinfo->abbrev, EVT_ARG_PFX) && ws_strtoi32(hfinfo->abbrev + sizeof(EVT_ARG_PFX) - 1, NULL, &arg_num)) ) { + arg_num = -1; + } + + if (strcmp(hfinfo->abbrev, "evt.is_io_write") == 0) { + is_io_write = sinsp_fields[sf_idx].res.boolean; + } + if (strcmp(hfinfo->abbrev, "evt.buffer") == 0) { + io_buffer = sinsp_fields[sf_idx].res.str; + io_buffer_len = sinsp_fields[sf_idx].res_len; + } + + switch (hfinfo->type) { + case FT_INT8: + case FT_INT16: + case FT_INT32: + proto_tree_add_int(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.i32); + break; + case FT_INT64: + proto_tree_add_int64(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.i64); + if (strcmp(hfinfo->abbrev, "thread.tid") == 0) { + if (!pinfo_conv_els) { + pinfo_conv_els = wmem_alloc0(pinfo->pool, sizeof(conversation_element_t) * 5); + pinfo_conv_els[0].type = CE_INT; + pinfo_conv_els[1].type = CE_INT64; + pinfo_conv_els[2].type = CE_INT; + pinfo_conv_els[3].type = CE_STRING; + } + pinfo_conv_els[0].int_val = hfinfo->id; + pinfo_conv_els[1].int64_val = sinsp_fields[sf_idx].res.i64; + } + break; + case FT_UINT8: + case FT_UINT16: + case FT_UINT32: + proto_tree_add_uint(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.u32); + break; + case FT_UINT64: + case FT_RELATIVE_TIME: + case FT_ABSOLUTE_TIME: + proto_tree_add_uint64(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.u64); + break; + case FT_STRINGZ: + { + const char* res_str = get_str_value(sinsp_fields, sf_idx); + if (res_str == NULL) { + continue; + } + + if (arg_num != -1) { + // When the field is an argument, we want to display things in a way that includes the argument name and value. + char* argname = get_evt_arg_name(sinp_evt_info, arg_num); + ti = proto_tree_add_string_format(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, res_str, "%s: %s", argname, res_str); + } else { + ti = proto_tree_add_string(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, res_str); + } + + if (bi->field_flags[hf_idx] & BFF_INFO) { + col_append_sep_fstr(pinfo->cinfo, COL_INFO, ", ", "%s", res_str); + // Mark it hidden, otherwise we end up with a bunch of empty "Info" tree items. + proto_item_set_hidden(ti); + } + + if (strcmp(hfinfo->abbrev, "proc.name") == 0) { + proc_name = res_str; + } else if (strcmp(hfinfo->abbrev, "fd.name") == 0) { + fd_name = res_str; + } else if (strcmp(hfinfo->abbrev, "container.id") == 0) { + container_id = res_str; + if (pinfo_conv_els) { + pinfo_conv_els[2].int_val = hfinfo->id; + } + } + } + break; + case FT_BOOLEAN: + proto_tree_add_boolean(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.boolean); + break; + case FT_DOUBLE: + proto_tree_add_double(parent_tree, bi->hf_ids[hf_idx], tvb, 0, 0, sinsp_fields[sf_idx].res.dbl); + break; + case FT_BYTES: + { + int addr_fld_idx = bi->hf_id_to_addr_id[hf_idx]; + if (addr_fld_idx < 0) { + int bytes_offset = 0; + uint32_t bytes_length = 0; + if (io_buffer) { // evt.buffer + bytes_offset = event_param_data->data_bytes_offset; + bytes_length = event_param_data->data_bytes_length; + } + proto_tree_add_bytes_with_length(parent_tree, bi->hf_ids[hf_idx], tvb, bytes_offset, bytes_length, sinsp_fields[sf_idx].res.str, sinsp_fields[sf_idx].res_len); + } else { + // XXX Need to differentiate between src and dest. Falco libs supply client vs server and local vs remote. + if (sinsp_fields[sf_idx].res_len == 4) { + ws_in4_addr v4_addr; + memcpy(&v4_addr, sinsp_fields[sf_idx].res.bytes, 4); + proto_tree_add_ipv4(parent_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 (sinsp_fields[sf_idx].res_len == 16) { + ws_in6_addr v6_addr; + memcpy(&v6_addr, sinsp_fields[sf_idx].res.bytes, 16); + proto_tree_add_ipv6(parent_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); + } else { + ws_warning("Invalid length %u for address field %u", sinsp_fields[sf_idx].res_len, sf_idx); + } + // XXX Add conversation support. + } + break; + } + default: + break; + } + sf_idx++; + } + + if (pinfo_conv_els) { + pinfo_conv_els[3].str_val = container_id; + pinfo_conv_els[4].type = CE_CONVERSATION_TYPE; + pinfo_conv_els[4].conversation_type_val = CONVERSATION_LOG; + pinfo->conv_elements = pinfo_conv_els; + find_or_create_conversation(pinfo); + } + + if (io_buffer_len > 0) { + if (have_tap_listener(fd_follow_tap)) { + fd_follow_tap_info *tap_info = wmem_new(pinfo->pool, fd_follow_tap_info); + tap_info->data = io_buffer; + tap_info->datalen = io_buffer_len; + tap_info->is_write = is_io_write; + tap_queue_packet(fd_follow_tap, pinfo, tap_info); + } + if (have_tap_listener(container_io_tap) && proc_name && fd_name) { + container_io_tap_info *tap_info = wmem_new(pinfo->pool, container_io_tap_info); + tap_info->proc_name = proc_name; + tap_info->fd_name = fd_name; + tap_info->container_id = container_id; + tap_info->io_bytes = io_buffer_len; + tap_info->is_write = is_io_write; + tap_queue_packet(container_io_tap, pinfo, tap_info); + } + } + + return tvb_captured_length(tvb); +} + +static int +dissect_sinsp_plugin(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* bi_ptr) +{ + bridge_info* bi = (bridge_info *) bi_ptr; + guint payload_len = tvb_captured_length(tvb); + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "oops"); + /* Clear out stuff in the info column */ + col_clear(pinfo->cinfo, COL_INFO); + + proto_item *ti = tree; + proto_tree* fb_tree = proto_item_add_subtree(ti, ett_sinsp_span); + + guint8* payload = (guint8*)tvb_get_ptr(tvb, 0, payload_len); + + plugin_field_extract_t *sinsp_fields = (plugin_field_extract_t*) wmem_alloc(pinfo->pool, sizeof(plugin_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); + plugin_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 ? FT_STRINGZ : FT_UINT64; + } + + // If we have a failure, try to dissect what we can first, then bail out with an error. + bool rc = extract_plugin_source_fields(bi->ssi, pinfo->num, payload, payload_len, 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++) { + plugin_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 == FT_STRINGZ && hfinfo->type == FT_STRINGZ) { + proto_item *pi = proto_tree_add_string(fb_tree, bi->hf_ids[fld_idx], tvb, 0, payload_len, 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 == FT_UINT64 && hfinfo->type == FT_UINT64) { + proto_tree_add_uint64(fb_tree, bi->hf_ids[fld_idx], tvb, 0, payload_len, 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 (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 payload_len; +} + +const char *st_str_container_total_io = "Total"; + +static void container_io_stats_tree_init(stats_tree* st _U_) +{ + stats_tree_create_node(st, st_str_container_total_io, 0, STAT_DT_INT, TRUE); + stat_node_set_flags(st, st_str_container_total_io, 0, FALSE, ST_FLG_SORT_TOP); + +} + +static tap_packet_status container_io_stats_tree_event(stats_tree* st, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* tap_info_p, tap_flags_t flags _U_) +{ + const container_io_tap_info* tap_info = (const container_io_tap_info*) tap_info_p; + + increase_stat_node(st, st_str_container_total_io, 0, FALSE, tap_info->io_bytes); + int container_id_node = increase_stat_node(st, tap_info->container_id, 0, TRUE, tap_info->io_bytes); + int proc_name_node = increase_stat_node(st, tap_info->proc_name, container_id_node, TRUE, tap_info->io_bytes); + int fd_name_node = increase_stat_node(st, tap_info->fd_name, proc_name_node, TRUE, tap_info->io_bytes); + if (tap_info->is_write) { + increase_stat_node(st, "write", fd_name_node, TRUE, tap_info->io_bytes); + } else { + increase_stat_node(st, "read", fd_name_node, TRUE, tap_info->io_bytes); + } + + return TAP_PACKET_REDRAW; +} + +void +proto_reg_handoff_falcoplugin(void) +{ + // Register statistics trees + stats_tree_cfg *st_config = stats_tree_register_plugin("container_io", "container_io", "Container I/O", 0, container_io_stats_tree_event, container_io_stats_tree_init, NULL); + stats_tree_set_group(st_config, REGISTER_LOG_STAT_GROUP_UNSORTED); + stats_tree_set_first_column_name(st_config, "Container, process, and FD I/O"); + +} + +void +proto_register_falcoplugin(void) +{ + // Opening requires a file path, so we do that in dissect_sinsp_enriched. + register_cleanup_routine(&falco_bridge_cleanup); + + proto_falco_bridge = proto_register_protocol("Falco Bridge", "Falco Bridge", "falcobridge"); + register_dissector("falcobridge", dissect_falco_bridge, proto_falco_bridge); + + // Register the syscall conversation filters. + // These show up in the "Conversation Filter" and "Colorize Conversation" context menus. + // The first match is also used for "Go" menu navigation. + register_log_conversation_filter("falcobridge", "Thread", sysdig_syscall_filter_valid, sysdig_thread_build_filter, NULL); + register_log_conversation_filter("falcobridge", "Process", sysdig_syscall_filter_valid, sysdig_proc_build_filter, NULL); + register_log_conversation_filter("falcobridge", "Container", sysdig_syscall_container_filter_valid, sysdig_container_build_filter, NULL); + register_log_conversation_filter("falcobridge", "Process and Descendants", sysdig_syscall_filter_valid, sysdig_procdescendants_build_filter, NULL); + register_log_conversation_filter("falcobridge", "File Descriptor", sysdig_syscall_fd_filter_valid, sysdig_fd_build_filter, NULL); + add_conversation_filter_protocol("falcobridge"); + + // Register statistics taps + container_io_tap = register_tap("container_io"); + + // Register the "follow" handlers + fd_follow_tap = register_tap("fd_follow"); + + register_follow_stream(proto_falco_bridge, "fd_follow", fd_follow_conv_filter, fd_follow_index_filter, fd_follow_address_filter, + fd_port_to_display, fd_tap_listener, get_fd_stream_count, NULL); + + // Try to have a 1:1 mapping for as many Sysdig / Falco fields as possible. + // The exceptions are SSC_EVTARGS and SSC_PROCLINEAGE, which exposes the event arguments in a way that is convenient for the user. + proto_syscalls[SSC_EVENT] = proto_register_protocol("Event Information", "Falco Event", "evt"); + proto_syscalls[SSC_EVTARGS] = proto_register_protocol("Event Arguments", "Falco Event Info", "evt.arg"); + proto_syscalls[SSC_PROCESS] = proto_register_protocol("Process Information", "Falco Process", "process"); + proto_syscalls[SSC_PROCLINEAGE] = proto_register_protocol("Process Ancestors", "Falco Process Lineage", "proc.aname"); + proto_syscalls[SSC_USER] = proto_register_protocol("User Information", "Falco User", "user"); + proto_syscalls[SSC_GROUP] = proto_register_protocol("Group Information", "Falco Group", "group"); + proto_syscalls[SSC_CONTAINER] = proto_register_protocol("Container Information", "Falco Container", "container"); + proto_syscalls[SSC_FD] = proto_register_protocol("File Descriptor Information", "Falco FD", "fd"); + proto_syscalls[SSC_FS] = proto_register_protocol("Filesystem Information", "Falco FS", "fs"); + // syslog.facility collides with the Syslog dissector, so let syslog fall through to "falco". + proto_syscalls[SSC_FDLIST] = proto_register_protocol("File Descriptor List", "Falco FD List", "fdlist"); + proto_syscalls[SSC_OTHER] = proto_register_protocol("Unknown or Miscellaneous Falco", "Falco Misc", "falco"); + + // Preferences + module_t *falco_bridge_module = prefs_register_protocol(proto_falco_bridge, NULL); + prefs_register_bool_preference(falco_bridge_module, "show_internal_events", + "Show internal events", + "Show internal libsinsp events in the event list.", + &pref_show_internal); + + + /* + * 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(), "falco", NULL); + char *ppdname = g_build_filename(get_plugins_pers_dir(), "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 + 1); + + create_sinsp_syscall_source(sinsp_span, &bridges[0].ssi); + + create_source_hfids(&bridges[0]); + nbridges = 1; + + 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 int *ett[] = { + &ett_falco_bridge, + &ett_syscalls[SSC_EVENT], + &ett_syscalls[SSC_EVTARGS], + &ett_syscalls[SSC_PROCESS], + &ett_syscalls[SSC_PROCLINEAGE], + &ett_syscalls[SSC_USER], + &ett_syscalls[SSC_GROUP], + &ett_syscalls[SSC_FD], + &ett_syscalls[SSC_FS], + &ett_syscalls[SSC_FDLIST], + &ett_syscalls[SSC_OTHER], + &ett_sinsp_enriched, + &ett_sinsp_span, + &ett_address, + }; + + /* + * Setup process lineage subtree array + */ + static int *ett_lin[] = { + &ett_lineage[0], + &ett_lineage[1], + &ett_lineage[2], + &ett_lineage[3], + &ett_lineage[4], + &ett_lineage[5], + &ett_lineage[6], + &ett_lineage[7], + &ett_lineage[8], + &ett_lineage[9], + &ett_lineage[10], + &ett_lineage[11], + &ett_lineage[12], + &ett_lineage[13], + &ett_lineage[14], + &ett_lineage[15], + }; + + proto_register_field_array(proto_falco_bridge, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + proto_register_subtree_array(ett_lin, array_length(ett_lin)); + + register_shutdown_routine(on_wireshark_exit); +} diff --git a/plugins/epan/falco_bridge/sinsp-span.cpp b/plugins/epan/falco_bridge/sinsp-span.cpp new file mode 100644 index 0000000000..98612f8cbf --- /dev/null +++ b/plugins/epan/falco_bridge/sinsp-span.cpp @@ -0,0 +1,1005 @@ +/* sinsp-span.cpp + * + * By Gerald Combs + * Copyright (C) 2022 Sysdig, Inc. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "config.h" + +#include <stddef.h> +#include <stdint.h> + +#include <glib.h> + +#include <epan/wmem_scopes.h> + +#include <wsutil/unicode-utils.h> + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4100) +#pragma warning(disable:4267) +#endif + +// To do: +// [ ] Move chunkify_string to a thread? For captures with large command lines, +// we spend a lot of time hashing strings. + + +// 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; + std::vector<const filter_check_info *> syscall_filter_checks; + std::vector<const filtercheck_field_info *> syscall_filter_fields; + std::vector<gen_event_filter_check *> syscall_event_filter_checks; // Same size as syscall_filter_fields + std::vector<sinsp_syscall_category_e> field_to_category; // Same size as syscall_filter_fields + sinsp_evt *evt; + uint8_t *evt_storage; + size_t evt_storage_size; + const char *name; + const char *description; + char *last_error; + size_t evt_category_idx; + uint16_t cpu_id_idx; + uint16_t proc_id_idx; +} sinsp_source_info_t; + +static const size_t sfe_slab_prealloc = 250000; + +typedef struct sinsp_span_t { + sinsp inspector; + sinsp_filter_check_list filter_checks; + sinsp_field_extract_t *sfe_slab; + size_t sfe_slab_offset; + // XXX Combine these into a single struct? + std::vector<sinsp_field_extract_t *> sfe_ptrs; + std::vector<uint16_t> sfe_lengths; + std::vector<const ppm_event_info*> sfe_infos; + // Interned data. Copied from maxmind_db.c. + wmem_map_t *str_chunk; + wmem_map_t *proc_info_chunk; +} sinsp_span_t; + +// #define SS_MEMORY_STATISTICS 1 + +#ifdef SS_MEMORY_STATISTICS +#include <wsutil/str_util.h> + +static int alloc_sfe; +static int unused_sfe_bytes; +static int total_chunked_strings; +static int unique_chunked_strings; +static int proc_info_hits; +static int proc_info_updates; +static int alloc_chunked_string_bytes; +static int total_bytes; +#endif + +static filter_check_info g_args_fci; +static filter_check_info g_lineage_fci; + +// These sinsp fields are not interesting in a wireshark-like use case, so we skip them. +std::set<std::string> g_fields_to_skip = { + "evt.num", + "evt.time", + "evt.time.s", + "evt.time.iso8601", + "evt.datetime", + "evt.datetime.s", + "evt.rawtime", + "evt.rawtime.s", + "evt.rawtime.ns", + "evt.reltime", + "evt.reltime.s", + "evt.reltime.ns", + "evt.deltatime", + "evt.deltatime.s", + "evt.deltatime.ns", + "syscall.type", + "evt.is_async", + "evt.is_syslog", + "evt.count", + "proc.exeline", + "proc.cmdnargs", + "proc.pexe", + "proc.pexepath", + "proc.pcmdline", + "proc.ppid", + "proc.aexe", + "proc.aexepath", + "proc.aname", + "proc.acmdline", + "proc.apid", + "proc.cmdlenargs", + "proc.ppid.duration", + "proc.ppid.ts", + "thread.exetime", + "thread.totexetime", + "thread.vmsize", + "thread.vmrss", + "fd.nameraw", + "fd.cproto", + "fd.sproto", + "fd.lproto", + "fd.rproto", +}; + +sinsp_span_t *create_sinsp_span() +{ + sinsp_span_t *span = new(sinsp_span_t); + span->inspector.set_internal_events_mode(true); + span->inspector.set_buffer_format(sinsp_evt::PF_EOLS_COMPACT); + + return span; +} + +void destroy_sinsp_span(sinsp_span_t *sinsp_span) { + delete(sinsp_span); +} + +static const char *chunkify_string(sinsp_span_t *sinsp_span, const uint8_t *key, uint32_t key_len, int64_t cpu_id, int64_t proc_id, uint16_t fc_idx) { + int64_t proc_key = 0; + +#ifdef SS_MEMORY_STATISTICS + total_chunked_strings++; +#endif + + // In order to avoid hashing the same potentially large strings over and over, + // we assume that field values will mostly be the same for each CPU,PID combo. + if (fc_idx) { + proc_key = (cpu_id << 48) | (proc_id << 16) | fc_idx; + char *proc_string = (char *) wmem_map_lookup(sinsp_span->proc_info_chunk, &proc_key); + + if (proc_string && strcmp(proc_string, (const char *)key) == 0) { +#ifdef SS_MEMORY_STATISTICS + proc_info_hits++; +#endif + return proc_string; + } + } + + char *chunk_string = (char *) wmem_map_lookup(sinsp_span->str_chunk, key); + + if (!chunk_string) { + chunk_string = (char *) ws_utf8_make_valid(wmem_file_scope(), key, (ssize_t)key_len); + char *key_string = chunk_string; + if (strcmp((const char *) key, chunk_string)) { + key_string = (char *) wmem_memdup(wmem_file_scope(), key, key_len); + } + wmem_map_insert(sinsp_span->str_chunk, key_string, chunk_string); +#ifdef SS_MEMORY_STATISTICS + unique_chunked_strings++; + alloc_chunked_string_bytes += (int) strlen(chunk_string); +#endif + } + + if (proc_key) { + wmem_map_insert(sinsp_span->proc_info_chunk, &proc_key, chunk_string); +#ifdef SS_MEMORY_STATISTICS + proc_info_updates++; +#endif + } + + return chunk_string; +} + +static sinsp_syscall_category_e filtercheck_name_to_category(const std::string fc_name) { + std::map<const char *, sinsp_syscall_category_e> fc_name_to_category = { + { "evt", SSC_EVENT }, + { "args", SSC_EVTARGS }, + { "process", SSC_PROCESS }, + { "lineage", SSC_PROCLINEAGE}, + { "user", SSC_USER }, + { "group", SSC_GROUP }, + { "container", SSC_CONTAINER }, + { "fd", SSC_FD }, + { "fs.path", SSC_FS }, + // syslog collides with the dissector + { "fdlist", SSC_FDLIST }, + }; + + for (const auto ptc : fc_name_to_category) { + if (ptc.first == fc_name) { + return ptc.second; + } + } + return SSC_OTHER; +} + +/* + * This is the list of "fake" fields that we create for the Falco event arguments. + */ +const filtercheck_field_info args_event_fields[] = +{ + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.0", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.1", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.2", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.3", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.4", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.5", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.6", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.7", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.8", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.9", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.10", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.11", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.12", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.13", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.14", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.15", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.16", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.17", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.18", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.19", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.20", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.21", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.22", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.23", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.24", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.25", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.26", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.27", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.28", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.29", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.30", "Argument", "Event argument."}, + {PT_CHARBUF, EPF_NONE, PF_NA, "evt.arg.31", "Argument", "Event argument."}, +}; + +#define CREATE_FIELD_INFO(index) \ + {PT_CHARBUF, EPF_NONE, PF_NA, "proc.aname." #index, "Name", "The proc.name..."}, \ + {PT_CHARBUF, EPF_NONE, PF_NA, "proc.aexepath." #index, "Executable Path", "The proc.exepath..."}, \ + {PT_INT64, EPF_NONE, PF_ID, "proc.apid." #index, "Process ID", "The pid..."}, \ + {PT_CHARBUF, EPF_NONE, PF_NA, "proc.acmdline." #index, "Command Line", "The full command line..."} + +/* + * This is the list of "fake" fields that we create for process lineage. + * We construct the array using a macro to limit verboseness. + */ +const filtercheck_field_info proc_lineage_event_fields[] = { + CREATE_FIELD_INFO(1), + CREATE_FIELD_INFO(2), + CREATE_FIELD_INFO(3), + CREATE_FIELD_INFO(4), + CREATE_FIELD_INFO(5), + CREATE_FIELD_INFO(6), + CREATE_FIELD_INFO(7), + CREATE_FIELD_INFO(8), + CREATE_FIELD_INFO(9), + CREATE_FIELD_INFO(10), + CREATE_FIELD_INFO(11), + CREATE_FIELD_INFO(12), + CREATE_FIELD_INFO(13), + CREATE_FIELD_INFO(14), + CREATE_FIELD_INFO(15), + CREATE_FIELD_INFO(16), +}; + +void add_arg_event(uint32_t arg_number, + sinsp_filter_factory* filter_factory, + sinsp_source_info_t *ssi, + sinsp_syscall_category_e args_syscall_category) { + + if (arg_number >= sizeof(args_event_fields) / sizeof(args_event_fields[0])) { + ws_error("falco event has too many arguments (%" PRIu32 ")", arg_number); + } + + std::string fname = "evt.arg[" + std::to_string(arg_number) + "]"; + + const filtercheck_field_info *ffi = &args_event_fields[arg_number]; + gen_event_filter_check *gefc = filter_factory->new_filtercheck(fname.c_str()); + if (!gefc) { + ws_error("cannot find expected Falco field evt.arg"); + } + gefc->parse_field_name(fname.c_str(), true, false); + ssi->field_to_category.push_back(args_syscall_category); + ssi->syscall_event_filter_checks.push_back(gefc); + ssi->syscall_filter_fields.push_back(ffi); +} + +void create_args_source(sinsp_source_info_t *ssi, + sinsp_filter_factory* filter_factory, + const filter_check_info* fci) { + g_args_fci.m_name = "args"; + sinsp_syscall_category_e args_syscall_category = filtercheck_name_to_category(g_args_fci.m_name); + + g_args_fci = *fci; + + for (uint32_t i = 0; i < 32; i++) { + add_arg_event(i, filter_factory, ssi, args_syscall_category); + } + ssi->syscall_filter_checks.push_back(&g_args_fci); +} + +void add_lineage_field(std::string basefname, + uint32_t ancestor_number, + uint32_t field_number, + sinsp_filter_factory* filter_factory, + sinsp_source_info_t *ssi, + sinsp_syscall_category_e args_syscall_category) { + std::string fname = basefname + "[" + std::to_string(ancestor_number) + "]"; + const filtercheck_field_info *ffi = &proc_lineage_event_fields[(ancestor_number - 1) * N_PROC_LINEAGE_ENTRY_FIELDS + field_number]; + gen_event_filter_check *gefc = filter_factory->new_filtercheck(fname.c_str()); + if (!gefc) { + ws_error("cannot find expected Falco field evt.arg"); + } + + gefc->parse_field_name(fname.c_str(), true, false); + ssi->field_to_category.push_back(args_syscall_category); + ssi->syscall_event_filter_checks.push_back(gefc); + ssi->syscall_filter_fields.push_back(ffi); +} + +void add_lineage_events(uint32_t ancestor_number, + sinsp_filter_factory* filter_factory, + sinsp_source_info_t *ssi, + sinsp_syscall_category_e args_syscall_category) { + + if (ancestor_number >= sizeof(proc_lineage_event_fields) / sizeof(proc_lineage_event_fields[0]) / N_PROC_LINEAGE_ENTRY_FIELDS) { + ws_error("falco lineage mismatch (%" PRIu32 ")", ancestor_number); + } + + add_lineage_field("proc.aname", ancestor_number, 0, filter_factory, ssi, args_syscall_category); + add_lineage_field("proc.acmdline", ancestor_number, 3, filter_factory, ssi, args_syscall_category); + add_lineage_field("proc.aexepath", ancestor_number, 1, filter_factory, ssi, args_syscall_category); + add_lineage_field("proc.apid", ancestor_number, 2, filter_factory, ssi, args_syscall_category); +} + +void create_lineage_source(sinsp_source_info_t *ssi, + sinsp_filter_factory* filter_factory, + const filter_check_info* fci) { + g_lineage_fci.m_name = "lineage"; + sinsp_syscall_category_e args_syscall_category = filtercheck_name_to_category(g_lineage_fci.m_name); + + g_lineage_fci = *fci; + + for (uint32_t i = 1; i < N_PROC_LINEAGE_ENTRIES; i++) { + add_lineage_events(i, filter_factory, ssi, args_syscall_category); + } + ssi->syscall_filter_checks.push_back(&g_lineage_fci); +} + +// Not all of the fields in sinsp have been designed with a Wireshark-like use case in mind. +// This functions determines which fields we should skip. +bool skip_field(const filtercheck_field_info *ffi) { + if (g_fields_to_skip.find(ffi->m_name) != g_fields_to_skip.end()) { + return true; + } + return false; +} + +/* + * We want the flexibility to decide the deiplay order of the fields in the UI, since + * the order in which they are defined in filterchecks.{cpp,h} is not necessarily the one we want. + */ +void reorder_syscall_fields(std::vector<const filter_check_info*>* all_syscall_fields) { + // Move "fd" after "proc" + all_syscall_fields->insert(all_syscall_fields->begin() + 3, all_syscall_fields->at(6)); + all_syscall_fields->erase(all_syscall_fields->begin() + 7); + + // Move "container" after "fd" + all_syscall_fields->insert(all_syscall_fields->begin() + 4, all_syscall_fields->at(6)); + all_syscall_fields->erase(all_syscall_fields->begin() + 7); +} + +/* + * Populate a sinsp_source_info_t struct with the symbols coming from libsinsp's builtin syscall extractors + */ +void create_sinsp_syscall_source(sinsp_span_t *sinsp_span, sinsp_source_info_t **ssi_ptr) { + sinsp_source_info_t *ssi = new sinsp_source_info_t(); + + std::shared_ptr<gen_event_filter_factory> factory(new sinsp_filter_factory(NULL, sinsp_span->filter_checks)); + sinsp_filter_factory filter_factory(&sinsp_span->inspector, sinsp_span->filter_checks); + std::vector<const filter_check_info*> all_syscall_fields; + + // Extract the fields defined in filterchecks.{cpp,h} + sinsp_span->filter_checks.get_all_fields(all_syscall_fields); + // Reorder the list of extractor the way we want them to appear in the UI. + reorder_syscall_fields(&all_syscall_fields); + for (const auto fci : all_syscall_fields) { + if (fci->m_flags == filter_check_info::FL_HIDDEN) { + continue; + } + + if (fci->m_name == "process") { + // This creates a meta-filtercheck for the events arguments and it register its fields. + // We do it before the process filtercheck because we want to have it exactly in the position + // after event and before process. + create_args_source(ssi, &filter_factory, fci); + } else if (fci->m_name == "fd") { + // This creates a meta-filtercheck for process lineage. + // We do it before the fd filtercheck because we want it to be between the proc and fd trees. + create_lineage_source(ssi, &filter_factory, fci); + } + + sinsp_syscall_category_e syscall_category = filtercheck_name_to_category(fci->m_name); + + for (int i = 0; i < fci->m_nfields; i++) { + const filtercheck_field_info *ffi = &fci->m_fields[i]; + if (ffi->m_flags == filtercheck_field_flags::EPF_NONE) { + // This is where we exclude fields that are not interesting in a wireshark-like use case. + if (skip_field(ffi)) { + continue; + } + + gen_event_filter_check *gefc = filter_factory.new_filtercheck(ffi->m_name); + if (!gefc) { + continue; + } + if (strcmp(ffi->m_name, "evt.category") == 0) { + ssi->evt_category_idx = ssi->syscall_filter_fields.size(); + } + if (strcmp(ffi->m_name, "evt.cpu") == 0) { + ssi->cpu_id_idx = (uint16_t) ssi->syscall_filter_fields.size(); + } + if (strcmp(ffi->m_name, "proc.pid") == 0) { + ssi->proc_id_idx = (uint16_t) ssi->syscall_filter_fields.size(); + } + gefc->parse_field_name(ffi->m_name, true, false); + ssi->field_to_category.push_back(syscall_category); + ssi->syscall_event_filter_checks.push_back(gefc); + ssi->syscall_filter_fields.push_back(ffi); + } + } + + ssi->syscall_filter_checks.push_back(fci); + } + + 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(sinsp_syscall_event_source_name); + ssi->description = strdup(sinsp_syscall_event_source_name); + *ssi_ptr = ssi; + return; +} + +/* + * Populate a sinsp_source_info_t struct with the symbols coming from a library loaded via libsinsp + */ +char * +create_sinsp_plugin_source(sinsp_span_t *sinsp_span, const char* libname, sinsp_source_info_t **ssi_ptr) +{ + sinsp_source_info_t *ssi = new sinsp_source_info_t(); + + char *err_str = NULL; + 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) +{ + if (ssi->source) { + return ssi->source->id(); + } + return 0; +} + +const char *get_sinsp_source_last_error(sinsp_source_info_t *ssi) +{ + if (ssi->source) { + 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) +{ + if (ssi->source) { + return ssi->source->fields().size(); + } + + return ssi->syscall_filter_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 >= get_sinsp_source_nfields(ssi)) { + return false; + } + + const filtercheck_field_info *ffi = NULL; + + if (ssi->source) { + ffi = &ssi->source->fields()[field_num]; + g_strlcpy(field->abbrev, ffi->m_name, sizeof(field->abbrev)); + } else { + ffi = ssi->syscall_filter_fields[field_num]; + if (ssi->field_to_category[field_num] == SSC_OTHER) { + snprintf(field->abbrev, sizeof(field->abbrev), FALCO_FIELD_NAME_PREFIX "%s", ffi->m_name); + } else { + g_strlcpy(field->abbrev, ffi->m_name, sizeof(field->abbrev)); + } + } + + g_strlcpy(field->display, ffi->m_display, sizeof(field->display)); + g_strlcpy(field->description, ffi->m_description, sizeof(field->description)); + + field->is_hidden = ffi->m_flags & EPF_TABLE_ONLY; + field->is_conversation = ffi->m_flags & EPF_CONVERSATION; + field->is_info = ffi->m_flags & EPF_INFO; + + field->is_numeric_address = false; + + switch (ffi->m_type) { + case PT_INT8: + field->type = FT_INT8; + break; + case PT_INT16: + field->type = FT_INT16; + break; + case PT_INT32: + field->type = FT_INT32; + break; + case PT_INT64: + field->type = FT_INT64; + break; + case PT_UINT8: + field->type = FT_UINT8; + break; + case PT_UINT16: + case PT_PORT: + field->type = FT_UINT16; + break; + case PT_UINT32: + field->type = FT_UINT32; + break; + case PT_UINT64: + case PT_RELTIME: + case PT_ABSTIME: + field->type = FT_UINT64; + break; + case PT_CHARBUF: + field->type = FT_STRINGZ; + break; +// field->type = FT_RELATIVE_TIME; +// break; +// field->type = FT_ABSOLUTE_TIME; +// field->type = FT_UINT64; +// field->display_format = SFDF_DECIMAL; + break; + case PT_BYTEBUF: + field->type = FT_BYTES; + break; + case PT_BOOL: + field->type = FT_BOOLEAN; + break; + case PT_DOUBLE: + field->type = FT_DOUBLE; + break; + case PT_IPADDR: + field->type = FT_BYTES; + field->is_numeric_address = true; + break; + default: + ws_debug("Unknown Falco parameter type %d for %s", ffi->m_type, field->abbrev); + field->type = FT_BYTES; + } + + switch (ffi->m_print_format) { + case PF_DEC: + case PF_10_PADDED_DEC: + case PF_ID: + 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; + break; + } + + return true; +} + +char* get_evt_arg_name(void* sinp_evt_info, uint32_t arg_num) { + ppm_event_info* realinfo = (ppm_event_info*)sinp_evt_info; + + if (arg_num > realinfo->nparams) { + ws_error("Arg number %u exceeds event parameter count %u", arg_num, realinfo->nparams); + return NULL; + } + return realinfo->params[arg_num].name; +} + +void open_sinsp_capture(sinsp_span_t *sinsp_span, const char *filepath) +{ + sinsp_span->sfe_slab = NULL; + sinsp_span->sfe_slab_offset = 0; + sinsp_span->sfe_ptrs.clear(); + sinsp_span->sfe_lengths.clear(); + sinsp_span->sfe_infos.clear(); + sinsp_span->inspector.open_savefile(filepath); + sinsp_span->str_chunk = wmem_map_new(wmem_file_scope(), g_str_hash, g_str_equal); + sinsp_span->proc_info_chunk = wmem_map_new(wmem_file_scope(), g_int64_hash, g_int64_equal); + +#ifdef SS_MEMORY_STATISTICS + alloc_sfe = 0; + unused_sfe_bytes = 0; + total_chunked_strings = 0; + unique_chunked_strings = 0; + proc_info_hits = 0; + proc_info_updates = 0; + alloc_chunked_string_bytes = 0; + total_bytes = 0; +#endif +} + +static void add_syscall_event_to_cache(sinsp_span_t *sinsp_span, sinsp_source_info_t *ssi, sinsp_evt *evt) +{ + uint64_t evt_num = evt->get_num(); + + // Fill in any gaps + if (evt_num > 1 && evt_num - 1 > sinsp_span->sfe_ptrs.size()) { + ws_debug("Filling syscall gap from %d to %u", (int) sinsp_span->sfe_ptrs.size(), (unsigned) evt_num - 1); + sinsp_span->sfe_ptrs.resize(evt_num - 1); + sinsp_span->sfe_lengths.resize(evt_num - 1); + sinsp_span->sfe_infos.resize(evt_num - 1); + } + + // libsinsp requires that events be processed in order so we cache our extracted + // data during the first pass. We don't know how many fields we're going to extract + // during an event, so we preallocate slabs of `sfe_slab_prealloc` entries. + // + // XXX This assumes that we won't extract more than ssi->syscall_event_filter_checks.size() + // fields per event. + if (sinsp_span->sfe_slab_offset + ssi->syscall_event_filter_checks.size() > sfe_slab_prealloc) { +#ifdef SS_MEMORY_STATISTICS + if (sinsp_span->sfe_slab_offset > 0) { + unused_sfe_bytes += sizeof(sinsp_field_extract_t) * (sfe_slab_prealloc - sinsp_span->sfe_slab_offset); + } +#endif + sinsp_span->sfe_slab = NULL; + sinsp_span->sfe_slab_offset = 0; + } + + if (sinsp_span->sfe_slab == NULL) { +#ifdef SS_MEMORY_STATISTICS + alloc_sfe += sfe_slab_prealloc; +#endif + sinsp_span->sfe_slab = (sinsp_field_extract_t *) wmem_alloc(wmem_file_scope(), sizeof(sinsp_field_extract_t) * sfe_slab_prealloc); + } + + sinsp_field_extract_t *sfe_block = &sinsp_span->sfe_slab[sinsp_span->sfe_slab_offset]; + std::vector<extract_value_t> values; + uint16_t sfe_idx = 0; + int16_t cpu_id = 0; + int64_t proc_id = 0; + + // First check for internal events. + // XXX We should skip this if "Show internal events" is enabled. + auto gefc = ssi->syscall_event_filter_checks[ssi->evt_category_idx]; + if (!gefc->extract(evt, values, false) || values.size() < 1) { + return; + } + if (strcmp((const char *) values[0].ptr, "internal") == 0) { + return; + } + + for (size_t fc_idx = 0; fc_idx < ssi->syscall_event_filter_checks.size(); fc_idx++) { + gefc = ssi->syscall_event_filter_checks[fc_idx]; + values.clear(); + if (!gefc->extract(evt, values, false) || values.size() < 1) { + continue; + } + auto ffi = ssi->syscall_filter_fields[fc_idx]; + if (ffi->m_flags == filtercheck_field_flags::EPF_NONE && values[0].len > 0) { + if (sinsp_span->sfe_slab_offset + sfe_idx >= sfe_slab_prealloc) { + ws_error("Extracting too many fields for event %u (%d vs %d)", (unsigned) evt->get_num(), (int) sfe_idx, (int) ssi->syscall_event_filter_checks.size()); + } + + sinsp_field_extract_t *sfe = &sfe_block[sfe_idx]; + sfe_idx++; + sfe->field_idx = (uint32_t) fc_idx; + // XXX Use memcpy instead of all this casting? + switch (ffi->m_type) { + case PT_INT8: + sfe->res.i32 = *(int8_t*)values[0].ptr; + break; + case PT_INT16: + sfe->res.i32 = *(int16_t*)values[0].ptr; + if (fc_idx == ssi->cpu_id_idx) { + cpu_id = *(int16_t*)values[0].ptr; + } + break; + case PT_INT32: + sfe->res.i32 = *(int32_t*)values[0].ptr; + break; + case PT_INT64: + sfe->res.i64 = *(int64_t *)values[0].ptr; + if (fc_idx == ssi->proc_id_idx) { + proc_id = *(int64_t*)values[0].ptr; + } + break; + case PT_UINT8: + sfe->res.u32 = *(uint8_t*)values[0].ptr; + break; + case PT_UINT16: + case PT_PORT: + sfe->res.u32 = *(uint16_t*)values[0].ptr; + break; + case PT_UINT32: + sfe->res.u32 = *(uint32_t*)values[0].ptr; + break; + case PT_UINT64: + case PT_RELTIME: + case PT_ABSTIME: + sfe->res.u64 = *(uint64_t *)values[0].ptr; + break; + case PT_CHARBUF: + if (values[0].len < SFE_SMALL_BUF_SIZE) { + // XXX We need to convert this to valid UTF-8 + g_strlcpy(sfe->res.small_str, (const char *) values[0].ptr, SFE_SMALL_BUF_SIZE); + } else { + sfe->res.str = chunkify_string(sinsp_span, values[0].ptr, values[0].len, cpu_id, proc_id, fc_idx); + } + break; + case PT_BOOL: + sfe->res.boolean = (bool)(uint32_t) *(uint32_t*)values[0].ptr; + break; + case PT_DOUBLE: + sfe->res.dbl = *(double*)values[0].ptr; + break; + default: + sfe->res.bytes = (uint8_t*) wmem_memdup(wmem_file_scope(), (const uint8_t *) values[0].ptr, values[0].len); +#ifdef SS_MEMORY_STATISTICS + total_bytes += values[0].len; +#endif + } + + sfe->res_len = values[0].len; + } + } + + sinsp_span->sfe_slab_offset += sfe_idx; + sinsp_span->sfe_ptrs.push_back(sfe_block); + sinsp_span->sfe_lengths.push_back(sfe_idx); + sinsp_span->sfe_infos.push_back(evt->get_info()); + + if (sinsp_span->sfe_ptrs.size() < evt_num) { + ws_warning("Unable to fill cache to the proper size (%d vs %u)", (int) sinsp_span->sfe_ptrs.size(), (unsigned) evt_num); + } + + return; +} + +void close_sinsp_capture(sinsp_span_t *sinsp_span) +{ +#ifdef SS_MEMORY_STATISTICS + unused_sfe_bytes += sizeof(sinsp_field_extract_t) * sfe_slab_prealloc - sinsp_span->sfe_slab_offset; + + g_warning("Allocated sinsp_field_extract_t structs: %s (%s)", + format_size(alloc_sfe, FORMAT_SIZE_UNIT_NONE, FORMAT_SIZE_PREFIX_SI), + format_size(alloc_sfe * sizeof(sinsp_field_extract_t), FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI)); + g_warning("Unused sinsp_field_extract_t bytes: %s", format_size(unused_sfe_bytes, FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI)); + g_warning("Chunked strings: %s (%s unique, %s)", + format_size(total_chunked_strings, FORMAT_SIZE_UNIT_NONE, FORMAT_SIZE_PREFIX_SI), + format_size(unique_chunked_strings, FORMAT_SIZE_UNIT_NONE, FORMAT_SIZE_PREFIX_SI), + format_size(alloc_chunked_string_bytes, FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI)); + g_warning("Process info string hits: %s, %s updates", + format_size(proc_info_hits, FORMAT_SIZE_UNIT_NONE, FORMAT_SIZE_PREFIX_SI), + format_size(proc_info_updates, FORMAT_SIZE_UNIT_NONE, FORMAT_SIZE_PREFIX_SI)); + g_warning("Byte value (I/O) bytes: %s", format_size(total_bytes, FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI)); + g_warning("Cache capacity: %s items, sinsp_field_extract_t pointer bytes = %s, length bytes = %s", + format_size(sinsp_span->sfe_ptrs.capacity(), FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI), + format_size(sinsp_span->sfe_ptrs.capacity() * sizeof(sinsp_field_extract_t *), FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI), + format_size(sinsp_span->sfe_ptrs.capacity() * sizeof(uint16_t), FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_SI)); + + alloc_sfe = 0; + unused_sfe_bytes = 0; + total_chunked_strings = 0; + unique_chunked_strings = 0; + proc_info_hits = 0; + proc_info_updates = 0; + alloc_chunked_string_bytes = 0; + total_bytes = 0; +#endif + + sinsp_span->inspector.close(); + sinsp_span->sfe_ptrs.clear(); + sinsp_span->sfe_lengths.clear(); + sinsp_span->sfe_infos.clear(); + sinsp_span->str_chunk = NULL; + sinsp_span->proc_info_chunk = NULL; +} + +sinsp_syscall_category_e get_syscall_parent_category(sinsp_source_info_t *ssi, size_t field_check_idx) +{ + if (field_check_idx < ssi->field_to_category.size()) { + return ssi->field_to_category[field_check_idx]; + } + return SSC_OTHER; +} + +// Either have separate cached / non-cached params or pass a pointer to a pointer array. +bool extract_syscall_source_fields(sinsp_span_t *sinsp_span, sinsp_source_info_t *ssi, uint32_t frame_num, sinsp_field_extract_t **sinsp_fields, uint32_t *sinsp_field_len, void** sinp_evt_info) { + if (ssi->source) { + return false; + } + + // libsinsp event numbers may or may not be contiguous. Make sure our event cache is at + // least as large as the current frame number. add_syscall_event_to_cache will fill in + // any gaps with null entries. + while (frame_num > sinsp_span->sfe_ptrs.size()) { + sinsp_evt *evt = NULL; + try { + int32_t res = sinsp_span->inspector.next(&evt); + switch (res) { + case SCAP_TIMEOUT: + case SCAP_FILTERED_EVENT: + break; + case SCAP_EOF: + ws_debug("Filling syscall EOF gap from %d to %u", (int) sinsp_span->sfe_ptrs.size(), frame_num); + sinsp_span->sfe_ptrs.resize(frame_num); + sinsp_span->sfe_lengths.resize(frame_num); + sinsp_span->sfe_infos.resize(frame_num); + break; + case SCAP_SUCCESS: + add_syscall_event_to_cache(sinsp_span, ssi, evt); + break; + default: + ws_warning("%s", sinsp_span->inspector.getlasterr().c_str()); + return false; + } + } catch (sinsp_exception &e) { + ws_warning("%s", e.what()); + return false; + } + } + + // Shouldn't happen + if (frame_num > sinsp_span->sfe_ptrs.size()) { + ws_error("Frame number %u exceeds cache size %d", frame_num, (int) sinsp_span->sfe_ptrs.size()); + return false; + } + + *sinsp_fields = sinsp_span->sfe_ptrs[frame_num - 1]; + *sinsp_field_len = sinsp_span->sfe_lengths[frame_num - 1]; + *sinp_evt_info = (void*)sinsp_span->sfe_infos[frame_num - 1]; + + return true; +} + +bool get_extracted_syscall_source_fields(sinsp_span_t *sinsp_span, uint32_t frame_num, sinsp_field_extract_t **sinsp_fields, uint32_t *sinsp_field_len, void** sinp_evt_info) { + // Shouldn't happen + if (frame_num > sinsp_span->sfe_ptrs.size()) { + ws_error("Frame number %u exceeds cache size %d", frame_num, (int) sinsp_span->sfe_ptrs.size()); + return false; + } + + *sinsp_fields = sinsp_span->sfe_ptrs[frame_num - 1]; + *sinsp_field_len = sinsp_span->sfe_lengths[frame_num - 1]; + *sinp_evt_info = (void*)sinsp_span->sfe_infos[frame_num - 1]; + 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_plugin_source_fields(sinsp_source_info_t *ssi, uint32_t event_num, uint8_t *evt_data, uint32_t evt_datalen, wmem_allocator_t *pool, plugin_field_extract_t *sinsp_fields, uint32_t sinsp_field_len) +{ + if (!ssi->source) { + return false; + } + + 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 payload_hdr_size = (nparams + 1) * 4; + 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); + ssi->evt->set_num(event_num); + + 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 == FT_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 diff --git a/plugins/epan/falco_bridge/sinsp-span.h b/plugins/epan/falco_bridge/sinsp-span.h new file mode 100644 index 0000000000..8430334030 --- /dev/null +++ b/plugins/epan/falco_bridge/sinsp-span.h @@ -0,0 +1,139 @@ +/* sinsp-span.h + * + * By Gerald Combs + * Copyright (C) 2022 Sysdig, Inc. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef __SINSP_SPAN_H__ +#define __SINSP_SPAN_H__ + +#include <stdint.h> + +#include <epan/ftypes/ftypes.h> +#include <wsutil/wmem/wmem.h> + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#define FALCO_FIELD_NAME_PREFIX "falco." + +#define N_PROC_LINEAGE_ENTRIES 16 +#define N_PROC_LINEAGE_ENTRY_FIELDS 4 + +typedef struct sinsp_source_info_t sinsp_source_info_t; +typedef struct sinsp_span_t sinsp_span_t; + +typedef enum sinsp_field_display_format_e { + SFDF_UNKNOWN, + SFDF_DECIMAL, + SFDF_HEXADECIMAL, + SFDF_OCTAL +} sinsp_field_display_format_e; + +// Should match sinsp_filter_check_list in libsinsp as closely as possible. + +typedef enum sinsp_syscall_category_e { + SSC_EVENT, // gen_event, event + SSC_EVTARGS, // event arguments + SSC_PROCESS, // thread + SSC_PROCLINEAGE, // process lineage + SSC_USER, // user + SSC_GROUP, // group + SSC_CONTAINER, // container + SSC_FD, // fd + SSC_FS, // fs.path +// SSC_SYSLOG, // syslog. Collides with syslog dissector so skip for now. + SSC_FDLIST, // fdlist + SSC_OTHER, // "falco.", catch-all + NUM_SINSP_SYSCALL_CATEGORIES +} sinsp_syscall_category_e; + +typedef struct sinsp_field_info_t { + enum ftenum 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; + bool is_numeric_address; +} sinsp_field_info_t; + +#define SFE_SMALL_BUF_SIZE 8 +typedef struct sinsp_field_extract_t { + union { + uint8_t *bytes; + const char *str; + int32_t i32; + int64_t i64; + uint32_t u32; + uint64_t u64; + double dbl; + bool boolean; + char small_str[SFE_SMALL_BUF_SIZE]; + uint8_t small_bytes[SFE_SMALL_BUF_SIZE]; + } res; + int res_len; // out + uint16_t field_idx; // out for syscalls +} sinsp_field_extract_t; + +typedef struct plugin_field_extract_t { + uint32_t field_id; // out for syscalls, in for plugins + const char *field_name; // in + enum ftenum type; // in, out + bool is_present; // out + union { + uint8_t *bytes; + const char *str; + int32_t i32; + int64_t i64; + uint32_t u32; + uint64_t u64; + double dbl; + uint8_t ipv6[16]; + bool boolean; + } res; + int res_len; // out +// sinsp_syscall_category_e parent_category; // out +} plugin_field_extract_t; + +sinsp_span_t *create_sinsp_span(void); +void destroy_sinsp_span(sinsp_span_t *sinsp_span); + +// Common routines +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); +bool get_sinsp_source_field_info(sinsp_source_info_t *ssi, size_t field_num, sinsp_field_info_t *field); +char* get_evt_arg_name(void* sinp_evt_info, uint32_t arg_num); + +// libsinsp builtin syscall routines. +void create_sinsp_syscall_source(sinsp_span_t *sinsp_span, sinsp_source_info_t **ssi_ptr); +void open_sinsp_capture(sinsp_span_t *sinsp_span, const char *filepath); +//uint32_t process_syscall_capture(sinsp_span_t * sinsp_span, sinsp_source_info_t *ssi, uint32_t to_event); +void close_sinsp_capture(sinsp_span_t *sinsp_span); +bool extract_syscall_source_fields(sinsp_span_t *sinsp_span, sinsp_source_info_t *ssi, uint32_t frame_num, sinsp_field_extract_t **sinsp_fields, uint32_t *sinsp_field_len, void** sinp_evt_info); +sinsp_syscall_category_e get_syscall_parent_category(sinsp_source_info_t *ssi, size_t field_check_idx); +bool get_extracted_syscall_source_fields(sinsp_span_t *sinsp_span, uint32_t frame_num, sinsp_field_extract_t **sinsp_fields, uint32_t *sinsp_field_len, void** sinp_evt_info); + +// Extractor plugin routines. +// These roughly match common_plugin_info +char *create_sinsp_plugin_source(sinsp_span_t *sinsp_span, const char* libname, sinsp_source_info_t **ssi_ptr); +size_t get_sinsp_source_nfields(sinsp_source_info_t *ssi); +bool extract_plugin_source_fields(sinsp_source_info_t *ssi, uint32_t event_num, uint8_t *evt_data, uint32_t evt_datalen, wmem_allocator_t *pool, plugin_field_extract_t *sinsp_fields, uint32_t sinsp_field_len); + + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __SINSP_SPAN_H__ diff --git a/plugins/epan/gryphon/CMakeLists.txt b/plugins/epan/gryphon/CMakeLists.txt index 8bf5939158..22bb87cf2b 100644 --- a/plugins/epan/gryphon/CMakeLists.txt +++ b/plugins/epan/gryphon/CMakeLists.txt @@ -29,10 +29,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "Gryphon automotive network tool protocol" ${DISSECTOR_SRC} ) -add_plugin_library(gryphon epan) +add_wireshark_epan_plugin_library(gryphon) target_link_libraries(gryphon epan) diff --git a/plugins/epan/gryphon/packet-gryphon.c b/plugins/epan/gryphon/packet-gryphon.c index 49afe5664e..2b4d4532b7 100644 --- a/plugins/epan/gryphon/packet-gryphon.c +++ b/plugins/epan/gryphon/packet-gryphon.c @@ -38,337 +38,339 @@ 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; +static int proto_gryphon; + +static int hf_gryphon_src; +static int hf_gryphon_srcchan; +static int hf_gryphon_srcchanclient; +static int hf_gryphon_dest; +static int hf_gryphon_destchan; +static int hf_gryphon_destchanclient; +static int hf_gryphon_type; +static int hf_gryphon_cmd; +static int hf_gryphon_cmd_context; +static int hf_gryphon_cmd_ioctl_context; +static int hf_gryphon_data; +static int hf_gryphon_data_length; +static int hf_gryphon_reserved; +static int hf_gryphon_padding; +static int hf_gryphon_ignored; +static int hf_gryphon_wait_flags; +static int hf_gryphon_wait_resp; +static int hf_gryphon_wait_prev_resp; +static int hf_gryphon_status; +static int hf_gryphon_response_in; +static int hf_gryphon_response_to; +static int hf_gryphon_response_time; +static int hf_gryphon_data_header_length; +static int hf_gryphon_data_header_length_bits; +static int hf_gryphon_data_data_length; +static int hf_gryphon_data_extra_data_length; +static int hf_gryphon_data_mode; +static int hf_gryphon_data_mode_transmitted; +static int hf_gryphon_data_mode_receive; +static int hf_gryphon_data_mode_local; +static int hf_gryphon_data_mode_remote; +static int hf_gryphon_data_mode_oneshot; +static int hf_gryphon_data_mode_combined; +static int hf_gryphon_data_mode_nomux; +static int hf_gryphon_data_mode_internal; +static int hf_gryphon_data_priority; +static int hf_gryphon_data_error_status; +static int hf_gryphon_data_time; +static int hf_gryphon_data_context; +static int hf_gryphon_data_header_data; +static int hf_gryphon_data_data; +static int hf_gryphon_data_extra_data; +static int hf_gryphon_data_padding; +static int hf_gryphon_event_id; +static int hf_gryphon_event_context; +static int hf_gryphon_event_time; +static int hf_gryphon_event_data; +static int hf_gryphon_event_padding; +static int hf_gryphon_misc_text; +static int hf_gryphon_misc_padding; +static int hf_gryphon_eventnum; +static int hf_gryphon_resp_time; +static int hf_gryphon_setfilt; +static int hf_gryphon_setfilt_length; +static int hf_gryphon_setfilt_discard_data; +static int hf_gryphon_setfilt_padding; +static int hf_gryphon_ioctl; +static int hf_gryphon_ioctl_nbytes; +static int hf_gryphon_ioctl_data; +static int hf_gryphon_addfilt_pass; +static int hf_gryphon_addfilt_active; +static int hf_gryphon_addfilt_blocks; +static int hf_gryphon_addfilt_handle; +static int hf_gryphon_modfilt; +static int hf_gryphon_modfilt_action; +static int hf_gryphon_filthan; +static int hf_gryphon_filthan_id; +static int hf_gryphon_filthan_padding; +static int hf_gryphon_dfiltmode; +static int hf_gryphon_filtmode; +static int hf_gryphon_event_name; +static int hf_gryphon_register_username; +static int hf_gryphon_register_password; +static int hf_gryphon_register_client_id; +static int hf_gryphon_register_privileges; +static int hf_gryphon_getspeeds_set_ioctl; +static int hf_gryphon_getspeeds_get_ioctl; +static int hf_gryphon_getspeeds_size; +static int hf_gryphon_getspeeds_preset; +static int hf_gryphon_getspeeds_data; +static int hf_gryphon_cmd_sort; +static int hf_gryphon_cmd_optimize; +static int hf_gryphon_config_device_name; +static int hf_gryphon_config_device_version; +static int hf_gryphon_config_device_serial_number; +static int hf_gryphon_config_num_channels; +static int hf_gryphon_config_name_version_ext; +static int hf_gryphon_config_driver_name; +static int hf_gryphon_config_driver_version; +static int hf_gryphon_config_device_security; +static int hf_gryphon_config_max_data_length; +static int hf_gryphon_config_min_data_length; +static int hf_gryphon_config_hardware_serial_number; +static int hf_gryphon_config_protocol_type; +static int hf_gryphon_config_channel_id; +static int hf_gryphon_config_card_slot_number; +static int hf_gryphon_config_max_extra_data; +static int hf_gryphon_config_min_extra_data; +static int hf_gryphon_sched_num_iterations; +static int hf_gryphon_sched_flags; +static int hf_gryphon_sched_flags_scheduler; +static int hf_gryphon_sched_sleep; +static int hf_gryphon_sched_transmit_count; +static int hf_gryphon_sched_transmit_period; +static int hf_gryphon_sched_transmit_flags; +static int hf_gryphon_sched_skip_transmit_period; +static int hf_gryphon_sched_skip_sleep; +static int hf_gryphon_sched_channel; +static int hf_gryphon_sched_channel0; +static int hf_gryphon_sched_rep_id; +static int hf_gryphon_sched_rep_message_index; +static int hf_gryphon_blm_data_time; +static int hf_gryphon_blm_data_bus_load; +static int hf_gryphon_blm_data_current_bus_load; +static int hf_gryphon_blm_data_peak_bus_load; +static int hf_gryphon_blm_data_historic_peak_bus_load; +static int hf_gryphon_blm_stat_receive_frame_count; +static int hf_gryphon_blm_stat_transmit_frame_count; +static int hf_gryphon_blm_stat_receive_dropped_frame_count; +static int hf_gryphon_blm_stat_transmit_dropped_frame_count; +static int hf_gryphon_blm_stat_receive_error_count; +static int hf_gryphon_blm_stat_transmit_error_count; +static int hf_gryphon_addresp_flags; +static int hf_gryphon_addresp_flags_active; +static int hf_gryphon_addresp_blocks; +static int hf_gryphon_addresp_responses; +static int hf_gryphon_addresp_old_handle; +static int hf_gryphon_addresp_action; +static int hf_gryphon_addresp_action_period; +static int hf_gryphon_addresp_action_deact_on_event; +static int hf_gryphon_addresp_action_deact_after_period; +static int hf_gryphon_addresp_action_period_type; +static int hf_gryphon_addresp_handle; +static int hf_gryphon_ldf_list; +static int hf_gryphon_ldf_number; +static int hf_gryphon_ldf_nodenumber; +static int hf_gryphon_ldf_remaining; +static int hf_gryphon_ldf_name; +static int hf_gryphon_ldf_info_pv; +static int hf_gryphon_ldf_info_lv; +static int hf_gryphon_ldf_ui; +static int hf_gryphon_lin_nodename; +static int hf_gryphon_lin_data_length; +static int hf_gryphon_lin_slave_table_enable; +static int hf_gryphon_lin_slave_table_cs; +static int hf_gryphon_lin_slave_table_data; +static int hf_gryphon_lin_slave_table_datacs; +static int hf_gryphon_lin_masterevent; +static int hf_gryphon_lin_numdata; +static int hf_gryphon_lin_numextra; +static int hf_gryphon_ldf_description; +static int hf_gryphon_ldf_size; +static int hf_gryphon_ldf_exists; +static int hf_gryphon_ldf_blockn; +static int hf_gryphon_ldf_file; +static int hf_gryphon_ldf_desc_pad; +static int hf_gryphon_ldf_restore_session; +static int hf_gryphon_ldf_schedule_name; +static int hf_gryphon_ldf_schedule_msg_dbytes; +static int hf_gryphon_ldf_schedule_flags; +static int hf_gryphon_ldf_schedule_event; +static int hf_gryphon_ldf_schedule_sporadic; +static int hf_gryphon_ldf_ioctl_setflags; +static int hf_gryphon_ldf_numb_ids; +static int hf_gryphon_ldf_bitrate; +static int hf_gryphon_ldf_ioctl_setflags_flags; +static int hf_gryphon_ldf_sched_size_place; +static int hf_gryphon_ldf_sched_numb_place; +static int hf_gryphon_ldf_sched_size; +static int hf_gryphon_ldf_num_node_names; +static int hf_gryphon_ldf_num_frames; +static int hf_gryphon_ldf_num_signal_names; +static int hf_gryphon_ldf_num_schedules; +static int hf_gryphon_ldf_num_encodings; +static int hf_gryphon_ldf_encoding_value; +static int hf_gryphon_ldf_encoding_min; +static int hf_gryphon_ldf_encoding_max; +static int hf_gryphon_ldf_master_node_name; +static int hf_gryphon_ldf_slave_node_name; +static int hf_gryphon_ldf_node_name; +static int hf_gryphon_ldf_signal_name; +static int hf_gryphon_ldf_signal_encoding_name; +static int hf_gryphon_ldf_signal_encoding_type; +static int hf_gryphon_ldf_signal_encoding_logical; +static int hf_gryphon_ldf_signal_offset; +static int hf_gryphon_ldf_signal_length; +static int hf_gryphon_ldf_get_frame; +static int hf_gryphon_ldf_get_frame_num; +static int hf_gryphon_ldf_get_frame_pub; +static int hf_gryphon_ldf_get_frame_num_signals; +static int hf_gryphon_cnvt_valuef; +static int hf_gryphon_cnvt_valuei; +static int hf_gryphon_cnvt_values; +static int hf_gryphon_cnvt_units; +static int hf_gryphon_cnvt_flags_getvalues; +static int hf_gryphon_dd_stream; +static int hf_gryphon_dd_value; +static int hf_gryphon_dd_time; +static int hf_gryphon_modresp_handle; +static int hf_gryphon_modresp_action; +static int hf_gryphon_num_resphan; +static int hf_gryphon_handle; +static int hf_gryphon_transmit_sched_id; +static int hf_gryphon_desc_program_size; +static int hf_gryphon_desc_program_name; +static int hf_gryphon_desc_program_description; +static int hf_gryphon_desc_flags; +static int hf_gryphon_desc_flags_program; +static int hf_gryphon_desc_handle; +static int hf_gryphon_upload_block_number; +static int hf_gryphon_upload_handle; +static int hf_gryphon_upload_data; +static int hf_gryphon_delete; +static int hf_gryphon_list_block_number; +static int hf_gryphon_list_num_programs; +static int hf_gryphon_list_num_remain_programs; +static int hf_gryphon_list_name; +static int hf_gryphon_list_description; +static int hf_gryphon_start_arguments; +static int hf_gryphon_start_channel; +static int hf_gryphon_status_num_running_copies; +static int hf_gryphon_options_handle; +static int hf_gryphon_files; +static int hf_gryphon_usdt_flags_register; +static int hf_gryphon_usdt_action_flags; +static int hf_gryphon_usdt_action_flags_non_legacy; +static int hf_gryphon_usdt_action_flags_register; +static int hf_gryphon_usdt_action_flags_action; +static int hf_gryphon_usdt_transmit_options_flags; +static int hf_gryphon_usdt_transmit_options_flags_echo; +static int hf_gryphon_usdt_transmit_options_done_event; +static int hf_gryphon_usdt_transmit_options_echo_short; +static int hf_gryphon_usdt_transmit_options_rx_nth_fc; +static int hf_gryphon_usdt_transmit_options_action; +static int hf_gryphon_usdt_transmit_options_send_done; +static int hf_gryphon_usdt_receive_options_flags; +static int hf_gryphon_usdt_receive_options_action; +static int hf_gryphon_usdt_receive_options_firstframe_event; +static int hf_gryphon_usdt_receive_options_lastframe_event; +static int hf_gryphon_usdt_receive_options_tx_nth_fc; +static int hf_gryphon_usdt_length_options_flags; +static int hf_gryphon_usdt_length_control_j1939; +static int hf_gryphon_usdt_stmin_fc; +static int hf_gryphon_usdt_bsmax_fc; +static int hf_gryphon_usdt_stmin_override; +static int hf_gryphon_usdt_stmin_override_active; +static int hf_gryphon_usdt_stmin_override_activate; +static int hf_gryphon_usdt_set_stmin_mul; +static int hf_gryphon_usdt_receive_options_firstframe; +static int hf_gryphon_usdt_receive_options_lastframe; +static int hf_gryphon_usdt_ext_address; +static int hf_gryphon_usdt_ext_address_id; +static int hf_gryphon_usdt_block_size; +static int hf_gryphon_bits_in_input1; +static int hf_gryphon_bits_in_input2; +static int hf_gryphon_bits_in_input3; +static int hf_gryphon_bits_in_pushbutton; +static int hf_gryphon_bits_out_output1; +static int hf_gryphon_bits_out_output2; +static int hf_gryphon_init_strat_reset_limit; +static int hf_gryphon_init_strat_delay; +static int hf_gryphon_speed_baud_rate_index; +static int hf_gryphon_filter_block_filter_start; +static int hf_gryphon_filter_block_filter_length; +static int hf_gryphon_filter_block_filter_type; +static int hf_gryphon_filter_block_filter_operator; +static int hf_gryphon_filter_block_filter_value1; +static int hf_gryphon_filter_block_filter_value2; +static int hf_gryphon_filter_block_filter_value4; +static int hf_gryphon_filter_block_filter_value_bytes; +static int hf_gryphon_blm_mode; +static int hf_gryphon_blm_mode_avg_period; +static int hf_gryphon_blm_mode_avg_frames; +static int hf_gryphon_command; +static int hf_gryphon_cmd_mode; +static int hf_gryphon_option; +static int hf_gryphon_option_data; +static int hf_gryphon_cmd_file; +static int hf_gryphon_bit_in_digital_data; +static int hf_gryphon_bit_out_digital_data; +static int hf_gryphon_filter_block_pattern; +static int hf_gryphon_filter_block_mask; +static int hf_gryphon_usdt_request; +static int hf_gryphon_usdt_request_ext; +static int hf_gryphon_usdt_nids; +static int hf_gryphon_usdt_response; +static int hf_gryphon_usdt_response_ext; +static int hf_gryphon_uudt_response; +static int hf_gryphon_uudt_response_ext; +static int hf_gryphon_more_filenames; +static int hf_gryphon_filenames; +static int hf_gryphon_program_channel_number; +static int hf_gryphon_valid_header_length; + +static gint ett_gryphon; +static gint ett_gryphon_header; +static gint ett_gryphon_body; +static gint ett_gryphon_command_data; +static gint ett_gryphon_response_data; +static gint ett_gryphon_data_header; +static gint ett_gryphon_flags; +static gint ett_gryphon_data_body; +static gint ett_gryphon_cmd_filter_block; +static gint ett_gryphon_cmd_events_data; +static gint ett_gryphon_cmd_config_device; +static gint ett_gryphon_cmd_sched_data; +static gint ett_gryphon_cmd_sched_cmd; +static gint ett_gryphon_cmd_response_block; +static gint ett_gryphon_pgm_list; +static gint ett_gryphon_pgm_status; +static gint ett_gryphon_pgm_options; +static gint ett_gryphon_valid_headers; +static gint ett_gryphon_usdt_data; +static gint ett_gryphon_usdt_action_flags; +static gint ett_gryphon_usdt_tx_options_flags; +static gint ett_gryphon_usdt_rx_options_flags; +static gint ett_gryphon_usdt_len_options_flags; +static gint ett_gryphon_usdt_data_block; +static gint ett_gryphon_lin_emulate_node; +static gint ett_gryphon_ldf_block; +static gint ett_gryphon_ldf_schedule_name; +static gint ett_gryphon_lin_schedule_msg; +static gint ett_gryphon_cnvt_getflags; +static gint ett_gryphon_digital_data; +static gint ett_gryphon_blm_mode; + +static expert_field ei_gryphon_type; /* desegmentation of Gryphon */ static gboolean gryphon_desegment = TRUE; @@ -621,7 +623,7 @@ static const value_string cmd_vals[] = { { 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 to uploaded" }, + { 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" }, @@ -2032,6 +2034,7 @@ cmd_sched(tvbuff_t *tvb, int offset, proto_tree *pt) 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); } @@ -3711,7 +3714,9 @@ decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int ds if (cmd > 0x3F) cmd += dst * 256; - if (!pinfo->fd->visited) { + 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); @@ -3725,8 +3730,6 @@ decode_command(tvbuff_t *tvb, packet_info* pinfo, int msglen, int offset, int ds 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); - } else { - pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); } proto_tree_add_uint(pt, hf_gryphon_command, tvb, offset, 1, cmd); @@ -3974,7 +3977,9 @@ decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tr if (cmd > 0x3F) cmd += src * 256; - if (!pinfo->fd->visited) { + 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); @@ -3999,14 +4004,17 @@ decode_response(tvbuff_t *tvb, packet_info* pinfo, int offset, int src, proto_tr p_add_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb), pkt_info); } - else { - pkt_info = (gryphon_pkt_info_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gryphon, (guint32)tvb_raw_offset(tvb)); - } - /* this is the old original way of displaying */ + /* + * 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, offset + 1, 1, pkt_info->ioctl_command); + 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); } @@ -4379,7 +4387,7 @@ proto_register_gryphon(void) { "Context", "gryphon.cmd.context", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_gryphon_cmd_ioctl_context, - { "IOCTL Response", "gryphon.cmd.ioctl_response", FT_UINT8, BASE_DEC, VALS(ioctls), 0x0, + { "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, @@ -4653,7 +4661,7 @@ proto_register_gryphon(void) { "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), 0x01, + { "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, @@ -4668,10 +4676,10 @@ proto_register_gryphon(void) { "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), 0x01, + { "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), 0x01, + { "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, @@ -5232,10 +5240,10 @@ proto_register_gryphon(void) { "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, + { "UUDT response extended address", "gryphon.uudt_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, + { "More filenames to return", "gryphon.more_filenames", FT_BOOLEAN, BASE_NONE, TFS(&yes_no), 0x0, NULL, HFILL }}, { &hf_gryphon_filenames, { "File and directory names", "gryphon.filenames", FT_STRING, BASE_NONE, NULL, 0x0, @@ -5294,6 +5302,7 @@ proto_register_gryphon(void) 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", @@ -5306,9 +5315,6 @@ proto_register_gryphon(void) void proto_reg_handoff_gryphon(void) { - dissector_handle_t gryphon_handle; - - gryphon_handle = create_dissector_handle(dissect_gryphon, proto_gryphon); dissector_add_uint_with_preference("tcp.port", GRYPHON_TCP_PORT, gryphon_handle); } diff --git a/plugins/epan/gryphon/packet-gryphon.h b/plugins/epan/gryphon/packet-gryphon.h index 4f69b3c7e5..182146269d 100644 --- a/plugins/epan/gryphon/packet-gryphon.h +++ b/plugins/epan/gryphon/packet-gryphon.h @@ -66,7 +66,7 @@ #define CMD_SET_TIME 0x0b /* set time */ /* SD-type specific commands: should start at 0x40, global uniqueness */ -/* is prefered, but not mandatory. */ +/* is preferred, but not mandatory. */ /* SD_CARD command types: */ @@ -155,7 +155,7 @@ /* Program loader (SD_PGM) commands: */ -#define CMD_PGM_DESC (SD_PGM * 256 + 0x90) /* Describe a program to to uploaded */ +#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 */ diff --git a/plugins/epan/irda/CMakeLists.txt b/plugins/epan/irda/CMakeLists.txt index 3c8b6058ce..47a2c7322e 100644 --- a/plugins/epan/irda/CMakeLists.txt +++ b/plugins/epan/irda/CMakeLists.txt @@ -31,10 +31,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "IrDA dissection" ${DISSECTOR_SRC} ) -add_plugin_library(irda epan) +add_wireshark_epan_plugin_library(irda) target_link_libraries(irda epan) diff --git a/plugins/epan/irda/packet-ircomm.c b/plugins/epan/irda/packet-ircomm.c index 0f46c33da2..cd5372a52e 100644 --- a/plugins/epan/irda/packet-ircomm.c +++ b/plugins/epan/irda/packet-ircomm.c @@ -16,13 +16,20 @@ /* * See * - * http://www.irdajp.info/specifications.php + * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp * * or * - * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp + * https://archive.org/search?query=creator%3A%22Infrared+Data+Association%22 + * + * for various IrDA specifications, including the IrCOMM 1.0 specification + * at + * + * https://web.archive.org/web/20040229015523/http://www.irda.org/standards/pubs/IrCOMM10.PDF + * + * or * - * for various IrDA specifications. + * https://archive.org/details/ir-comm-10 */ #include "irda-appl.h" @@ -109,8 +116,8 @@ void proto_reg_handoff_ircomm(void); /* Initialize the subtree pointers */ -static gint ett_ircomm = -1; -static gint ett_ircomm_ctrl = -1; +static gint ett_ircomm; +static gint ett_ircomm_ctrl; #define MAX_PARAMETERS 32 static gint ett_param[MAX_IAP_ENTRIES * MAX_PARAMETERS]; @@ -118,13 +125,13 @@ 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 int proto_ircomm; +static int hf_ircomm_param; +/* static int hf_param_pi; */ +/* static int hf_param_pl; */ +/* static int hf_param_pv; */ +static int hf_control; +static int hf_control_len; 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); @@ -408,7 +415,6 @@ void proto_register_ircomm(void) 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); diff --git a/plugins/epan/irda/packet-irda.c b/plugins/epan/irda/packet-irda.c index 79dc458b96..6486aa797e 100644 --- a/plugins/epan/irda/packet-irda.c +++ b/plugins/epan/irda/packet-irda.c @@ -29,16 +29,24 @@ #include "irda-appl.h" /* - * This plugin dissects infrared data transmissions as defined by the IrDA - * specification (www.irda.org). See + * This plugin dissects infrared data transmissions as defined by IrDA + * specifications. See * - * http://www.irdajp.info/specifications.php + * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp * * or * - * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/specifications.asp + * https://archive.org/search?query=creator%3A%22Infrared+Data+Association%22 * - * for various IrDA specifications. + * for various IrDA specifications, including a zip archive of the IrPHY + * 1.4, IrLAP 1.1, IrLMP 1.1, IrDA Tiny TP 1.1, and IrDA Point and Shoot + * Profile 1.1 and Test Specification 1.0 at + * + * https://web.archive.org/web/20040405053146/http://www.irda.org/standards/pubs/IrData.zip + * + * or the the IrLAP 1.1 specification at + * + * https://archive.org/details/ir-lap-11 * * The plugin operates both offline with libpcap files and online on supported * platforms. Live dissection is currently available for Linux-IrDA @@ -133,99 +141,99 @@ 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; +static int proto_irlap; +static int hf_lap_a; +static int hf_lap_a_cr; +static int hf_lap_a_address; +static int hf_lap_c; +static int hf_lap_c_nr; +static int hf_lap_c_ns; +static int hf_lap_c_p; +static int hf_lap_c_f; +static int hf_lap_c_s; +static int hf_lap_c_u_cmd; +static int hf_lap_c_u_rsp; +static int hf_lap_c_i; +static int hf_lap_c_s_u; +static int hf_lap_i; +static int hf_snrm_saddr; +static int hf_snrm_daddr; +static int hf_snrm_ca; +static int hf_ua_saddr; +static int hf_ua_daddr; +static int hf_negotiation_param; +static int hf_param_pi; +static int hf_param_pl; +static int hf_param_pv; +static int hf_xid_ident; +static int hf_xid_saddr; +static int hf_xid_daddr; +static int hf_xid_flags; +static int hf_xid_s; +static int hf_xid_conflict; +static int hf_xid_slotnr; +static int hf_xid_version; + +static int proto_irlmp; +static int hf_lmp_xid_hints; +static int hf_lmp_xid_charset; +static int hf_lmp_xid_name; +static int hf_lmp_xid_name_no_encoding; +static int hf_lmp_dst; +static int hf_lmp_dst_control; +static int hf_lmp_dst_lsap; +static int hf_lmp_src; +static int hf_lmp_src_r; +static int hf_lmp_src_lsap; +static int hf_lmp_opcode; +static int hf_lmp_rsvd; +static int hf_lmp_reason; +static int hf_lmp_mode; +static int hf_lmp_status; + +static int proto_iap; +static int hf_iap_ctl; +static int hf_iap_ctl_lst; +static int hf_iap_ctl_ack; +static int hf_iap_ctl_opcode; +static int hf_iap_class_name; +static int hf_iap_attr_name; +static int hf_iap_return; +static int hf_iap_list_len; +static int hf_iap_list_entry; +static int hf_iap_obj_id; +static int hf_iap_attr_type; +static int hf_iap_int; +static int hf_iap_seq_len; +static int hf_iap_oct_seq; +static int hf_iap_char_set; +static int hf_iap_string; +static int hf_iap_invaloctet; +static int hf_iap_invallsap; + +static int proto_ttp; +static int hf_ttp_p; +static int hf_ttp_icredit; +static int hf_ttp_m; +static int hf_ttp_dcredit; + +static int proto_log; +static int hf_log_msg; +static int hf_log_missed; /* 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; +static gint ett_irlap; +static gint ett_lap_a; +static gint ett_lap_c; +static gint ett_lap_i; +static gint ett_xid_flags; +static gint ett_log; +static gint ett_irlmp; +static gint ett_lmp_dst; +static gint ett_lmp_src; +static gint ett_iap; +static gint ett_iap_ctl; +static gint ett_ttp; #define MAX_PARAMETERS 32 static gint ett_param[MAX_PARAMETERS]; @@ -492,7 +500,7 @@ static guint dissect_ttp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, gb head = tvb_get_guint8(tvb, offset); - g_snprintf(buf, 128, ", Credit=%d", head & ~TTP_PARAMETERS); + snprintf(buf, 128, ", Credit=%d", head & ~TTP_PARAMETERS); col_append_str(pinfo->cinfo, COL_INFO, buf); if (root) @@ -557,7 +565,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r set_address(&destaddr, irda_address_type, 1, &circuit_id); - conv = find_conversation(pinfo->num, &srcaddr, &destaddr, ENDPOINT_NONE, pinfo->srcport, pinfo->destport, 0); + 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); @@ -579,7 +587,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r } else { - conv = conversation_new(pinfo->num, &srcaddr, &destaddr, ENDPOINT_NONE, pinfo->srcport, pinfo->destport, 0); + 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); } @@ -699,7 +707,7 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro set_address(&destaddr, irda_address_type, 1, &circuit_id); /* Find result value dissector */ - conv = find_conversation(pinfo->num, &srcaddr, &destaddr, ENDPOINT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { num = pinfo->num; @@ -743,7 +751,7 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro break; case IAS_OCT_SEQ: - g_snprintf(buf, 300, ", %d Octets", tvb_get_ntohs(tvb, offset + 7)); + snprintf(buf, 300, ", %d Octets", tvb_get_ntohs(tvb, offset + 7)); break; case IAS_STRING: @@ -980,7 +988,7 @@ static void dissect_appl_proto(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro set_address(&destaddr, irda_address_type, 1, &circuit_id); /* Find result value dissector */ - conv = find_conversation(pinfo->num, &srcaddr, &destaddr, ENDPOINT_NONE, pinfo->srcport, pinfo->destport, 0); + conv = find_conversation(pinfo->num, &srcaddr, &destaddr, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); if (conv) { num = pinfo->num; @@ -1208,7 +1216,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec dest = circuit_id ^ CMD_FRAME; set_address(&destaddr, irda_address_type, 1, &dest); - conv = find_conversation(pinfo->num, &destaddr, &srcaddr, ENDPOINT_NONE, dlsap, 0, NO_PORT_B); + 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); @@ -1229,7 +1237,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec } else { - conv = conversation_new(pinfo->num, &destaddr, &srcaddr, ENDPOINT_NONE, dlsap, 0, NO_PORT_B); + 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); } @@ -1488,6 +1496,7 @@ static void dissect_xid(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, pro if (lap_tree) { + /* Discovery flags */ 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); @@ -1509,6 +1518,7 @@ static void dissect_xid(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, pro proto_item_append_text(ti, " (final)"); } } + /* Skip (empty?) byte even if no command.. Have seen non-zero values in a capture */ offset++; if (lap_tree) @@ -1764,7 +1774,7 @@ static void dissect_irlap(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root) circuit_id = tvb_get_guint8(tvb, 0); /* initially set address columns to connection address */ - g_snprintf(addr, sizeof(addr)-1, "0x%02X", circuit_id >> 1); + 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); @@ -1796,7 +1806,7 @@ static void dissect_irlap(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root) offset++; /* process the control field */ - c = dissect_xdlc_control(tvb, 1, pinfo, tree, hf_lap_c, + c = dissect_xdlc_control(tvb, offset, 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++; @@ -2287,13 +2297,11 @@ void proto_register_irda(void) 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); diff --git a/plugins/epan/irda/packet-sir.c b/plugins/epan/irda/packet-sir.c index 71b0e837bb..b9baf4775c 100644 --- a/plugins/epan/irda/packet-sir.c +++ b/plugins/epan/irda/packet-sir.c @@ -40,17 +40,17 @@ 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; +static int proto_sir; +static int ett_sir; +static int hf_sir_bof; +/* static int hf_sir_ce; */ +static int hf_sir_eof; +static int hf_sir_fcs; +static int hf_sir_fcs_status; +static int hf_sir_length; +static int hf_sir_preamble; + +static expert_field ei_sir_fcs; /* Copied and renamed from proto.c because global value_strings don't work for plugins */ static const value_string plugin_proto_checksum_vals[] = { diff --git a/plugins/epan/mate/.editorconfig b/plugins/epan/mate/.editorconfig new file mode 100644 index 0000000000..2ee8bf0b2d --- /dev/null +++ b/plugins/epan/mate/.editorconfig @@ -0,0 +1,3 @@ +[mate_grammar.lemon] +indent_style = tab +indent_size = tab diff --git a/plugins/epan/mate/CMakeLists.txt b/plugins/epan/mate/CMakeLists.txt index 53f2ee3f1e..e012f536bc 100644 --- a/plugins/epan/mate/CMakeLists.txt +++ b/plugins/epan/mate/CMakeLists.txt @@ -37,18 +37,20 @@ set(PLUGIN_FILES ) set_source_files_properties( - ${PLUGIN_FILES} + ${DISSECTOR_SRC} + ${DISSECTOR_SUPPORT_SRC} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin + "Meta Analysis Tracing Engine (MATE)" ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) -add_plugin_library(mate epan) +add_wireshark_epan_plugin_library(mate) target_link_libraries(mate epan) diff --git a/plugins/epan/mate/examples/call.mate b/plugins/epan/mate/examples/call.mate deleted file mode 100644 index 0dbbb45ef8..0000000000 --- a/plugins/epan/mate/examples/call.mate +++ /dev/null @@ -1,34 +0,0 @@ -# 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; diff --git a/plugins/epan/mate/examples/mms.mate b/plugins/epan/mate/examples/mms.mate index 7554b11932..43da382777 100644 --- a/plugins/epan/mate/examples/mms.mate +++ b/plugins/epan/mate/examples/mms.mate @@ -1,40 +1,57 @@ -# 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; +Transform rm_client_from_http_resp1 { + Match (http_rq); + Match Every (addr) Insert (not_rq); +}; + +Transform rm_client_from_http_resp2 { + Match (not_rq,ue) Replace (); +}; + +Pdu mmse_over_http_pdu Proto http Transport tcp/ip { + Payload mmse; + Extract addr From ip.addr; + Extract port From tcp.port; + Extract http_rq From http.request; + Extract content From http.content_type; + Extract resp From http.response.code; + Extract method From http.request.method; + Extract host From http.host; + Extract content From http.content_type; + Extract trx From mmse.transaction_id; + Extract msg_type From mmse.message_type; + Extract notify_status From mmse.status; + Extract send_status From mmse.response_status; + Transform rm_client_from_http_resp1, rm_client_from_http_resp2; +}; + +Gop mmse_over_http On mmse_over_http_pdu Match (addr, addr, port, port) { + Start (http_rq); + Stop (http_rs); + Extra (host, ue, resp, notify_status, send_status, trx); +}; + +Transform mms_start { + Match Loose() Insert (mms_start); +}; + +Pdu mmse_over_wsp_pdu Proto wsp Transport ip { + Payload mmse; + Extract trx From mmse.transaction_id; + Extract msg_type From mmse.message_type; + Extract notify_status From mmse.status; + Extract send_status From mmse.response_status; + Transform mms_start; +}; + +Gop mmse_over_wsp On mmse_over_wsp_pdu Match (trx) { + Start (mms_start); + Stop (never); + Extra (ue, notify_status, send_status); +}; + +Gog mms { + Member mmse_over_http (trx); + Member mmse_over_wsp (trx); + Extra (ue, notify_status, send_status, resp, host, trx); + Expiration 60.0; +}; diff --git a/plugins/epan/mate/examples/pasv_ftp.mate b/plugins/epan/mate/examples/pasv_ftp.mate index 24ef7ab470..9a8852803b 100644 --- a/plugins/epan/mate/examples/pasv_ftp.mate +++ b/plugins/epan/mate/examples/pasv_ftp.mate @@ -1,18 +1,33 @@ -# pasv_ftp.mate +Pdu ftp_pdu Proto ftp Transport tcp/ip { + Extract ftp_addr From ip.addr; + Extract ftp_port From tcp.port; + Extract ftp_resp From ftp.response.code; + Extract ftp_req From ftp.request.command; + Extract server_addr From ftp.passive.ip; + Extract server_port From ftp.passive.port; -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; + LastPdu true; +}; -Action=PduDef; Name=ftp_data_pdu; Proto=ftp-data; Transport=tcp/ip; server_addr=ip.src; server_port=tcp.srcport; +Pdu ftp_data_pdu Proto ftp-data Transport tcp/ip{ + Extract server_addr From ip.src; + Extract server_port From 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; +Gop ftp_data On ftp_data_pdu Match (server_addr, server_port) { + Start (server_addr); +}; -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; +Gop ftp_ctl On ftp_pdu Match (ftp_addr, ftp_addr, ftp_port, ftp_port) { + Start (ftp_resp=220); + Stop (ftp_resp=221); + Extra (server_addr, server_port); +}; +Gog ftp_ses { + Member ftp_ctl (ftp_addr, ftp_addr, ftp_port, ftp_port); + Member ftp_data (server_addr, server_port); +}; + +Done; diff --git a/plugins/epan/mate/examples/tcp.mate b/plugins/epan/mate/examples/tcp.mate index 2abe3e8882..773ad85f37 100644 --- a/plugins/epan/mate/examples/tcp.mate +++ b/plugins/epan/mate/examples/tcp.mate @@ -1,7 +1,14 @@ -# tcp.mate +Pdu tcp_pdu Proto tcp Transport ip { + Extract addr From ip.addr; + Extract port From tcp.port; + Extract tcp_start From tcp.flags.syn; + Extract tcp_stop From tcp.flags.reset; + Extract tcp_stop From tcp.flags.fin; +}; - 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; +Gop tcp_ses On tcp_pdu Match (addr, addr, port, port) { + Start (tcp_start=1); + Stop (tcp_stop=1); +}; +Done; diff --git a/plugins/epan/mate/examples/web.mate b/plugins/epan/mate/examples/web.mate index fd00c651de..7b3d2246b5 100644 --- a/plugins/epan/mate/examples/web.mate +++ b/plugins/epan/mate/examples/web.mate @@ -1,27 +1,52 @@ -# 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; +Transform rm_client_from_dns_resp { + Match (dns_resp=1, client) Replace (dns_resp=1); +}; + +Pdu dns_pdu Proto dns Transport ip { + Extract addr From ip.addr; + Extract dns_id From dns.id; + Extract dns_resp From dns.flags.response; + Extract host From dns.qry.name; + Extract client From ip.src; + Transform rm_client_from_dns_resp; +}; + +Gop dns_req On dns_pdu Match (addr,addr,dns_id) { + Start (dns_resp=0); + Stop (dns_resp=1); + Extra (host, client); +}; + +Transform rm_client_from_http_resp1 { + Match (http_rq); + Match Every (addr) Insert (not_rq); +}; + +Transform rm_client_from_http_resp2 { + Match (not_rq, client) Replace (); +}; + +Pdu http_pdu Proto http Transport tcp/ip { + Extract addr From ip.addr; + Extract port From tcp.port; + Extract http_rq From http.request.method; + Extract http_rs From http.response; + Extract host From http.host; + Extract client From ip.src; + Transform rm_client_from_http_resp1, rm_client_from_http_resp2; + DiscardPduData true; +}; + +Gop http_req On http_pdu Match (addr, addr, port, port) { + Start (http_rq); + Stop (http_rs); + Extra (host, client); +}; + +Gog http_use { + Member http_req (host, client); + Member dns_req (host, client); + Expiration 0.75; +}; + +Done; diff --git a/plugins/epan/mate/mate.h b/plugins/epan/mate/mate.h index 0a8786005f..c4a5adc954 100644 --- a/plugins/epan/mate/mate.h +++ b/plugins/epan/mate/mate.h @@ -15,12 +15,12 @@ #define __MATE_H_ #define WS_LOG_DOMAIN "MATE" +#include <wireshark.h> #include <gmodule.h> #include <stdio.h> #include <string.h> -#include <errno.h> #include <wsutil/report_message.h> #include <wsutil/wslog.h> @@ -267,7 +267,7 @@ struct _mate_pdu { AVPL* avpl; - guint32 frame; /* wich frame I belog to? */ + guint32 frame; /* which frame I belong to? */ mate_pdu* next_in_frame; /* points to the next pdu in this frame */ float rel_time; /* time since start of capture */ diff --git a/plugins/epan/mate/mate_grammar.lemon b/plugins/epan/mate/mate_grammar.lemon index 0947afa2e5..57f291fe29 100644 --- a/plugins/epan/mate/mate_grammar.lemon +++ b/plugins/epan/mate/mate_grammar.lemon @@ -19,6 +19,9 @@ #ifndef NDEBUG #define NDEBUG #endif +#include "config.h" + +#include <errno.h> #include "mate.h" #include "mate_grammar.h" @@ -78,7 +81,7 @@ static void configuration_error(mate_config* mc, const gchar* fmt, ...) { va_list list; va_start( list, fmt ); - g_vsnprintf(error_buffer,sizeof(error_buffer),fmt,list); + vsnprintf(error_buffer,sizeof(error_buffer),fmt,list); va_end( list ); i = (gint) mc->config_stack->len; @@ -167,6 +170,11 @@ static gchar* recolonize(mate_config* mc, gchar* s) { return r; } +DIAG_OFF_LEMON() +} /* end of %include */ + +%code { +DIAG_ON_LEMON() } %name MateParser @@ -709,7 +717,7 @@ 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 = g_strdup_printf("%s|%s",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); } diff --git a/plugins/epan/mate/mate_parser.l b/plugins/epan/mate/mate_parser.l index ad08c9ea7a..6e423abccd 100644 --- a/plugins/epan/mate/mate_parser.l +++ b/plugins/epan/mate/mate_parser.l @@ -87,7 +87,7 @@ /* * Disable diagnostics in the code generated by Flex. */ -DIAG_OFF_FLEX +DIAG_OFF_FLEX() void MateParseTrace(FILE*,char*); @@ -337,7 +337,7 @@ blk_cmnt_stop "*/" /* * Turn diagnostics back on, so we check the code that we've written. */ -DIAG_ON_FLEX +DIAG_ON_FLEX() static void ptr_array_free(gpointer data, gpointer user_data _U_) { diff --git a/plugins/epan/mate/mate_runtime.c b/plugins/epan/mate/mate_runtime.c index 41d9c0de35..8cda791a62 100644 --- a/plugins/epan/mate/mate_runtime.c +++ b/plugins/epan/mate/mate_runtime.c @@ -18,6 +18,7 @@ typedef struct _mate_range mate_range; struct _mate_range { + tvbuff_t *ds_tvb; guint start; guint end; }; @@ -643,19 +644,84 @@ static void analyze_pdu(mate_config* mc, mate_pdu* pdu) { } } +static proto_node * +proto_tree_find_node_from_finfo(proto_tree *tree, field_info *finfo) +{ + proto_node *pnode = tree; + proto_node *child; + proto_node *current; + + if (PNODE_FINFO(pnode) == finfo) { + return pnode; + } + + child = pnode->first_child; + while (child != NULL) { + current = child; + child = current->next; + if ((pnode = proto_tree_find_node_from_finfo((proto_tree *)current, finfo))) { + return pnode; + } + } + + return NULL; +} + +/* This returns true if there's no point in searching for the avp among the + * ancestor nodes in the tree. That includes if the field is within one + * of the ranges, or if the field and all the ranges share the same + * data source. + */ +static bool +add_avp(const char *name, field_info *fi, const field_info *ancestor_fi, tmp_pdu_data *data) +{ + AVP* avp; + char* s; + mate_range* curr_range; + unsigned start, end; + tvbuff_t *ds_tvb; + bool all_same_ds = true; + + start = ancestor_fi->start; + end = ancestor_fi->start + ancestor_fi->length; + ds_tvb = ancestor_fi->ds_tvb; + + for (unsigned j = 0; j < data->ranges->len; j++) { + + curr_range = (mate_range*) g_ptr_array_index(data->ranges,j); + + if (curr_range->ds_tvb == ds_tvb) { + 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,"add_avp: got %s",s); + g_free(s); + } + + if (! insert_avp(data->pdu->avpl, avp) ) { + delete_avp(avp); + } + return true; + } + } else { + all_same_ds = false; + } + } + + return all_same_ds; +} + 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 i; guint start; guint end; - AVP* avp; - gchar* s; - + tvbuff_t *ds_tvb; fis = proto_get_finfo_ptr_array(data->tree, hfid); @@ -666,37 +732,35 @@ static void get_pdu_fields(gpointer k, gpointer v, gpointer p) { start = fi->start; end = fi->start + fi->length; + ds_tvb = fi->ds_tvb; 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); + if (!add_avp(name, fi, fi, data)) { + /* The field came from a different data source than one of the + * ranges (protocol, transport protocol, payload). Search for + * the tree node with the field and look to see if one of its + * parents is contained within one of the ranges. + * (The field, and the hfis for the ranges, were marked as + * interesting so this should always work, albeit slower than above.) + */ + for (proto_node *pnode = proto_tree_find_node_from_finfo(data->tree, fi); + pnode; pnode = pnode->parent) { + field_info *ancestor_fi = PNODE_FINFO(pnode); + if (ancestor_fi && ancestor_fi->ds_tvb != ds_tvb) { + /* Only check anew when the data source changes. */ + ds_tvb = ancestor_fi->ds_tvb; + if (add_avp(name, fi, ancestor_fi, data)) { + /* Go to next field in fis */ + break; + } } - } } } } } -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; @@ -732,12 +796,13 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, pdu->is_stop = FALSE; pdu->after_release = FALSE; - data.ranges = g_ptr_array_new(); + data.ranges = g_ptr_array_new_with_free_func(g_free); data.pdu = pdu; data.tree = tree; /* first we create the proto range */ proto_range = g_new(mate_range, 1); + proto_range->ds_tvb = proto->ds_tvb; proto_range->start = proto->start; proto_range->end = proto->start + proto->length; g_ptr_array_add(data.ranges,proto_range); @@ -764,6 +829,7 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, if ( range_fi ) { range = (mate_range *)g_malloc(sizeof(*range)); + range->ds_tvb = range_fi->ds_tvb; range->start = range_fi->start; range->end = range_fi->start + range_fi->length; g_ptr_array_add(data.ranges,range); @@ -801,6 +867,7 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, if ( range_fi ) { range = (mate_range *)g_malloc(sizeof(*range)); + range->ds_tvb = range_fi->ds_tvb; range->start = range_fi->start; range->end = range_fi->start + range_fi->length; g_ptr_array_add(data.ranges,range); @@ -819,7 +886,6 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, 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; diff --git a/plugins/epan/mate/mate_setup.c b/plugins/epan/mate/mate_setup.c index 727b536bd7..680a8fa92c 100644 --- a/plugins/epan/mate/mate_setup.c +++ b/plugins/epan/mate/mate_setup.c @@ -21,7 +21,7 @@ static void report_error(mate_config* mc, const gchar* fmt, ...) { va_list list; va_start( list, fmt ); - g_vsnprintf(error_buffer,DEBUG_BUFFER_SIZE,fmt,list); + vsnprintf(error_buffer,DEBUG_BUFFER_SIZE,fmt,list); va_end( list ); g_string_append(mc->config_error,error_buffer); @@ -177,7 +177,7 @@ extern gboolean add_hfid(mate_config* mc, header_field_info* hfi, gchar* how, G #if 0 /* - * XXX - where is this suposed to be used? + * XXX - where is this supposed to be used? */ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) { gchar** ranges; @@ -196,7 +196,7 @@ extern gchar* add_ranges(mate_config* mc, gchar* range,GPtrArray* range_ptr_arr) g_ptr_array_add(range_ptr_arr,(gpointer)hfidp); } else { g_strfreev(ranges); - return g_strdup_printf("no such proto: '%s'",ranges[i]); + return ws_strdup_printf("no such proto: '%s'",ranges[i]); } } @@ -215,12 +215,12 @@ static void new_attr_hfri(mate_config* mc, gchar* item_name, GHashTable* hfids, *p_id = -1; hfri.p_id = p_id; hfri.hfinfo.name = g_strdup(name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.%s",item_name,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 = g_strdup_printf("%s attribute of %s",name,item_name); + hfri.hfinfo.blurb = ws_strdup_printf("%s attribute of %s",name,item_name); *p_id = -1; g_hash_table_insert(hfids,name,p_id); @@ -271,16 +271,16 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) { hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s id",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 = g_strdup_printf("%s time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.RelativeTime",cfg->name); + 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"; @@ -288,8 +288,8 @@ static void analyze_pdu_config(mate_config* mc, mate_cfg_pdu* cfg) { g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_pdu_time_in_gop); - hfri.hfinfo.name = g_strdup_printf("%s time since beginning of Gop",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.TimeInGop",cfg->name); + 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"; @@ -326,49 +326,49 @@ static void analyze_gop_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s id",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 = g_strdup_printf("%s start time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name); + 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 = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); + 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 = g_strdup_printf("%s hold time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Time",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Duration in seconds from start to stop of this %s",cfg->name); + 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 = g_strdup_printf("%s duration",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); + 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 = g_strdup_printf("%s number of PDUs",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfPdus",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Number of PDUs assigned to this %s",cfg->name); + 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 = g_strdup_printf("A PDU of %s",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Pdu",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("A PDU assigned to this %s",cfg->name); + 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; @@ -445,8 +445,8 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { /* create the hf array for this gog */ hfri.p_id = &(cfg->hfid); hfri.hfinfo.name = g_strdup(cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("%s Id",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; @@ -454,16 +454,16 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid_gog_num_of_gops); hfri.hfinfo.name = "number of GOPs"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.NumOfGops",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.NumOfGops",cfg->name); hfri.hfinfo.type = FT_UINT32; hfri.hfinfo.display = BASE_DEC; - hfri.hfinfo.blurb = g_strdup_printf("Number of GOPs assigned to this %s",cfg->name); + 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 = g_strdup_printf("mate.%s.GopStart",cfg->name); + 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"); @@ -472,7 +472,7 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { hfri.p_id = &(cfg->hfid_gog_gopstop); hfri.hfinfo.name = "GopStop frame"; - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.GopStop",cfg->name); + 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"); @@ -480,27 +480,27 @@ static void analyze_gog_config(gpointer k _U_, gpointer v, gpointer p) { g_array_append_val(mc->hfrs,hfri); hfri.p_id = &(cfg->hfid_start_time); - hfri.hfinfo.name = g_strdup_printf("%s start time",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.StartTime",cfg->name); + 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 = g_strdup_printf("Seconds passed since the beginning of capture to the start of this %s",cfg->name); + 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 = g_strdup_printf("%s duration",cfg->name); - hfri.hfinfo.abbrev = g_strdup_printf("mate.%s.Duration",cfg->name); - hfri.hfinfo.blurb = g_strdup_printf("Time passed between the start of this %s and the last pdu assigned to it",cfg->name); + 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 = g_strdup_printf("mate.%s.Gop",cfg->name); + hfri.hfinfo.abbrev = ws_strdup_printf("mate.%s.Gop",cfg->name); hfri.hfinfo.type = FT_STRING; hfri.hfinfo.display = BASE_NONE; - hfri.hfinfo.blurb = g_strdup_printf("a GOPs assigned to this %s",cfg->name); + hfri.hfinfo.blurb = ws_strdup_printf("a GOPs assigned to this %s",cfg->name); g_array_append_val(mc->hfrs,hfri); @@ -586,7 +586,7 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { mc->dbg_facility = NULL; - mc->mate_lib_path = g_strdup_printf("%s%c%s%c",get_datafile_dir(),DIR_SEP,DEFAULT_MATE_LIB_PATH,DIR_SEP); + 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); diff --git a/plugins/epan/mate/mate_util.c b/plugins/epan/mate/mate_util.c index 6bc6f63f5d..4fa7e653e4 100644 --- a/plugins/epan/mate/mate_util.c +++ b/plugins/epan/mate/mate_util.c @@ -15,6 +15,8 @@ #include "mate.h" #include "mate_util.h" + +#include <errno.h> #include <wsutil/file_util.h> @@ -38,7 +40,7 @@ void dbg_print(const gint* which, gint how, FILE* where, const gchar* fmt, ... ) if ( ! which || *which < how ) return; va_start( list, fmt ); - g_vsnprintf(debug_buffer,DEBUG_BUFFER_SIZE,fmt,list); + vsnprintf(debug_buffer,DEBUG_BUFFER_SIZE,fmt,list); va_end( list ); if (! where) { @@ -193,7 +195,7 @@ gchar* scs_subscribe_printf(SCS_collection* c, gchar* fmt, ...) { static gchar buf[SCS_HUGE_SIZE]; va_start( list, fmt ); - g_vsnprintf(buf, SCS_HUGE_SIZE, fmt, list); + vsnprintf(buf, SCS_HUGE_SIZE, fmt, list); va_end( list ); return scs_subscribe(c,buf); @@ -293,7 +295,7 @@ extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) { new_avp_val->n = scs_subscribe(avp_strings, name); - repr = fvalue_to_string_repr(NULL, &finfo->value,FTREPR_DISPLAY,finfo->hfinfo->display); + repr = fvalue_to_string_repr(NULL, finfo->value, FTREPR_DISPLAY, finfo->hfinfo->display); if (repr) { value = scs_subscribe(avp_strings, repr); @@ -823,7 +825,7 @@ extern void merge_avpl(AVPL* dst, AVPL* src, gboolean copy_avps) { } } - // if there are remaing source AVPs while there are no more destination + // if there are remaining 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) { @@ -881,7 +883,7 @@ extern AVPL* new_avpl_from_avpl(const gchar* name, AVPL* avpl, gboolean copy_avp /** * match_avp: - * @param src an src to be compared agains an "op" avp + * @param src an src to be compared against an "op" avp * @param op the "op" avp that will be matched against the src avp * * Checks whether or not two avp's match. @@ -959,7 +961,7 @@ extern AVP* match_avp(AVP* src, AVP* op) { /* case AVP_OP_TRANSF: */ /* return do_transform(src,op); */ case AVP_OP_CONTAINS: - return g_strrstr(src->v, op->v) ? src : NULL;; + return g_strrstr(src->v, op->v) ? src : NULL; } /* will never get here */ return NULL; @@ -1115,7 +1117,7 @@ extern AVPL* new_avpl_pairs_match(const gchar* name, AVPL* src, AVPL* op, gboole * 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 src the data AVPL to be matched against 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. @@ -1435,13 +1437,13 @@ static LoAL* load_loal_error(FILE* fp, LoAL* loal, AVPL* curr, int linenum, cons gchar* err; va_start( list, fmt ); - desc = g_strdup_vprintf(fmt, list); + desc = ws_strdup_vprintf(fmt, list); va_end( list ); if (loal) { - err = g_strdup_printf("Error Loading LoAL from file: in %s at line: %i, %s",loal->name,linenum,desc); + err = ws_strdup_printf("Error Loading LoAL from file: in %s at line: %i, %s",loal->name,linenum,desc); } else { - err = g_strdup_printf("Error Loading LoAL at line: %i, %s",linenum,desc); + err = ws_strdup_printf("Error Loading LoAL at line: %i, %s",linenum,desc); } ret = new_loal(err); @@ -1559,7 +1561,7 @@ extern LoAL* loal_from_file(gchar* filename) { i = 0; name[i++] = c; name[i] = '\0'; - g_snprintf(linenum_buf,MAX_ITEM_LEN,"%s:%u",filename,linenum); + snprintf(linenum_buf,MAX_ITEM_LEN,"%s:%u",filename,linenum); curr = new_avpl(linenum_buf); continue; case '#': diff --git a/plugins/epan/mate/mate_util.h b/plugins/epan/mate/mate_util.h index a233f5fc34..0764ea5ec2 100644 --- a/plugins/epan/mate/mate_util.h +++ b/plugins/epan/mate/mate_util.h @@ -150,7 +150,7 @@ extern void delete_avp(AVP* avp); * avp methods */ /* returns a newly allocated string containing a representation of the avp */ -#define avp_to_str(avp) (g_strdup_printf("%s%c%s",avp->n,avp->o,avp->v)) +#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); diff --git a/plugins/epan/mate/packet-mate.c b/plugins/epan/mate/packet-mate.c index 97774cd1a9..f4621e349d 100644 --- a/plugins/epan/mate/packet-mate.c +++ b/plugins/epan/mate/packet-mate.c @@ -26,15 +26,15 @@ void proto_reg_handoff_mate(void); static mate_config* mc = NULL; -static int proto_mate = -1; +static int proto_mate; -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 int hf_mate_released_time; +static int hf_mate_duration; +static int hf_mate_number_of_pdus; +static int hf_mate_started_at; +static int hf_mate_gop_key; -static expert_field ei_mate_undefined_attribute = EI_INIT; +static expert_field ei_mate_undefined_attribute; static const gchar* pref_mate_config_filename = ""; static const gchar* current_mate_config_filename = NULL; @@ -368,6 +368,15 @@ proto_reg_handoff_mate(void) */ set_postdissector_wanted_hfids(mate_handle, mc->wanted_hfids); + /* XXX: Due to #17877, any protocol added to the tree with length -1 + * that changes its length later (and there are many, such as TCP) + * doesn't actually change its length unless the tree is visible, + * which means that entire range checking work in MATE to split up + * multiple PDUs of the target protocol in the same frame doesn't + * work. Set the tree as visible as with Lua postdissectors that + * need all fields. It's overkill and bad for performance, though. + */ + epan_set_always_visible(TRUE); initialize_mate_runtime(mc); } diff --git a/plugins/epan/opcua/CMakeLists.txt b/plugins/epan/opcua/CMakeLists.txt index 674b9838b5..04c1bbb5a0 100644 --- a/plugins/epan/opcua/CMakeLists.txt +++ b/plugins/epan/opcua/CMakeLists.txt @@ -28,6 +28,7 @@ set(DISSECTOR_SUPPORT_SRC opcua_extensionobjecttable.c opcua_hfindeces.c opcua_statuscode.c + opcua_keyset.c ) set(PLUGIN_FILES @@ -44,13 +45,14 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "OpcUa (OPC Unified Architecture) dissection" ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) -add_plugin_library(opcua epan) +add_wireshark_epan_plugin_library(opcua) -target_link_libraries(opcua epan) +target_link_libraries(opcua epan ${GCRYPT_LIBRARIES}) install_plugin(opcua epan) diff --git a/plugins/epan/opcua/opcua.c b/plugins/epan/opcua/opcua.c index 99287102e3..10ad0e1b3f 100644 --- a/plugins/epan/opcua/opcua.c +++ b/plugins/epan/opcua/opcua.c @@ -14,54 +14,82 @@ ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com> ******************************************************************************/ -#include "config.h" - +#include <epan/dissectors/packet-tcp.h> #include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/range.h> #include <epan/reassemble.h> -#include <epan/dissectors/packet-tcp.h> -#include "opcua_transport_layer.h" -#include "opcua_security_layer.h" +#include <epan/secrets.h> +#include <epan/tvbuff.h> +#include <gcrypt.h> +#include <wiretap/secrets-types.h> +#include <wsutil/file_util.h> + +#include "config.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" +#include "opcua_keyset.h" +#include "opcua_security_layer.h" +#include "opcua_serviceparser.h" +#include "opcua_serviceids.h" +#include "opcua_simpletypes.h" +#include "opcua_transport_layer.h" void proto_register_opcua(void); extern const value_string g_requesttypes[]; extern const int g_NumServices; +static const gchar *g_opcua_debug_file_name = NULL; +int g_opcua_default_sig_len = 0; /* 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); +typedef int (*FctParse)(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); -int proto_opcua = -1; +int proto_opcua; static dissector_handle_t opcua_handle; +static module_t *opcua_module; + +/* #define OPCUA_DEBUG */ +#ifdef OPCUA_DEBUG +# define debugprintf(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__); +#else +# define debugprintf(fmt, ...) +#endif + /** Official IANA registered port for OPC UA Binary Protocol. */ +#define OPCUA_DEFAULT_PORT 4840 +/* default port range for preferences */ #define OPCUA_PORT_RANGE "4840" +/** header length that is needed to compute the pdu length. + * @see get_opcua_message_len + */ +#define FRAME_HEADER_LEN 8 +/* AES block size: for both AES128 and AES256 the block size is 128 bits */ +#define AES_BLOCK_SIZE 16 /** subtree types used in opcua_transport_layer.c */ -gint ett_opcua_extensionobject = -1; -gint ett_opcua_nodeid = -1; +gint ett_opcua_extensionobject; +gint ett_opcua_nodeid; /** 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 gint ett_opcua_transport; +static gint ett_opcua_fragment; +static gint ett_opcua_fragments; + +static int hf_opcua_fragments; +static int hf_opcua_fragment; +static int hf_opcua_fragment_overlap; +static int hf_opcua_fragment_overlap_conflicts; +static int hf_opcua_fragment_multiple_tails; +static int hf_opcua_fragment_too_long_fragment; +static int hf_opcua_fragment_error; +static int hf_opcua_fragment_count; +static int hf_opcua_reassembled_in; +static int hf_opcua_reassembled_length; static const fragment_items opcua_frag_items = { /* Fragment subtrees */ @@ -86,7 +114,6 @@ static const fragment_items opcua_frag_items = { "Message fragments" }; - static reassembly_table opcua_reassembly_table; /** OpcUa Transport Message Types */ @@ -115,14 +142,26 @@ static const char* g_szMessageTypes[] = "Invalid message" }; +static const enum_val_t opcua_sig_len_enum[] = { + { "None", "Unsigned", 0 }, + { "20", "20 Bytes", 20 }, + { "32", "32 Bytes", 32 }, + { NULL, NULL, 0 } +}; - - -/** header length that is needed to compute - * the pdu length. - * @see get_opcua_message_len - */ -#define FRAME_HEADER_LEN 8 +#ifdef _MSC_VER +static char *ua_strtok_r(char *str, const char *delim, char **saveptr) +{ + /* use MSVC specific strtok_s */ + return strtok_s(str, delim, saveptr); +} +#else +static char *ua_strtok_r(char *str, const char *delim, char **saveptr) +{ + /* use POSIX strtok_r */ + return strtok_r(str, delim, saveptr); +} +#endif /** returns the length of an OpcUa message. * This function reads the length information from @@ -139,6 +178,315 @@ static guint get_opcua_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, return plen; } +/* Helper function to convert hex string to binary data */ +guint hex_to_bin(const char *hex_string, unsigned char *binary_data, unsigned int binary_size) +{ + guint length = (guint)strlen(hex_string); + guint i; + + for (i = 0; i < length / 2 && i < binary_size; ++i) { + sscanf(hex_string + 2 * i, "%2hhx", &binary_data[i]); + } + + return i; +} + +/** Parsing context */ +struct opcua_keylog_parser_ctx { + struct ua_keyset *keyset; /**< current keyset */ + uint64_t last_id; /**< the id of the previous line, this is also the id of the keyset */ +}; + +/** + * Common function for parsing key log line used by opcua_keylog_process_lines and opcua_load_keylog_file. + * + * @param ctx Parsing context. + * @param line Current line to parse. + */ +static void opcua_keylog_process_line(struct opcua_keylog_parser_ctx *ctx, const char *line) +{ + struct ua_keyset *keyset; + char key[33]; /* 32 chars + null terminator */ + char value[65]; /* 64 hex chars + null terminator */ + const char *parts[4]; /* for string split */ + unsigned int num_parts; + char *tmp, *saveptr; + uint32_t token_id = 0; + uint32_t channel_id = 0; + uint64_t id = 0; + int n; + + /* parse key/value pair */ + n = sscanf(line, "%32[^:]: %64s\n", key, value); + if (n != 2) return; + + debugprintf("%s = %s\n", key, value); + + /* split key into parts */ + num_parts = 0; + tmp = ua_strtok_r(key, "_", &saveptr); + while (tmp && num_parts < 4) { + parts[num_parts++] = tmp; + tmp = ua_strtok_r(NULL, "_", &saveptr); + } + if (num_parts != 4) return; /* skip invalid enty */ + channel_id = (uint32_t)strtoul(parts[2], NULL, 10); + token_id = (uint32_t)strtoul(parts[3], NULL, 10); + + debugprintf("channel_id = %u\n", channel_id); + debugprintf("token_id = %u\n", token_id); + + /* create unique keyset id */ + id = ua_keyset_id(channel_id, token_id); + + if (ctx->keyset == NULL || id != ctx->last_id) { + debugprintf("Adding new keyset for id %lu...\n", id); + /* create new keyset for new id */ + ctx->keyset = ua_keysets_add(); + ctx->last_id = id; + } + keyset = ctx->keyset; + if (keyset) { + keyset->id = id; + /* store key material */ + if (strcmp(parts[0], "client") == 0) { + if (strcmp(parts[1], "iv") == 0) { + hex_to_bin(value, keyset->client_iv, sizeof(keyset->client_iv)); + } else if (strcmp(parts[1], "key") == 0) { + keyset->client_key_len = (unsigned int)hex_to_bin(value, keyset->client_key, sizeof(keyset->client_key)); + } else if (strcmp(parts[1], "siglen") == 0) { + keyset->client_sig_len = (unsigned int)strtoul(value, NULL, 10); + } + } else if (strcmp(parts[0], "server") == 0) { + if (strcmp(parts[1], "iv") == 0) { + hex_to_bin(value, keyset->server_iv, sizeof(keyset->server_iv)); + } else if (strcmp(parts[1], "key") == 0) { + keyset->server_key_len = (unsigned int)hex_to_bin(value, keyset->server_key, sizeof(keyset->server_key)); + } else if (strcmp(parts[1], "siglen") == 0) { + keyset->server_sig_len = (unsigned int)strtoul(value, NULL, 10); + } + } + } +} + +/** + * Parses key log data from PCAP file. + * This function splits the data by \n and calls opcua_keylog_process_line. + */ +static void opcua_keylog_process_lines(char *data) +{ + struct opcua_keylog_parser_ctx ctx = { NULL, 0 }; + char *saveptr; + const char *line = ua_strtok_r(data, "\n", &saveptr); + + while (line) { + opcua_keylog_process_line(&ctx, line); + line = ua_strtok_r(NULL, "\n", &saveptr); + } + + /* sort data by id to make lookup working */ + ua_keysets_sort(); +} + +/** + * Loads the configured OPCUA Keylog file. + */ +static void opcua_load_keylog_file(const char *filename) +{ + struct opcua_keylog_parser_ctx ctx = { NULL, 0 }; + char line[256]; + + debugprintf("Loading key file '%s'...\n", filename); + FILE *f = ws_fopen(filename, "r"); + if (f == NULL) { + debugprintf("error: '%s' not found\n", filename); + return; + } + + /* parse file contents */ + while (fgets(line, sizeof(line), f)) { + opcua_keylog_process_line(&ctx, line); + } + fclose(f); + + /* sort data by id to make lookup working */ + ua_keysets_sort(); +} + +/** + * Checks the padding of a symetric signed message. + * A message always contains a padding_len byte, which tells us the length of + * the padding. All following padding bytes contain the same value. This makes it + * possible the padding from the end of the message. + * Example Paddings: + * - 00 + * - 01 01 + * - 02 02 02 + * @param padding Pointer to last padding byte. + * @return padding length on success, -1 if the paddding is invalid. + */ +static int verify_padding(const guint8 *padding) +{ + uint8_t pad_len; + uint8_t i; + + pad_len = *padding; + + for (i = 0; i < pad_len; ++i) { + if (padding[-pad_len + i] != pad_len) return -1; + } + + return pad_len; +} +/** + * Gets security footer info. + * + * @param channel_id SecureChannelId for keyset lookup. + * @param token_id TokenId for keyset lookup. + * @param sig_len Returns the length of the signature. + * @param from_server True of the message is sent from the server, false when sent from the client. + * + * @return Returns 0 on success, -1 if parsing failed. + */ +static int opcua_get_footer_info(uint32_t channel_id, uint32_t token_id, guint8 *sig_len, bool from_server) +{ + struct ua_keyset *keyset; + uint64_t id; + + id = ua_keyset_id(channel_id, token_id); + + /* try to get correct signature length from key log file */ + keyset = ua_keysets_lookup(id); + if (keyset) { + /* The Client keys are used to secure Messages sent by the Client. The Server keys are used to + * secure Messages sent by the Server. + */ + if (from_server) { + *sig_len = keyset->server_sig_len; + } else { + *sig_len = keyset->client_sig_len; + } + } + + debugprintf("no keyset found for channel_id=%u and token_id=%u\n", channel_id, token_id); + /* we use sig_len set from OpenSecurehChannel Policy in this case. + * this requires to have the OPN in the capture file, otherwise we are out of luck. + */ + + return 0; +} + +/** + * This function to perform AES decryption on service data in-place. + * Add also determines the payload length by removing the padding and signature. + * + * @param channel_id SecureChannelId for keyset lookup. + * @param token_id TokenId for keyset lookup. + * @param cipher The cipher text. + * @param cipher_len The cipher test length in bytes. + * @param plaintext The plaintext to return. + * @param plaintext_len The plaintext in bytes, should be the same as cipher_len. + * @param padding_len Returns the length of the padding. + * @param sig_len Returns the length of the signature. + * @param from_server True of the message is sent from the server, false when sent from the client. + * + * @return Returns 0 on success, -1 if decryption failed. + */ +static int decrypt_opcua( + uint32_t channel_id, uint32_t token_id, + const guint8 *cipher, guint cipher_len, + guint8 *plaintext, guint plaintext_len, + guint8 *padding_len, guint8 *sig_len, bool from_server) +{ + struct ua_keyset *keyset; + uint64_t id; + unsigned int keylen, ivlen; + unsigned char *keydata, *ivdata; + int cipher_mode; + gcry_error_t res; + int ret = 0; + + id = ua_keyset_id(channel_id, token_id); + + keyset = ua_keysets_lookup(id); + if (keyset == NULL) { + debugprintf("no keyset found for channel_id=%u and token_id=%u\n", channel_id, token_id); + /* col_append_fstr(pinfo->cinfo, COL_INFO, " (encrypted)"); */ + return -1; + } + debugprintf("found keyset for channel_id=%u and token_id=%u\n", channel_id, token_id); + + /* The Client keys are used to secure Messages sent by the Client. The Server keys are used to + * secure Messages sent by the Server. + */ + if (from_server) { + ivlen = sizeof(keyset->server_iv); + ivdata = keyset->server_iv; + keylen = keyset->server_key_len; + keydata = keyset->server_key; + *sig_len = keyset->server_sig_len; + } else { + ivlen = sizeof(keyset->client_iv); + ivdata = keyset->client_iv; + keylen = keyset->client_key_len; + keydata = keyset->client_key; + *sig_len = keyset->client_sig_len; + } + /* derive AES mode from key length */ + switch (keylen) { + case 16: + debugprintf("using AES-128-CBC\n"); + cipher_mode = GCRY_CIPHER_AES128; + break; + case 32: + debugprintf("using AES-256-CBC\n"); + cipher_mode = GCRY_CIPHER_AES256; + break; + default: + debugprintf("invalid AES key length: %u bytes\n", keylen); + /* col_append_fstr(pinfo->cinfo, COL_INFO, " (encrypted)"); */ + return -1; + } + + debugprintf("cipher_len=%u\n", cipher_len); + if (cipher_len % 16 != 0) { + debugprintf("warning: cipher_len not a multiple of 16.\n"); + } + + gcry_cipher_hd_t handle; + gcry_cipher_open(&handle, cipher_mode, GCRY_CIPHER_MODE_CBC, GCRY_CIPHER_CBC_CTS); + gcry_cipher_setkey(handle, keydata, keylen); + gcry_cipher_setiv(handle, ivdata, ivlen); + + /* Decrypt the data in-place */ + res = gcry_cipher_decrypt(handle, plaintext, plaintext_len, cipher, cipher_len); + if (res == 0) { + /* col_append_fstr(pinfo->cinfo, COL_INFO, " (decrypted)"); */ + debugprintf("decryption succeeded.\n"); + } else { + /* col_append_fstr(pinfo->cinfo, COL_INFO, " (encrypted)"); */ + debugprintf("decryption failed.\n"); + ret = -1; + } + gcry_cipher_close(handle); + /* it makes no sense to continue and verify the padding if decryption failed */ + if (ret != 0) { + return ret; + } + + ret = verify_padding(&plaintext[plaintext_len - *sig_len - 1]); + if (ret < 0) { + debugprintf("padding is invalid.\n"); + } + + /* return padding length */ + *padding_len = plaintext[plaintext_len - *sig_len - 1]; + debugprintf("sig_len=%u\n", *sig_len); + debugprintf("pad_len=%u\n", *padding_len); + + return 0; +} + /** The OpcUa message dissector. * This method dissects full OpcUa messages. * It gets only called with reassembled data @@ -148,41 +496,64 @@ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * { FctParse pfctParse = NULL; enum MessageType msgtype = MSG_INVALID; + guint16 src_port = pinfo->srcport; + range_t *port_range; + bool from_server = false; + bool decrypted = false; /* successfully decrypted secure message */ + enum ua_message_mode mode = UA_MessageMode_None; + uint8_t sig_len = 0; + struct ua_metadata metadata; + tvbuff_t *decrypted_tvb = NULL; + int ret; + + /* determine if telegram is from server or from client by checking the port number */ + if (src_port == OPCUA_DEFAULT_PORT) { + from_server = true; + } else { + port_range = prefs_get_range_value("opcua", "tcp.port"); + if (port_range && value_is_in_range(port_range, src_port)) { + from_server = true; + } + } + + metadata.encrypted = false; + get_encryption_info(pinfo, &mode, &sig_len); col_set_str(pinfo->cinfo, COL_PROTOCOL, "OpcUa"); + /* parse message type */ - if (tvb_memeql(tvb, 0, "HEL", 3) == 0) + if (tvb_memeql(tvb, 0, (const guint8 * )"HEL", 3) == 0) { msgtype = MSG_HELLO; pfctParse = parseHello; } - else if (tvb_memeql(tvb, 0, "ACK", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"ACK", 3) == 0) { msgtype = MSG_ACKNOWLEDGE; pfctParse = parseAcknowledge; } - else if (tvb_memeql(tvb, 0, "ERR", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"ERR", 3) == 0) { msgtype = MSG_ERROR; pfctParse = parseError; } - else if (tvb_memeql(tvb, 0, "RHE", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"RHE", 3) == 0) { msgtype = MSG_REVERSEHELLO; pfctParse = parseReverseHello; } - else if (tvb_memeql(tvb, 0, "MSG", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"MSG", 3) == 0) { msgtype = MSG_MESSAGE; pfctParse = parseMessage; } - else if (tvb_memeql(tvb, 0, "OPN", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"OPN", 3) == 0) { msgtype = MSG_OPENSECURECHANNEL; pfctParse = parseOpenSecureChannel; } - else if (tvb_memeql(tvb, 0, "CLO", 3) == 0) + else if (tvb_memeql(tvb, 0, (const guint8*)"CLO", 3) == 0) { msgtype = MSG_CLOSESECURECHANNEL; pfctParse = parseCloseSecureChannel; @@ -207,9 +578,10 @@ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * { gint offset = 0; int iServiceId = -1; - tvbuff_t *next_tvb = tvb; - gboolean bParseService = TRUE; - gboolean bIsLastFragment = FALSE; + gboolean bParseService = FALSE; /* Only MSG, OPN and CLO have a service payload */ + gboolean bIsFinalChunk = FALSE; + guint payload_len = 0; + guint8 pad_len = 0; /* we are being asked for details */ proto_item *ti = NULL; @@ -218,72 +590,146 @@ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * 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) + /* call the transport message dissector */ + (*pfctParse)(transport_tree, tvb, pinfo, &offset, &metadata); + + /* MSG_MESSAGE and MSG_CLOSESECURECHANNEL can be decrypted. + * Also handle chunked message reassembly for MSG_MESSAGE. + */ + if (msgtype == MSG_MESSAGE || msgtype == MSG_CLOSESECURECHANNEL) { guint8 chunkType = 0; - guint32 opcua_seqid = 0; - guint32 opcua_num = 0; - guint32 opcua_seqnum = 0; + guint32 opcua_seqno = 0; /* OPCUA sequence number */ + guint32 opcua_reqid = 0; /* OPCUA request id */ fragment_head *frag_msg = NULL; + bParseService = TRUE; offset = 3; - chunkType = tvb_get_guint8(tvb, offset); offset += 1; + offset += 4; /* message size */ + offset += 4; /* skip secure channel_id */ + parseSecurityHeader(transport_tree, tvb, &offset, &metadata); /* only token_id (4 byte) */ + + if (mode == UA_MessageMode_MaybeEncrypted) { + /* try to parse ServiceId */ + iServiceId = getServiceNodeId(tvb, offset + 8); /* skip 4 byte SeqNo and 4 byte RequestId */ + const gchar *szServiceName = val_to_str((guint32)iServiceId, g_requesttypes, "not found"); + if (strcmp(szServiceName, "not found") == 0) { + mode = UA_MessageMode_SignAndEncrypt; + } else { + mode = UA_MessageMode_Sign; + } + store_encryption_info(pinfo, mode, sig_len); + } - offset += 4; /* Message Size */ - offset += 4; /* SecureChannelId */ - offset += 4; /* Security Token Id */ + /* Message Structure: + * +-----------------+ + * / | Message Header | MSGF, MessageSize + * | +-----------------+ + * | | Security Header | SecureChannelId, TokenId + * | +-----------------+ + * Signed < | Sequence Header | \ SequenceNumber, RequestId + * | +-----------------+ | + * | | Body | | + * | +-----------------+ > Encrypted + * \ | Padding | | + * +-----------------+ | + * | Signature | / + * +-----------------+ + */ + if (mode == UA_MessageMode_SignAndEncrypt) { + uint32_t channel_id = tvb_get_letohl(tvb, 8); + uint32_t token_id = tvb_get_letohl(tvb, 12); + guint cipher_len = tvb_ensure_captured_length_remaining(tvb, 16); + guint plaintext_len = cipher_len; + const guint8 *cipher = tvb_get_ptr(tvb, 16, (gint)cipher_len); + guchar *plaintext = (guchar*)wmem_alloc(pinfo->pool, plaintext_len); + + ret = decrypt_opcua(channel_id, token_id, cipher, cipher_len, plaintext, plaintext_len, &pad_len, &sig_len, from_server); + if (ret == 0) { + /* decrypted */ + /* to get the payload length we need to subtract the sequence header (8) byte, + * the padding (paddin_len+1), and the signature from the plaintext */ + payload_len = plaintext_len - pad_len - sig_len - 9; /* pad_len 2 = 02 02 02 */ + /* Now re-setup the tvb buffer to have the new data */ + decrypted_tvb = tvb_new_child_real_data(tvb, plaintext, (guint)plaintext_len, (gint)plaintext_len); + add_new_data_source(pinfo, decrypted_tvb, "Decrypted Data"); + /* process decrypted_tvb from here */ + tvb = decrypted_tvb; + offset = 0; + decrypted = true; + } else { + /* decryption failed */ + metadata.encrypted = true; + } + } else if (mode == UA_MessageMode_Sign) { + uint32_t channel_id = tvb_get_letohl(tvb, 8); + uint32_t token_id = tvb_get_letohl(tvb, 12); + payload_len = tvb_ensure_captured_length_remaining(tvb, 24); /* subtract header */ + + ret = opcua_get_footer_info(channel_id, token_id, &sig_len, from_server); + if (ret != 0) { + debugprintf("Processing security footer of signed message failed.\n"); + } else { + /* signed only messages have no padding, so the payload is the message size + * without 24 byte header and without signature */ + payload_len -= sig_len; + } + /* store the current tvb as decrypted tvb, because we need this to parse the signature + * at the end, and tvb gets replaces with the reassembled UA message if the message was chunked. + */ + decrypted_tvb = tvb; + } else { + /* no padding, no signature, just payload */ + payload_len = tvb_ensure_captured_length_remaining(tvb, 24); /* subtract header */ + pad_len= 0; + sig_len = 0; + } - opcua_num = tvb_get_letohl(tvb, offset); offset += 4; /* Security Sequence Number */ - opcua_seqid = tvb_get_letohl(tvb, offset); offset += 4; /* Security RequestId */ + opcua_seqno = tvb_get_letohl(tvb, offset); /* Sequence.Sequence Number */ + opcua_reqid = tvb_get_letohl(tvb, offset + 4); /* Sequence.RequestId */ + parseSequenceHeader(transport_tree, tvb, &offset, &metadata); if (chunkType == 'A') { - fragment_delete(&opcua_reassembly_table, pinfo, opcua_seqid, NULL); + /* cancel chunk reassembly */ + fragment_delete(&opcua_reassembly_table, pinfo, opcua_reqid, 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); + (*pfctParse)(transport_tree, tvb, pinfo, &offset, &metadata); + parseAbort(transport_tree, tvb, pinfo, &offset, &metadata); 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 + opcua_reassembly_table if the opcua_reqid belongs to a chunked message */ - frag_msg = fragment_get(&opcua_reassembly_table, pinfo, opcua_seqid, NULL); + frag_msg = fragment_get(&opcua_reassembly_table, pinfo, opcua_reqid, NULL); if (frag_msg == NULL) { - frag_msg = fragment_get_reassembled_id(&opcua_reassembly_table, pinfo, opcua_seqid); + frag_msg = fragment_get_reassembled_id(&opcua_reassembly_table, pinfo, opcua_reqid); } - if (frag_msg != NULL || chunkType != 'F') + if (frag_msg != NULL || chunkType == 'C') { gboolean bSaveFragmented = pinfo->fragmented; gboolean bMoreFragments = TRUE; - tvbuff_t *new_tvb = NULL; + tvbuff_t *reassembled_tvb = NULL; + bool first_frag = false; pinfo->fragmented = TRUE; if (frag_msg == NULL) { - /* first fragment */ - opcua_seqnum = 0; + first_frag = true; } 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 */ - while (frag_msg->next) {frag_msg = frag_msg->next;} - opcua_seqnum = frag_msg->offset + 1; - if (chunkType == 'F') { bMoreFragments = FALSE; @@ -294,77 +740,100 @@ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree * tvb, offset, pinfo, - opcua_seqid, /* ID for fragments belonging together */ + opcua_reqid, /* ID for fragments belonging together */ NULL, - opcua_seqnum, /* fragment sequence number */ - tvb_captured_length_remaining(tvb, offset), /* fragment length - to the end */ + first_frag ? 0 : opcua_seqno, /* fragment sequence number */ + payload_len, bMoreFragments); /* More fragments? */ - new_tvb = process_reassembled_data(tvb, + if (first_frag) { + /* the UA protocol does not number the chunks beginning + * from 0 but uses the common sequence number. We + * handle that in Wireshark by setting the sequence + * offset here, after passing in 0 for the first + * fragment. For later fragments we can use the + * sequence number as contained in the protocol. + */ + + fragment_add_seq_offset(&opcua_reassembly_table, pinfo, opcua_reqid, NULL, opcua_seqno); + } + reassembled_tvb = process_reassembled_data(tvb, offset, pinfo, - "Reassembled Message", + "Reassembled UA Message", frag_msg, &opcua_frag_items, NULL, transport_tree); - if (new_tvb) + if (reassembled_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) - { + bIsFinalChunk = TRUE; /* take it all */ - next_tvb = new_tvb; + tvb = reassembled_tvb; + /* new tvb starts at payload */ + offset = 0; } else { + /* Not last packet of reassembled UA message */ + col_append_fstr(pinfo->cinfo, COL_INFO, " (Message fragment %u)", opcua_seqno); /* only show transport header */ bParseService = FALSE; - next_tvb = tvb_new_subset_remaining(tvb, 0); + 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); - } + /* parse payload if not encrypted */ + if (!metadata.encrypted && bParseService) { + if (msgtype == MSG_CLOSESECURECHANNEL) { + iServiceId = parseService(transport_tree, tvb, pinfo, &offset, &metadata); + if (iServiceId == OpcUaId_CloseSecureChannelRequest_Encoding_DefaultBinary) { + col_append_str(pinfo->cinfo, COL_INFO, ": CloseSecureChannelRequest"); + } else if (iServiceId == OpcUaId_CloseSecureChannelResponse_Encoding_DefaultBinary) { + col_append_str(pinfo->cinfo, COL_INFO, ": CloseSecureChannelResponse"); + } else { + const gchar *szServiceName = val_to_str((guint32)iServiceId, g_requesttypes, "ServiceId %d"); + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (Wrong ServiceId)", szServiceName); + } + } else if (msgtype == MSG_MESSAGE) { + /* parse the service if not chunked or message was reassembled */ + iServiceId = parseService(transport_tree, tvb, pinfo, &offset, &metadata); - /* 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"); + /* 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); + if (bIsFinalChunk == FALSE) + { + /* normal message in one chunk */ + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", szServiceName); + } + else + { + /* reassembled message from multiple chunks */ + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (Message Reassembled)", szServiceName); + } + } } - else - { - col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s (Message Reassembled)", g_szMessageTypes[msgtype], szServiceName); + if (mode == UA_MessageMode_SignAndEncrypt && decrypted) { + /* parse padding and signature */ + parseSecurityFooterSAE(transport_tree, decrypted_tvb, 8 + payload_len, pad_len, sig_len); + } else if (mode == UA_MessageMode_Sign) { + /* parse signature */ + parseSecurityFooterSO(transport_tree, decrypted_tvb, 24 + payload_len, sig_len); } } + if (metadata.encrypted) { + col_append_str(pinfo->cinfo, COL_INFO, " (encrypted)"); + } else if (mode == UA_MessageMode_SignAndEncrypt) { + col_append_str(pinfo->cinfo, COL_INFO, " (decrypted)"); + } } return tvb_reported_length(tvb); @@ -381,6 +850,36 @@ static int dissect_opcua(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo return tvb_reported_length(tvb); } +/** Init plugin resources */ +void proto_init_opcua(void) +{ + debugprintf("proto_init_opcua called.\n"); + ua_keysets_init(); + opcua_load_keylog_file(g_opcua_debug_file_name); +} + +/** Cleanup plugin resources */ +void proto_cleanup_opcua(void) +{ + debugprintf("proto_cleanup_opcua called.\n"); + ua_keysets_clear(); +} + +/** secrets callback called from Wireshark when loading a capture file with OPC UA Keylog File. */ +static void opcua_secrets_block_callback(const void *secrets, guint size) +{ + char *tmp = g_memdup2(secrets, size + 1); + if (tmp == NULL) return; /* OOM */ + + debugprintf("Loading secrets block '%s'...\n", (const char*)secrets); + debugprintf("size = %u\n", size); + /* ensure data is zero terminated */ + tmp[size] = 0; + /* parse data */ + opcua_keylog_process_lines(tmp); + g_free(tmp); +} + /** plugin entry functions. * This registers the OpcUa protocol. */ @@ -412,9 +911,23 @@ void proto_register_opcua(void) }; proto_opcua = proto_register_protocol("OpcUa Binary Protocol", "OpcUa", "opcua"); + opcua_handle = register_dissector("opcua", dissect_opcua, proto_opcua); + + register_init_routine(proto_init_opcua); + register_cleanup_routine(proto_cleanup_opcua); + + opcua_module = prefs_register_protocol(proto_opcua, proto_reg_handoff_opcua); + prefs_register_filename_preference(opcua_module, "debug_file", "OPCUA debug file", + "Redirect OPC UA Secure Conversion session keys to the file specified to enable decryption.", + &g_opcua_debug_file_name, FALSE); + + prefs_register_enum_preference(opcua_module, "signature_length", "Default signature length", + "Default signature length to use if the OpenSecureChannel message is missing.", + &g_opcua_default_sig_len, opcua_sig_len_enum, FALSE); registerTransportLayerTypes(proto_opcua); registerSecurityLayerTypes(proto_opcua); + registerSequenceLayerTypes(proto_opcua); registerApplicationLayerTypes(proto_opcua); registerSimpleTypes(proto_opcua); registerEnumTypes(proto_opcua); @@ -427,12 +940,11 @@ void proto_register_opcua(void) reassembly_table_register(&opcua_reassembly_table, &addresses_reassembly_table_functions); + secrets_register_type(SECRETS_TYPE_OPCUA, opcua_secrets_block_callback); } void proto_reg_handoff_opcua(void) { - opcua_handle = create_dissector_handle(dissect_opcua, proto_opcua); - dissector_add_uint_range_with_preference("tcp.port", OPCUA_PORT_RANGE, opcua_handle); } diff --git a/plugins/epan/opcua/opcua_application_layer.c b/plugins/epan/opcua/opcua_application_layer.c index 688cd651fc..dfa1e19238 100644 --- a/plugins/epan/opcua/opcua_application_layer.c +++ b/plugins/epan/opcua/opcua_application_layer.c @@ -33,9 +33,9 @@ static const value_string g_nodeidmasks[] = { /** 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; +static int hf_opcua_nodeid_encodingmask; +static int hf_opcua_app_nsid; +static int hf_opcua_app_numeric; /** Register application layer types. */ void registerApplicationLayerTypes(int proto) @@ -52,6 +52,40 @@ void registerApplicationLayerTypes(int proto) proto_register_field_array(proto, hf, array_length(hf)); } +/** Decodes the service nodeid without modifying the tree or offset. + * Service NodeIds are alsways numeric. + */ +int getServiceNodeId(tvbuff_t *tvb, gint offset) +{ + guint8 EncodingMask; + guint32 Numeric = 0; + + EncodingMask = tvb_get_guint8(tvb, offset); + offset++; + + switch(EncodingMask) + { + case 0x00: /* two byte node id */ + Numeric = tvb_get_guint8(tvb, offset); + break; + case 0x01: /* four byte node id */ + offset+=1; + Numeric = tvb_get_letohs(tvb, offset); + break; + case 0x02: /* numeric, that does not fit into four bytes */ + offset+=2; + Numeric = tvb_get_letohl(tvb, offset); + break; + case 0x03: /* string */ + case 0x04: /* guid */ + case 0x05: /* opaque*/ + /* NOT USED */ + break; + }; + + return Numeric; +} + /** Parses an OpcUa Service NodeId and returns the service type. * In this cases the NodeId is always from type numeric and NSId = 0. */ diff --git a/plugins/epan/opcua/opcua_application_layer.h b/plugins/epan/opcua/opcua_application_layer.h index c9b043e895..44e9345cdc 100644 --- a/plugins/epan/opcua/opcua_application_layer.h +++ b/plugins/epan/opcua/opcua_application_layer.h @@ -17,4 +17,5 @@ void registerApplicationLayerTypes(int proto); /* Ua type parsers */ +int getServiceNodeId(tvbuff_t *tvb, gint offset); int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); diff --git a/plugins/epan/opcua/opcua_complextypeparser.c b/plugins/epan/opcua/opcua_complextypeparser.c index e37dd29917..53362785ff 100644 --- a/plugins/epan/opcua/opcua_complextypeparser.c +++ b/plugins/epan/opcua/opcua_complextypeparser.c @@ -24,286 +24,286 @@ #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; +gint ett_opcua_TrustListDataType; +gint ett_opcua_array_TrustListDataType; +gint ett_opcua_Node; +gint ett_opcua_array_Node; +gint ett_opcua_InstanceNode; +gint ett_opcua_array_InstanceNode; +gint ett_opcua_TypeNode; +gint ett_opcua_array_TypeNode; +gint ett_opcua_ObjectNode; +gint ett_opcua_array_ObjectNode; +gint ett_opcua_ObjectTypeNode; +gint ett_opcua_array_ObjectTypeNode; +gint ett_opcua_VariableNode; +gint ett_opcua_array_VariableNode; +gint ett_opcua_VariableTypeNode; +gint ett_opcua_array_VariableTypeNode; +gint ett_opcua_ReferenceTypeNode; +gint ett_opcua_array_ReferenceTypeNode; +gint ett_opcua_MethodNode; +gint ett_opcua_array_MethodNode; +gint ett_opcua_ViewNode; +gint ett_opcua_array_ViewNode; +gint ett_opcua_DataTypeNode; +gint ett_opcua_array_DataTypeNode; +gint ett_opcua_ReferenceNode; +gint ett_opcua_array_ReferenceNode; +gint ett_opcua_Argument; +gint ett_opcua_array_Argument; +gint ett_opcua_EnumValueType; +gint ett_opcua_array_EnumValueType; +gint ett_opcua_OptionSet; +gint ett_opcua_array_OptionSet; +gint ett_opcua_TimeZoneDataType; +gint ett_opcua_array_TimeZoneDataType; +gint ett_opcua_ApplicationDescription; +gint ett_opcua_array_ApplicationDescription; +gint ett_opcua_RequestHeader; +gint ett_opcua_array_RequestHeader; +gint ett_opcua_ResponseHeader; +gint ett_opcua_array_ResponseHeader; +gint ett_opcua_ServerOnNetwork; +gint ett_opcua_array_ServerOnNetwork; +gint ett_opcua_UserTokenPolicy; +gint ett_opcua_array_UserTokenPolicy; +gint ett_opcua_EndpointDescription; +gint ett_opcua_array_EndpointDescription; +gint ett_opcua_RegisteredServer; +gint ett_opcua_array_RegisteredServer; +gint ett_opcua_MdnsDiscoveryConfiguration; +gint ett_opcua_array_MdnsDiscoveryConfiguration; +gint ett_opcua_ChannelSecurityToken; +gint ett_opcua_array_ChannelSecurityToken; +gint ett_opcua_SignedSoftwareCertificate; +gint ett_opcua_array_SignedSoftwareCertificate; +gint ett_opcua_SignatureData; +gint ett_opcua_array_SignatureData; +gint ett_opcua_UserIdentityToken; +gint ett_opcua_array_UserIdentityToken; +gint ett_opcua_AnonymousIdentityToken; +gint ett_opcua_array_AnonymousIdentityToken; +gint ett_opcua_UserNameIdentityToken; +gint ett_opcua_array_UserNameIdentityToken; +gint ett_opcua_X509IdentityToken; +gint ett_opcua_array_X509IdentityToken; +gint ett_opcua_KerberosIdentityToken; +gint ett_opcua_array_KerberosIdentityToken; +gint ett_opcua_IssuedIdentityToken; +gint ett_opcua_array_IssuedIdentityToken; +gint ett_opcua_NodeAttributes; +gint ett_opcua_array_NodeAttributes; +gint ett_opcua_ObjectAttributes; +gint ett_opcua_array_ObjectAttributes; +gint ett_opcua_VariableAttributes; +gint ett_opcua_array_VariableAttributes; +gint ett_opcua_MethodAttributes; +gint ett_opcua_array_MethodAttributes; +gint ett_opcua_ObjectTypeAttributes; +gint ett_opcua_array_ObjectTypeAttributes; +gint ett_opcua_VariableTypeAttributes; +gint ett_opcua_array_VariableTypeAttributes; +gint ett_opcua_ReferenceTypeAttributes; +gint ett_opcua_array_ReferenceTypeAttributes; +gint ett_opcua_DataTypeAttributes; +gint ett_opcua_array_DataTypeAttributes; +gint ett_opcua_ViewAttributes; +gint ett_opcua_array_ViewAttributes; +gint ett_opcua_AddNodesItem; +gint ett_opcua_array_AddNodesItem; +gint ett_opcua_AddNodesResult; +gint ett_opcua_array_AddNodesResult; +gint ett_opcua_AddReferencesItem; +gint ett_opcua_array_AddReferencesItem; +gint ett_opcua_DeleteNodesItem; +gint ett_opcua_array_DeleteNodesItem; +gint ett_opcua_DeleteReferencesItem; +gint ett_opcua_array_DeleteReferencesItem; +gint ett_opcua_ViewDescription; +gint ett_opcua_array_ViewDescription; +gint ett_opcua_BrowseDescription; +gint ett_opcua_array_BrowseDescription; +gint ett_opcua_ReferenceDescription; +gint ett_opcua_array_ReferenceDescription; +gint ett_opcua_BrowseResult; +gint ett_opcua_array_BrowseResult; +gint ett_opcua_RelativePathElement; +gint ett_opcua_array_RelativePathElement; +gint ett_opcua_RelativePath; +gint ett_opcua_array_RelativePath; +gint ett_opcua_BrowsePath; +gint ett_opcua_array_BrowsePath; +gint ett_opcua_BrowsePathTarget; +gint ett_opcua_array_BrowsePathTarget; +gint ett_opcua_BrowsePathResult; +gint ett_opcua_array_BrowsePathResult; +gint ett_opcua_EndpointConfiguration; +gint ett_opcua_array_EndpointConfiguration; +gint ett_opcua_SupportedProfile; +gint ett_opcua_array_SupportedProfile; +gint ett_opcua_SoftwareCertificate; +gint ett_opcua_array_SoftwareCertificate; +gint ett_opcua_QueryDataDescription; +gint ett_opcua_array_QueryDataDescription; +gint ett_opcua_NodeTypeDescription; +gint ett_opcua_array_NodeTypeDescription; +gint ett_opcua_QueryDataSet; +gint ett_opcua_array_QueryDataSet; +gint ett_opcua_NodeReference; +gint ett_opcua_array_NodeReference; +gint ett_opcua_ContentFilterElement; +gint ett_opcua_array_ContentFilterElement; +gint ett_opcua_ContentFilter; +gint ett_opcua_array_ContentFilter; +gint ett_opcua_ElementOperand; +gint ett_opcua_array_ElementOperand; +gint ett_opcua_LiteralOperand; +gint ett_opcua_array_LiteralOperand; +gint ett_opcua_AttributeOperand; +gint ett_opcua_array_AttributeOperand; +gint ett_opcua_SimpleAttributeOperand; +gint ett_opcua_array_SimpleAttributeOperand; +gint ett_opcua_ContentFilterElementResult; +gint ett_opcua_array_ContentFilterElementResult; +gint ett_opcua_ContentFilterResult; +gint ett_opcua_array_ContentFilterResult; +gint ett_opcua_ParsingResult; +gint ett_opcua_array_ParsingResult; +gint ett_opcua_ReadValueId; +gint ett_opcua_array_ReadValueId; +gint ett_opcua_HistoryReadValueId; +gint ett_opcua_array_HistoryReadValueId; +gint ett_opcua_HistoryReadResult; +gint ett_opcua_array_HistoryReadResult; +gint ett_opcua_ReadEventDetails; +gint ett_opcua_array_ReadEventDetails; +gint ett_opcua_ReadRawModifiedDetails; +gint ett_opcua_array_ReadRawModifiedDetails; +gint ett_opcua_ReadProcessedDetails; +gint ett_opcua_array_ReadProcessedDetails; +gint ett_opcua_ReadAtTimeDetails; +gint ett_opcua_array_ReadAtTimeDetails; +gint ett_opcua_HistoryData; +gint ett_opcua_array_HistoryData; +gint ett_opcua_ModificationInfo; +gint ett_opcua_array_ModificationInfo; +gint ett_opcua_HistoryModifiedData; +gint ett_opcua_array_HistoryModifiedData; +gint ett_opcua_HistoryEvent; +gint ett_opcua_array_HistoryEvent; +gint ett_opcua_WriteValue; +gint ett_opcua_array_WriteValue; +gint ett_opcua_HistoryUpdateDetails; +gint ett_opcua_array_HistoryUpdateDetails; +gint ett_opcua_UpdateDataDetails; +gint ett_opcua_array_UpdateDataDetails; +gint ett_opcua_UpdateStructureDataDetails; +gint ett_opcua_array_UpdateStructureDataDetails; +gint ett_opcua_UpdateEventDetails; +gint ett_opcua_array_UpdateEventDetails; +gint ett_opcua_DeleteRawModifiedDetails; +gint ett_opcua_array_DeleteRawModifiedDetails; +gint ett_opcua_DeleteAtTimeDetails; +gint ett_opcua_array_DeleteAtTimeDetails; +gint ett_opcua_DeleteEventDetails; +gint ett_opcua_array_DeleteEventDetails; +gint ett_opcua_HistoryUpdateResult; +gint ett_opcua_array_HistoryUpdateResult; +gint ett_opcua_CallMethodRequest; +gint ett_opcua_array_CallMethodRequest; +gint ett_opcua_CallMethodResult; +gint ett_opcua_array_CallMethodResult; +gint ett_opcua_DataChangeFilter; +gint ett_opcua_array_DataChangeFilter; +gint ett_opcua_EventFilter; +gint ett_opcua_array_EventFilter; +gint ett_opcua_AggregateConfiguration; +gint ett_opcua_array_AggregateConfiguration; +gint ett_opcua_AggregateFilter; +gint ett_opcua_array_AggregateFilter; +gint ett_opcua_EventFilterResult; +gint ett_opcua_array_EventFilterResult; +gint ett_opcua_AggregateFilterResult; +gint ett_opcua_array_AggregateFilterResult; +gint ett_opcua_MonitoringParameters; +gint ett_opcua_array_MonitoringParameters; +gint ett_opcua_MonitoredItemCreateRequest; +gint ett_opcua_array_MonitoredItemCreateRequest; +gint ett_opcua_MonitoredItemCreateResult; +gint ett_opcua_array_MonitoredItemCreateResult; +gint ett_opcua_MonitoredItemModifyRequest; +gint ett_opcua_array_MonitoredItemModifyRequest; +gint ett_opcua_MonitoredItemModifyResult; +gint ett_opcua_array_MonitoredItemModifyResult; +gint ett_opcua_NotificationMessage; +gint ett_opcua_array_NotificationMessage; +gint ett_opcua_DataChangeNotification; +gint ett_opcua_array_DataChangeNotification; +gint ett_opcua_MonitoredItemNotification; +gint ett_opcua_array_MonitoredItemNotification; +gint ett_opcua_EventNotificationList; +gint ett_opcua_array_EventNotificationList; +gint ett_opcua_EventFieldList; +gint ett_opcua_array_EventFieldList; +gint ett_opcua_HistoryEventFieldList; +gint ett_opcua_array_HistoryEventFieldList; +gint ett_opcua_StatusChangeNotification; +gint ett_opcua_array_StatusChangeNotification; +gint ett_opcua_SubscriptionAcknowledgement; +gint ett_opcua_array_SubscriptionAcknowledgement; +gint ett_opcua_TransferResult; +gint ett_opcua_array_TransferResult; +gint ett_opcua_ScalarTestType; +gint ett_opcua_array_ScalarTestType; +gint ett_opcua_ArrayTestType; +gint ett_opcua_array_ArrayTestType; +gint ett_opcua_CompositeTestType; +gint ett_opcua_array_CompositeTestType; +gint ett_opcua_BuildInfo; +gint ett_opcua_array_BuildInfo; +gint ett_opcua_RedundantServerDataType; +gint ett_opcua_array_RedundantServerDataType; +gint ett_opcua_EndpointUrlListDataType; +gint ett_opcua_array_EndpointUrlListDataType; +gint ett_opcua_NetworkGroupDataType; +gint ett_opcua_array_NetworkGroupDataType; +gint ett_opcua_SamplingIntervalDiagnosticsDataType; +gint ett_opcua_array_SamplingIntervalDiagnosticsDataType; +gint ett_opcua_ServerDiagnosticsSummaryDataType; +gint ett_opcua_array_ServerDiagnosticsSummaryDataType; +gint ett_opcua_ServerStatusDataType; +gint ett_opcua_array_ServerStatusDataType; +gint ett_opcua_SessionDiagnosticsDataType; +gint ett_opcua_array_SessionDiagnosticsDataType; +gint ett_opcua_SessionSecurityDiagnosticsDataType; +gint ett_opcua_array_SessionSecurityDiagnosticsDataType; +gint ett_opcua_ServiceCounterDataType; +gint ett_opcua_array_ServiceCounterDataType; +gint ett_opcua_StatusResult; +gint ett_opcua_array_StatusResult; +gint ett_opcua_SubscriptionDiagnosticsDataType; +gint ett_opcua_array_SubscriptionDiagnosticsDataType; +gint ett_opcua_ModelChangeStructureDataType; +gint ett_opcua_array_ModelChangeStructureDataType; +gint ett_opcua_SemanticChangeStructureDataType; +gint ett_opcua_array_SemanticChangeStructureDataType; +gint ett_opcua_Range; +gint ett_opcua_array_Range; +gint ett_opcua_EUInformation; +gint ett_opcua_array_EUInformation; +gint ett_opcua_ComplexNumberType; +gint ett_opcua_array_ComplexNumberType; +gint ett_opcua_DoubleComplexNumberType; +gint ett_opcua_array_DoubleComplexNumberType; +gint ett_opcua_AxisInformation; +gint ett_opcua_array_AxisInformation; +gint ett_opcua_XVType; +gint ett_opcua_array_XVType; +gint ett_opcua_ProgramDiagnosticDataType; +gint ett_opcua_array_ProgramDiagnosticDataType; +gint ett_opcua_Annotation; +gint ett_opcua_array_Annotation; void parseTrustListDataType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName) { @@ -637,7 +637,7 @@ void parseEndpointDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pinf 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); + parseCertificate(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 */ @@ -1817,7 +1817,7 @@ void parseSessionSecurityDiagnosticsDataType(proto_tree *tree, tvbuff_t *tvb, pa 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); + parseCertificate(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) diff --git a/plugins/epan/opcua/opcua_enumparser.c b/plugins/epan/opcua/opcua_enumparser.c index 9b3bd4b77c..7a25e18d5a 100644 --- a/plugins/epan/opcua/opcua_enumparser.c +++ b/plugins/epan/opcua/opcua_enumparser.c @@ -22,34 +22,34 @@ #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; +gint ett_opcua_array_NodeIdType; +gint ett_opcua_array_NamingRuleType; +gint ett_opcua_array_OpenFileMode; +gint ett_opcua_array_TrustListMasks; +gint ett_opcua_array_IdType; +gint ett_opcua_array_NodeClass; +gint ett_opcua_array_ApplicationType; +gint ett_opcua_array_MessageSecurityMode; +gint ett_opcua_array_UserTokenType; +gint ett_opcua_array_SecurityTokenRequestType; +gint ett_opcua_array_NodeAttributesMask; +gint ett_opcua_array_AttributeWriteMask; +gint ett_opcua_array_BrowseDirection; +gint ett_opcua_array_BrowseResultMask; +gint ett_opcua_array_ComplianceLevel; +gint ett_opcua_array_FilterOperator; +gint ett_opcua_array_TimestampsToReturn; +gint ett_opcua_array_HistoryUpdateType; +gint ett_opcua_array_PerformUpdateType; +gint ett_opcua_array_MonitoringMode; +gint ett_opcua_array_DataChangeTrigger; +gint ett_opcua_array_DeadbandType; +gint ett_opcua_array_EnumeratedTestType; +gint ett_opcua_array_RedundancySupport; +gint ett_opcua_array_ServerState; +gint ett_opcua_array_ModelChangeStructureVerbMask; +gint ett_opcua_array_AxisScaleEnumeration; +gint ett_opcua_array_ExceptionDeviationFormat; /** NodeIdType enum table */ static const value_string g_NodeIdTypeTable[] = { @@ -61,7 +61,7 @@ static const value_string g_NodeIdTypeTable[] = { { 5, "ByteString" }, { 0, NULL } }; -static int hf_opcua_NodeIdType = -1; +static int hf_opcua_NodeIdType; void parseNodeIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -74,7 +74,7 @@ static const value_string g_NamingRuleTypeTable[] = { { 3, "Constraint" }, { 0, NULL } }; -static int hf_opcua_NamingRuleType = -1; +static int hf_opcua_NamingRuleType; void parseNamingRuleType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -88,7 +88,7 @@ static const value_string g_OpenFileModeTable[] = { { 8, "Append" }, { 0, NULL } }; -static int hf_opcua_OpenFileMode = -1; +static int hf_opcua_OpenFileMode; void parseOpenFileMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -104,7 +104,7 @@ static const value_string g_TrustListMasksTable[] = { { 15, "All" }, { 0, NULL } }; -static int hf_opcua_TrustListMasks = -1; +static int hf_opcua_TrustListMasks; void parseTrustListMasks(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -118,7 +118,7 @@ static const value_string g_IdTypeTable[] = { { 3, "Opaque" }, { 0, NULL } }; -static int hf_opcua_IdType = -1; +static int hf_opcua_IdType; void parseIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -137,7 +137,7 @@ static const value_string g_NodeClassTable[] = { { 128, "View" }, { 0, NULL } }; -static int hf_opcua_NodeClass = -1; +static int hf_opcua_NodeClass; void parseNodeClass(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -151,7 +151,7 @@ static const value_string g_ApplicationTypeTable[] = { { 3, "DiscoveryServer" }, { 0, NULL } }; -static int hf_opcua_ApplicationType = -1; +static int hf_opcua_ApplicationType; void parseApplicationType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -165,7 +165,7 @@ static const value_string g_MessageSecurityModeTable[] = { { 3, "SignAndEncrypt" }, { 0, NULL } }; -static int hf_opcua_MessageSecurityMode = -1; +static int hf_opcua_MessageSecurityMode; void parseMessageSecurityMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -180,7 +180,7 @@ static const value_string g_UserTokenTypeTable[] = { { 4, "Kerberos" }, { 0, NULL } }; -static int hf_opcua_UserTokenType = -1; +static int hf_opcua_UserTokenType; void parseUserTokenType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -192,7 +192,7 @@ static const value_string g_SecurityTokenRequestTypeTable[] = { { 1, "Renew" }, { 0, NULL } }; -static int hf_opcua_SecurityTokenRequestType = -1; +static int hf_opcua_SecurityTokenRequestType; void parseSecurityTokenRequestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -234,7 +234,7 @@ static const value_string g_NodeAttributesMaskTable[] = { { 1335532, "View" }, { 0, NULL } }; -static int hf_opcua_NodeAttributesMask = -1; +static int hf_opcua_NodeAttributesMask; void parseNodeAttributesMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -271,7 +271,7 @@ static const value_string g_AttributeWriteMaskTable[] = { { 33554432, "AccessLevelEx" }, { 0, NULL } }; -static int hf_opcua_AttributeWriteMask = -1; +static int hf_opcua_AttributeWriteMask; void parseAttributeWriteMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -282,9 +282,10 @@ static const value_string g_BrowseDirectionTable[] = { { 0, "Forward" }, { 1, "Inverse" }, { 2, "Both" }, + { 3, "Invalid" }, { 0, NULL } }; -static int hf_opcua_BrowseDirection = -1; +static int hf_opcua_BrowseDirection; void parseBrowseDirection(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -299,7 +300,7 @@ static const value_string g_ComplianceLevelTable[] = { { 3, "Certified" }, { 0, NULL } }; -static int hf_opcua_ComplianceLevel = -1; +static int hf_opcua_ComplianceLevel; void parseComplianceLevel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -327,7 +328,7 @@ static const value_string g_FilterOperatorTable[] = { { 17, "BitwiseOr" }, { 0, NULL } }; -static int hf_opcua_FilterOperator = -1; +static int hf_opcua_FilterOperator; void parseFilterOperator(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -342,7 +343,7 @@ static const value_string g_TimestampsToReturnTable[] = { { 4, "Invalid" }, { 0, NULL } }; -static int hf_opcua_TimestampsToReturn = -1; +static int hf_opcua_TimestampsToReturn; void parseTimestampsToReturn(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -356,7 +357,7 @@ static const value_string g_HistoryUpdateTypeTable[] = { { 4, "Delete" }, { 0, NULL } }; -static int hf_opcua_HistoryUpdateType = -1; +static int hf_opcua_HistoryUpdateType; void parseHistoryUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -370,7 +371,7 @@ static const value_string g_PerformUpdateTypeTable[] = { { 4, "Remove" }, { 0, NULL } }; -static int hf_opcua_PerformUpdateType = -1; +static int hf_opcua_PerformUpdateType; void parsePerformUpdateType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -383,7 +384,7 @@ static const value_string g_MonitoringModeTable[] = { { 2, "Reporting" }, { 0, NULL } }; -static int hf_opcua_MonitoringMode = -1; +static int hf_opcua_MonitoringMode; void parseMonitoringMode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -396,7 +397,7 @@ static const value_string g_DataChangeTriggerTable[] = { { 2, "StatusValueTimestamp" }, { 0, NULL } }; -static int hf_opcua_DataChangeTrigger = -1; +static int hf_opcua_DataChangeTrigger; void parseDataChangeTrigger(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -409,7 +410,7 @@ static const value_string g_DeadbandTypeTable[] = { { 2, "Percent" }, { 0, NULL } }; -static int hf_opcua_DeadbandType = -1; +static int hf_opcua_DeadbandType; void parseDeadbandType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -422,7 +423,7 @@ static const value_string g_EnumeratedTestTypeTable[] = { { 5, "Green" }, { 0, NULL } }; -static int hf_opcua_EnumeratedTestType = -1; +static int hf_opcua_EnumeratedTestType; void parseEnumeratedTestType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -438,7 +439,7 @@ static const value_string g_RedundancySupportTable[] = { { 5, "HotAndMirrored" }, { 0, NULL } }; -static int hf_opcua_RedundancySupport = -1; +static int hf_opcua_RedundancySupport; void parseRedundancySupport(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -456,7 +457,7 @@ static const value_string g_ServerStateTable[] = { { 7, "Unknown" }, { 0, NULL } }; -static int hf_opcua_ServerState = -1; +static int hf_opcua_ServerState; void parseServerState(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -471,7 +472,7 @@ static const value_string g_ModelChangeStructureVerbMaskTable[] = { { 16, "DataTypeChanged" }, { 0, NULL } }; -static int hf_opcua_ModelChangeStructureVerbMask = -1; +static int hf_opcua_ModelChangeStructureVerbMask; void parseModelChangeStructureVerbMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -484,7 +485,7 @@ static const value_string g_AxisScaleEnumerationTable[] = { { 2, "Ln" }, { 0, NULL } }; -static int hf_opcua_AxisScaleEnumeration = -1; +static int hf_opcua_AxisScaleEnumeration; void parseAxisScaleEnumeration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -499,7 +500,7 @@ static const value_string g_ExceptionDeviationFormatTable[] = { { 4, "Unknown" }, { 0, NULL } }; -static int hf_opcua_ExceptionDeviationFormat = -1; +static int hf_opcua_ExceptionDeviationFormat; void parseExceptionDeviationFormat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { @@ -536,7 +537,7 @@ static const value_string g_AttributeIdTable[] = { {27, "AccessLevelEx"}, {0, NULL} }; -static int hf_opcua_AttributeId = -1; +static int hf_opcua_AttributeId; void parseAttributeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) { diff --git a/plugins/epan/opcua/opcua_hfindeces.c b/plugins/epan/opcua/opcua_hfindeces.c index 255927f96f..9982154961 100644 --- a/plugins/epan/opcua/opcua_hfindeces.c +++ b/plugins/epan/opcua/opcua_hfindeces.c @@ -22,302 +22,302 @@ #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; +int hf_opcua_AccessLevel; +int hf_opcua_ActualSessionTimeout; +int hf_opcua_AddResults; +int hf_opcua_Algorithm; +int hf_opcua_Alias; +int hf_opcua_AnnotationTime; +int hf_opcua_ApplicationUri; +int hf_opcua_ArrayDimensions; +int hf_opcua_AuditEntryId; +int hf_opcua_AuthenticationMechanism; +int hf_opcua_AvailableSequenceNumbers; +int hf_opcua_AxisSteps; +int hf_opcua_Boolean; +int hf_opcua_Booleans; +int hf_opcua_BuildDate; +int hf_opcua_BuildNumber; +int hf_opcua_Byte; +int hf_opcua_ByteString; +int hf_opcua_ByteStrings; +int hf_opcua_CancelCount; +int hf_opcua_CertificateData; +int hf_opcua_ChannelId; +int hf_opcua_ChannelLifetime; +int hf_opcua_ClientCertificate; +int hf_opcua_ClientConnectionTime; +int hf_opcua_ClientHandle; +int hf_opcua_ClientLastContactTime; +int hf_opcua_ClientNonce; +int hf_opcua_ClientProtocolVersion; +int hf_opcua_ClientUserIdHistory; +int hf_opcua_ClientUserIdOfSession; +int hf_opcua_ComplianceDate; +int hf_opcua_ComplianceTool; +int hf_opcua_ConfigurationResults; +int hf_opcua_ContainsNoLoops; +int hf_opcua_ContinuationPoint; +int hf_opcua_ContinuationPoints; +int hf_opcua_CreateClientName; +int hf_opcua_CreatedAt; +int hf_opcua_CumulatedSessionCount; +int hf_opcua_CumulatedSubscriptionCount; +int hf_opcua_CurrentKeepAliveCount; +int hf_opcua_CurrentLifetimeCount; +int hf_opcua_CurrentMonitoredItemsCount; +int hf_opcua_CurrentPublishRequestsInQueue; +int hf_opcua_CurrentSessionCount; +int hf_opcua_CurrentSubscriptionCount; +int hf_opcua_CurrentSubscriptionsCount; +int hf_opcua_CurrentTime; +int hf_opcua_DataChangeNotificationsCount; +int hf_opcua_DataStatusCodes; +int hf_opcua_DateTime; +int hf_opcua_DateTimes; +int hf_opcua_DaylightSavingInOffset; +int hf_opcua_DeadbandType; +int hf_opcua_DeadbandValue; +int hf_opcua_DeleteBidirectional; +int hf_opcua_DeleteSubscriptions; +int hf_opcua_DeleteTargetReferences; +int hf_opcua_DisableCount; +int hf_opcua_DisabledMonitoredItemCount; +int hf_opcua_DiscardOldest; +int hf_opcua_DiscardedMessageCount; +int hf_opcua_DiscoveryProfileUri; +int hf_opcua_DiscoveryUrl; +int hf_opcua_DiscoveryUrls; +int hf_opcua_Double; +int hf_opcua_Doubles; +int hf_opcua_EnableCount; +int hf_opcua_Encoding; +int hf_opcua_EncryptionAlgorithm; +int hf_opcua_EndTime; +int hf_opcua_EndpointUrl; +int hf_opcua_EndpointUrlList; +int hf_opcua_ErrorCount; +int hf_opcua_EventIds; +int hf_opcua_EventNotificationsCount; +int hf_opcua_EventNotifier; +int hf_opcua_EventQueueOverFlowCount; +int hf_opcua_Executable; +int hf_opcua_Float; +int hf_opcua_Floats; +int hf_opcua_GatewayServerUri; +int hf_opcua_Guid; +int hf_opcua_Guids; +int hf_opcua_High; +int hf_opcua_Historizing; +int hf_opcua_Imaginary; +int hf_opcua_IncludeSubTypes; +int hf_opcua_IncludeSubtypes; +int hf_opcua_Index; +int hf_opcua_IndexRange; +int hf_opcua_InputArgumentResults; +int hf_opcua_Int16; +int hf_opcua_Int16s; +int hf_opcua_Int32; +int hf_opcua_Int32s; +int hf_opcua_Int64; +int hf_opcua_Int64s; +int hf_opcua_InvocationCreationTime; +int hf_opcua_IsAbstract; +int hf_opcua_IsDeleteModified; +int hf_opcua_IsForward; +int hf_opcua_IsInverse; +int hf_opcua_IsOnline; +int hf_opcua_IsReadModified; +int hf_opcua_IssueDate; +int hf_opcua_IssuedBy; +int hf_opcua_IssuedTokenType; +int hf_opcua_IssuerCertificates; +int hf_opcua_IssuerCrls; +int hf_opcua_IssuerEndpointUrl; +int hf_opcua_Iteration; +int hf_opcua_LastCounterResetTime; +int hf_opcua_LastMethodCall; +int hf_opcua_LastMethodCallTime; +int hf_opcua_LastTransitionTime; +int hf_opcua_LatePublishRequestCount; +int hf_opcua_LinksToAdd; +int hf_opcua_LinksToRemove; +int hf_opcua_LocaleIds; +int hf_opcua_Low; +int hf_opcua_ManufacturerName; +int hf_opcua_MaxAge; +int hf_opcua_MaxArrayLength; +int hf_opcua_MaxBufferSize; +int hf_opcua_MaxByteStringLength; +int hf_opcua_MaxDataSetsToReturn; +int hf_opcua_MaxKeepAliveCount; +int hf_opcua_MaxLifetimeCount; +int hf_opcua_MaxMessageSize; +int hf_opcua_MaxMonitoredItemCount; +int hf_opcua_MaxNotificationsPerPublish; +int hf_opcua_MaxRecordsToReturn; +int hf_opcua_MaxReferencesToReturn; +int hf_opcua_MaxRequestMessageSize; +int hf_opcua_MaxResponseMessageSize; +int hf_opcua_MaxStringLength; +int hf_opcua_MdnsServerName; +int hf_opcua_Message; +int hf_opcua_MinimumSamplingInterval; +int hf_opcua_ModificationTime; +int hf_opcua_ModifyCount; +int hf_opcua_MonitoredItemCount; +int hf_opcua_MonitoredItemId; +int hf_opcua_MonitoredItemIds; +int hf_opcua_MonitoringQueueOverflowCount; +int hf_opcua_MoreNotifications; +int hf_opcua_Name; +int hf_opcua_NamespaceUri; +int hf_opcua_NextSequenceNumber; +int hf_opcua_NotificationsCount; +int hf_opcua_NumValuesPerNode; +int hf_opcua_Offset; +int hf_opcua_OperandStatusCodes; +int hf_opcua_OperationResults; +int hf_opcua_OperationTimeout; +int hf_opcua_OrganizationUri; +int hf_opcua_Password; +int hf_opcua_PercentDataBad; +int hf_opcua_PercentDataGood; +int hf_opcua_PolicyId; +int hf_opcua_Priority; +int hf_opcua_ProcessingInterval; +int hf_opcua_ProductName; +int hf_opcua_ProductUri; +int hf_opcua_ProfileId; +int hf_opcua_ProfileUris; +int hf_opcua_PublishRequestCount; +int hf_opcua_PublishTime; +int hf_opcua_PublishingEnabled; +int hf_opcua_PublishingInterval; +int hf_opcua_PublishingIntervalCount; +int hf_opcua_QueueSize; +int hf_opcua_Real; +int hf_opcua_RecordId; +int hf_opcua_RejectedRequestsCount; +int hf_opcua_RejectedSessionCount; +int hf_opcua_ReleaseContinuationPoint; +int hf_opcua_ReleaseContinuationPoints; +int hf_opcua_RemainingPathIndex; +int hf_opcua_RemoveResults; +int hf_opcua_RepublishMessageCount; +int hf_opcua_RepublishMessageRequestCount; +int hf_opcua_RepublishRequestCount; +int hf_opcua_ReqTimes; +int hf_opcua_RequestHandle; +int hf_opcua_RequestedLifetime; +int hf_opcua_RequestedLifetimeCount; +int hf_opcua_RequestedMaxKeepAliveCount; +int hf_opcua_RequestedMaxReferencesPerNode; +int hf_opcua_RequestedPublishingInterval; +int hf_opcua_RequestedSessionTimeout; +int hf_opcua_Results; +int hf_opcua_RetransmitSequenceNumber; +int hf_opcua_ReturnBounds; +int hf_opcua_ReturnDiagnostics; +int hf_opcua_RevisedContinuationPoint; +int hf_opcua_RevisedLifetime; +int hf_opcua_RevisedLifetimeCount; +int hf_opcua_RevisedMaxKeepAliveCount; +int hf_opcua_RevisedProcessingInterval; +int hf_opcua_RevisedPublishingInterval; +int hf_opcua_RevisedQueueSize; +int hf_opcua_RevisedSamplingInterval; +int hf_opcua_RevisedSessionTimeout; +int hf_opcua_RevisedStartTime; +int hf_opcua_SByte; +int hf_opcua_SBytes; +int hf_opcua_SamplingInterval; +int hf_opcua_SecondsTillShutdown; +int hf_opcua_SecurityLevel; +int hf_opcua_SecurityPolicyUri; +int hf_opcua_SecurityRejectedRequestsCount; +int hf_opcua_SecurityRejectedSessionCount; +int hf_opcua_SecurityTokenLifetime; +int hf_opcua_SelectClauseResults; +int hf_opcua_SemaphoreFilePath; +int hf_opcua_SendInitialValues; +int hf_opcua_SequenceNumber; +int hf_opcua_ServerCapabilities; +int hf_opcua_ServerCapabilityFilter; +int hf_opcua_ServerCertificate; +int hf_opcua_ServerId; +int hf_opcua_ServerName; +int hf_opcua_ServerNonce; +int hf_opcua_ServerProtocolVersion; +int hf_opcua_ServerUri; +int hf_opcua_ServerUris; +int hf_opcua_ServerViewCount; +int hf_opcua_ServiceLevel; +int hf_opcua_ServiceResult; +int hf_opcua_SessionAbortCount; +int hf_opcua_SessionName; +int hf_opcua_SessionTimeoutCount; +int hf_opcua_Signature; +int hf_opcua_SoftwareVersion; +int hf_opcua_SpecifiedAttributes; +int hf_opcua_SpecifiedLists; +int hf_opcua_StartTime; +int hf_opcua_StartingRecordId; +int hf_opcua_Status; +int hf_opcua_StatusCode; +int hf_opcua_StatusCodes; +int hf_opcua_String; +int hf_opcua_StringTable; +int hf_opcua_Strings; +int hf_opcua_SubscriptionId; +int hf_opcua_SubscriptionIds; +int hf_opcua_Symmetric; +int hf_opcua_TargetServerUri; +int hf_opcua_TestId; +int hf_opcua_TicketData; +int hf_opcua_TimeoutHint; +int hf_opcua_Timestamp; +int hf_opcua_TokenData; +int hf_opcua_TokenId; +int hf_opcua_TotalCount; +int hf_opcua_TransferRequestCount; +int hf_opcua_TransferredToAltClientCount; +int hf_opcua_TransferredToSameClientCount; +int hf_opcua_TransportProfileUri; +int hf_opcua_TransportProtocol; +int hf_opcua_TreatUncertainAsBad; +int hf_opcua_TriggeringItemId; +int hf_opcua_TrustedCertificates; +int hf_opcua_TrustedCrls; +int hf_opcua_UInt16; +int hf_opcua_UInt16s; +int hf_opcua_UInt32; +int hf_opcua_UInt32s; +int hf_opcua_UInt64; +int hf_opcua_UInt64s; +int hf_opcua_UnacknowledgedMessageCount; +int hf_opcua_UnauthorizedRequestCount; +int hf_opcua_UnitId; +int hf_opcua_UnsupportedUnitIds; +int hf_opcua_UseBinaryEncoding; +int hf_opcua_UseServerCapabilitiesDefaults; +int hf_opcua_UseSimpleBounds; +int hf_opcua_UseSlopedExtrapolation; +int hf_opcua_UserAccessLevel; +int hf_opcua_UserExecutable; +int hf_opcua_UserName; +int hf_opcua_UserWriteMask; +int hf_opcua_ValidBits; +int hf_opcua_Value; +int hf_opcua_ValueRank; +int hf_opcua_VendorName; +int hf_opcua_VendorProductCertificate; +int hf_opcua_Verb; +int hf_opcua_ViewVersion; +int hf_opcua_WriteMask; +int hf_opcua_X; +int hf_opcua_XmlElement; +int hf_opcua_XmlElements; /** Register field types. */ void registerFieldTypes(int proto) diff --git a/plugins/epan/opcua/opcua_keyset.c b/plugins/epan/opcua/opcua_keyset.c new file mode 100644 index 0000000000..eba1d2deca --- /dev/null +++ b/plugins/epan/opcua/opcua_keyset.c @@ -0,0 +1,156 @@ +/****************************************************************************** +** Copyright (C) 2006-2023 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 <gerhard.gappmeier@ascolab.com> +******************************************************************************/ + +#include "opcua_keyset.h" +#include <stdbool.h> +#include <stddef.h> +#include <stdlib.h> +#include <epan/packet.h> + +static struct ua_keyset *g_keysets; +static unsigned int g_num_keysets; +static bool g_sorted; + +int ua_keysets_init(void) +{ + g_keysets = NULL; + g_num_keysets = 0; + g_sorted = false; + return 0; +} + +int ua_keysets_clear(void) +{ + if (g_keysets) { + g_free(g_keysets); + g_keysets = NULL; + } + g_num_keysets = 0; + g_sorted = false; + return 0; +} + +/** + * Allocates a new keyset entry. + * + * @return Returns pointer to new empty keyset. + * NULL would indicate an out of memory situation. + */ +struct ua_keyset *ua_keysets_add(void) +{ + struct ua_keyset *tmp = g_realloc(g_keysets, sizeof(*g_keysets) * (g_num_keysets + 1)); + if (tmp == NULL) return NULL; /* out of mem */ + /* realloc succeeded, assign new pointer */ + g_keysets = tmp; + /* return new element */ + tmp = &g_keysets[g_num_keysets++]; + memset(tmp, 0, sizeof(*tmp)); + /* default to 32 byte sig_len if missing. + * This is the most likely length for SHA256 based signatures, + * SHA1 based signatures with 16 bytes are deprecated. + */ + tmp->client_sig_len = 32; + tmp->server_sig_len = 32; + return tmp; +} + +/** + * Compare function for bsearch/qsort. + * Sorts by keyset->id. + */ +static int keyset_compare(const void *a, const void *b) +{ + const struct ua_keyset *keyset_a = a; + const struct ua_keyset *keyset_b = b; + + if (keyset_a->id == keyset_b->id) return 0; + if (keyset_a->id < keyset_b->id) return -1; + return 1; +} + +/** + * Sorts the keyset to be able to use bsearch. + */ +void ua_keysets_sort(void) +{ + if (g_num_keysets >= 2) { + qsort(g_keysets, g_num_keysets, sizeof(struct ua_keyset), keyset_compare); + } + + g_sorted = true; +} + +/** + * Looks up a keyset by id. + * + * @param id The id is 64bit value which contains the combined securechannel_id and token_id. + * + * @return Keyset if found, NULL if not found. + */ +struct ua_keyset *ua_keysets_lookup(uint64_t id) +{ + struct ua_keyset *tmp, key; + + if (!g_sorted) return NULL; + + key.id = id; + tmp = bsearch(&key, g_keysets, g_num_keysets, sizeof(struct ua_keyset), keyset_compare); + + return tmp; +} + +static void print_hex(unsigned char *data, unsigned int data_len) +{ + unsigned int i; + + for (i = 0; i < data_len; ++i) { + printf("%02X", data[i]); + } + printf("\n"); +} + +/** + * For debugging purposes only. + */ +void ua_keysets_dump(void) +{ + struct ua_keyset *tmp; + unsigned int i; + uint32_t channel_id, token_id; + + printf("Number of keysets: %u\n", g_num_keysets); + + for (i = 0; i < g_num_keysets; ++i) { + tmp = &g_keysets[i]; + channel_id = (uint32_t)(tmp->id >> 32); + token_id = (uint32_t)(tmp->id & 0xffffffff); + + printf("%u: id=%" PRIu64 ", channel_id=%u, token_id=%u\n", i, tmp->id, channel_id, token_id); + + printf("%u: client IV: ", i); + print_hex(tmp->client_iv, sizeof(tmp->client_iv)); + printf("%u: client key(%u): ", i, tmp->client_key_len); + print_hex(tmp->client_key, tmp->client_key_len); + printf("%u: client sig_len(%u): ", i, tmp->client_sig_len); + + printf("%u: server IV: ", i); + print_hex(tmp->server_iv, sizeof(tmp->server_iv)); + printf("%u: server key(%u): ", i, tmp->server_key_len); + print_hex(tmp->server_key, tmp->server_key_len); + printf("%u: server sig_len(%u): ", i, tmp->server_sig_len); + } +} + diff --git a/plugins/epan/opcua/opcua_keyset.h b/plugins/epan/opcua/opcua_keyset.h new file mode 100644 index 0000000000..0492427b4c --- /dev/null +++ b/plugins/epan/opcua/opcua_keyset.h @@ -0,0 +1,59 @@ +/****************************************************************************** +** Copyright (C) 2006-2023 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 <gerhard.gappmeier@ascolab.com> +******************************************************************************/ + +#ifndef __OPCUA_KEYSET_H__ +#define __OPCUA_KEYSET_H__ + +#include <stdint.h> + +/** symmetric encryption keyset */ +struct ua_keyset { + uint64_t id; /** keyset identifier: combination of securechannel_id and token_id */ + unsigned char client_iv[16]; /**< Client side IV. Always 128 bit. */ + unsigned char server_iv[16]; /**< Server side IV. Always 128 bit. */ + unsigned char client_key[32]; /**< client encryption key */ + unsigned char server_key[32]; /**< server encryption key */ + unsigned int client_key_len; /**< AES key length: 16 (AES-128) or 32 (AES-256) */ + unsigned int server_key_len; /**< AES key length: 16 (AES-128) or 32 (AES-256) */ + unsigned int client_sig_len; /**< Client side symmetric signture length. */ + unsigned int server_sig_len; /**< Server side symmetric signture length. */ +}; + +int ua_keysets_init(void); +int ua_keysets_clear(void); + +/** + * Creates a unique keyset id from securechannel_id and token_id. + * + * @param securechannel_id Identifies the secure channel to be able to distinguish + * different connections. This is a randomly generated id. + * @param token_id Identifies the keyset of a channel. This number normally starts with + * 1 and gets incremented with every secure channel renew. + * + * @return 64bit Id. + */ +static inline uint64_t ua_keyset_id(uint32_t securechannel_id, uint32_t token_id) +{ + return ((uint64_t)securechannel_id << 32) | token_id; +} + +struct ua_keyset *ua_keysets_add(void); +void ua_keysets_sort(void); +struct ua_keyset *ua_keysets_lookup(uint64_t id); +void ua_keysets_dump(void); + +#endif /* __OPCUA_KEYSET_H__ */ + diff --git a/plugins/epan/opcua/opcua_security_layer.c b/plugins/epan/opcua/opcua_security_layer.c index 933fd981d1..5e66c1a194 100644 --- a/plugins/epan/opcua/opcua_security_layer.c +++ b/plugins/epan/opcua/opcua_security_layer.c @@ -18,32 +18,65 @@ #include <epan/packet.h> #include "opcua_security_layer.h" +#include "opcua_transport_layer.h" -static int hf_opcua_security_tokenid = -1; -static int hf_opcua_security_seq = -1; -static int hf_opcua_security_rqid = -1; +static int hf_opcua_security_tokenid; +static int hf_opcua_security_padding; +static int hf_opcua_security_signature; +static int hf_opcua_sequence_seqno; +static int hf_opcua_sequence_rqid; -/** Register security layer types. */ +/** Register symmetric 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}} + /* 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_padding, {"Security Padding", "opcua.security.padding", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + {&hf_opcua_security_signature, {"Security Signature", "opcua.security.signature", FT_BYTES, BASE_NONE, 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) +/** Register sequence header types. */ +void registerSequenceLayerTypes(int proto) +{ + static hf_register_info hf[] = + { + /* id full name abbreviation type display strings bitmask blurb HFILL */ + {&hf_opcua_sequence_seqno, {"Sequence Number", "opcua.sequence.seq", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, + {&hf_opcua_sequence_rqid, {"RequestId", "opcua.sequence.rqid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}} + }; + proto_register_field_array(proto, hf, array_length(hf)); +} + +/* The symmetric security header consists only of one field. */ +void parseSecurityHeader(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, struct ua_metadata *data _U_) { 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; +} + +/* Sequence header can optionally be encrypted. */ +void parseSequenceHeader(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, struct ua_metadata *data) +{ + if (!data->encrypted) { + proto_tree_add_item(tree, hf_opcua_sequence_seqno, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; + proto_tree_add_item(tree, hf_opcua_sequence_rqid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; + } +} + +/* Parse symmetric security footer (signed only) */ +void parseSecurityFooterSO(proto_tree *tree, tvbuff_t *tvb, gint offset, guint sig_len) +{ + proto_tree_add_item(tree, hf_opcua_security_signature, tvb, offset, sig_len, ENC_NA); +} + +/* Parse symmetric security footer (signed and encrypted) */ +void parseSecurityFooterSAE(proto_tree *tree, tvbuff_t *tvb, gint offset, guint pad_len, guint sig_len) +{ + proto_tree_add_item(tree, hf_opcua_security_padding, tvb, offset, pad_len + 1, ENC_NA); + proto_tree_add_item(tree, hf_opcua_security_signature, tvb, offset + pad_len + 1, sig_len, ENC_NA); } /* diff --git a/plugins/epan/opcua/opcua_security_layer.h b/plugins/epan/opcua/opcua_security_layer.h index d5b36ce03b..c05a2d7242 100644 --- a/plugins/epan/opcua/opcua_security_layer.h +++ b/plugins/epan/opcua/opcua_security_layer.h @@ -14,5 +14,11 @@ ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com> ******************************************************************************/ +struct ua_metadata; + void registerSecurityLayerTypes(int proto); -void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); +void registerSequenceLayerTypes(int proto); +void parseSecurityHeader(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, struct ua_metadata *data); +void parseSequenceHeader(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, struct ua_metadata *data); +void parseSecurityFooterSO(proto_tree *tree, tvbuff_t *tvb, gint offset, guint sig_len); +void parseSecurityFooterSAE(proto_tree *tree, tvbuff_t *tvb, gint offset, guint pad_len, guint sig_len); diff --git a/plugins/epan/opcua/opcua_serviceparser.c b/plugins/epan/opcua/opcua_serviceparser.c index d71b67815e..a38c86e836 100644 --- a/plugins/epan/opcua/opcua_serviceparser.c +++ b/plugins/epan/opcua/opcua_serviceparser.c @@ -25,172 +25,172 @@ #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; +gint ett_opcua_ServiceFault; +gint ett_opcua_array_ServiceFault; +gint ett_opcua_FindServersRequest; +gint ett_opcua_array_FindServersRequest; +gint ett_opcua_FindServersResponse; +gint ett_opcua_array_FindServersResponse; +gint ett_opcua_FindServersOnNetworkRequest; +gint ett_opcua_array_FindServersOnNetworkRequest; +gint ett_opcua_FindServersOnNetworkResponse; +gint ett_opcua_array_FindServersOnNetworkResponse; +gint ett_opcua_GetEndpointsRequest; +gint ett_opcua_array_GetEndpointsRequest; +gint ett_opcua_GetEndpointsResponse; +gint ett_opcua_array_GetEndpointsResponse; +gint ett_opcua_RegisterServerRequest; +gint ett_opcua_array_RegisterServerRequest; +gint ett_opcua_RegisterServerResponse; +gint ett_opcua_array_RegisterServerResponse; +gint ett_opcua_RegisterServer2Request; +gint ett_opcua_array_RegisterServer2Request; +gint ett_opcua_RegisterServer2Response; +gint ett_opcua_array_RegisterServer2Response; +gint ett_opcua_OpenSecureChannelRequest; +gint ett_opcua_array_OpenSecureChannelRequest; +gint ett_opcua_OpenSecureChannelResponse; +gint ett_opcua_array_OpenSecureChannelResponse; +gint ett_opcua_CloseSecureChannelRequest; +gint ett_opcua_array_CloseSecureChannelRequest; +gint ett_opcua_CloseSecureChannelResponse; +gint ett_opcua_array_CloseSecureChannelResponse; +gint ett_opcua_CreateSessionRequest; +gint ett_opcua_array_CreateSessionRequest; +gint ett_opcua_CreateSessionResponse; +gint ett_opcua_array_CreateSessionResponse; +gint ett_opcua_ActivateSessionRequest; +gint ett_opcua_array_ActivateSessionRequest; +gint ett_opcua_ActivateSessionResponse; +gint ett_opcua_array_ActivateSessionResponse; +gint ett_opcua_CloseSessionRequest; +gint ett_opcua_array_CloseSessionRequest; +gint ett_opcua_CloseSessionResponse; +gint ett_opcua_array_CloseSessionResponse; +gint ett_opcua_CancelRequest; +gint ett_opcua_array_CancelRequest; +gint ett_opcua_CancelResponse; +gint ett_opcua_array_CancelResponse; +gint ett_opcua_AddNodesRequest; +gint ett_opcua_array_AddNodesRequest; +gint ett_opcua_AddNodesResponse; +gint ett_opcua_array_AddNodesResponse; +gint ett_opcua_AddReferencesRequest; +gint ett_opcua_array_AddReferencesRequest; +gint ett_opcua_AddReferencesResponse; +gint ett_opcua_array_AddReferencesResponse; +gint ett_opcua_DeleteNodesRequest; +gint ett_opcua_array_DeleteNodesRequest; +gint ett_opcua_DeleteNodesResponse; +gint ett_opcua_array_DeleteNodesResponse; +gint ett_opcua_DeleteReferencesRequest; +gint ett_opcua_array_DeleteReferencesRequest; +gint ett_opcua_DeleteReferencesResponse; +gint ett_opcua_array_DeleteReferencesResponse; +gint ett_opcua_BrowseRequest; +gint ett_opcua_array_BrowseRequest; +gint ett_opcua_BrowseResponse; +gint ett_opcua_array_BrowseResponse; +gint ett_opcua_BrowseNextRequest; +gint ett_opcua_array_BrowseNextRequest; +gint ett_opcua_BrowseNextResponse; +gint ett_opcua_array_BrowseNextResponse; +gint ett_opcua_TranslateBrowsePathsToNodeIdsRequest; +gint ett_opcua_array_TranslateBrowsePathsToNodeIdsRequest; +gint ett_opcua_TranslateBrowsePathsToNodeIdsResponse; +gint ett_opcua_array_TranslateBrowsePathsToNodeIdsResponse; +gint ett_opcua_RegisterNodesRequest; +gint ett_opcua_array_RegisterNodesRequest; +gint ett_opcua_RegisterNodesResponse; +gint ett_opcua_array_RegisterNodesResponse; +gint ett_opcua_UnregisterNodesRequest; +gint ett_opcua_array_UnregisterNodesRequest; +gint ett_opcua_UnregisterNodesResponse; +gint ett_opcua_array_UnregisterNodesResponse; +gint ett_opcua_QueryFirstRequest; +gint ett_opcua_array_QueryFirstRequest; +gint ett_opcua_QueryFirstResponse; +gint ett_opcua_array_QueryFirstResponse; +gint ett_opcua_QueryNextRequest; +gint ett_opcua_array_QueryNextRequest; +gint ett_opcua_QueryNextResponse; +gint ett_opcua_array_QueryNextResponse; +gint ett_opcua_ReadRequest; +gint ett_opcua_array_ReadRequest; +gint ett_opcua_ReadResponse; +gint ett_opcua_array_ReadResponse; +gint ett_opcua_HistoryReadRequest; +gint ett_opcua_array_HistoryReadRequest; +gint ett_opcua_HistoryReadResponse; +gint ett_opcua_array_HistoryReadResponse; +gint ett_opcua_WriteRequest; +gint ett_opcua_array_WriteRequest; +gint ett_opcua_WriteResponse; +gint ett_opcua_array_WriteResponse; +gint ett_opcua_HistoryUpdateRequest; +gint ett_opcua_array_HistoryUpdateRequest; +gint ett_opcua_HistoryUpdateResponse; +gint ett_opcua_array_HistoryUpdateResponse; +gint ett_opcua_CallRequest; +gint ett_opcua_array_CallRequest; +gint ett_opcua_CallResponse; +gint ett_opcua_array_CallResponse; +gint ett_opcua_CreateMonitoredItemsRequest; +gint ett_opcua_array_CreateMonitoredItemsRequest; +gint ett_opcua_CreateMonitoredItemsResponse; +gint ett_opcua_array_CreateMonitoredItemsResponse; +gint ett_opcua_ModifyMonitoredItemsRequest; +gint ett_opcua_array_ModifyMonitoredItemsRequest; +gint ett_opcua_ModifyMonitoredItemsResponse; +gint ett_opcua_array_ModifyMonitoredItemsResponse; +gint ett_opcua_SetMonitoringModeRequest; +gint ett_opcua_array_SetMonitoringModeRequest; +gint ett_opcua_SetMonitoringModeResponse; +gint ett_opcua_array_SetMonitoringModeResponse; +gint ett_opcua_SetTriggeringRequest; +gint ett_opcua_array_SetTriggeringRequest; +gint ett_opcua_SetTriggeringResponse; +gint ett_opcua_array_SetTriggeringResponse; +gint ett_opcua_DeleteMonitoredItemsRequest; +gint ett_opcua_array_DeleteMonitoredItemsRequest; +gint ett_opcua_DeleteMonitoredItemsResponse; +gint ett_opcua_array_DeleteMonitoredItemsResponse; +gint ett_opcua_CreateSubscriptionRequest; +gint ett_opcua_array_CreateSubscriptionRequest; +gint ett_opcua_CreateSubscriptionResponse; +gint ett_opcua_array_CreateSubscriptionResponse; +gint ett_opcua_ModifySubscriptionRequest; +gint ett_opcua_array_ModifySubscriptionRequest; +gint ett_opcua_ModifySubscriptionResponse; +gint ett_opcua_array_ModifySubscriptionResponse; +gint ett_opcua_SetPublishingModeRequest; +gint ett_opcua_array_SetPublishingModeRequest; +gint ett_opcua_SetPublishingModeResponse; +gint ett_opcua_array_SetPublishingModeResponse; +gint ett_opcua_PublishRequest; +gint ett_opcua_array_PublishRequest; +gint ett_opcua_PublishResponse; +gint ett_opcua_array_PublishResponse; +gint ett_opcua_RepublishRequest; +gint ett_opcua_array_RepublishRequest; +gint ett_opcua_RepublishResponse; +gint ett_opcua_array_RepublishResponse; +gint ett_opcua_TransferSubscriptionsRequest; +gint ett_opcua_array_TransferSubscriptionsRequest; +gint ett_opcua_TransferSubscriptionsResponse; +gint ett_opcua_array_TransferSubscriptionsResponse; +gint ett_opcua_DeleteSubscriptionsRequest; +gint ett_opcua_array_DeleteSubscriptionsRequest; +gint ett_opcua_DeleteSubscriptionsResponse; +gint ett_opcua_array_DeleteSubscriptionsResponse; +gint ett_opcua_TestStackRequest; +gint ett_opcua_array_TestStackRequest; +gint ett_opcua_TestStackResponse; +gint ett_opcua_array_TestStackResponse; +gint ett_opcua_TestStackExRequest; +gint ett_opcua_array_TestStackExRequest; +gint ett_opcua_TestStackExResponse; +gint ett_opcua_array_TestStackExResponse; void parseServiceFault(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) { @@ -360,7 +360,7 @@ void parseCreateSessionRequest(proto_tree *tree, tvbuff_t *tvb, packet_info *pin 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); + parseCertificate(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); @@ -375,7 +375,7 @@ void parseCreateSessionResponse(proto_tree *tree, tvbuff_t *tvb, packet_info *pi 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); + parseCertificate(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 */ diff --git a/plugins/epan/opcua/opcua_simpletypes.c b/plugins/epan/opcua/opcua_simpletypes.c index 945b528794..da98a823f5 100644 --- a/plugins/epan/opcua/opcua_simpletypes.c +++ b/plugins/epan/opcua/opcua_simpletypes.c @@ -19,8 +19,11 @@ #include <epan/packet.h> #include <epan/expert.h> -#include <epan/dissectors/packet-windows-common.h> +#include <epan/proto.h> #include <epan/proto_data.h> +#include <epan/asn1.h> +#include <epan/dissectors/packet-windows-common.h> +#include <epan/dissectors/packet-x509af.h> #include "opcua_simpletypes.h" #include "opcua_hfindeces.h" #include "opcua_statuscode.h" @@ -83,94 +86,94 @@ #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; +static int hf_opcua_diag_mask; +static int hf_opcua_diag_mask_symbolicflag; +static int hf_opcua_diag_mask_namespaceflag; +static int hf_opcua_diag_mask_localizedtextflag; +static int hf_opcua_diag_mask_localeflag; +static int hf_opcua_diag_mask_additionalinfoflag; +static int hf_opcua_diag_mask_innerstatuscodeflag; +static int hf_opcua_diag_mask_innerdiaginfoflag; +static int hf_opcua_loctext_mask; +static int hf_opcua_loctext_mask_localeflag; +static int hf_opcua_loctext_mask_textflag; +static int hf_opcua_datavalue_mask; +static int hf_opcua_datavalue_mask_valueflag; +static int hf_opcua_datavalue_mask_statuscodeflag; +static int hf_opcua_datavalue_mask_sourcetimestampflag; +static int hf_opcua_datavalue_mask_servertimestampflag; +static int hf_opcua_datavalue_mask_sourcepicoseconds; +static int hf_opcua_datavalue_mask_serverpicoseconds; +static int hf_opcua_nodeid_encodingmask; +static int hf_opcua_expandednodeid_mask; +static int hf_opcua_expandednodeid_mask_namespaceuri; +static int hf_opcua_expandednodeid_mask_serverindex; +static int hf_opcua_variant_encodingmask; +static int hf_opcua_nodeid_nsindex; +static int hf_opcua_nodeid_numeric; +static int hf_opcua_nodeid_string; +static int hf_opcua_nodeid_guid; +static int hf_opcua_nodeid_bytestring; +static int hf_opcua_localizedtext_locale; +static int hf_opcua_localizedtext_text; +static int hf_opcua_qualifiedname_id; +static int hf_opcua_qualifiedname_name; +static int hf_opcua_SourceTimestamp; +static int hf_opcua_SourcePicoseconds; +static int hf_opcua_ServerTimestamp; +static int hf_opcua_ServerPicoseconds; +static int hf_opcua_diag_symbolicid; +static int hf_opcua_diag_namespace; +static int hf_opcua_diag_localizedtext; +static int hf_opcua_diag_locale; +static int hf_opcua_diag_additionalinfo; +static int hf_opcua_diag_innerstatuscode; +static int hf_opcua_extobj_mask; +static int hf_opcua_extobj_mask_binbodyflag; +static int hf_opcua_extobj_mask_xmlbodyflag; +static int hf_opcua_ArraySize; +static int hf_opcua_ServerIndex; +static int hf_opcua_status_StructureChanged; +static int hf_opcua_status_SemanticsChanged; +static int hf_opcua_status_InfoBit_Limit_Overflow; +static int hf_opcua_status_InfoBit_Historian_Partial; +static int hf_opcua_status_InfoBit_Historian_ExtraData; +static int hf_opcua_status_InfoBit_Historian_MultiValue; +static int hf_opcua_status_InfoType; +static int hf_opcua_status_Limit; +static int hf_opcua_status_Historian; +int hf_opcua_returnDiag; +int hf_opcua_returnDiag_mask_sl_symbolicId; +int hf_opcua_returnDiag_mask_sl_localizedText; +int hf_opcua_returnDiag_mask_sl_additionalinfo; +int hf_opcua_returnDiag_mask_sl_innerstatuscode; +int hf_opcua_returnDiag_mask_sl_innerdiagnostics; +int hf_opcua_returnDiag_mask_ol_symbolicId; +int hf_opcua_returnDiag_mask_ol_localizedText; +int hf_opcua_returnDiag_mask_ol_additionalinfo; +int hf_opcua_returnDiag_mask_ol_innerstatuscode; +int hf_opcua_returnDiag_mask_ol_innerdiagnostics; +int hf_opcua_nodeClassMask; +int hf_opcua_nodeClassMask_all; +int hf_opcua_nodeClassMask_object; +int hf_opcua_nodeClassMask_variable; +int hf_opcua_nodeClassMask_method; +int hf_opcua_nodeClassMask_objecttype; +int hf_opcua_nodeClassMask_variabletype; +int hf_opcua_nodeClassMask_referencetype; +int hf_opcua_nodeClassMask_datatype; +int hf_opcua_nodeClassMask_view; +int hf_opcua_resultMask; +int hf_opcua_resultMask_all; +int hf_opcua_resultMask_referencetype; +int hf_opcua_resultMask_isforward; +int hf_opcua_resultMask_nodeclass; +int hf_opcua_resultMask_browsename; +int hf_opcua_resultMask_displayname; +int hf_opcua_resultMask_typedefinition; + +static expert_field ei_array_length; +static expert_field ei_nesting_depth; extern int proto_opcua; @@ -342,50 +345,50 @@ static const value_string g_ResultMask[] = { }; /* 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_opcua_diagnosticinfo; +static gint ett_opcua_diagnosticinfo_encodingmask; +static gint ett_opcua_nodeid; +static gint ett_opcua_expandednodeid; +static gint ett_opcua_expandednodeid_encodingmask; +static gint ett_opcua_localizedtext; +static gint ett_opcua_localizedtext_encodingmask; +static gint ett_opcua_qualifiedname; +static gint ett_opcua_datavalue; +static gint ett_opcua_datavalue_encodingmask; +static gint ett_opcua_variant; +static gint ett_opcua_variant_arraydims; +static gint ett_opcua_extensionobject; +static gint ett_opcua_extensionobject_encodingmask; +static gint ett_opcua_statuscode; +static gint ett_opcua_statuscode_info; +gint ett_opcua_array_Boolean; +gint ett_opcua_array_SByte; +gint ett_opcua_array_Byte; +gint ett_opcua_array_Int16; +gint ett_opcua_array_UInt16; +gint ett_opcua_array_Int32; +gint ett_opcua_array_UInt32; +gint ett_opcua_array_Int64; +gint ett_opcua_array_UInt64; +gint ett_opcua_array_Float; +gint ett_opcua_array_Double; +gint ett_opcua_array_String; +gint ett_opcua_array_DateTime; +gint ett_opcua_array_Guid; +gint ett_opcua_array_ByteString; +gint ett_opcua_array_XmlElement; +gint ett_opcua_array_NodeId; +gint ett_opcua_array_ExpandedNodeId; +gint ett_opcua_array_StatusCode; +gint ett_opcua_array_DiagnosticInfo; +gint ett_opcua_array_QualifiedName; +gint ett_opcua_array_LocalizedText; +gint ett_opcua_array_ExtensionObject; +gint ett_opcua_array_DataValue; +gint ett_opcua_array_Variant; +gint ett_opcua_returnDiagnostics; +gint ett_opcua_nodeClassMask; +gint ett_opcua_resultMask; static gint *ett[] = { @@ -641,6 +644,50 @@ proto_item* parseString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, return item; } +proto_item* parseString_ret_string_and_length(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex, const guint8 **retval, gint *lenretval) +{ + proto_item *item = NULL; + char *szValue; + gint iOffset = *pOffset; + gint32 iLen = tvb_get_letohl(tvb, *pOffset); + iOffset+=4; + + if (retval) { + *retval = ""; + } + if (lenretval) { + *lenretval = iLen; + } + + 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_ret_string_and_length(tree, hfIndex, tvb, iOffset, iLen, ENC_UTF_8|ENC_NA, NULL, retval, lenretval); + 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; @@ -835,14 +882,14 @@ void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gi { parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_namespace); } - if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG) - { - parseInt32(subtree, tvb, pinfo, &iOffset, hf_opcua_diag_localizedtext); - } 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); @@ -875,6 +922,41 @@ void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gin proto_item_set_end(ti, tvb, *pOffset); } +void parseCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, 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_bytes_with_length(tree, hfIndex, tvb, *pOffset, 4, NULL, 0); + proto_item_append_text(item, "[OpcUa Null ByteString]"); + } + else if (iLen == 0) + { + item = proto_tree_add_bytes_with_length(tree, hfIndex, tvb, *pOffset, 4, NULL, 0); + proto_item_append_text(item, "[OpcUa Empty ByteString]"); + } + else if (iLen > 0) + { + asn1_ctx_t asn1_ctx; + asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); + dissect_x509af_Certificate(FALSE, tvb, iOffset, &asn1_ctx, tree, hfIndex); + iOffset += iLen; /* eat the whole bytestring */ + } + else + { + item = proto_tree_add_bytes_with_length(tree, hfIndex, tvb, *pOffset, 4, NULL, 0); + szValue = wmem_strdup_printf(pinfo->pool, "[Invalid ByteString] Invalid length: %d", iLen); + proto_item_append_text(item, "%s", szValue); + } + + *pOffset = iOffset; +} + 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, @@ -1134,7 +1216,7 @@ void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint for (i=0; i<iLen; i++) { char szNum[20]; - g_snprintf(szNum, 20, "[%i]", i); + snprintf(szNum, 20, "[%i]", i); (*pParserFunction)(subtree, tvb, pinfo, pOffset, szNum); } proto_item_set_end(ti, tvb, *pOffset); @@ -1218,7 +1300,7 @@ void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, g /* add nodeid subtree */ TypeId = getExtensionObjectType(tvb, &iOffset); - parseExpandedNodeId(extobj_tree, tvb, pinfo, &iOffset, "TypeId"); + parseNodeId(extobj_tree, tvb, pinfo, &iOffset, "TypeId"); /* parse encoding mask */ EncodingMask = tvb_get_guint8(tvb, iOffset); diff --git a/plugins/epan/opcua/opcua_simpletypes.h b/plugins/epan/opcua/opcua_simpletypes.h index 9d88983bf7..72b2f0cfd7 100644 --- a/plugins/epan/opcua/opcua_simpletypes.h +++ b/plugins/epan/opcua/opcua_simpletypes.h @@ -66,6 +66,14 @@ extern gint ett_opcua_array_DataValue; extern gint ett_opcua_array_Variant; extern gint ett_opcua_returnDiagnostics; +enum ua_message_mode { + UA_MessageMode_Unknown = 0, + UA_MessageMode_None, + UA_MessageMode_Sign, + UA_MessageMode_SignAndEncrypt, + UA_MessageMode_MaybeEncrypted +}; + /* 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); @@ -77,6 +85,7 @@ proto_item* parseInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint 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* parseString_ret_string_and_length(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex, const guint8 **retval, gint *lenretval); 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); @@ -90,6 +99,7 @@ void parseNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOff 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 parseCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex); 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); diff --git a/plugins/epan/opcua/opcua_transport_layer.c b/plugins/epan/opcua/opcua_transport_layer.c index 31fdca3b1b..7769d07a5c 100644 --- a/plugins/epan/opcua/opcua_transport_layer.c +++ b/plugins/epan/opcua/opcua_transport_layer.c @@ -17,34 +17,51 @@ #include "config.h" #include <epan/packet.h> +#include <epan/conversation.h> +#include "epan/column-utils.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; +static int hf_opcua_transport_type; +static int hf_opcua_transport_chunk; +static int hf_opcua_transport_size; +static int hf_opcua_transport_ver; +static int hf_opcua_transport_scid; +static int hf_opcua_transport_rbs; +static int hf_opcua_transport_sbs; +static int hf_opcua_transport_mms; +static int hf_opcua_transport_mcc; +static int hf_opcua_transport_endpoint; +static int hf_opcua_transport_suri; +static int hf_opcua_transport_error; +static int hf_opcua_transport_reason; +static int hf_opcua_transport_spu; +static int hf_opcua_transport_scert; +static int hf_opcua_transport_rcthumb; +static int hf_opcua_transport_seq; +static int hf_opcua_transport_rqid; /** subtree types */ extern gint ett_opcua_nodeid; extern gint ett_opcua_extensionobject; +extern gint proto_opcua; + +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_NONE_STRING "http://opcfoundation.org/UA/SecurityPolicy#None" +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_BASIC128RSA15_STRING "http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15" +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_BASIC256_STRING "http://opcfoundation.org/UA/SecurityPolicy#Basic256" +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_BASIC256SHA256_STRING "http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256" +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_AES128_SHA256_RSAOAEP_STRING "http://opcfoundation.org/UA/SecurityPolicy#Aes128_Sha256_RsaOaep" +/** Defined security policy URL from Part 7 OPC UA Specification. */ +#define UA_SECURITY_POLICY_AES256_SHA256_RSAPSS_STRING "http://opcfoundation.org/UA/SecurityPolicy#Aes256_Sha256_RsaPss" /** Register transport layer types. */ void registerTransportLayerTypes(int proto) @@ -75,12 +92,17 @@ void registerTransportLayerTypes(int proto) 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) +void parseMessageHeader(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, struct ua_metadata *data _U_) { 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; +} + +/* Transport Layer: message parsers */ +int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data _U_) +{ + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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; @@ -90,11 +112,9 @@ int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffse return -1; } -int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) +int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, struct ua_metadata *data _U_) { - 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; + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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; @@ -103,48 +123,40 @@ int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gi return -1; } -int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) +int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data _U_) { - 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; + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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) +int parseReverseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data _U_) { - 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; + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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) +int parseMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, struct ua_metadata *data _U_) { - 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; + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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) +int parseAbort(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, struct ua_metadata *data _U_) { + parseMessageHeader(tree, tvb, pinfo, pOffset, data); 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) +int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data _U_) { proto_item *ti; proto_item *ti_inner; @@ -152,83 +164,125 @@ int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOff 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"); + 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"); + 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); + if (ServiceId >= 0) { + 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) +/** + * Stores the messages mode and signature length for this TCP connection. + * We need to know this mode in the following message to decide if decryption is required or not. + */ +void store_encryption_info(packet_info *pinfo, enum ua_message_mode mode, uint8_t sig_len) { - 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"); + conversation_t *conv = find_conversation_pinfo(pinfo, 0); + if (conv) { + uintptr_t data = (uintptr_t)mode; + data |= ((uintptr_t)sig_len << 8); + conversation_add_proto_data(conv, proto_opcua, (gpointer)data); + } +} - /* 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); +/** Returns the message mode and signature length for current TCP connection. */ +void get_encryption_info(packet_info *pinfo, enum ua_message_mode *mode, uint8_t *sig_len) +{ + conversation_t *conv = find_conversation_pinfo(pinfo, 0); + if (conv) { + uintptr_t data = (uintptr_t)conversation_get_proto_data(conv, proto_opcua); + if (data == 0) { + *mode = g_opcua_default_sig_len ? UA_MessageMode_MaybeEncrypted : UA_MessageMode_None; + *sig_len = g_opcua_default_sig_len; + } else { + *mode = (enum ua_message_mode)(data & 0xff); + *sig_len = (uintptr_t)(data >> 8); + } + } +} - dispatchService(encobj_tree, tvb, pinfo, pOffset, ServiceId); +/** + * Compares an unterminated string of a string constant. + * + * @param text Unterminated string to compare. + * @param text_len String data. + * @param ref_text Zero terminated string constant to compare with. + * + * @return 0 if equal, -1 if not. + */ +static int opcua_string_compare(const char *text, gint text_len, const char *ref_text) +{ + gint len = (gint)strlen(ref_text); + if (text_len == len && memcmp(text, ref_text, len) == 0) return 0; - proto_item_set_end(ti, tvb, *pOffset); - return ServiceId; + return -1; } -int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset) +int parseOpenSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data) { - proto_item *ti; - proto_item *ti_inner; - proto_tree *encobj_tree; - proto_tree *nodeid_tree; - int ServiceId = 0; + const guint8 *sec_policy = NULL; + gint sec_policy_len = 0; + int ServiceId = -1; + bool encrypted = false; + // Message Header 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; + // Asym Security Header + parseString_ret_string_and_length(tree, tvb, pinfo, pOffset, hf_opcua_transport_spu, &sec_policy, &sec_policy_len); + parseCertificate(tree, tvb, pinfo, pOffset, hf_opcua_transport_scert); + parseByteString(tree, tvb, pinfo, pOffset, hf_opcua_transport_rcthumb); - 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"); + if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_NONE_STRING ) == 0) { + store_encryption_info(pinfo, UA_MessageMode_None, 0); + } else { + guint8 sig_len = 0; + // OPN is always encrypted for Policies != None, for both message modes Sign and SignAndEncrypted + encrypted = true; + // determine signature length based on security policy + if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_BASIC128RSA15_STRING ) == 0) { + sig_len = 20; + } else if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_BASIC256_STRING ) == 0) { + sig_len = 20; + } else if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_BASIC256SHA256_STRING ) == 0) { + sig_len = 32; + } else if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_AES128_SHA256_RSAOAEP_STRING ) == 0) { + sig_len = 32; + } else if (opcua_string_compare(sec_policy, sec_policy_len, UA_SECURITY_POLICY_AES256_SHA256_RSAPSS_STRING ) == 0) { + sig_len = 32; + } + // We don't know the messagemode without decrypting the OPN, so we assume it is SignAndEncrypt, + // we will try to decode the next service (CreateSession) and if it succeeds we change the mode to Sign + // or SignAndEncrypt accordingly + store_encryption_info(pinfo, UA_MessageMode_MaybeEncrypted, sig_len); + } + + data->encrypted = encrypted; + if (!encrypted) { + parseSequenceHeader(tree, tvb, pOffset, data); + ServiceId = parseService(tree, tvb, pinfo,pOffset, data); + } - /* 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); + return ServiceId; +} - dispatchService(encobj_tree, tvb, pinfo, pOffset, ServiceId); +int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data _U_) +{ + parseMessageHeader(tree, tvb, pinfo, pOffset, data); + proto_tree_add_item(tree, hf_opcua_transport_scid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; - proto_item_set_end(ti, tvb, *pOffset); - return ServiceId; + return -1; } /* diff --git a/plugins/epan/opcua/opcua_transport_layer.h b/plugins/epan/opcua/opcua_transport_layer.h index 4e63aa5a0f..cd2089d71b 100644 --- a/plugins/epan/opcua/opcua_transport_layer.h +++ b/plugins/epan/opcua/opcua_transport_layer.h @@ -14,14 +14,25 @@ ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com> ******************************************************************************/ +/* This struct is used to pass meta data down to decoding functions. */ +struct ua_metadata { + bool encrypted; /* true if payload is encrypted, false if no encryption was used or it was successfully decrypted. */ +}; + +extern int g_opcua_default_sig_len; + /* 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); +int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseReverseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseAbort(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseOpenSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); +int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, struct ua_metadata *data); void registerTransportLayerTypes(int proto); + +enum ua_message_mode; +void store_encryption_info(packet_info *pinfo, enum ua_message_mode mode, uint8_t sig_len); +void get_encryption_info(packet_info *pinfo, enum ua_message_mode *mode, uint8_t *sig_len); diff --git a/plugins/epan/pluginifdemo/CMakeLists.txt b/plugins/epan/pluginifdemo/CMakeLists.txt index 6a97cdfa64..3180c9c91a 100644 --- a/plugins/epan/pluginifdemo/CMakeLists.txt +++ b/plugins/epan/pluginifdemo/CMakeLists.txt @@ -10,14 +10,20 @@ include(WiresharkPlugin) # Plugin name and version info (major minor micro extra) -set_module_info(pluginifdemo 0 0 1 0) +set_module_info(pluginifdemo 0 0 2 0) SET(CMAKE_AUTOMOC ON) SET(CMAKE_AUTOUIC ON) -find_package(Qt5Core) -find_package(Qt5PrintSupport) -find_package(Qt5Widgets) +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 @@ -47,12 +53,13 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "Qt demonstration plugin" ${DISSECTOR_SRC} ) -add_plugin_library(pluginifdemo epan) +add_wireshark_epan_plugin_library(pluginifdemo) -target_link_libraries(pluginifdemo epan Qt5::Core Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia) +target_link_libraries(pluginifdemo epan Qt${qtver}::Core Qt${qtver}::Widgets Qt${qtver}::PrintSupport) install_plugin(pluginifdemo epan) diff --git a/plugins/epan/pluginifdemo/pluginifdemo.c b/plugins/epan/pluginifdemo/pluginifdemo.c index 5cbe4ad4fc..3f0fea1fa5 100644 --- a/plugins/epan/pluginifdemo/pluginifdemo.c +++ b/plugins/epan/pluginifdemo/pluginifdemo.c @@ -24,7 +24,7 @@ void proto_register_pluginifdemo(void); void proto_reg_handoff_pluginifdemo(void); -static int proto_pluginifdemo = -1; +static int proto_pluginifdemo; void toolbar_cb(gpointer object, gpointer item_data, gpointer user_data); @@ -105,31 +105,31 @@ void toolbar_cb(gpointer toolbar_item, gpointer item_data, gpointer user_data _U 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 = g_strdup_printf("Current frame is: %u", 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 = g_strdup_printf("Capture file name is: %s", 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 = g_strdup_printf( "Checkbox selected value: %d", (int) (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 = g_strdup_printf( "String entered in toolbar: %s", 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 = g_strdup_printf( "Value from toolbar: %s", data->value ); + message = ws_strdup_printf( "Value from toolbar: %s", data->value ); pluginifdemo_toolbar_log(message); } diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui index faf560b417..c31f0583e2 100644 --- a/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui +++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_about.ui @@ -73,7 +73,7 @@ <item> <widget class="QLabel" name="lblAboutDialog"> <property name="text"> - <string><html><head/><body><p><span style=" font-size:10pt;"><br/></span><span style=" font-size:10pt; font-weight:600;">PlugIn Interface Demonstration</span><span style=" font-size:10pt;"><br/>Version: </span><span style=" font-size:10pt; font-weight:600;">0.0.1 </span></p><p><span style=" font-size:10pt;">Copyright © </span><span style=" font-size:10pt; font-style:italic;">Wireshark Foundation</span><span style=" font-size:10pt;"><br/></span><a href="https://www.wireshark.org"><span style=" text-decoration: underline; color:#0000ff;">www.wireshark.org</span></a></p></body></html></string> + <string><html><head/><body><p><span style=" font-size:10pt;"><br/></span><span style=" font-size:10pt; font-weight:600;">PlugIn Interface Demonstration</span><span style=" font-size:10pt;"><br/>Version: </span><span style=" font-size:10pt; font-weight:600;">0.0.2 </span></p><p><span style=" font-size:10pt;">Copyright © </span><span style=" font-size:10pt; font-style:italic;">Wireshark Foundation</span><span style=" font-size:10pt;"><br/></span><a href="https://www.wireshark.org"><span style=" text-decoration: underline; color:#0000ff;">www.wireshark.org</span></a></p></body></html></string> </property> <property name="wordWrap"> <bool>true</bool> diff --git a/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp index 7e8bf6392e..a4823817fe 100644 --- a/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp +++ b/plugins/epan/pluginifdemo/ui/pluginifdemo_main.cpp @@ -42,7 +42,7 @@ void PluginIfTypeModel::addPluginIfType(const PluginIfType &ifType) int PluginIfTypeModel::rowCount(const QModelIndex &) const { - return m_pluginIfTypes.count(); + return static_cast<int>(m_pluginIfTypes.count()); } QVariant PluginIfTypeModel::data(const QModelIndex & idx, int role) const @@ -286,7 +286,7 @@ void PluginIFDemo_Main::on_btnRemoveItem_clicked() bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; QString content = listModel->data(idx).toString(); - int pos = content.indexOf(":"); + int pos = static_cast<int>(content.indexOf(":")); gchar * value = g_strdup(content.left(pos).toUtf8().constData() ); /* -2 because removal of : and space */ @@ -314,11 +314,11 @@ void PluginIFDemo_Main::on_btnSendList_clicked() for( int i = 0; i < listModel->rowCount(); i++ ) { QString content = listModel->data(listModel->index(i, 0)).toString(); - int pos = content.indexOf(":"); + 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).toStdString().c_str() ); - valEntry->display = g_strdup(content.right(content.size() - pos + 1).toStdString().c_str()); + 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); } @@ -360,7 +360,7 @@ void PluginIFDemo_Main::on_lstItems_clicked(const QModelIndex &idx) bool silent = ui->chkSilent->checkState() == Qt::Checked ? true : false; QString content = listModel->data(listModel->index(idx.row(), 0)).toString(); - int pos = content.indexOf(":"); + int pos = static_cast<int>(content.indexOf(":")); gchar * idxData = g_strdup(content.left(pos).toUtf8().constData() ); diff --git a/plugins/epan/profinet/CMakeLists.txt b/plugins/epan/profinet/CMakeLists.txt index 1c3d41c3a4..005d7c3a82 100644 --- a/plugins/epan/profinet/CMakeLists.txt +++ b/plugins/epan/profinet/CMakeLists.txt @@ -43,11 +43,12 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "PROFINET dissector" ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) -add_plugin_library(profinet epan) +add_wireshark_epan_plugin_library(profinet) target_link_libraries(profinet epan) diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c index a378a2c0a4..6ce81e760e 100644 --- a/plugins/epan/profinet/packet-dcerpc-pn-io.c +++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c @@ -82,752 +82,890 @@ void proto_reg_handoff_pn_io(void); #define PN_INPUT_CR 1 /* PROFINET Input Connect Request value */ #define PN_INPUT_DATADESCRITPION 1 /* PROFINET Input Data Description value */ - -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; - -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; +#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; +static int proto_pn_io_device; +static int proto_pn_io_controller; +static int proto_pn_io_supervisor; +static int proto_pn_io_parameterserver; +static int proto_pn_io_implicitar; +int proto_pn_io_apdu_status; +int proto_pn_io_time_aware_status; + +static int hf_pn_io_opnum; +static int hf_pn_io_reserved16; + +static int hf_pn_io_array; +static int hf_pn_io_args_max; +static int hf_pn_io_args_len; +static int hf_pn_io_array_max_count; +static int hf_pn_io_array_offset; +static int hf_pn_io_array_act_count; + +static int hf_pn_io_ar_type; +static int hf_pn_io_artype_req; +static int hf_pn_io_cminitiator_macadd; +static int hf_pn_io_cminitiator_objectuuid; +static int hf_pn_io_parameter_server_objectuuid; +static int hf_pn_io_ar_data; +static int hf_pn_io_ar_properties; +static int hf_pn_io_ar_properties_state; +static int hf_pn_io_ar_properties_supervisor_takeover_allowed; +static int hf_pn_io_ar_properties_parameterization_server; /* removed within 2.3 -static int hf_pn_io_ar_properties_data_rate = -1; +static int hf_pn_io_ar_properties_data_rate; */ -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_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; +static int hf_pn_io_ar_properties_reserved_1; +static int hf_pn_io_ar_properties_device_access; +static int hf_pn_io_ar_properties_companion_ar; +static int hf_pn_io_ar_properties_achnowledge_companion_ar; +static int hf_pn_io_ar_properties_reserved; +static int hf_pn_io_ar_properties_time_aware_system; +static int hf_pn_io_ar_properties_combined_object_container_with_legacy_startupmode; +static int hf_pn_io_ar_properties_combined_object_container_with_advanced_startupmode; +static int hf_pn_io_ar_properties_pull_module_alarm_allowed; + +static int hf_pn_RedundancyInfo; +static int hf_pn_RedundancyInfo_reserved; +static int hf_pn_io_number_of_ARDATAInfo; + +static int hf_pn_io_cminitiator_activitytimeoutfactor; +static int hf_pn_io_cminitiator_udprtport; +static int hf_pn_io_station_name_length; +static int hf_pn_io_cminitiator_station_name; +/* static int hf_pn_io_responder_station_name; */ +static int hf_pn_io_arproperties_StartupMode; + +static int hf_pn_io_parameter_server_station_name; + +static int hf_pn_io_cmresponder_macadd; +static int hf_pn_io_cmresponder_udprtport; + +static int hf_pn_io_number_of_iocrs; +static int hf_pn_io_iocr_tree; +static int hf_pn_io_iocr_type; +static int hf_pn_io_iocr_reference; +static int hf_pn_io_iocr_SubframeOffset; +static int hf_pn_io_iocr_SubframeData; +/* static int hf_pn_io_iocr_txports_port; */ +/* static int hf_pn_io_iocr_txports_redundantport; */ +static int hf_pn_io_sr_properties_Reserved_1; +static int hf_pn_io_sr_properties_Mode; +static int hf_pn_io_sr_properties_Reserved_2; +static int hf_pn_io_sr_properties_Reserved_3; +static int hf_pn_io_RedundancyDataHoldFactor; +static int hf_pn_io_sr_properties; +static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_0; +static int hf_pn_io_sr_properties_InputValidOnBackupAR_with_SRProperties_Mode_1; + +static int hf_pn_io_arvendor_strucidentifier_if0_low; +static int hf_pn_io_arvendor_strucidentifier_if0_high; +static int hf_pn_io_arvendor_strucidentifier_if0_is8000; +static int hf_pn_io_arvendor_strucidentifier_not0; + +static int hf_pn_io_lt; +static int hf_pn_io_iocr_properties; +static int hf_pn_io_iocr_properties_rtclass; +static int hf_pn_io_iocr_properties_reserved_1; +static int hf_pn_io_iocr_properties_media_redundancy; +static int hf_pn_io_iocr_properties_reserved_2; +static int hf_pn_io_iocr_properties_reserved_3; +static int hf_pn_io_iocr_properties_fast_forwarding_mac_adr; +static int hf_pn_io_iocr_properties_distributed_subframe_watchdog; +static int hf_pn_io_iocr_properties_full_subframe_structure; + + +static int hf_pn_io_data_length; +static int hf_pn_io_ir_frame_data; +static int hf_pn_io_frame_id; +static int hf_pn_io_send_clock_factor; +static int hf_pn_io_reduction_ratio; +static int hf_pn_io_phase; +static int hf_pn_io_sequence; +static int hf_pn_io_frame_send_offset; +static int hf_pn_io_frame_data_properties; +static int hf_pn_io_frame_data_properties_forwarding_Mode; +static int hf_pn_io_frame_data_properties_FastForwardingMulticastMACAdd; +static int hf_pn_io_frame_data_properties_FragmentMode; +static int hf_pn_io_frame_data_properties_reserved_1; +static int hf_pn_io_frame_data_properties_reserved_2; +static int hf_pn_io_watchdog_factor; +static int hf_pn_io_data_hold_factor; +static int hf_pn_io_iocr_tag_header; +static int hf_pn_io_iocr_multicast_mac_add; +static int hf_pn_io_number_of_apis; +static int hf_pn_io_number_of_io_data_objects; +static int hf_pn_io_io_data_object_frame_offset; +static int hf_pn_io_number_of_iocs; +static int hf_pn_io_iocs_frame_offset; + +static int hf_pn_io_SFIOCRProperties; +static int hf_pn_io_DistributedWatchDogFactor; +static int hf_pn_io_RestartFactorForDistributedWD; +static int hf_pn_io_SFIOCRProperties_DFPmode; +static int hf_pn_io_SFIOCRProperties_reserved_1; +static int hf_pn_io_SFIOCRProperties_reserved_2; +static int hf_pn_io_SFIOCRProperties_DFPType; +static int hf_pn_io_SFIOCRProperties_DFPRedundantPathLayout; +static int hf_pn_io_SFIOCRProperties_SFCRC16; + +static int hf_pn_io_subframe_data; +static int hf_pn_io_subframe_data_reserved1; +static int hf_pn_io_subframe_data_reserved2; + +static int hf_pn_io_subframe_data_position; +static int hf_pn_io_subframe_reserved1; +static int hf_pn_io_subframe_data_length; +static int hf_pn_io_subframe_reserved2; + +static int hf_pn_io_alarmcr_type; +static int hf_pn_io_alarmcr_properties; +static int hf_pn_io_alarmcr_properties_priority; +static int hf_pn_io_alarmcr_properties_transport; +static int hf_pn_io_alarmcr_properties_reserved; + +static int hf_pn_io_rta_timeoutfactor; +static int hf_pn_io_rta_retries; +static int hf_pn_io_localalarmref; +static int hf_pn_io_remotealarmref; +static int hf_pn_io_maxalarmdatalength; +static int hf_pn_io_alarmcr_tagheaderhigh; +static int hf_pn_io_alarmcr_tagheaderlow; + +static int hf_pn_io_IRData_uuid; +static int hf_pn_io_ar_uuid; +static int hf_pn_io_target_ar_uuid; +static int hf_pn_io_ar_discriminator; +static int hf_pn_io_ar_configid; +static int hf_pn_io_ar_arnumber; +static int hf_pn_io_ar_arresource; +static int hf_pn_io_ar_arreserved; +static int hf_pn_io_ar_selector; +static int hf_pn_io_api_tree; +static int hf_pn_io_module_tree; +static int hf_pn_io_submodule_tree; +static int hf_pn_io_io_data_object; /* 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_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_qualified_info = -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_diag_info = -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_type = -1; - -static int hf_pn_io_ext_channel_add_value = -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; +static int hf_pn_io_io_cs; + +static int hf_pn_io_substitutionmode; + +static int hf_pn_io_api; +static int hf_pn_io_slot_nr; +static int hf_pn_io_subslot_nr; +static int hf_pn_io_index; +static int hf_pn_io_seq_number; +static int hf_pn_io_record_data_length; +static int hf_pn_io_add_val1; +static int hf_pn_io_add_val2; + +static int hf_pn_io_block; +static int hf_pn_io_block_header; +static int hf_pn_io_block_type; +static int hf_pn_io_block_length; +static int hf_pn_io_block_version_high; +static int hf_pn_io_block_version_low; + +static int hf_pn_io_sessionkey; +static int hf_pn_io_control_alarm_sequence_number; +static int hf_pn_io_control_command; +static int hf_pn_io_control_command_prmend; +static int hf_pn_io_control_command_applready; +static int hf_pn_io_control_command_release; +static int hf_pn_io_control_command_done; +static int hf_pn_io_control_command_ready_for_companion; +static int hf_pn_io_control_command_ready_for_rt_class3; +static int hf_pn_io_control_command_prmbegin; +static int hf_pn_io_control_command_reserved_7_15; +static int hf_pn_io_control_block_properties; +static int hf_pn_io_control_block_properties_applready; +static int hf_pn_io_control_block_properties_applready_bit0; +static int hf_pn_io_control_block_properties_applready_bit1; +static int hf_pn_io_control_block_properties_applready_otherbits; + +/* static int hf_pn_io_AlarmSequenceNumber; */ +static int hf_pn_io_control_command_reserved; +static int hf_pn_io_SubmoduleListEntries; + +static int hf_pn_io_alarm_type; +static int hf_pn_io_alarm_specifier; +static int hf_pn_io_alarm_specifier_sequence; +static int hf_pn_io_alarm_specifier_channel; +static int hf_pn_io_alarm_specifier_manufacturer; +static int hf_pn_io_alarm_specifier_submodule; +static int hf_pn_io_alarm_specifier_ardiagnosis; + +static int hf_pn_io_alarm_dst_endpoint; +static int hf_pn_io_alarm_src_endpoint; +static int hf_pn_io_pdu_type; +static int hf_pn_io_pdu_type_type; +static int hf_pn_io_pdu_type_version; +static int hf_pn_io_add_flags; +static int hf_pn_io_window_size; +static int hf_pn_io_tack; +static int hf_pn_io_send_seq_num; +static int hf_pn_io_ack_seq_num; +static int hf_pn_io_var_part_len; + +static int hf_pn_io_number_of_modules; +static int hf_pn_io_module_ident_number; +static int hf_pn_io_module_properties; +static int hf_pn_io_module_state; +static int hf_pn_io_number_of_submodules; +static int hf_pn_io_submodule_ident_number; +static int hf_pn_io_submodule_properties; +static int hf_pn_io_submodule_properties_type; +static int hf_pn_io_submodule_properties_shared_input; +static int hf_pn_io_submodule_properties_reduce_input_submodule_data_length; +static int hf_pn_io_submodule_properties_reduce_output_submodule_data_length; +static int hf_pn_io_submodule_properties_discard_ioxs; +static int hf_pn_io_submodule_properties_reserved; + +static int hf_pn_io_submodule_state; +static int hf_pn_io_submodule_state_format_indicator; +static int hf_pn_io_submodule_state_add_info; +static int hf_pn_io_submodule_state_advice; +static int hf_pn_io_submodule_state_maintenance_required; +static int hf_pn_io_submodule_state_maintenance_demanded; +static int hf_pn_io_submodule_state_fault; +static int hf_pn_io_submodule_state_ar_info; +static int hf_pn_io_submodule_state_ident_info; +static int hf_pn_io_submodule_state_detail; + +static int hf_pn_io_data_description_tree; +static int hf_pn_io_data_description; +static int hf_pn_io_submodule_data_length; +static int hf_pn_io_length_iocs; +static int hf_pn_io_length_iops; + +static int hf_pn_io_iocs; +static int hf_pn_io_iops; +static int hf_pn_io_ioxs_extension; +static int hf_pn_io_ioxs_res14; +static int hf_pn_io_ioxs_instance; +static int hf_pn_io_ioxs_datastate; + +static int hf_pn_io_address_resolution_properties; +static int hf_pn_io_mci_timeout_factor; +static int hf_pn_io_provider_station_name; + +static int hf_pn_io_user_structure_identifier; +static int hf_pn_io_user_structure_identifier_manf; + +static int hf_pn_io_channel_number; +static int hf_pn_io_channel_properties; +static int hf_pn_io_channel_properties_type; +static int hf_pn_io_channel_properties_accumulative; +static int hf_pn_io_channel_properties_maintenance; + + +static int hf_pn_io_NumberOfSubframeBlocks; +static int hf_pn_io_channel_properties_specifier; +static int hf_pn_io_channel_properties_direction; + +static int hf_pn_io_channel_error_type; +static int hf_pn_io_ext_channel_error_type0; +static int hf_pn_io_ext_channel_error_type0x8000; +static int hf_pn_io_ext_channel_error_type0x8001; +static int hf_pn_io_ext_channel_error_type0x8002; +static int hf_pn_io_ext_channel_error_type0x8003; +static int hf_pn_io_ext_channel_error_type0x8004; +static int hf_pn_io_ext_channel_error_type0x8005; +static int hf_pn_io_ext_channel_error_type0x8007; +static int hf_pn_io_ext_channel_error_type0x8008; +static int hf_pn_io_ext_channel_error_type0x800A; +static int hf_pn_io_ext_channel_error_type0x800B; +static int hf_pn_io_ext_channel_error_type0x800C; +static int hf_pn_io_ext_channel_error_type0x8010; + +static int hf_pn_io_ext_channel_error_type; + +static int hf_pn_io_ext_channel_add_value; +static int hf_pn_io_qualified_channel_qualifier; + +static int hf_pn_io_ptcp_subdomain_id; +static int hf_pn_io_ir_data_id; +static int hf_pn_io_max_bridge_delay; +static int hf_pn_io_number_of_ports; +static int hf_pn_io_max_port_tx_delay; +static int hf_pn_io_max_port_rx_delay; + +static int hf_pn_io_max_line_rx_delay; +static int hf_pn_io_yellowtime; +static int hf_pn_io_reserved_interval_begin; +static int hf_pn_io_reserved_interval_end; +static int hf_pn_io_pllwindow; +static int hf_pn_io_sync_send_factor; +static int hf_pn_io_sync_properties; +static int hf_pn_io_sync_frame_address; +static int hf_pn_io_ptcp_timeout_factor; +static int hf_pn_io_ptcp_takeover_timeout_factor; +static int hf_pn_io_ptcp_master_startup_time; +static int hf_pn_io_ptcp_master_priority_1; +static int hf_pn_io_ptcp_master_priority_2; +static int hf_pn_io_ptcp_length_subdomain_name; +static int hf_pn_io_ptcp_subdomain_name; + +static int hf_pn_io_MultipleInterfaceMode_NameOfDevice; +static int hf_pn_io_MultipleInterfaceMode_reserved_1; +static int hf_pn_io_MultipleInterfaceMode_reserved_2; /* 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; +static int hf_pn_io_pdportstatistic_counter_status; +static int hf_pn_io_pdportstatistic_counter_status_ifInOctets; +static int hf_pn_io_pdportstatistic_counter_status_ifOutOctets; +static int hf_pn_io_pdportstatistic_counter_status_ifInDiscards; +static int hf_pn_io_pdportstatistic_counter_status_ifOutDiscards; +static int hf_pn_io_pdportstatistic_counter_status_ifInErrors; +static int hf_pn_io_pdportstatistic_counter_status_ifOutErrors; +static int hf_pn_io_pdportstatistic_counter_status_reserved; +static int hf_pn_io_pdportstatistic_ifInOctets; +static int hf_pn_io_pdportstatistic_ifOutOctets; +static int hf_pn_io_pdportstatistic_ifInDiscards; +static int hf_pn_io_pdportstatistic_ifOutDiscards; +static int hf_pn_io_pdportstatistic_ifInErrors; +static int hf_pn_io_pdportstatistic_ifOutErrors; /* 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_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_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_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; +static int hf_pn_io_domain_boundary; +static int hf_pn_io_domain_boundary_ingress; +static int hf_pn_io_domain_boundary_egress; +static int hf_pn_io_multicast_boundary; +static int hf_pn_io_adjust_properties; +static int hf_pn_io_PreambleLength; +static int hf_pn_io_mau_type; +static int hf_pn_io_mau_type_mode; +static int hf_pn_io_port_state; +static int hf_pn_io_link_state_port; +static int hf_pn_io_link_state_link; +static int hf_pn_io_line_delay; +static int hf_pn_io_line_delay_value; +static int hf_pn_io_cable_delay_value; +static int hf_pn_io_line_delay_format_indicator; +static int hf_pn_io_number_of_peers; +static int hf_pn_io_length_peer_port_id; +static int hf_pn_io_peer_port_id; +static int hf_pn_io_length_peer_chassis_id; +static int hf_pn_io_peer_chassis_id; +static int hf_pn_io_neighbor; +static int hf_pn_io_length_peer_port_name; +static int hf_pn_io_peer_port_name; +static int hf_pn_io_length_peer_station_name; +static int hf_pn_io_peer_station_name; +static int hf_pn_io_length_own_port_id; +static int hf_pn_io_own_port_id; +static int hf_pn_io_peer_macadd; +static int hf_pn_io_media_type; +static int hf_pn_io_macadd; +static int hf_pn_io_length_own_chassis_id; +static int hf_pn_io_own_chassis_id; +static int hf_pn_io_rtclass3_port_status; + +static int hf_pn_io_ethertype; +static int hf_pn_io_rx_port; +static int hf_pn_io_frame_details; +static int hf_pn_io_frame_details_sync_frame; +static int hf_pn_io_frame_details_meaning_frame_send_offset; +static int hf_pn_io_frame_details_reserved; +static int hf_pn_io_nr_of_tx_port_groups; +static int hf_pn_io_TxPortGroupProperties; +static int hf_pn_io_TxPortGroupProperties_bit0; +static int hf_pn_io_TxPortGroupProperties_bit1; +static int hf_pn_io_TxPortGroupProperties_bit2; +static int hf_pn_io_TxPortGroupProperties_bit3; +static int hf_pn_io_TxPortGroupProperties_bit4; +static int hf_pn_io_TxPortGroupProperties_bit5; +static int hf_pn_io_TxPortGroupProperties_bit6; +static int hf_pn_io_TxPortGroupProperties_bit7; + +static int hf_pn_io_start_of_red_frame_id; +static int hf_pn_io_end_of_red_frame_id; +static int hf_pn_io_ir_begin_end_port; +static int hf_pn_io_number_of_assignments; +static int hf_pn_io_number_of_phases; +static int hf_pn_io_red_orange_period_begin_tx; +static int hf_pn_io_orange_period_begin_tx; +static int hf_pn_io_green_period_begin_tx; +static int hf_pn_io_red_orange_period_begin_rx; +static int hf_pn_io_orange_period_begin_rx; +static int hf_pn_io_green_period_begin_rx; +/* static int hf_pn_io_tx_phase_assignment; */ +static int hf_pn_ir_tx_phase_assignment; +static int hf_pn_ir_rx_phase_assignment; +static int hf_pn_io_tx_phase_assignment_begin_value; +static int hf_pn_io_tx_phase_assignment_orange_begin; +static int hf_pn_io_tx_phase_assignment_end_reserved; +static int hf_pn_io_tx_phase_assignment_reserved; +/* static int hf_pn_io_rx_phase_assignment; */ + +static int hf_pn_io_slot; +static int hf_pn_io_subslot; +static int hf_pn_io_number_of_slots; +static int hf_pn_io_number_of_subslots; + +/* static int hf_pn_io_maintenance_required_drop_budget; */ +/* static int hf_pn_io_maintenance_demanded_drop_budget; */ +/* static int hf_pn_io_error_drop_budget; */ + +static int hf_pn_io_tsn_number_of_queues; +static int hf_pn_io_tsn_max_supported_record_size; +static int hf_pn_io_tsn_transfer_time_tx; +static int hf_pn_io_tsn_transfer_time_rx; +static int hf_pn_io_tsn_port_capabilities_time_aware; +static int hf_pn_io_tsn_port_capabilities_preemption; +static int hf_pn_io_tsn_port_capabilities_queue_masking; +static int hf_pn_io_tsn_port_capabilities_reserved; +static int hf_pn_io_tsn_forwarding_group; +static int hf_pn_io_tsn_forwarding_group_ingress; +static int hf_pn_io_tsn_forwarding_group_egress; +static int hf_pn_io_tsn_stream_class; +static int hf_pn_io_tsn_dependent_forwarding_delay; +static int hf_pn_io_tsn_independent_forwarding_delay; +static int hf_pn_io_tsn_forwarding_delay_block_number_of_entries; +static int hf_pn_io_tsn_expected_neighbor_block_number_of_entries; +static int hf_pn_io_tsn_port_id_block_number_of_entries; + +static int hf_pn_io_tsn_nme_parameter_uuid; +static int hf_pn_io_tsn_domain_vid_config; +static int hf_pn_io_tsn_domain_vid_config_stream_high_vid; +static int hf_pn_io_tsn_domain_vid_config_stream_high_red_vid; +static int hf_pn_io_tsn_domain_vid_config_stream_low_vid; +static int hf_pn_io_tsn_domain_vid_config_stream_low_red_vid; +static int hf_pn_io_tsn_domain_vid_config_non_stream_vid; +static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_B; +static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_C; +static int hf_pn_io_tsn_domain_vid_config_non_stream_vid_D; +static int hf_pn_io_tsn_domain_vid_config_reserved; +static int hf_pn_io_number_of_tsn_time_data_block_entries; +static int hf_pn_io_number_of_tsn_domain_queue_rate_limiter_entries; +static int hf_pn_io_number_of_tsn_domain_port_ingress_rate_limiter_entries; +static int hf_pn_io_number_of_tsn_domain_port_config_entries; + +static int hf_pn_io_tsn_domain_port_config; +static int hf_pn_io_tsn_domain_port_config_preemption_enabled; +static int hf_pn_io_tsn_domain_port_config_boundary_port_config; +static int hf_pn_io_tsn_domain_port_config_reserved; + +static int hf_pn_io_tsn_domain_port_ingress_rate_limiter; +static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_cir; +static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_cbs; +static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_envelope; +static int hf_pn_io_tsn_domain_port_ingress_rate_limiter_rank; + +static int hf_pn_io_tsn_domain_queue_rate_limiter; +static int hf_pn_io_tsn_domain_queue_rate_limiter_cir; +static int hf_pn_io_tsn_domain_queue_rate_limiter_cbs; +static int hf_pn_io_tsn_domain_queue_rate_limiter_envelope; +static int hf_pn_io_tsn_domain_queue_rate_limiter_rank; +static int hf_pn_io_tsn_domain_queue_rate_limiter_queue_id; +static int hf_pn_io_tsn_domain_queue_rate_limiter_reserved; + +static int hf_pn_io_number_of_tsn_domain_queue_config_entries; +static int hf_pn_io_tsn_domain_queue_config; +static int hf_pn_io_tsn_domain_queue_config_queue_id; +static int hf_pn_io_tsn_domain_queue_config_tci_pcp; +static int hf_pn_io_tsn_domain_queue_config_shaper; +static int hf_pn_io_tsn_domain_queue_config_preemption_mode; +static int hf_pn_io_tsn_domain_queue_config_unmask_time_offset; +static int hf_pn_io_tsn_domain_queue_config_mask_time_offset; + +static int hf_pn_io_network_deadline; +static int hf_pn_io_time_domain_number; +static int hf_pn_io_time_pll_window; +static int hf_pn_io_message_interval_factor; +static int hf_pn_io_message_timeout_factor; +static int hf_pn_io_time_sync_properties; +static int hf_pn_io_time_sync_properties_role; +static int hf_pn_io_time_sync_properties_reserved; +static int hf_pn_io_time_domain_uuid; +static int hf_pn_io_time_domain_name_length; +static int hf_pn_io_time_domain_name; +static int hf_pn_io_tsn_nme_name_uuid; +static int hf_pn_io_tsn_nme_name_length; +static int hf_pn_io_tsn_nme_name; +static int hf_pn_io_tsn_domain_uuid; +static int hf_pn_io_tsn_domain_name_length; +static int hf_pn_io_tsn_domain_name; + +static int hf_pn_io_tsn_fdb_command; +static int hf_pn_io_tsn_dst_add; + +static int hf_pn_io_number_of_tsn_domain_sync_tree_entries; +static int hf_pn_io_tsn_domain_sync_port_role; +static int hf_pn_io_tsn_domain_port_id; + +static int hf_pn_io_maintenance_required_power_budget; +static int hf_pn_io_maintenance_demanded_power_budget; +static int hf_pn_io_error_power_budget; + +static int hf_pn_io_fiber_optic_type; +static int hf_pn_io_fiber_optic_cable_type; + +static int hf_pn_io_controller_appl_cycle_factor; +static int hf_pn_io_time_data_cycle; +static int hf_pn_io_time_io_input; +static int hf_pn_io_time_io_output; +static int hf_pn_io_time_io_input_valid; +static int hf_pn_io_time_io_output_valid; + +static int hf_pn_io_maintenance_status; +static int hf_pn_io_maintenance_status_required; +static int hf_pn_io_maintenance_status_demanded; + +static int hf_pn_io_vendor_id_high; +static int hf_pn_io_vendor_id_low; +static int hf_pn_io_vendor_block_type; +static int hf_pn_io_order_id; +static int hf_pn_io_im_serial_number; +static int hf_pn_io_im_hardware_revision; +static int hf_pn_io_im_revision_prefix; +static int hf_pn_io_im_sw_revision_functional_enhancement; +static int hf_pn_io_im_revision_bugfix; +static int hf_pn_io_im_sw_revision_internal_change; +static int hf_pn_io_im_revision_counter; +static int hf_pn_io_im_profile_id; +static int hf_pn_io_im_profile_specific_type; +static int hf_pn_io_im_version_major; +static int hf_pn_io_im_version_minor; +static int hf_pn_io_im_supported; +static int hf_pn_io_im_numberofentries; +static int hf_pn_io_im_annotation; +static int hf_pn_io_im_order_id; + +static int hf_pn_io_number_of_ars; + +static int hf_pn_io_cycle_counter; +static int hf_pn_io_data_status; +static int hf_pn_io_data_status_res67; +static int hf_pn_io_data_status_ok; +static int hf_pn_io_data_status_operate; +static int hf_pn_io_data_status_res3; +static int hf_pn_io_data_status_valid; +static int hf_pn_io_data_status_res1; +static int hf_pn_io_data_status_primary; +static int hf_pn_io_transfer_status; + +static int hf_pn_io_actual_local_time_stamp; +static int hf_pn_io_number_of_log_entries; +static int hf_pn_io_local_time_stamp; +static int hf_pn_io_entry_detail; + +static int hf_pn_io_ip_address; +static int hf_pn_io_subnetmask; +static int hf_pn_io_standard_gateway; + +static int hf_pn_io_mrp_domain_uuid; +static int hf_pn_io_mrp_role; +static int hf_pn_io_mrp_length_domain_name; +static int hf_pn_io_mrp_domain_name; +static int hf_pn_io_mrp_instances; +static int hf_pn_io_mrp_instance; + +static int hf_pn_io_mrp_prio; +static int hf_pn_io_mrp_topchgt; +static int hf_pn_io_mrp_topnrmax; +static int hf_pn_io_mrp_tstshortt; +static int hf_pn_io_mrp_tstdefaultt; +static int hf_pn_io_mrp_tstnrmax; +static int hf_pn_io_mrp_check; +static int hf_pn_io_mrp_check_mrm; +static int hf_pn_io_mrp_check_mrpdomain; +static int hf_pn_io_mrp_check_reserved_1; +static int hf_pn_io_mrp_check_reserved_2; + +static int hf_pn_io_mrp_rtmode; +static int hf_pn_io_mrp_rtmode_rtclass12; +static int hf_pn_io_mrp_rtmode_rtclass3; +static int hf_pn_io_mrp_rtmode_reserved1; +static int hf_pn_io_mrp_rtmode_reserved2; + +static int hf_pn_io_mrp_lnkdownt; +static int hf_pn_io_mrp_lnkupt; +static int hf_pn_io_mrp_lnknrmax; +static int hf_pn_io_mrp_version; + +static int hf_pn_io_substitute_active_flag; +static int hf_pn_io_length_data; + +static int hf_pn_io_mrp_ring_state; +static int hf_pn_io_mrp_rt_state; + +static int hf_pn_io_im_tag_function; +static int hf_pn_io_im_tag_location; +static int hf_pn_io_im_date; +static int hf_pn_io_im_descriptor; + +static int hf_pn_io_fs_hello_mode; +static int hf_pn_io_fs_hello_interval; +static int hf_pn_io_fs_hello_retry; +static int hf_pn_io_fs_hello_delay; + +static int hf_pn_io_fs_parameter_mode; +static int hf_pn_io_fs_parameter_uuid; + + +static int hf_pn_io_check_sync_mode; +static int hf_pn_io_check_sync_mode_reserved; +static int hf_pn_io_check_sync_mode_sync_master; +static int hf_pn_io_check_sync_mode_cable_delay; /* 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; +static int hf_pn_io_ps_f_prm_flag1; +static int hf_pn_io_ps_f_prm_flag1_chck_seq; +static int hf_pn_io_ps_f_prm_flag1_chck_ipar; +static int hf_pn_io_ps_f_prm_flag1_sil; +static int hf_pn_io_ps_f_prm_flag1_crc_len; +static int hf_pn_io_ps_f_prm_flag1_crc_seed; +static int hf_pn_io_ps_f_prm_flag1_reserved; +static int hf_pn_io_ps_f_prm_flag2; +static int hf_pn_io_ps_f_wd_time; +static int hf_pn_io_ps_f_ipar_crc; +static int hf_pn_io_ps_f_par_crc; +static int hf_pn_io_ps_f_src_adr; +static int hf_pn_io_ps_f_dest_adr; +static int hf_pn_io_ps_f_prm_flag2_reserved; +static int hf_pn_io_ps_f_prm_flag2_f_block_id; +static int hf_pn_io_ps_f_prm_flag2_f_par_version; + +static int hf_pn_io_profidrive_request_reference; +static int hf_pn_io_profidrive_request_id; +static int hf_pn_io_profidrive_do_id; +static int hf_pn_io_profidrive_no_of_parameters; +static int hf_pn_io_profidrive_response_id; +static int hf_pn_io_profidrive_param_attribute; +static int hf_pn_io_profidrive_param_no_of_elems; +static int hf_pn_io_profidrive_param_number; +static int hf_pn_io_profidrive_param_subindex; +static int hf_pn_io_profidrive_param_format; +static int hf_pn_io_profidrive_param_no_of_values; +static int hf_pn_io_profidrive_param_value_byte; +static int hf_pn_io_profidrive_param_value_word; +static int hf_pn_io_profidrive_param_value_dword; +static int hf_pn_io_profidrive_param_value_float; +static int hf_pn_io_profidrive_param_value_string; +static int hf_pn_io_profidrive_param_value_error; +static int hf_pn_io_profidrive_param_value_error_sub; /* 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_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_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 int hf_pn_io_rs_alarm_info_reserved_0_7; +static int hf_pn_io_rs_alarm_info_reserved_8_15; +static int hf_pn_io_rs_alarm_info; +static int hf_pn_io_rs_event_info; +static int hf_pn_io_rs_event_block; +static int hf_pn_io_rs_adjust_block; +static int hf_pn_io_rs_event_data_extension; +static int hf_pn_io_number_of_rs_event_info; +static int hf_pn_io_rs_block_type; +static int hf_pn_io_rs_block_length; +static int hf_pn_io_rs_specifier; +static int hf_pn_io_rs_specifier_sequence; +static int hf_pn_io_rs_specifier_reserved; +static int hf_pn_io_rs_specifier_specifier; +static int hf_pn_io_rs_time_stamp; +static int hf_pn_io_rs_time_stamp_status; +static int hf_pn_io_rs_time_stamp_value; +static int hf_pn_io_rs_minus_error; +static int hf_pn_io_rs_plus_error; +static int hf_pn_io_rs_extension_block_type; +static int hf_pn_io_rs_extension_block_length; +static int hf_pn_io_rs_reason_code; +static int hf_pn_io_rs_reason_code_reason; +static int hf_pn_io_rs_reason_code_detail; +static int hf_pn_io_rs_domain_identification; +static int hf_pn_io_rs_master_identification; +static int hf_pn_io_soe_digital_input_current_value; +static int hf_pn_io_soe_digital_input_current_value_value; +static int hf_pn_io_soe_digital_input_current_value_reserved; +static int hf_pn_io_am_device_identification; +static int hf_pn_io_am_device_identification_device_sub_id; +static int hf_pn_io_am_device_identification_device_id; +static int hf_pn_io_am_device_identification_vendor_id; +static int hf_pn_io_am_device_identification_organization; +static int hf_pn_io_rs_adjust_info; +static int hf_pn_io_soe_max_scan_delay; +static int hf_pn_io_soe_adjust_specifier; +static int hf_pn_io_soe_adjust_specifier_reserved; +static int hf_pn_io_soe_adjust_specifier_incident; +static int hf_pn_io_rs_properties; +static int hf_pn_io_rs_properties_alarm_transport; +static int hf_pn_io_rs_properties_reserved1; +static int hf_pn_io_rs_properties_reserved2; + +static int hf_pn_io_asset_management_info; +static int hf_pn_io_number_of_asset_management_info; +static int hf_pn_io_im_uniqueidentifier; +static int hf_pn_io_am_location_structure; +static int hf_pn_io_am_location_level_0; +static int hf_pn_io_am_location_level_1; +static int hf_pn_io_am_location_level_2; +static int hf_pn_io_am_location_level_3; +static int hf_pn_io_am_location_level_4; +static int hf_pn_io_am_location_level_5; +static int hf_pn_io_am_location_level_6; +static int hf_pn_io_am_location_level_7; +static int hf_pn_io_am_location_level_8; +static int hf_pn_io_am_location_level_9; +static int hf_pn_io_am_location_level_10; +static int hf_pn_io_am_location_level_11; +static int hf_pn_io_am_location; +static int hf_pn_io_am_location_reserved1; +static int hf_pn_io_am_location_reserved2; +static int hf_pn_io_am_location_reserved3; +static int hf_pn_io_am_location_reserved4; +static int hf_pn_io_am_location_beginslotnum; +static int hf_pn_io_am_location_beginsubslotnum; +static int hf_pn_io_am_location_endslotnum; +static int hf_pn_io_am_location_endsubslotnum; +static int hf_pn_io_am_software_revision; +static int hf_pn_io_am_hardware_revision; +static int hf_pn_io_am_type_identification; +static int hf_pn_io_am_reserved; + +static int hf_pn_io_dcp_boundary_value; +static int hf_pn_io_dcp_boundary_value_bit0; +static int hf_pn_io_dcp_boundary_value_bit1; +static int hf_pn_io_dcp_boundary_value_otherbits; + +static int hf_pn_io_peer_to_peer_boundary_value; +static int hf_pn_io_peer_to_peer_boundary_value_bit0; +static int hf_pn_io_peer_to_peer_boundary_value_bit1; +static int hf_pn_io_peer_to_peer_boundary_value_bit2; +static int hf_pn_io_peer_to_peer_boundary_value_otherbits; + +static int hf_pn_io_mau_type_extension; + +static int hf_pn_io_pe_operational_mode; + +static int hf_pn_io_snmp_community_name_length; +static int hf_pn_io_snmp_community_name; +static int hf_pn_io_snmp_read_community_name; +static int hf_pn_io_snmp_write_community_name; + +static int hf_pn_io_snmp_control; + +/* static int hf_pn_io_packedframe_SFCRC; */ +static gint ett_pn_io; +static gint ett_pn_io_block; +static gint ett_pn_io_block_header; +static gint ett_pn_io_rtc; +static gint ett_pn_io_rta; +static gint ett_pn_io_pdu_type; +static gint ett_pn_io_add_flags; +static gint ett_pn_io_control_command; +static gint ett_pn_io_ioxs; +static gint ett_pn_io_api; +static gint ett_pn_io_data_description; +static gint ett_pn_io_module; +static gint ett_pn_io_submodule; +static gint ett_pn_io_io_data_object; +static gint ett_pn_io_io_cs; +static gint ett_pn_io_ar_properties; +static gint ett_pn_io_iocr_properties; +static gint ett_pn_io_submodule_properties; +static gint ett_pn_io_alarmcr_properties; +static gint ett_pn_io_submodule_state; +static gint ett_pn_io_channel_properties; +static gint ett_pn_io_slot; +static gint ett_pn_io_subslot; +static gint ett_pn_io_maintenance_status; +static gint ett_pn_io_data_status; +static gint ett_pn_io_iocr; +static gint ett_pn_io_mrp_rtmode; +static gint ett_pn_io_control_block_properties; +static gint ett_pn_io_check_sync_mode; +static gint ett_pn_io_ir_frame_data; +static gint ett_pn_FrameDataProperties; +static gint ett_pn_io_ar_info; +static gint ett_pn_io_ar_data; +static gint ett_pn_io_ir_begin_end_port; +static gint ett_pn_io_ir_tx_phase; +static gint ett_pn_io_ir_rx_phase; +static gint ett_pn_io_subframe_data; +static gint ett_pn_io_SFIOCRProperties; +static gint ett_pn_io_frame_defails; +static gint ett_pn_io_profisafe_f_parameter; +static gint ett_pn_io_profisafe_f_parameter_prm_flag1; +static gint ett_pn_io_profisafe_f_parameter_prm_flag2; +static gint ett_pn_io_profidrive_parameter_request; +static gint ett_pn_io_profidrive_parameter_response; +static gint ett_pn_io_profidrive_parameter_address; +static gint ett_pn_io_profidrive_parameter_value; +static gint ett_pn_io_rs_alarm_info; +static gint ett_pn_io_rs_event_info; +static gint ett_pn_io_rs_event_block; +static gint ett_pn_io_rs_adjust_block; +static gint ett_pn_io_rs_event_data_extension; +static gint ett_pn_io_rs_specifier; +static gint ett_pn_io_rs_time_stamp; +static gint ett_pn_io_am_device_identification; +static gint ett_pn_io_rs_reason_code; +static gint ett_pn_io_soe_digital_input_current_value; +static gint ett_pn_io_rs_adjust_info; +static gint ett_pn_io_soe_adjust_specifier; +static gint ett_pn_io_sr_properties; +static gint ett_pn_io_line_delay; +static gint ett_pn_io_counter_status; +static gint ett_pn_io_neighbor; + +static gint ett_pn_io_GroupProperties; + +static gint ett_pn_io_asset_management_info; +static gint ett_pn_io_asset_management_block; +static gint ett_pn_io_am_location; + +static gint ett_pn_io_dcp_boundary; +static gint ett_pn_io_peer_to_peer_boundary; + +static gint ett_pn_io_mau_type_extension; + +static gint ett_pn_io_pe_operational_mode; + +static gint ett_pn_io_tsn_domain_port_config; +static gint ett_pn_io_tsn_domain_port_ingress_rate_limiter; +static gint ett_pn_io_tsn_domain_queue_rate_limiter; +static gint ett_pn_io_tsn_domain_vid_config; +static gint ett_pn_io_tsn_domain_queue_config; +static gint ett_pn_io_time_sync_properties; +static gint ett_pn_io_tsn_domain_port_id; + +static gint ett_pn_io_snmp_command_name; + #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 expert_field ei_pn_io_block_version; +static expert_field ei_pn_io_block_length; +static expert_field ei_pn_io_unsupported; +static expert_field ei_pn_io_localalarmref; +static expert_field ei_pn_io_mrp_instances; +static expert_field ei_pn_io_ar_info_not_found; +static expert_field ei_pn_io_iocr_type; +static expert_field ei_pn_io_frame_id; +static expert_field ei_pn_io_nr_of_tx_port_groups; +static expert_field ei_pn_io_max_recursion_depth_reached; 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; @@ -854,6 +992,7 @@ 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 */ @@ -862,7 +1001,9 @@ 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"}, @@ -917,8 +1058,9 @@ static const value_string pn_io_block_type[] = { { 0x0105, "PrmServerBlockReq"}, { 0x8105, "PrmServerBlockRes"}, { 0x0106, "MCRBlockReq"}, - { 0x8106, "ARServerBlock"}, + { 0x8106, "ARServerBlockRes"}, { 0x0107, "SubFrameBlock"}, + { 0x8107, "ARRPCBlockRes"}, { 0x0108, "ARVendorBlockReq"}, { 0x8108, "ARVendorBlockRes"}, { 0x0109, "IRInfoBlock"}, @@ -927,12 +1069,12 @@ static const value_string pn_io_block_type[] = { { 0x010C, "RSInfoBlock"}, { 0x0110, "IODControlReq Prm End.req"}, { 0x8110, "IODControlRes Prm End.rsp"}, - { 0x0111, "IODControlReq Prm End.req"}, - { 0x8111, "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 Application Ready.req"}, - { 0x8113, "IOXBlockRes Application Ready.rsp"}, + { 0x0113, "IOXBlockReq Plug Application Ready.req"}, + { 0x8113, "IOXBlockRes Plug Application Ready.rsp"}, { 0x0114, "IODReleaseReq"}, { 0x8114, "IODReleaseRes"}, { 0x0115, "ARRPCServerBlockReq"}, @@ -941,9 +1083,9 @@ static const value_string pn_io_block_type[] = { { 0x8116, "IOXControlRes Ready for Companion.rsp"}, { 0x0117, "IOXControlReq Ready for RT_CLASS_3.req"}, { 0x8117, "IOXControlRes Ready for RT_CLASS_3.rsp"}, - { 0x0118, "ControlBlockPrmBegin"}, + { 0x0118, "PrmBeginReq"}, + { 0x8118, "PrmBeginRes"}, { 0x0119, "SubmoduleListBlock"}, - { 0x8118, "ControlBlockPrmBeginRes"}, { 0x0200, "PDPortDataCheck"}, { 0x0201, "PDevData"}, @@ -988,29 +1130,63 @@ static const value_string pn_io_block_type[] = { { 0x0229, "AdjustMAUType-Extension"}, { 0x022A, "PDIRSubframeData"}, { 0x022B, "SubframeBlock"}, + { 0x022C, "PDPortDataRealExtended"}, + { 0x022D, "PDTimeData"}, + { 0x022E, "PDPortSFPDataCheck"}, { 0x0230, "PDNCDataCheck"}, { 0x0231, "MrpInstanceDataAdjust"}, { 0x0232, "MrpInstanceDataReal"}, { 0x0233, "MrpInstanceDataCheck"}, - { 0x0241, "PDRsiInstances"}, + { 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"}, - { 0x0600, "FSHello"}, + { 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)" }, @@ -1219,6 +1395,13 @@ static const value_string pn_io_arproperties_acknowldege_companion_ar[] = { { 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" }, @@ -1349,9 +1532,9 @@ static const value_string pn_io_submodule_state_add_info[] = { { 0, NULL } }; -static const value_string pn_io_submodule_state_qualified_info[] = { - { 0x0000, "No QualifiedInfo available" }, - { 0x0001, "QualifiedInfo available" }, +static const value_string pn_io_submodule_state_advice[] = { + { 0x0000, "No Advice available" }, + { 0x0001, "Advice available" }, { 0, NULL } }; @@ -1367,9 +1550,9 @@ static const value_string pn_io_submodule_state_maintenance_demanded[] = { { 0, NULL } }; -static const value_string pn_io_submodule_state_diag_info[] = { - { 0x0000, "No DiagnosisData available" }, - { 0x0001, "DiagnosisData available" }, +static const value_string pn_io_submodule_state_fault[] = { + { 0x0000, "No Fault available" }, + { 0x0001, "Fault available" }, { 0, NULL } }; @@ -1433,68 +1616,65 @@ static const value_string pn_io_index[] = { { 0x8013, "Maintenance demanded in all codings for one subslot" }, /*0x8014 - 0x801D reserved */ { 0x801E, "SubstituteValues for one subslot" }, - /*0x801F - 0x8027 reserved */ + /*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, "Expected PDSyncData for one subslot with SyncID value 0" }, + { 0x802D, "PDSyncData for one subslot with SyncID value 0" }, /*0x802E reserved */ { 0x802F, "PDPortDataAdjust for one subslot" }, { 0x8030, "IsochronousModeData for one subslot" }, - { 0x8031, "Expected PDSyncData for one subslot with SyncID value 1" }, - { 0x8032, "Expected PDSyncData for one subslot with SyncID value 2" }, - { 0x8033, "Expected PDSyncData for one subslot with SyncID value 3" }, - { 0x8034, "Expected PDSyncData for one subslot with SyncID value 4" }, - { 0x8035, "Expected PDSyncData for one subslot with SyncID value 5" }, - { 0x8036, "Expected PDSyncData for one subslot with SyncID value 6" }, - { 0x8037, "Expected PDSyncData for one subslot with SyncID value 7" }, - { 0x8038, "Expected PDSyncData for one subslot with SyncID value 8" }, - { 0x8039, "Expected PDSyncData for one subslot with SyncID value 9" }, - { 0x803A, "Expected PDSyncData for one subslot with SyncID value 10" }, - { 0x803B, "Expected PDSyncData for one subslot with SyncID value 11" }, - { 0x803C, "Expected PDSyncData for one subslot with SyncID value 12" }, - { 0x803D, "Expected PDSyncData for one subslot with SyncID value 13" }, - { 0x803E, "Expected PDSyncData for one subslot with SyncID value 14" }, - { 0x803F, "Expected PDSyncData for one subslot with SyncID value 15" }, - { 0x8040, "Expected PDSyncData for one subslot with SyncID value 16" }, - { 0x8041, "Expected PDSyncData for one subslot with SyncID value 17" }, - { 0x8042, "Expected PDSyncData for one subslot with SyncID value 18" }, - { 0x8043, "Expected PDSyncData for one subslot with SyncID value 19" }, - { 0x8044, "Expected PDSyncData for one subslot with SyncID value 20" }, - { 0x8045, "Expected PDSyncData for one subslot with SyncID value 21" }, - { 0x8046, "Expected PDSyncData for one subslot with SyncID value 22" }, - { 0x8047, "Expected PDSyncData for one subslot with SyncID value 23" }, - { 0x8048, "Expected PDSyncData for one subslot with SyncID value 24" }, - { 0x8049, "Expected PDSyncData for one subslot with SyncID value 25" }, - { 0x804A, "Expected PDSyncData for one subslot with SyncID value 26" }, - { 0x804B, "Expected PDSyncData for one subslot with SyncID value 27" }, - { 0x804C, "Expected PDSyncData for one subslot with SyncID value 28" }, - { 0x804D, "Expected PDSyncData for one subslot with SyncID value 29" }, - { 0x804E, "Expected PDSyncData for one subslot with SyncID value 30" }, - { 0x804F, "Expected PDSyncData for one subslot with SyncID value 31" }, + { 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 - 0x805F reserved */ + { 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 - 0x806F reserved */ + { 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, "Expected PDInterfaceFSUDataAdjust" }, - /*0x8091 - 0xAFEF reserved except 0x80B0, 0x80AF and 0x80CF*/ + { 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" }, @@ -1605,7 +1785,8 @@ static const value_string pn_io_index[] = { { 0xE031, "PE_EntityStatusData for one AR" }, /*0xE032 - 0xE03F reserved */ { 0xE040, "MultipleWrite" }, - /*0xE041 - 0xE04F reserved */ + { 0xE041, "ApplicationReadyBlock" }, + /*0xE042 - 0xE04F reserved */ { 0xE050, "ARFSUDataAdjust data for one AR" }, /*0xE051 - 0xE05F reserved */ { 0xE060, "RS_GetEvent (using RecordDataRead service)" }, @@ -1643,11 +1824,24 @@ static const value_string pn_io_index[] = { { 0xF842, "PDExpectedData" }, /*0xF843 - 0xF84F reserved */ { 0xF850, "AutoConfiguration" }, + { 0xF860, "GSD upload using UploadBLOBQuery and UploadBLOB" }, { 0xF870, "PE_EntityFilterData" }, { 0xF871, "PE_EntityStatusData" }, - { 0xF880, "AssetManagementData" }, - /*0xF851 - 0xFBFF reserved except 0xF880*/ + { 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 } }; @@ -1660,12 +1854,15 @@ static const value_string pn_io_user_structure_identifier[] = { { 0x8003, "QualifiedChannelDiagnosis" }, /*0x8004 - 0x80FF reserved */ { 0x8100, "Maintenance" }, - /*0x8101 - 0x8FFF reserved except 8300, 8301, 8302, 8303 */ - { 0x8300, "Sequence of events RS_LowWatermark" }, - { 0x8301, "Sequence of events RS_Timeout" }, - { 0x8302, "Sequence of events RS_Overflow" }, - { 0x8303, "Sequence of events RS_Event" }, + /*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 } @@ -1678,28 +1875,47 @@ static const value_string pn_io_channel_error_type[] = { { 0x0003, "Overvoltage" }, { 0x0004, "Overload" }, { 0x0005, "Overtemperature" }, - { 0x0006, "line break" }, - { 0x0007, "upper limit value exceeded" }, - { 0x0008, "lower limit value exceeded" }, + { 0x0006, "Wire break" }, + { 0x0007, "Upper limit value exceeded" }, + { 0x0008, "Lower limit value exceeded" }, { 0x0009, "Error" }, - /*0x000A - 0x000F reserved */ - { 0x0010, "parameterization fault" }, - { 0x0011, "power supply fault" }, - { 0x0012, "fuse blown / open" }, + { 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, "safety event" }, - { 0x001A, "external fault" }, + { 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" }, + { 0x8002, "Media redundancy mismatch - Ring" }, { 0x8003, "Sync mismatch" }, { 0x8004, "IsochronousMode mismatch" }, { 0x8005, "Multicast CR mismatch" }, @@ -1711,9 +1927,373 @@ static const value_string pn_io_channel_error_type[] = { { 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 } }; @@ -1747,8 +2327,8 @@ static const value_string pn_io_ext_channel_error_type0x8000[] = { static const value_string pn_io_ext_channel_error_type0x8001[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ - { 0x8000, "Peer Chassis ID mismatch"}, - { 0x8001, "Peer Port ID mismatch"}, + { 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"}, @@ -1758,7 +2338,8 @@ static const value_string pn_io_ext_channel_error_type0x8001[] = { { 0x8008, "Peer PTCP mismatch b"}, { 0x8009, "Peer Preamble Length mismatch"}, { 0x800A, "Peer Fragmentation mismatch"}, - /* 0x800B - 0x8FFF Reserved */ + { 0x800B, "Peer MRP Interconnection domain mismatch"}, + /* 0x800C - 0x8FFF Reserved */ /* 0x9000 - 0x9FFF Reserved for profiles */ /* 0xA000 - 0xFFFF Reserved */ { 0, NULL } @@ -1867,7 +2448,16 @@ static const value_string pn_io_ext_channel_error_type0x8007[] = { /* 0x0000 Reserved */ /* 0x0001 - 0x7FFF Manufacturer specific */ { 0x8000, "Power Budget"}, - /* 0x8001 - 0x8FFF Reserved */ + { 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 } @@ -1922,6 +2512,56 @@ static const value_string pn_io_ext_channel_error_type0x800C[] = { { 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" }, @@ -2003,7 +2643,9 @@ static const value_string pn_io_mau_type[] = { { 0x002E, "100BASELX10" }, /*0x002F - 0x0035 reserved */ { 0x0036, "100BASEPXFD" }, - /*0x0037 - 0xFFFF reserved */ + /*0x0037 - 0x008C reserved */ + { 0x008D, "10BASET1L" }, + /*0x008E - 0xFFFF reserved */ { 0, NULL } }; @@ -2057,7 +2699,9 @@ static const range_string pn_io_mau_type_extension[] = { { 0x0000, 0x0000, "No SubMAUType" }, { 0x0001, 0x00FF, "Reserved" }, { 0x0100, 0x0100, "POF" }, - { 0x0101, 0xFFEF, "Reserved for SubMAUType" }, + { 0x0101, 0x01FF, "Reserved for SubMAUType" }, + { 0x0200, 0x0200, "APL" }, + { 0x0201, 0xFFEF, "Reserved for SubMAUType" }, { 0xFFF0, 0xFFFF, "Reserved" }, { 0, 0, NULL } }; @@ -2120,7 +2764,6 @@ static const value_string pn_io_media_type[] = { { 0, NULL } }; - static const value_string pn_io_fiber_optic_type[] = { { 0x0000, "No fiber type adjusted" }, { 0x0001, "9 um single mode fiber" }, @@ -2446,7 +3089,7 @@ static const value_string pn_io_profidrive_format_vals[] = { { 0, NULL } }; -static const value_string pn_io_profidrive_parameter_resp_errors[] = +static const value_string pn_io_profidrive_parameter_resp_errors[] = { {0x0, "Disallowed parameter number" }, {0x1, "The parameter value cannot be changed" }, @@ -2615,6 +3258,481 @@ static const value_string pn_io_pdportstatistic_counter_status_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) @@ -2654,7 +3772,7 @@ dissect_profidrive_value(tvbuff_t *tvb, gint offset, packet_info *pinfo, { 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_io_profidrive_param_value_string, tvb, offset, sLen, ENC_ASCII); offset = (offset + sLen); break; } @@ -3061,11 +4179,11 @@ dissect_RS_IdentificationInfo(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_io_im_tag_location, tvb, offset, 22, ENC_ASCII); offset += 22; return offset; @@ -3292,106 +4410,139 @@ dissect_RS_EventInfo(tvbuff_t *tvb, int 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) +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_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); + offset = dissect_Diagnosis(tvb, offset, pinfo, tree, item, drep, + u16UserStructureIdentifier); *body_length -= 6; break; case(0x8002): /* ExtChannelDiagnosisData */ - 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 (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 - { - 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); + 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; @@ -3412,8 +4563,7 @@ dissect_AlarmUserStructure(tvbuff_t *tvb, int offset, break; /* XXX - dissect remaining user structures of [AlarmItem] */ case(0x8001): /* DiagnosisData */ - case(0x8003): /* QualifiedChannelDiagnosisData */ - default: + default: if (u16UserStructureIdentifier >= 0x8000) { offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, *body_length); } else { @@ -3505,11 +4655,11 @@ dissect_IandM0_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* x16 IM_Hardware_Revision */ @@ -3564,11 +4714,11 @@ dissect_IandM1_block(tvbuff_t *tvb, int offset, } /* IM_Tag_Function [32] */ - proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_tag_function, tvb, offset, 32, ENC_ASCII|ENC_NA, pinfo->pool, &pTagFunction); + 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|ENC_NA, pinfo->pool, &pTagLocation); + 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); @@ -3590,7 +4740,7 @@ dissect_IandM2_block(tvbuff_t *tvb, int offset, } /* IM_Date [16] */ - proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_date, tvb, offset, 16, ENC_ASCII|ENC_NA, pinfo->pool, &pDate); + 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); @@ -3612,7 +4762,7 @@ dissect_IandM3_block(tvbuff_t *tvb, int offset, } /* IM_Descriptor [54] */ - proto_tree_add_item_ret_display_string (tree, hf_pn_io_im_descriptor, tvb, offset, 54, ENC_ASCII|ENC_NA, pinfo->pool, &pDescriptor); + 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); @@ -3750,11 +4900,11 @@ dissect_IandM5Data_block(tvbuff_t *tvb, int offset, guint8 u8IMSWRevisionInternalChange; /* c8[64] IM Annotation */ - proto_tree_add_item(tree, hf_pn_io_im_annotation, tvb, offset, 64, ENC_ASCII|ENC_NA); + 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_io_im_order_id, tvb, offset, 64, ENC_ASCII); offset += 64; /* x8 VendorIDHigh */ @@ -3765,7 +4915,7 @@ dissect_IandM5Data_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* x16 IM_Hardware_Revision */ @@ -3999,23 +5149,23 @@ guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) 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); + 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|ENC_NA); + 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|ENC_NA); + 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|ENC_NA); + 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_io_im_serial_number, tvb, offset, 16, ENC_ASCII); offset += 16; /* IM_Software_Revision */ @@ -4689,9 +5839,9 @@ dissect_IODReadResHeader_block(tvbuff_t *tvb, int offset, } -/* dissect the control/connect block */ +/* dissect the control/connect and control/connect block */ static int -dissect_ControlConnect_block(tvbuff_t *tvb, int offset, +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) { @@ -4720,8 +5870,15 @@ dissect_ControlConnect_block(tvbuff_t *tvb, int offset, offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_sessionkey, &u16SessionKey); - offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, - hf_pn_io_reserved16, NULL); + 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); @@ -5082,11 +6239,15 @@ dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset, 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; @@ -5114,7 +6275,7 @@ dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset, 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|ENC_NA, pinfo->pool, &pOwnPortID); + 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 */ @@ -5125,31 +6286,40 @@ dissect_PDPortDataReal_block(tvbuff_t *tvb, int offset, 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, tree, drep, + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_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|ENC_NA); + 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, tree, drep, + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, sub_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|ENC_NA); + 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, tree); + offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); /* LineDelay */ - offset = dissect_Line_Delay(tvb, offset, pinfo, tree, drep, &u32LineDelayValue); + offset = dissect_Line_Delay(tvb, offset, pinfo, sub_tree, drep, &u32LineDelayValue); /* PeerMACAddress */ - offset = dissect_pn_mac(tvb, offset, pinfo, tree, + offset = dissect_pn_mac(tvb, offset, pinfo, sub_tree, hf_pn_io_peer_macadd, mac); /* Padding */ - offset = dissect_pn_align4(tvb, offset, pinfo, tree); + offset = dissect_pn_align4(tvb, offset, pinfo, sub_tree); + + proto_item_append_text(sub_item, ": %s (%s)", pPeerChassisId, pPeerPortId); } /* MAUType */ @@ -5187,6 +6357,43 @@ dissect_PDPortDataReal_block(tvbuff_t *tvb, int 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) @@ -5240,7 +6447,7 @@ dissect_PDInterfaceMrpDataAdjust_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; /* Padding */ @@ -5311,7 +6518,7 @@ dissect_PDInterfaceMrpDataReal_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_mrp_domain_name, tvb, offset, u8LengthDomainName, ENC_ASCII); offset += u8LengthDomainName; if (u8BlockVersionLow == 0) { @@ -5885,14 +7092,14 @@ dissect_CheckPeers_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_peer_chassis_id, tvb, offset, u8LengthPeerChassisID, ENC_ASCII); offset += u8LengthPeerChassisID; } @@ -6265,7 +7472,7 @@ dissect_MrpInstanceDataAdjust_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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); @@ -6312,7 +7519,7 @@ dissect_MrpInstanceDataReal_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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); @@ -6386,6 +7593,814 @@ dissect_PDInterfaceAdjust_block(tvbuff_t *tvb, int offset, 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, @@ -6452,6 +8467,157 @@ dissect_PDPortStatistic_block(tvbuff_t *tvb, int offset, 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 @@ -6473,7 +8639,7 @@ dissect_PDInterfaceDataReal_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_own_chassis_id, tvb, offset, u8LengthOwnChassisID, ENC_ASCII); offset += u8LengthOwnChassisID; /* Padding */ @@ -6618,7 +8784,7 @@ dissect_PDSyncData_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item (tree, hf_pn_io_ptcp_subdomain_name, tvb, offset, u8LengthSubdomainName, ENC_ASCII); offset += u8LengthSubdomainName; /* Padding */ @@ -7127,6 +9293,7 @@ dissect_ARProperties(tvbuff_t *tvb, int offset, 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); @@ -7148,6 +9315,13 @@ dissect_ARProperties(tvbuff_t *tvb, int offset, 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); @@ -7171,7 +9345,6 @@ dissect_ARProperties(tvbuff_t *tvb, int offset, return offset; } - /* dissect the IOCRProperties */ static int dissect_IOCRProperties(tvbuff_t *tvb, int offset, @@ -7267,7 +9440,7 @@ dissect_ARData_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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, @@ -7350,7 +9523,7 @@ dissect_ARData_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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, @@ -7397,7 +9570,7 @@ dissect_ARData_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + 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); @@ -7406,7 +9579,7 @@ dissect_ARData_block(tvbuff_t *tvb, int offset, 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|ENC_NA); + proto_tree_add_item (ar_tree, hf_pn_io_parameter_server_station_name, tvb, offset, u16NameLength, ENC_ASCII); offset += u16NameLength; } else @@ -8031,12 +10204,12 @@ dissect_ARBlockReq_block(tvbuff_t *tvb, int offset, /* 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, ENDPOINT_UDP, 0, 0, 0); + 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, ENDPOINT_UDP, 0, 0, 0); + 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 */ @@ -8087,7 +10260,7 @@ dissect_ARBlockReq_block(tvbuff_t *tvb, int offset, 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|ENC_NA, pinfo->pool, &pStationName); + 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", @@ -8191,11 +10364,13 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, guint8 mac[6]; guint16 u16NumberOfAPIs; guint32 u32Api; - guint16 u16NumberOfIODataObjects; + guint16 u16NumberOfIODataObjectsInAPI; + guint16 u16NumberOfIODataObjectsInCR = 0U; guint16 u16SlotNr; guint16 u16SubslotNr; guint16 u16IODataObjectFrameOffset; - guint16 u16NumberOfIOCS; + guint16 u16NumberOfIOCSInAPI; + guint16 u16NumberOfIOCSInCR = 0U; guint16 u16IOCSFrameOffset; proto_item *api_item; proto_tree *api_tree; @@ -8206,6 +10381,7 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, guint32 u32SubStart; conversation_t *conversation; + conversation_t *conversation_time_aware; stationInfo *station_info = NULL; iocsObject *iocs_object; iocsObject *cmp_iocs_object; @@ -8230,7 +10406,7 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_lt, &u16LT); - offset = dissect_IOCRProperties(tvb, offset, pinfo, tree, drep); + offset = dissect_IOCRProperties(tvb, offset, pinfo, tree, drep); offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_data_length, &u16DataLength); @@ -8255,6 +10431,25 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, 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); @@ -8273,18 +10468,18 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, hf_pn_io_api, &u32Api); /* NumberOfIODataObjects */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, - hf_pn_io_number_of_io_data_objects, &u16NumberOfIODataObjects); + hf_pn_io_number_of_io_data_objects, &u16NumberOfIODataObjectsInAPI); /* Set global Variant for Number of IO Data Objects */ - /* Notice: Handle Input & Output seperate!!! */ + /* Notice: Handle Input & Output separate!!! */ if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -8302,12 +10497,12 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, init_pnio_rtc1_station(station_info); conversation_add_proto_data(conversation, current_aruuid, station_info); } - station_info->ioDataObjectNr += u16NumberOfIODataObjects; + u16NumberOfIODataObjectsInCR += u16NumberOfIODataObjectsInAPI; pn_find_dcp_station_info(station_info, conversation); } - u16Tmp = u16NumberOfIODataObjects; + 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); @@ -8367,16 +10562,14 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, /* NumberOfIOCS */ offset = dissect_dcerpc_uint16(tvb, offset, pinfo, api_tree, drep, - hf_pn_io_number_of_iocs, &u16NumberOfIOCS); + hf_pn_io_number_of_iocs, &u16NumberOfIOCSInAPI); /* Set global Vairant for NumberOfIOCS */ if (!PINFO_FD_VISITED(pinfo)) { - if (station_info != NULL) { - station_info->iocsNr = u16NumberOfIOCS; - } + u16NumberOfIOCSInCR += u16NumberOfIOCSInAPI; } - u16Tmp = u16NumberOfIOCS; + 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); @@ -8427,11 +10620,24 @@ dissect_IOCRBlockReq_block(tvbuff_t *tvb, int offset, } proto_item_append_text(api_item, ": 0x%x, NumberOfIODataObjects: %u NumberOfIOCS: %u", - u32Api, u16NumberOfIODataObjects, u16NumberOfIOCS); + 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 */ @@ -8586,7 +10792,7 @@ dissect_ARServerBlock(tvbuff_t *tvb, int 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|ENC_NA); + 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); @@ -8692,7 +10898,7 @@ dissect_MCRBlockReq_block(tvbuff_t *tvb, int offset, 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|ENC_NA, pinfo->pool, &pStationName); + 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", @@ -9078,12 +11284,12 @@ dissect_DataDescription(tvbuff_t *tvb, int offset, /* 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -9110,6 +11316,7 @@ dissect_DataDescription(tvbuff_t *tvb, int offset, 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; @@ -9130,6 +11337,108 @@ dissect_DataDescription(tvbuff_t *tvb, int 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, @@ -9224,12 +11533,12 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset, /* Get current conversation endpoints using MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -9383,12 +11692,29 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset, 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 @@ -9628,9 +11954,9 @@ dissect_ModuleDiffBlock_block(tvbuff_t *tvb, int offset, if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -9686,13 +12012,13 @@ dissect_ModuleDiffBlock_block(tvbuff_t *tvb, int offset, 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_diag_info, &u16SubmoduleState); + 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_qualified_info, &u16SubmoduleState); + 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 { @@ -9769,6 +12095,60 @@ dissect_IsochronousModeData_block(tvbuff_t *tvb, int offset, return offset+1; } +static int +dissect_CommunityName_block(tvbuff_t *tvb, int offset, + packet_info *pinfo, 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(pinfo->pool, 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 @@ -10100,7 +12480,7 @@ dissect_block(tvbuff_t *tvb, int offset, val_to_str(u16BlockType, pn_io_block_type, "Unknown (0x%04x)")); col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", - val_to_str(u16BlockType, pn_io_block_type, "Unknown")); + 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 */ @@ -10241,7 +12621,7 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x0114): case(0x0116): case(0x0117): - dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType); + dissect_ControlPlugOrConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType); break; case(0x0118): @@ -10383,6 +12763,9 @@ dissect_block(tvbuff_t *tvb, int offset, 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); @@ -10396,7 +12779,6 @@ dissect_block(tvbuff_t *tvb, int offset, 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; @@ -10409,6 +12791,60 @@ dissect_block(tvbuff_t *tvb, int offset, 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; @@ -10487,7 +12923,7 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x8116): case(0x8117): case(0x8118): - dissect_ControlConnect_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar, u16BlockType); + 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); @@ -10683,7 +13119,7 @@ dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset, 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(request_id, pn_io_profidrive_request_id_vals, "Unknown"), + 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", @@ -10716,7 +13152,7 @@ dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset, hf_pn_io_profidrive_param_subindex, &idx); proto_item_append_text(sub_item, "Attr:%s, Elems:%u, Parameter:%u, Index:%u", - val_to_str(attribute, pn_io_profidrive_attribute_vals, "Unknown"), no_of_elems, + val_to_str_const(attribute, pn_io_profidrive_attribute_vals, "Unknown"), no_of_elems, parameter, idx); if (no_of_elems>1) { @@ -10745,7 +13181,7 @@ dissect_ProfiDriveParameterRequest(tvbuff_t *tvb, int offset, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", - val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); + val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); while (no_of_vals--) { @@ -10768,7 +13204,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, 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: "); @@ -10781,11 +13217,11 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, 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(response_id, pn_io_profidrive_response_id_vals, "Unknown"), + 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(response_id, pn_io_profidrive_response_id_vals, "Unknown response")); + 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++) { @@ -10804,7 +13240,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", - val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); + val_to_str_const(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); while (no_of_vals--) { @@ -10816,7 +13252,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, 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; @@ -10835,12 +13271,12 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", - val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); + 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); + hf_pn_io_profidrive_param_value_error, &value16); if(value16 == 0x23){ addr_idx = no_of_parameters; @@ -10871,7 +13307,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, } } } - + if(response_id == 0x82){ for(addr_idx=0; addr_idx<no_of_parameters; addr_idx++) { @@ -10891,17 +13327,17 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, hf_pn_io_profidrive_param_no_of_values, &no_of_vals); proto_item_append_text(sub_item, "Format:%s, NoOfVals:%u", - val_to_str(format, pn_io_profidrive_format_vals, "Unknown"), no_of_vals); + 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); + hf_pn_io_profidrive_param_value_error, &value16); if(value16 == 0x23){ addr_idx = no_of_parameters; } - + while (--no_of_vals) { switch(value16) @@ -10913,7 +13349,7 @@ dissect_ProfiDriveParameterResponse(tvbuff_t *tvb, int offset, 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; @@ -10964,6 +13400,8 @@ dissect_RecordDataRead(tvbuff_t *tvb, int offset, 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 */ @@ -10971,9 +13409,15 @@ dissect_RecordDataRead(tvbuff_t *tvb, int offset, 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 */ @@ -10981,6 +13425,8 @@ dissect_RecordDataRead(tvbuff_t *tvb, int offset, 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 */ @@ -11062,7 +13508,7 @@ dissect_RecordDataRead(tvbuff_t *tvb, int offset, case(0x802e): /* Expected PDSyncData for one subslot with SyncID value 0 for PTCPoverRTC */ case(0x802f): /* PDPortDataAdjust */ case(0x8030): /* IsochronousModeData for one subslot */ - case(0x8031): /* Expected PDSyncData for one subslot with SyncID value 1 */ + case(0x8031): /* PDTimeData for one subslot */ case(0x8032): case(0x8033): case(0x8034): @@ -11093,7 +13539,10 @@ dissect_RecordDataRead(tvbuff_t *tvb, int offset, case(0x804d): case(0x804e): case(0x804f): /* Expected PDSyncData for one subslot with SyncID value 31 */ - case(0x8072): /* PDPortStatistic for one subslot */ + 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 */ @@ -11264,12 +13713,12 @@ dissect_ProfiSafeParameterRequest(tvbuff_t *tvb, int offset, if (!PINFO_FD_VISITED(pinfo)) { /* Get current conversation endpoints using MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -11344,12 +13793,12 @@ dissect_RecordDataWrite(tvbuff_t *tvb, int offset, /* PROFISafe */ /* Get current conversation endpoints using MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -11428,16 +13877,23 @@ dissect_RecordDataWrite(tvbuff_t *tvb, int offset, 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) */ @@ -11738,7 +14194,7 @@ dissect_PNIO_RTA(tvbuff_t *tvb, int offset, hf_pn_io_pdu_type_version, &u8PDUVersion); u8PDUVersion >>= 4; proto_item_append_text(sub_item, ", Type: %s, Version: %u", - val_to_str(u8PDUType, pn_io_pdu_type, "Unknown"), + val_to_str_const(u8PDUType, pn_io_pdu_type, "Unknown"), u8PDUVersion); /* additional flags */ @@ -11797,6 +14253,8 @@ dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* 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, @@ -11806,10 +14264,27 @@ dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, 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 >= 0x700 && u16FrameID <= 0x0fff)) { /* RTC3 redundant */ + 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; } @@ -11817,7 +14292,7 @@ dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* 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 >= 0x1000 && u16FrameID <= 0x7fff) { + if (u16FrameID >= 0x4000 && u16FrameID <= 0x7fff) { dissect_PNIO_C_SDU(tvb, 0, pinfo, tree, drep); return TRUE; } @@ -11867,7 +14342,7 @@ dissect_PNIO_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static gboolean -pn_io_ar_conv_valid(packet_info *pinfo) +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); @@ -11875,7 +14350,7 @@ pn_io_ar_conv_valid(packet_info *pinfo) } static gchar * -pn_io_ar_conv_filter(packet_info *pinfo) +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); @@ -11889,7 +14364,7 @@ pn_io_ar_conv_filter(packet_info *pinfo) set_address(&controllermac_addr, AT_ETHER, 6, ar->controllermac); set_address(&devicemac_addr, AT_ETHER, 6, ar->devicemac); - buf = g_strdup_printf( + 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) */ @@ -11900,7 +14375,7 @@ pn_io_ar_conv_filter(packet_info *pinfo) } static gchar * -pn_io_ar_conv_data_filter(packet_info *pinfo) +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); @@ -11919,7 +14394,7 @@ pn_io_ar_conv_data_filter(packet_info *pinfo) guid_str = guid_to_str(pinfo->pool, (const e_guid_t*) &ar->aruuid); if (ar->arType == 0x0010) /* IOCARSingle using RT_CLASS_3 */ { - buf = g_strdup_printf( + 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) */ @@ -11931,7 +14406,7 @@ pn_io_ar_conv_data_filter(packet_info *pinfo) } else { - buf = g_strdup_printf( + 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 */ @@ -11970,6 +14445,7 @@ pnio_cleanup(void) { 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); } @@ -12079,7 +14555,12 @@ proto_register_pn_io (void) }, { &hf_pn_io_ar_properties_reserved, { "Reserved", "pn_io.ar_properties.reserved", - FT_UINT32, BASE_HEX, NULL, 0x1FFFF000, + 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, @@ -12109,7 +14590,7 @@ proto_register_pn_io (void) }, { &hf_pn_RedundancyInfo_reserved, { "RedundancyInfo.reserved", "pn_io.srl_data.redundancyInfoReserved", - FT_UINT16, BASE_HEX, NULL, 0xFFFFFFFC, + FT_UINT16, BASE_HEX, NULL, 0xFFFC, NULL, HFILL } }, { &hf_pn_io_number_of_ARDATAInfo, @@ -12195,12 +14676,12 @@ proto_register_pn_io (void) }, { &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), 0x01, + 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), 0x01, + FT_BOOLEAN, 32, TFS(&tfs_pn_io_sr_properties_BackupAR_with_SRProperties_Mode_1), 0x00000001, NULL, HFILL } }, { &hf_pn_io_sr_properties_Reserved_1, @@ -12275,7 +14756,7 @@ proto_register_pn_io (void) }, { &hf_pn_io_iocr_properties_reserved_3, { "Reserved3", "pn_io.iocr_properties.reserved3", - FT_UINT32, BASE_HEX, NULL, 0xF000000, + FT_UINT32, BASE_HEX, NULL, 0x0F000000, NULL, HFILL } }, { &hf_pn_io_iocr_properties_fast_forwarding_mac_adr, @@ -12300,17 +14781,17 @@ proto_register_pn_io (void) }, { &hf_pn_io_DistributedWatchDogFactor, { "SFIOCRProperties.DistributedWatchDogFactor", "pn_io.SFIOCRProperties.DistributedWatchDogFactor", - FT_UINT32, BASE_HEX, NULL, 0x0FF, + FT_UINT32, BASE_HEX, NULL, 0x000000FF, NULL, HFILL } }, { &hf_pn_io_RestartFactorForDistributedWD, { "SFIOCRProperties.RestartFactorForDistributedWD", "pn_io.SFIOCRProperties.RestartFactorForDistributedWD", - FT_UINT32, BASE_HEX, NULL, 0xff00, + FT_UINT32, BASE_HEX, NULL, 0x0000ff00, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_DFPmode, { "SFIOCRProperties.DFPmode", "pn_io.SFIOCRProperties.DFPmode", - FT_UINT32, BASE_HEX, NULL, 0xFF0000, + FT_UINT32, BASE_HEX, NULL, 0x00FF0000, NULL, HFILL } }, { &hf_pn_io_SFIOCRProperties_reserved_1, @@ -12658,6 +15139,11 @@ proto_register_pn_io (void) 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, @@ -12705,7 +15191,7 @@ proto_register_pn_io (void) }, { &hf_pn_io_control_command_reserved_7_15, { "ControlBlockProperties.reserved", "pn_io.control_properties_reserved_7_15", - FT_UINT16, BASE_HEX, NULL, 0x0FF80, + FT_UINT16, BASE_HEX, NULL, 0xFF80, NULL, HFILL } }, { &hf_pn_io_control_block_properties, @@ -12915,9 +15401,9 @@ proto_register_pn_io (void) FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_add_info), 0x0007, NULL, HFILL } }, - { &hf_pn_io_submodule_state_qualified_info, - { "QualifiedInfo", "pn_io.submodule_state.qualified_info", - FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_qualified_info), 0x0008, + { &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, @@ -12930,9 +15416,9 @@ proto_register_pn_io (void) FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_maintenance_demanded), 0x0020, NULL, HFILL } }, - { &hf_pn_io_submodule_state_diag_info, - { "DiagInfo", "pn_io.submodule_state.diag_info", - FT_UINT16, BASE_HEX, VALS(pn_io_submodule_state_diag_info), 0x0040, + { &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, @@ -13045,7 +15531,7 @@ proto_register_pn_io (void) NULL, HFILL } }, { &hf_pn_io_subframe_reserved2, - { "Reserved1", "pn_io.subframe_data.reserved2", + { "Reserved2", "pn_io.subframe_data.reserved2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, @@ -13070,7 +15556,7 @@ proto_register_pn_io (void) NULL, HFILL } }, { &hf_pn_io_subframe_data_reserved2, - { "Reserved1", "pn_io.subframe_data.reserved_2", + { "Reserved2", "pn_io.subframe_data.reserved_2", FT_UINT32, BASE_HEX, NULL, 0xFFFF0000, NULL, HFILL } }, @@ -13181,6 +15667,11 @@ proto_register_pn_io (void) 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, @@ -13191,6 +15682,11 @@ proto_register_pn_io (void) 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, @@ -13412,6 +15908,396 @@ proto_register_pn_io (void) 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, @@ -13527,6 +16413,31 @@ proto_register_pn_io (void) 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, @@ -13537,6 +16448,11 @@ proto_register_pn_io (void) 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, @@ -13706,12 +16622,12 @@ proto_register_pn_io (void) }, { &hf_pn_io_tx_phase_assignment_begin_value, { "AssignedValueForReservedBegin", "pn_io.tx_phase_assignment_begin_value", - FT_UINT16, BASE_DEC, NULL, 0x0F, + 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, 0x0F0, + FT_UINT16, BASE_DEC, NULL, 0x00F0, NULL, HFILL } }, { &hf_pn_io_tx_phase_assignment_end_reserved, @@ -13721,7 +16637,7 @@ proto_register_pn_io (void) }, { &hf_pn_io_tx_phase_assignment_reserved, { "Reserved should be 0", "pn_io.tx_phase_assignment_reserved", - FT_UINT16, BASE_DEC, NULL, 0x0F000, + FT_UINT16, BASE_DEC, NULL, 0xF000, NULL, HFILL } }, { &hf_pn_ir_rx_phase_assignment, @@ -14084,12 +17000,12 @@ proto_register_pn_io (void) }, { &hf_pn_io_mrp_check_reserved_1, { "MRP_Check.reserved_1", "pn_io.mrp_check_reserved_1", - FT_UINT32, BASE_HEX, NULL, 0x0FFFFFC, + 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, 0x0FF000000, + FT_UINT32, BASE_HEX, NULL, 0xFF000000, NULL, HFILL } }, { &hf_pn_io_mrp_rtmode, @@ -14401,12 +17317,12 @@ proto_register_pn_io (void) }, { &hf_pn_io_rs_alarm_info_reserved_8_15, { "RSAlarmInfo.Reserved2", "pn_io.rs_alarm_info_reserved_8_15", - FT_UINT16, BASE_HEX, NULL, 0x0FF00, + 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, 0x000FF, + FT_UINT16, BASE_HEX, NULL, 0x00FF, NULL, HFILL } }, { &hf_pn_io_rs_alarm_info, @@ -14769,6 +17685,31 @@ proto_register_pn_io (void) 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[] = { @@ -14840,7 +17781,16 @@ proto_register_pn_io (void) &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_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[] = { @@ -14871,6 +17821,7 @@ proto_register_pn_io (void) 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)); @@ -14884,13 +17835,13 @@ proto_register_pn_io (void) "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 */ + "Folder containing GSD files", /* Title */ + "Place GSD files in this folder.", /* Descreption */ + &pnio_ps_networkpath); /* Variable in which to save the GSD file folder path */ /* 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); + heur_pn_subdissector_list = register_heur_dissector_list_with_description("pn_io", "PROFINET IO payload", proto_pn_io); /* Initialise RTC1 dissection */ init_pn_io_rtc1(proto_pn_io); @@ -14904,8 +17855,8 @@ proto_register_pn_io (void) /* 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); - register_conversation_filter("pn_io", "PN-IO AR (with data)", pn_io_ar_conv_valid, pn_io_ar_conv_data_filter); + 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); } diff --git a/plugins/epan/profinet/packet-dcom-cba-acco.c b/plugins/epan/profinet/packet-dcom-cba-acco.c index 9026023d62..3fe5fd5998 100644 --- a/plugins/epan/profinet/packet-dcom-cba-acco.c +++ b/plugins/epan/profinet/packet-dcom-cba-acco.c @@ -25,162 +25,162 @@ 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 int hf_cba_acco_opnum; + +static int hf_cba_acco_ping_factor; + +static int hf_cba_acco_count; + +static int hf_cba_acco_item; +static int hf_cba_acco_data; +static int hf_cba_acco_qc; +static int hf_cba_acco_time_stamp; + +static int hf_cba_acco_conn_qos_type; +static int hf_cba_acco_conn_qos_value; +static int hf_cba_acco_conn_state; +static int hf_cba_acco_conn_cons_id; +static int hf_cba_acco_conn_version; +static int hf_cba_acco_conn_prov_id; +static int hf_cba_acco_conn_provider; +static int hf_cba_acco_conn_consumer; +static int hf_cba_acco_conn_provider_item; +static int hf_cba_acco_conn_consumer_item; +static int hf_cba_acco_conn_substitute; +static int hf_cba_acco_conn_epsilon; +static int hf_cba_acco_conn_persist; + +static int hf_cba_acco_cb_length; +static int hf_cba_acco_cb_conn_data; +static int hf_cba_acco_cb_version; +static int hf_cba_acco_cb_flags; +static int hf_cba_acco_cb_count; +static int hf_cba_acco_cb_item; +static int hf_cba_acco_cb_item_hole; +static int hf_cba_acco_cb_item_length; +static int hf_cba_acco_cb_item_data; + +static int hf_cba_connect_in; +static int hf_cba_disconnect_in; +static int hf_cba_connectcr_in; +static int hf_cba_disconnectcr_in; +static int hf_cba_disconnectme_in; +static int hf_cba_data_first_in; +static int hf_cba_data_last_in; + +/* static int hf_cba_acco_server_pICBAAccoCallback; */ + +static int hf_cba_acco_server_first_connect; + +static int hf_cba_acco_serversrt_prov_mac; +static int hf_cba_acco_serversrt_cons_mac; + +static int hf_cba_acco_serversrt_cr_id; +static int hf_cba_acco_serversrt_cr_length; +static int hf_cba_acco_serversrt_cr_flags; +static int hf_cba_acco_serversrt_cr_flags_timestamped; +static int hf_cba_acco_serversrt_cr_flags_reconfigure; +static int hf_cba_acco_serversrt_record_length; +/* static int hf_cba_acco_serversrt_action; */ +static int hf_cba_acco_serversrt_last_connect; + +static int hf_cba_getprovconnout; + +static int hf_cba_type_desc_len; + +static int hf_cba_connectincr; +static int hf_cba_connectoutcr; +static int hf_cba_connectin; +static int hf_cba_connectout; +static int hf_cba_getconnectionout; +static int hf_cba_readitemout; +static int hf_cba_writeitemin; +static int hf_cba_addconnectionin; +static int hf_cba_addconnectionout; +static int hf_cba_getidout; + +static int hf_cba_getconsconnout; +static int hf_cba_diagconsconnout; +static int hf_cba_acco_conn_error_state; + +static int hf_cba_acco_info_max; +static int hf_cba_acco_info_curr; + +static int hf_cba_acco_cdb_cookie; + +static int hf_cba_acco_rtauto; + +static int hf_cba_acco_prov_crid; + +static int hf_cba_acco_diag_req; +static int hf_cba_acco_diag_in_length; +static int hf_cba_acco_diag_out_length; +static int hf_cba_acco_diag_data; +static int hf_cba_acco_dcom_call; +static int hf_cba_acco_srt_call; + +gint ett_cba_connectincr; +gint ett_cba_connectoutcr; +gint ett_cba_connectin; +gint ett_cba_connectout; +gint ett_cba_getprovconnout; +gint ett_cba_addconnectionin; +gint ett_cba_addconnectionout; +gint ett_cba_getidout; +gint ett_cba_getconnectionout; +gint ett_cba_readitemout; +gint ett_cba_writeitemin; +gint ett_cba_acco_serversrt_cr_flags; +gint ett_cba_frame_info; +gint ett_cba_conn_info; + +static expert_field ei_cba_acco_pdev_find; +static expert_field ei_cba_acco_prov_crid; +static expert_field ei_cba_acco_conn_consumer; +static expert_field ei_cba_acco_ldev_unknown; +static expert_field ei_cba_acco_no_request_info; +static expert_field ei_cba_acco_ipid_unknown; +static expert_field ei_cba_acco_qc; +static expert_field ei_cba_acco_pdev_find_unknown_interface; +static expert_field ei_cba_acco_disconnect; +static expert_field ei_cba_acco_connect; + +static int proto_ICBAAccoMgt; +static gint ett_ICBAAccoMgt; 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 int proto_ICBAAccoMgt2; 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 int proto_ICBAAccoCallback; +static gint ett_ICBAAccoCallback; +static gint ett_ICBAAccoCallback_Buffer; +static gint ett_ICBAAccoCallback_Item; 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 int proto_ICBAAccoCallback2; 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 int proto_ICBAAccoServer; +static gint ett_ICBAAccoServer; 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 int proto_ICBAAccoServer2; 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 int proto_ICBAAccoServerSRT; +static gint ett_ICBAAccoServerSRT; 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 int proto_ICBAAccoSync; +static gint ett_ICBAAccoSync; static e_guid_t uuid_ICBAAccoSync = { 0xcba00044, 0x6c97, 0x11d1, { 0x82, 0x71, 0x00, 0xa0, 0x24, 0x42, 0xdf, 0x7d } }; static guint16 ver_ICBAAccoSync = 0; @@ -328,7 +328,7 @@ GList *cba_pdevs; const true_false_string acco_flags_set_truth = { "Set", "Not set" }; static gboolean -cba_filter_valid(packet_info *pinfo) +cba_filter_valid(packet_info *pinfo, void *user_data _U_) { void* profinet_type = p_get_proto_data(pinfo->pool, pinfo, proto_ICBAAccoMgt, 0); @@ -336,7 +336,7 @@ cba_filter_valid(packet_info *pinfo) } static gchar* -cba_build_filter(packet_info *pinfo) +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); @@ -345,25 +345,25 @@ cba_build_filter(packet_info *pinfo) /* IPv4 */ switch(GPOINTER_TO_UINT(profinet_type)) { case 1: - return g_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)", + 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 g_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)", + 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 g_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)", + 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 g_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)", + 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), @@ -4408,7 +4408,7 @@ dissect_ICBAAccoSync_ReadItems_resp(tvbuff_t *tvb, int offset, proto_item_append_text(sub_item, "[%u]: QC=%s (0x%02x) %s", u32Idx, - val_to_str(u16QC, cba_acco_qc_vals, "Unknown"), + 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); @@ -4540,7 +4540,7 @@ dissect_ICBAAccoSync_WriteItemsQCD_rqst(tvbuff_t *tvb, int offset, proto_item_append_text(sub_item, "[%u]: Item=\"%s\" QC=%s (0x%02x)", u32Idx, szStr, - val_to_str(u16QC, cba_acco_qc_vals, "Unknown"), u16QC); + val_to_str_const(u16QC, cba_acco_qc_vals, "Unknown"), u16QC); proto_item_set_len(sub_item, offset - u32SubStart); u32Idx++; @@ -5014,12 +5014,12 @@ proto_register_dcom_cba_acco (void) "This connection Disconnect was in the packet with this number", HFILL } }, { &hf_cba_connectcr_in, - { "ConnectCR in frame", "cba.connect_in", + { "ConnectCR in frame", "cba.connectcr_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", + { "DisconnectCR in frame", "cba.disconnectcr_in", FT_FRAMENUM, BASE_NONE, NULL, 0, "This frame DisconnectCR was in the packet with this number", HFILL } }, @@ -5107,7 +5107,7 @@ proto_register_dcom_cba_acco (void) 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); + register_conversation_filter("cba", "PN-CBA", cba_filter_valid, cba_build_filter, NULL); } diff --git a/plugins/epan/profinet/packet-dcom-cba.c b/plugins/epan/profinet/packet-dcom-cba.c index 52c5017e1f..26f5735b49 100644 --- a/plugins/epan/profinet/packet-dcom-cba.c +++ b/plugins/epan/profinet/packet-dcom-cba.c @@ -20,144 +20,144 @@ 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 int hf_cba_opnum; + +static int hf_cba_revision_major; +static int hf_cba_revision_minor; +static int hf_cba_revision_service_pack; +static int hf_cba_revision_build; + +static int hf_cba_time; + +static int hf_cba_name; +static int hf_cba_producer; +static int hf_cba_product; +static int hf_cba_production_date; +static int hf_cba_serial_no; +static int hf_cba_multi_app; +static int hf_cba_profinet_dcom_stack; +static int hf_cba_pdev_stamp; + +static int hf_cba_browse_count; +static int hf_cba_browse_offset; +static int hf_cba_browse_max_return; +static int hf_cba_browse_item; +static int hf_cba_browse_data_type; +static int hf_cba_browse_access_right; +static int hf_cba_browse_selector; +static int hf_cba_browse_info1; +static int hf_cba_browse_info2; + +static int hf_cba_cookie; +static int hf_cba_state; +static int hf_cba_new_state; +static int hf_cba_old_state; +static int hf_cba_grouperror; +static int hf_cba_new_grouperror; +static int hf_cba_old_grouperror; + +static int hf_cba_component_id; +static int hf_cba_component_version; +static int hf_cba_pbaddress; +static int hf_cba_pbaddress_system_id; +static int hf_cba_pbaddress_address; + +static int hf_cba_save_ldev_name; +static int hf_cba_save_result; + +static expert_field ei_cba_acco_interface_pointer_unresolved; 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 int proto_ICBAPhysicalDevice; +static gint ett_ICBAPhysicalDevice; 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 int proto_ICBAPhysicalDevice2; 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 int proto_ICBABrowse; +static gint ett_ICBABrowse; 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 int proto_ICBABrowse2; 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 int proto_ICBAPhysicalDevicePC; +static gint ett_ICBAPhysicalDevicePC; 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 int proto_ICBAPhysicalDevicePCEvent; +static gint ett_ICBAPhysicalDevicePCEvent; 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 int proto_ICBAPersist; +static gint ett_ICBAPersist; 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 int proto_ICBAPersist2; 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 int proto_ICBALogicalDevice; +static gint ett_ICBALogicalDevice; 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 int proto_ICBALogicalDevice2; 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 int proto_ICBAState; +static gint ett_ICBAState; 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 int proto_ICBAStateEvent; +static gint ett_ICBAStateEvent; 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 int proto_ICBATime; +static gint ett_ICBATime; 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 int proto_ICBAGroupError; +static gint ett_ICBAGroupError; 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 int proto_ICBAGroupErrorEvent; +static gint ett_ICBAGroupErrorEvent; 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 int proto_ICBARTAuto; +static gint ett_ICBARTAuto; 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 int proto_ICBARTAuto2; 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 int proto_ICBASystemProperties; +static gint ett_ICBASystemProperties; 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 gint ett_PBAddress; static const value_string cba_state_vals[] = { diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c index 9f366afcae..6de2b19c23 100644 --- a/plugins/epan/profinet/packet-pn-dcp.c +++ b/plugins/epan/profinet/packet-pn-dcp.c @@ -16,7 +16,7 @@ * * 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 + * informations will later be used for detailed dissection of cyclic PNIO RTC1 * dataframes. * * The declaration of the new added structures are within packet-pn.h to @@ -46,81 +46,94 @@ 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_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 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; +int proto_pn_dcp; + +static int hf_pn_dcp_service_id; +static int hf_pn_dcp_service_type; +static int hf_pn_dcp_xid; +static int hf_pn_dcp_reserved8; +static int hf_pn_dcp_reserved16; +static int hf_pn_dcp_response_delay; +static int hf_pn_dcp_data_length; +static int hf_pn_dcp_block_length; + +static int hf_pn_dcp_block; + +static int hf_pn_dcp_block_error; + +static int hf_pn_dcp_option; +static int hf_pn_dcp_block_info; +static int hf_pn_dcp_block_qualifier; +static int hf_pn_dcp_blockqualifier; +static int hf_pn_dcp_blockqualifier_r2f; + +static int hf_pn_dcp_suboption_ip; +static int hf_pn_dcp_suboption_ip_block_info; +static int hf_pn_dcp_suboption_ip_ip; +static int hf_pn_dcp_suboption_ip_subnetmask; +static int hf_pn_dcp_suboption_ip_standard_gateway; +static int hf_pn_dcp_suboption_ip_mac_address; + +static int hf_pn_dcp_suboption_device; +static int hf_pn_dcp_suboption_device_typeofstation; +static int hf_pn_dcp_suboption_device_nameofstation; +static int hf_pn_dcp_suboption_vendor_id; +static int hf_pn_dcp_suboption_device_id; +static int hf_pn_dcp_suboption_device_role; +static int hf_pn_dcp_suboption_device_aliasname; +static int hf_pn_dcp_suboption_device_instance_high; +static int hf_pn_dcp_suboption_device_instance_low; +static int hf_pn_dcp_suboption_device_oem_ven_id; +static int hf_pn_dcp_suboption_device_oem_dev_id; + +static int hf_pn_dcp_rsi_properties_value; +static int hf_pn_dcp_rsi_properties_value_bit0; +static int hf_pn_dcp_rsi_properties_value_bit1; +static int hf_pn_dcp_rsi_properties_value_bit2; +static int hf_pn_dcp_rsi_properties_value_bit3; +static int hf_pn_dcp_rsi_properties_value_bit4; +static int hf_pn_dcp_rsi_properties_value_bit5; +static int hf_pn_dcp_rsi_properties_value_otherbits; + +static int hf_pn_dcp_suboption_tsn; +static int hf_pn_dcp_suboption_tsn_domain_name; +static int hf_pn_dcp_suboption_tsn_domain_uuid; +static int hf_pn_dcp_suboption_tsn_nme_prio; +static int hf_pn_dcp_suboption_tsn_nme_parameter_uuid; +static int hf_pn_dcp_suboption_tsn_nme_agent; + +static int hf_pn_dcp_suboption_dhcp; +static int hf_pn_dcp_suboption_dhcp_option_code; +static int hf_pn_dcp_suboption_dhcp_parameter_length; +static int hf_pn_dcp_suboption_dhcp_parameter_data; +static int hf_pn_dcp_suboption_dhcp_arbitrary_client_id; +static int hf_pn_dcp_suboption_dhcp_control_parameter_data; + +static int hf_pn_dcp_suboption_control; +static int hf_pn_dcp_suboption_control_option; +static int hf_pn_dcp_suboption_control_signal_value; + +static int hf_pn_dcp_suboption_deviceinitiative; +static int hf_pn_dcp_deviceinitiative_value; + +static int hf_pn_dcp_suboption_all; + +static int hf_pn_dcp_suboption_manuf; + +static int hf_pn_dcp_vendor_id_high; +static int hf_pn_dcp_vendor_id_low; +static int hf_pn_dcp_device_id_high; +static int hf_pn_dcp_device_id_low; +static int hf_pn_dcp_instance_id_high; +static int hf_pn_dcp_instance_id_low; +static gint ett_pn_dcp; +static gint ett_pn_dcp_block; + +static gint ett_pn_dcp_rsi_properties_value; + +static expert_field ei_pn_dcp_block_parse_error; +static expert_field ei_pn_dcp_block_error_unknown; +static expert_field ei_pn_dcp_ip_conflict; #define PNDCP_SERVICE_ID_GET 0x03 #define PNDCP_SERVICE_ID_SET 0x04 @@ -205,6 +218,7 @@ static const value_string pn_dcp_BlockQualifier[] = { #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 @@ -217,6 +231,7 @@ static const range_string pn_dcp_option[] = { { 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" }, @@ -279,7 +294,33 @@ static const value_string pn_dcp_suboption_device[] = { }; static const true_false_string pn_dcp_rsi_properties_value_bit = - { "Available", "Not available" }; + { "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 @@ -392,6 +433,10 @@ dissect_PNDCP_Option(tvbuff_t *tvb, int offset, packet_info *pinfo, 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; @@ -402,10 +447,11 @@ dissect_PNDCP_Option(tvbuff_t *tvb, int offset, packet_info *pinfo, } proto_item_append_text(block_item, ", Status from %s - %s", - rval_to_str(option, pn_dcp_option, "Unknown"), val_to_str(suboption, val_str, "Unknown")); + 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(suboption, val_str, "Unknown")); + col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(suboption, val_str, "Unknown")); } return offset; @@ -459,11 +505,11 @@ dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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); @@ -484,7 +530,7 @@ dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, } offset += 2; proto_item_append_text(block_item, ", BlockInfo: %s", - val_to_str(block_info, pn_dcp_suboption_ip_block_info, "Undecoded")); + 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); @@ -495,7 +541,7 @@ dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); block_length -= 2; } @@ -538,11 +584,11 @@ dissect_PNDCP_Suboption_IP(tvbuff_t *tvb, int offset, packet_info *pinfo, if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } /* IPAddress */ @@ -653,31 +699,31 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, * 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|ENC_NA, pinfo->pool, &typeofstation); + 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } @@ -710,31 +756,31 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, * 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|ENC_NA, pinfo->pool, &nameofstation); + 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } @@ -757,15 +803,15 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, if (PINFO_FD_VISITED(pinfo) == FALSE) { /* Create a conversation between the MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + conversation = conversation_new(pinfo->num, &pinfo->dl_dst, &pinfo->dl_src, CONVERSATION_NONE, 0, 0, 0); } } @@ -785,11 +831,11 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "Device/Device ID"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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; @@ -800,10 +846,10 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "Device/Device Role"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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) @@ -819,11 +865,11 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "Device/Device Options"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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) { @@ -858,16 +904,16 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, * 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|ENC_NA, pinfo->pool, &aliasname); + 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } proto_item_append_text(block_item, ", \"%s\"", aliasname); offset += block_length; @@ -879,11 +925,11 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "Device/Device Instance"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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); @@ -895,11 +941,11 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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; @@ -924,9 +970,9 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, if (pinfo->fd->visited == FALSE) { /* Create a conversation between the MAC addresses */ - conversation = find_conversation(pinfo->num, &pinfo->dl_src, &pinfo->dl_dst, ENDPOINT_NONE, 0, 0, 0); + 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, ENDPOINT_NONE, 0, 0, 0); + 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); @@ -941,11 +987,11 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "Device/RSI Properties"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); } break; default: @@ -955,6 +1001,239 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, 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 @@ -1001,11 +1280,11 @@ dissect_PNDCP_Suboption_DHCP(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item_append_text(block_item, "DHCP/Client-ID"); if (have_block_qualifier) { proto_item_append_text(block_item, ", BlockQualifier: %s", - val_to_str(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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); @@ -1032,7 +1311,7 @@ dissect_PNDCP_Suboption_DHCP(tvbuff_t *tvb, int offset, packet_info *pinfo, * 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|ENC_NA); + proto_tree_add_item(tree, hf_pn_dcp_suboption_dhcp_arbitrary_client_id, tvb, offset, dhcpparameterlength - 1, ENC_ASCII); offset += (dhcpparameterlength-1); } } @@ -1042,11 +1321,11 @@ dissect_PNDCP_Suboption_DHCP(tvbuff_t *tvb, int offset, packet_info *pinfo, 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + 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(block_info, pn_dcp_block_info, "Unknown")); + 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); @@ -1118,13 +1397,13 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, offset += 1; if (block_error != 0) { expert_add_info_format(pinfo, item, &ei_pn_dcp_block_error_unknown, "%s", - val_to_str(block_error, pn_dcp_block_error, "Unknown")); + val_to_str_const(block_error, pn_dcp_block_error, "Unknown")); } info_str = wmem_strdup_printf(pinfo->pool, ", Response(%s)", - val_to_str(block_error, pn_dcp_block_error, "Unknown")); + 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(block_error, pn_dcp_block_error, "Unknown")); + val_to_str_const(block_error, pn_dcp_block_error, "Unknown")); break; case PNDCP_SUBOPTION_CONTROL_FACT_RESET: @@ -1133,7 +1412,7 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, 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(BlockQualifier, pn_dcp_suboption_other, "reserved")); + val_to_str_const(BlockQualifier, pn_dcp_suboption_other, "reserved")); block_length -= 2; break; @@ -1143,7 +1422,7 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, 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(BlockQualifier, pn_dcp_BlockQualifier, "reserved")); + val_to_str_const(BlockQualifier, pn_dcp_BlockQualifier, "reserved")); block_length -= 2; break; @@ -1156,7 +1435,7 @@ dissect_PNDCP_Suboption_Control(tvbuff_t *tvb, int offset, packet_info *pinfo, } -/* dissect the "deviceinitaitve" suboption */ +/* dissect the "deviceinitiatve" 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, @@ -1181,7 +1460,7 @@ dissect_PNDCP_Suboption_DeviceInitiative(tvbuff_t *tvb, int offset, packet_info ((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(block_info, pn_dcp_block_info, "Unknown")); + rval_to_str_const(block_info, pn_dcp_block_info, "Unknown")); block_length -= 2; } @@ -1189,7 +1468,7 @@ dissect_PNDCP_Suboption_DeviceInitiative(tvbuff_t *tvb, int offset, packet_info 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(block_qualifier, pn_dcp_block_qualifier, "Unknown")); + val_to_str_const(block_qualifier, pn_dcp_block_qualifier, "Unknown")); block_length -= 2; } @@ -1287,6 +1566,10 @@ dissect_PNDCP_Block(tvbuff_t *tvb, int offset, packet_info *pinfo, { 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); @@ -1644,6 +1927,36 @@ proto_register_pn_dcp (void) 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, @@ -1699,6 +2012,36 @@ proto_register_pn_dcp (void) 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, diff --git a/plugins/epan/profinet/packet-pn-mrp.c b/plugins/epan/profinet/packet-pn-mrp.c index 9d83a859da..77da40a0c5 100644 --- a/plugins/epan/profinet/packet-pn-mrp.c +++ b/plugins/epan/profinet/packet-pn-mrp.c @@ -21,34 +21,36 @@ void proto_register_pn_mrp(void); void proto_reg_handoff_pn_mrp(void); -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 dissector_handle_t mrp_handle; + +static int proto_pn_mrp; + +static int hf_pn_mrp_type; +static int hf_pn_mrp_length; +static int hf_pn_mrp_version; +static int hf_pn_mrp_sequence_id; +static int hf_pn_mrp_sa; +static int hf_pn_mrp_prio; +static int hf_pn_mrp_port_role; +static int hf_pn_mrp_ring_state; +static int hf_pn_mrp_interval; +static int hf_pn_mrp_transition; +static int hf_pn_mrp_time_stamp; +static int hf_pn_mrp_blocked; +static int hf_pn_mrp_domain_uuid; +static int hf_pn_mrp_oui; +static int hf_pn_mrp_ed1type; +static int hf_pn_mrp_ed1_manufacturer_data; +static int hf_pn_mrp_sub_tlv_header_type; +static int hf_pn_mrp_sub_tlv_header_length; +static int hf_pn_mrp_sub_option2; +static int hf_pn_mrp_other_mrm_prio; +static int hf_pn_mrp_other_mrm_sa; +static int hf_pn_mrp_manufacturer_data; + +static gint ett_pn_mrp; +static gint ett_pn_mrp_type; +static gint ett_pn_sub_tlv; static const value_string pn_mrp_block_type_vals[] = { { 0x00, "MRP_End" }, @@ -467,8 +469,8 @@ dissect_PNMRP_PDU(tvbuff_t *tvb, int offset, } else { proto_item_append_text(item, " "); } - col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); - proto_item_append_text(item, "%s", val_to_str_const(type, pn_mrp_block_type_vals, "Unknown TLVType 0x%x")); + 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: @@ -649,18 +651,14 @@ proto_register_pn_mrp (void) 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_handle_t mrp_handle; - - - mrp_handle = create_dissector_handle(dissect_PNMRP,proto_pn_mrp); dissector_add_uint("ethertype", ETHERTYPE_MRP, mrp_handle); - } /* diff --git a/plugins/epan/profinet/packet-pn-mrrt.c b/plugins/epan/profinet/packet-pn-mrrt.c index 5c332a5ae8..ab1598065e 100644 --- a/plugins/epan/profinet/packet-pn-mrrt.c +++ b/plugins/epan/profinet/packet-pn-mrrt.c @@ -19,17 +19,17 @@ void proto_register_pn_mrrt(void); void proto_reg_handoff_pn_mrrt(void); -static int proto_pn_mrrt = -1; +static int proto_pn_mrrt; -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 int hf_pn_mrrt_sequence_id; +static int hf_pn_mrrt_domain_uuid; +static int hf_pn_mrrt_type; +static int hf_pn_mrrt_length; +static int hf_pn_mrrt_version; +static int hf_pn_mrrt_sa; -static gint ett_pn_mrrt = -1; +static gint ett_pn_mrrt; diff --git a/plugins/epan/profinet/packet-pn-ptcp.c b/plugins/epan/profinet/packet-pn-ptcp.c index 6a753a5f62..90627cb37e 100644 --- a/plugins/epan/profinet/packet-pn-ptcp.c +++ b/plugins/epan/profinet/packet-pn-ptcp.c @@ -20,58 +20,58 @@ void proto_register_pn_ptcp(void); void proto_reg_handoff_pn_ptcp(void); -static int proto_pn_ptcp = -1; +static int proto_pn_ptcp; -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_header; +static int hf_pn_ptcp_block; +static int hf_pn_ptcp_block_tlvheader; -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_res1; +static int hf_pn_ptcp_res2; +static int hf_pn_ptcp_delay10ns; +static int hf_pn_ptcp_seq_id; +static int hf_pn_ptcp_delay1ns_byte; +static int hf_pn_ptcp_delay1ns_fup; +static int hf_pn_ptcp_delay1ns; -static int hf_pn_ptcp_tl_length = -1; -static int hf_pn_ptcp_tl_type = -1; +static int hf_pn_ptcp_tl_length; +static int hf_pn_ptcp_tl_type; -static int hf_pn_ptcp_master_source_address = -1; -static int hf_pn_ptcp_subdomain_uuid = -1; +static int hf_pn_ptcp_master_source_address; +static int hf_pn_ptcp_subdomain_uuid; -static int hf_pn_ptcp_port_mac_address = -1; +static int hf_pn_ptcp_port_mac_address; -static int hf_pn_ptcp_t2portrxdelay = -1; -static int hf_pn_ptcp_t3porttxdelay = -1; +static int hf_pn_ptcp_t2portrxdelay; +static int hf_pn_ptcp_t3porttxdelay; -static int hf_pn_ptcp_t2timestamp = -1; +static int hf_pn_ptcp_t2timestamp; -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_epoch_number; +static int hf_pn_ptcp_seconds; +static int hf_pn_ptcp_nanoseconds; -static int hf_pn_ptcp_flags = -1; -static int hf_pn_ptcp_currentutcoffset = -1; +static int hf_pn_ptcp_flags; +static int hf_pn_ptcp_currentutcoffset; -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_priority1; +static int hf_pn_ptcp_master_priority_level; +static int hf_pn_ptcp_master_priority1_res; +static int hf_pn_ptcp_master_priority1_act; -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_master_priority2; +static int hf_pn_ptcp_clock_class; +static int hf_pn_ptcp_clock_accuracy; +static int hf_pn_ptcp_clockvariance; -static int hf_pn_ptcp_oui = -1; -static int hf_pn_ptcp_profinet_subtype = -1; -static int hf_pn_ptcp_irdata_uuid = -1; +static int hf_pn_ptcp_oui; +static int hf_pn_ptcp_profinet_subtype; +static int hf_pn_ptcp_irdata_uuid; -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; +static gint ett_pn_ptcp; +static gint ett_pn_ptcp_header; +static gint ett_pn_ptcp_block; +static gint ett_pn_ptcp_block_header; #define OUI_PROFINET_MULTICAST 0x010ECF /* PROFIBUS Nutzerorganisation e.V. */ @@ -522,10 +522,10 @@ dissect_PNPTCP_block(tvbuff_t *tvb, int offset, offset = dissect_PNPTCP_TLVHeader(tvb, offset, pinfo, tlvheader_tree, sub_item, &type, &length); proto_item_set_text(sub_item, "%s", - val_to_str(type, pn_ptcp_block_type, "Unknown")); + val_to_str_const(type, pn_ptcp_block_type, "Unknown")); proto_item_append_text(tlvheader_item, ": Type=%s (%x), Length=%u", - val_to_str(type, pn_ptcp_block_type, "Unknown"), type, length); + val_to_str_const(type, pn_ptcp_block_type, "Unknown"), type, length); switch (type) { case 0x00: /* End, no content */ @@ -671,11 +671,11 @@ dissect_PNPTCP_RTSyncPDU(tvbuff_t *tvb, int offset, 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" G_GINT64_MODIFIER "uns", + 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=%" G_GINT64_MODIFIER "uns", + 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=%" G_GINT64_MODIFIER "uns", + proto_item_append_text(header_item, ": Sequence=%u, Delay=%" PRIu64 "ns", seq_id, delay1ns_64); if (delay1ns_64 != 0) @@ -933,7 +933,7 @@ proto_register_pn_ptcp (void) { &hf_pn_ptcp_tl_length, { "TypeLength.Length", "pn_ptcp.tl_length", - FT_UINT16, BASE_DEC, 0x0, 0x1FF, + FT_UINT16, BASE_DEC, 0x0, 0x01FF, NULL, HFILL }}, { &hf_pn_ptcp_tl_type, diff --git a/plugins/epan/profinet/packet-pn-rsi.c b/plugins/epan/profinet/packet-pn-rsi.c index d6cebad540..fe6e71ac4b 100644 --- a/plugins/epan/profinet/packet-pn-rsi.c +++ b/plugins/epan/profinet/packet-pn-rsi.c @@ -46,60 +46,60 @@ 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 int proto_pn_rsi; + +static int hf_pn_rsi_dst_srv_access_point; +static int hf_pn_rsi_src_srv_access_point; + +static int hf_pn_rsi_pdu_type; +static int hf_pn_rsi_pdu_type_type; +static int hf_pn_rsi_pdu_type_version; + +static int hf_pn_rsi_add_flags; +static int hf_pn_rsi_add_flags_windowsize; +static int hf_pn_rsi_add_flags_reserved1; +static int hf_pn_rsi_add_flags_tack; +static int hf_pn_rsi_add_flags_morefrag; +static int hf_pn_rsi_add_flags_notification; +static int hf_pn_rsi_add_flags_reserved2; + +static int hf_pn_rsi_send_seq_num; +static int hf_pn_rsi_ack_seq_num; +static int hf_pn_rsi_var_part_len; + +static int hf_pn_rsi_f_opnum_offset; +static int hf_pn_rsi_f_opnum_offset_offset; +static int hf_pn_rsi_f_opnum_offset_opnum; +static int hf_pn_rsi_f_opnum_offset_callsequence; + +static int hf_pn_rsi_conn_block; +static int hf_pn_rsi_rsp_max_length; +static int hf_pn_rsi_vendor_id; +static int hf_pn_rsi_device_id; +static int hf_pn_rsi_instance_id; +static int hf_pn_rsi_interface; + +static int hf_pn_rsi_svcs_block; + +static int hf_pn_rsi_number_of_entries; +static int hf_pn_rsi_pd_rsi_instance; +static int hf_pn_rsi_device_type; +static int hf_pn_rsi_order_id; +static int hf_pn_rsi_im_serial_number; +static int hf_pn_rsi_hw_revision; +static int hf_pn_rsi_sw_revision_prefix; +static int hf_pn_rsi_sw_revision; + +static gint ett_pn_rsi; +static gint ett_pn_rsi_pdu_type; +static gint ett_pn_rsi_f_opnum_offset; +static gint ett_pn_rsi_conn_block; +static gint ett_pn_rsi_svcs_block; +static gint ett_pn_rsi_add_flags; +static gint ett_pn_rsi_rta; +static gint ett_pn_io_pd_rsi_instance; + +static expert_field ei_pn_rsi_error; static const range_string pn_rsi_alarm_endpoint[] = { { 0x0000, 0x7FFF, "RSI Initiator Instance (ISAP) or RSI Responder Instance (RSAP)" }, @@ -239,19 +239,19 @@ dissect_FOpnumOffset(tvbuff_t *tvb, int offset, return offset; } -static int hf_pn_rsi_data_payload = -1; +static int hf_pn_rsi_data_payload; -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 int hf_pn_rsi_segments; +static int hf_pn_rsi_segment; +//static int hf_pn_rsi_data; +static int hf_pn_rsi_segment_overlap; +static int hf_pn_rsi_segment_overlap_conflict; +static int hf_pn_rsi_segment_multiple_tails; +static int hf_pn_rsi_segment_too_long_segment; +static int hf_pn_rsi_segment_error; +static int hf_pn_rsi_segment_count; +static int hf_pn_rsi_reassembled_in; +static int hf_pn_rsi_reassembled_length; static reassembly_table pn_rsi_reassembly_table; @@ -261,10 +261,10 @@ 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 gint ett_pn_rsi_segments; +static gint ett_pn_rsi_segment; +//static gint ett_pn_rsi_data; +static gint ett_pn_rsi_data_payload; static const fragment_items pn_rsi_frag_items = { &ett_pn_rsi_segment, @@ -299,10 +299,10 @@ dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info if (pinfo->srcport != 0 && pinfo->destport != 0) { /* COTP over RFC1006/TCP, try reassembling */ - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, ENDPOINT_NONE, + 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, ENDPOINT_NONE, + conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->srcport, pinfo->destport, 0); } @@ -312,10 +312,10 @@ dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info } else { /* plain COTP transport (without RFC1006/TCP), try reassembling */ - conv = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, ENDPOINT_NONE, + 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, ENDPOINT_NONE, + conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, CONVERSATION_NONE, pinfo->clnp_srcref, pinfo->clnp_dstref, 0); } @@ -348,7 +348,7 @@ dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info /* reassembling completed? */ if (fd_reass != NULL) { - /* is this the packet to show the reassembed payload in? */ + /* is this the packet to show the reassembled 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); @@ -371,7 +371,7 @@ dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info 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); + proto_item_set_generated(pi); } } @@ -381,15 +381,20 @@ dissect_pn_rta_remaining_user_data_bytes(tvbuff_t *tvb, int offset, packet_info /* 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, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) + packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) { - proto_item *sub_item; + proto_item* sub_item; proto_tree *sub_tree; - guint32 u32RspMaxLength; + 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, @@ -400,15 +405,17 @@ dissect_RSI_SVCS_block(tvbuff_t *tvb, int offset, proto_item_append_text(sub_item, ", RSI Header of SVCS is at first segment"); } - 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); + 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, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) + packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag, guint32 u32FOpnumOffsetOffset, guint32 u32FOpnumOffsetOpnum) { proto_item *sub_item; proto_tree *sub_tree; @@ -418,6 +425,10 @@ dissect_RSI_CONN_block(tvbuff_t *tvb, int offset, 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); @@ -442,8 +453,10 @@ dissect_RSI_CONN_block(tvbuff_t *tvb, int offset, proto_item_append_text(sub_item, ", RSI Header of CONN is at first segment"); } - 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); + 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; } @@ -451,7 +464,7 @@ dissect_RSI_CONN_block(tvbuff_t *tvb, int 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, guint8 u8MoreFrag) + packet_info *pinfo, proto_tree *tree, guint8 *drep, guint16 u16VarPartLen, guint8 u8MoreFrag) { guint32 u32FOpnumOffset; guint32 u32FOpnumOffsetOpnum; @@ -462,7 +475,7 @@ dissect_FREQ_RTA_block(tvbuff_t *tvb, int offset, 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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"); @@ -470,35 +483,35 @@ dissect_FREQ_RTA_block(tvbuff_t *tvb, int offset, 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + 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, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); + offset = dissect_RSI_SVCS_block(tvb, offset, pinfo, tree, drep, u16VarPartLen, u8MoreFrag, u32FOpnumOffsetOffset, u32FOpnumOffsetOpnum); break; default: col_append_str(pinfo->cinfo, COL_INFO, "Reserved"); @@ -701,7 +714,7 @@ dissect_PNIO_RSI(tvbuff_t *tvb, int offset, 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, u8MoreFrag); + 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); @@ -733,12 +746,6 @@ dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset, const int HWrevision_size = 5; const int SWrevisionprefix_size = 1; const int SWrevision_size = 9; - char *deviceType; - char *orderID; - char *IMserialnumber; - char *HWrevision; - char *SWrevisionprefix; - char *SWrevision; if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { expert_add_info_format(pinfo, item, &ei_pn_rsi_error, @@ -779,53 +786,35 @@ dissect_PDRsiInstances_block(tvbuff_t *tvb, int offset, /* SystemIdentification */ /* DeviceType */ - deviceType = (char *)wmem_alloc(pinfo->pool, deviceType_size + 1); - tvb_memcpy(tvb, (guint8 *)deviceType, offset, 25); - deviceType[deviceType_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_device_type, tvb, offset, deviceType_size, deviceType); + proto_tree_add_item(tree, hf_pn_rsi_device_type, tvb, offset, deviceType_size, ENC_UTF_8); offset += deviceType_size + 1; /* Blank */ /* OrderID */ - orderID = (char *)wmem_alloc(pinfo->pool, orderID_size + 1); - tvb_memcpy(tvb, (guint8 *)orderID, offset, 20); - orderID[orderID_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_order_id, tvb, offset, orderID_size, 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 */ - IMserialnumber = (char *)wmem_alloc(pinfo->pool, IMserialnumber_size + 1); - tvb_memcpy(tvb, (guint8 *)IMserialnumber, offset, 16); - IMserialnumber[IMserialnumber_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_im_serial_number, tvb, offset, IMserialnumber_size, IMserialnumber); + proto_tree_add_item(tree, hf_pn_rsi_im_serial_number, tvb, offset, IMserialnumber_size, ENC_UTF_8); offset += IMserialnumber_size + 1; /* Blank */ /* HWRevision */ - HWrevision = (char *)wmem_alloc(pinfo->pool, HWrevision_size + 1); - tvb_memcpy(tvb, (guint8 *)HWrevision, offset, 5); - HWrevision[HWrevision_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_hw_revision, tvb, offset, HWrevision_size, HWrevision); + proto_tree_add_item(tree, hf_pn_rsi_hw_revision, tvb, offset, HWrevision_size, ENC_UTF_8); offset += HWrevision_size + 1; /* Blank */ /* SWRevisionPrefix */ - SWrevisionprefix = (char *)wmem_alloc(pinfo->pool, SWrevisionprefix_size + 1); - tvb_memcpy(tvb, (guint8 *)SWrevisionprefix, offset, 1); - SWrevisionprefix[SWrevisionprefix_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_sw_revision_prefix, tvb, offset, SWrevisionprefix_size, SWrevisionprefix); + proto_tree_add_item(tree, hf_pn_rsi_sw_revision_prefix, tvb, offset, SWrevisionprefix_size, ENC_UTF_8); offset += SWrevisionprefix_size; /* SWRevision */ - SWrevision = (char *)wmem_alloc(pinfo->pool, SWrevision_size + 1); - tvb_memcpy(tvb, (guint8 *)SWrevision, offset, 9); - SWrevision[SWrevision_size] = '\0'; - proto_tree_add_string(tree, hf_pn_rsi_sw_revision, tvb, offset, SWrevision_size, SWrevision); + proto_tree_add_item(tree, hf_pn_rsi_sw_revision, tvb, offset, SWrevision_size, ENC_UTF_8); offset += SWrevision_size; return offset; } @@ -1081,7 +1070,7 @@ init_pn_rsi(int proto) }; static ei_register_info ei[] = { - { &ei_pn_rsi_error, { "pn_rsi.ack_seq_num", PI_UNDECODED, PI_NOTE, "Block version not implemented yet!", EXPFILL } } + { &ei_pn_rsi_error, { "pn_rsi.error", PI_UNDECODED, PI_NOTE, "Block version not implemented yet!", EXPFILL } } }; diff --git a/plugins/epan/profinet/packet-pn-rt.c b/plugins/epan/profinet/packet-pn-rt.c index b03e946647..f7f9387d1b 100644 --- a/plugins/epan/profinet/packet-pn-rt.c +++ b/plugins/epan/profinet/packet-pn-rt.c @@ -30,57 +30,59 @@ void proto_reg_handoff_pn_rt(void); #define PROFINET_UDP_PORT 0x8892 /* Define the pn-rt proto */ -static int proto_pn_rt = -1; +static int proto_pn_rt; 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; +static int hf_pn_rt_frame_id; +static int hf_pn_rt_cycle_counter; +static int hf_pn_rt_transfer_status; +static int hf_pn_rt_data_status; +static int hf_pn_rt_data_status_ignore; +static int hf_pn_rt_frame_info_type; +static int hf_pn_rt_frame_info_function_meaning_input_conv; +static int hf_pn_rt_frame_info_function_meaning_output_conv; +static int hf_pn_rt_data_status_Reserved_2; +static int hf_pn_rt_data_status_ok; +static int hf_pn_rt_data_status_operate; +static int hf_pn_rt_data_status_res3; +static int hf_pn_rt_data_status_valid; +static int hf_pn_rt_data_status_redundancy; +static int hf_pn_rt_data_status_redundancy_output_cr; +static int hf_pn_rt_data_status_redundancy_input_cr_state_is_backup; +static int hf_pn_rt_data_status_redundancy_input_cr_state_is_primary; +static int hf_pn_rt_data_status_primary; + +static int hf_pn_rt_sf_crc16; +static int hf_pn_rt_sf_crc16_status; +static int hf_pn_rt_sf; +static int hf_pn_rt_sf_position; +/* static int hf_pn_rt_sf_position_control; */ +static int hf_pn_rt_sf_data_length; +static int hf_pn_rt_sf_cycle_counter; + +static int hf_pn_rt_frag; +static int hf_pn_rt_frag_data_length; +static int hf_pn_rt_frag_status; +static int hf_pn_rt_frag_status_more_follows; +static int hf_pn_rt_frag_status_error; +static int hf_pn_rt_frag_status_fragment_number; +static int hf_pn_rt_frag_data; /* * 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 int ett_pn_rt; +static int ett_pn_rt_data_status; +static int ett_pn_rt_sf; +static int ett_pn_rt_frag; +static int ett_pn_rt_frag_status; -static expert_field ei_pn_rt_sf_crc16 = EI_INIT; +static expert_field ei_pn_rt_sf_crc16; /* * Here are the global variables associated with @@ -169,18 +171,18 @@ dissect_DataStatus(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pin 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, ENDPOINT_UDP, 0, 0, 0); + 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))) { + 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; } /* IOD -> IOC: InputCR */ - if (addresses_equal(&(pinfo->dst), conversation_key_addr1(conversation->key_ptr)) && addresses_equal(&(pinfo->src), conversation_key_addr2(conversation->key_ptr))) { + 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; } @@ -218,7 +220,7 @@ dissect_DataStatus(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pin if (inputFlag) { proto_tree_add_uint(sub_tree, hf_pn_rt_data_status_valid, tvb, offset, 1, u8DataStatus); - proto_tree_add_item(tree, hf_pn_rt_frame_info_function_meaning_input_conv, 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); @@ -250,7 +252,7 @@ dissect_DataStatus(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pin // output conversation is found. else if (outputFlag) { - proto_tree_add_item(tree, hf_pn_rt_frame_info_function_meaning_output_conv, tvb, offset, 1, u8DataStatus); + 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); @@ -278,7 +280,7 @@ IsDFP_Frame(tvbuff_t *tvb, packet_info *pinfo, guint16 u16FrameID) gint tvb_len = 0; unsigned char virtualFramebuffer[16]; - /* try to build a temporaray buffer for generating this CRC */ + /* try to build a temporary 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 @@ -365,7 +367,7 @@ dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * /* possible FrameID ranges for DFP */ - if ((u16FrameID < 0x100) || (u16FrameID > 0x0FFF)) + 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 */ @@ -445,11 +447,11 @@ dissect_CSF_SDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * } -/* for reasemble processing we need some inits.. */ +/* for reassemble processing we need some inits.. */ /* Register PNIO defrag table init routine. */ static reassembly_table pdu_reassembly_table; -static GHashTable *reasembled_frag_table = NULL; +static GHashTable *reassembled_frag_table = NULL; static dissector_table_t ethertype_subdissector_table; @@ -462,13 +464,13 @@ 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); + reassembled_frag_table = g_hash_table_new(NULL, NULL); } static void pnio_defragment_cleanup(void) { - g_hash_table_destroy(reasembled_frag_table); + g_hash_table_destroy(reassembled_frag_table); } /* possibly dissect a FRAG_PDU related PN-RT packet */ @@ -510,7 +512,7 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void bMoreFollows = (u8FragStatus & 0x80) != 0; proto_item_append_text(status_item, ": Number: %u, %s", uFragNumber, - val_to_str( (u8FragStatus & 0x80) >> 7, pn_rt_frag_status_more_follows, "Unknown")); + 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", @@ -545,12 +547,12 @@ dissect_FRAG_PDU_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void 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); + g_hash_table_insert(reassembled_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)); + pdu_frag = (fragment_head *)g_hash_table_lookup(reassembled_frag_table, GUINT_TO_POINTER(pinfo->num)); if (pdu_frag) /* found a matching fragment; dissect it */ { guint16 type; @@ -597,7 +599,8 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U 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 @@ -638,6 +641,13 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U 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) { @@ -670,24 +680,48 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U pszProtSummary = "Real-Time"; pszProtComment = "0x0082-0x00FF: Reserved ID"; bCyclic = FALSE; - } else if (u16FrameID <= 0x6FF) { + } 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) { + } 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) { + } 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, "; @@ -843,7 +877,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U u8DataStatus = tvb_get_guint8(tvb, pdu_len - 2); u8TransferStatus = tvb_get_guint8(tvb, pdu_len - 1); - g_snprintf (szFieldSummary, sizeof(szFieldSummary), + 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", @@ -860,7 +894,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U u8TransferStatus = 0; /* acyclic transfer has no fields at the end */ - g_snprintf (szFieldSummary, sizeof(szFieldSummary), + snprintf (szFieldSummary, sizeof(szFieldSummary), "%sID:0x%04x, Len:%4u", pszProtAddInfo, u16FrameID, pdu_len - 2); @@ -907,7 +941,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U /* update column info now */ if (u16FrameID == 0xFE02) { - g_snprintf(szFieldSummary, sizeof(szFieldSummary), "%s", ""); + snprintf(szFieldSummary, sizeof(szFieldSummary), "%s", ""); } col_add_str(pinfo->cinfo, COL_INFO, szFieldSummary); col_set_str(pinfo->cinfo, COL_PROTOCOL, pszProtShort); @@ -980,7 +1014,7 @@ proto_register_pn_rt(void) NULL, HFILL }}, { &hf_pn_rt_data_status_res3, - { "Reserved_1 (should be zero)", "pn_rt.ds_res3", + { "Reserved_3 (should be zero)", "pn_rt.ds_res3", FT_UINT8, BASE_HEX, 0, 0x08, NULL, HFILL }}, @@ -1089,7 +1123,7 @@ proto_register_pn_rt(void) /* 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, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; @@ -1110,6 +1144,7 @@ proto_register_pn_rt(void) 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)); @@ -1131,7 +1166,7 @@ proto_register_pn_rt(void) &pnio_desegment); /* register heuristics anchor for payload dissectors */ - heur_subdissector_list = register_heur_dissector_list("pn_rt", proto_pn_rt); + heur_subdissector_list = register_heur_dissector_list_with_description("pn_rt", "PROFINET RT payload", proto_pn_rt); init_pn (proto_pn_rt); register_init_routine(pnio_defragment_init); @@ -1145,10 +1180,6 @@ proto_register_pn_rt(void) void proto_reg_handoff_pn_rt(void) { - dissector_handle_t pn_rt_handle; - - pn_rt_handle = create_dissector_handle(dissect_pn_rt, proto_pn_rt); - dissector_add_uint("ethertype", ETHERTYPE_PROFINET, pn_rt_handle); dissector_add_uint_with_preference("udp.port", PROFINET_UDP_PORT, pn_rt_handle); diff --git a/plugins/epan/profinet/packet-pn-rtc-one.c b/plugins/epan/profinet/packet-pn-rtc-one.c index c91f3db2b9..af927205be 100644 --- a/plugins/epan/profinet/packet-pn-rtc-one.c +++ b/plugins/epan/profinet/packet-pn-rtc-one.c @@ -64,68 +64,83 @@ #include "packet-pn.h" -#define F_MESSAGE_TRAILER_4BYTE 4 /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte */ +#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; +static int proto_pn_io_rtc1; /* 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; +static int hf_pn_io_frame_info_type; +static int hf_pn_io_frame_info_vendor; +static int hf_pn_io_frame_info_nameofstation; +static int hf_pn_io_frame_info_gsd_found; +static int hf_pn_io_frame_info_gsd_error; +static int hf_pn_io_frame_info_gsd_path; +static int hf_pn_io_io_data_object; +static int hf_pn_io_io_data_object_info_module_diff; +static int hf_pn_io_io_data_object_info_moduleidentnumber; +static int hf_pn_io_io_data_object_info_submoduleidentnumber; + +static int hf_pn_io_iocs; +static int hf_pn_io_iops; +static int hf_pn_io_ioxs_extension; +static int hf_pn_io_ioxs_res14; +static int hf_pn_io_ioxs_instance; +static int hf_pn_io_ioxs_datastate; /* 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; +static int hf_pn_io_ps_sb; +static int hf_pn_io_ps_sb_iparOK; +static int hf_pn_io_ps_sb_DeviceFault; +static int hf_pn_io_ps_sb_CECRC; +static int hf_pn_io_ps_sb_WDtimeout; +static int hf_pn_io_ps_sb_FVactivated; +static int hf_pn_io_ps_sb_Toggle_d; +static int hf_pn_io_ps_sb_ConsNr_reset; +static int hf_pn_io_ps_sb_res; +static int hf_pn_io_ps_sb_toggelBitChanged; +static int hf_pn_io_ps_sb_toggelBitChange_slot_nr; +static int hf_pn_io_ps_sb_toggelBitChange_subslot_nr; + +static int hf_pn_io_ps_cb; +static int hf_pn_io_ps_cb_iparEN; +static int hf_pn_io_ps_cb_OAReq; +static int hf_pn_io_ps_cb_resetConsNr; +static int hf_pn_io_ps_cb_useTO2; +static int hf_pn_io_ps_cb_activateFV; +static int hf_pn_io_ps_cb_Toggle_h; +static int hf_pn_io_ps_cb_Chf_ACK; +static int hf_pn_io_ps_cb_loopcheck; +static int hf_pn_io_ps_cb_toggelBitChanged; +static int hf_pn_io_ps_cb_toggelBitChange_slot_nr; +static int hf_pn_io_ps_cb_toggelBitChange_subslot_nr; /* PROFIsafe */ -static int hf_pn_io_ps_f_dest_adr = -1; -static int hf_pn_io_ps_f_data = -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 expert_field ei_pn_io_too_many_data_objects = EI_INIT; +static int hf_pn_io_ps_f_dest_adr; +static int hf_pn_io_ps_f_data; + +/* PA Profile 4.02 */ +static int hf_pn_pa_profile_status; +static int hf_pn_pa_profile_status_quality; +static int hf_pn_pa_profile_status_substatus_bad; +static int hf_pn_pa_profile_status_substatus_uncertain; +static int hf_pn_pa_profile_status_substatus_good; +static int hf_pn_pa_profile_status_update_event; +static int hf_pn_pa_profile_status_simulate; +static int hf_pn_pa_profile_value_8bit; +static int hf_pn_pa_profile_value_16bit; +static int hf_pn_pa_profile_value_float; + +static gint ett_pn_io_rtc; +static gint ett_pn_io_ioxs; +static gint ett_pn_io_io_data_object; +static gint ett_pn_pa_profile_status; + +static expert_field ei_pn_io_too_many_data_objects; static const value_string pn_io_ioxs_extension[] = { { 0x00 /* 0*/, "No IOxS octet follows" }, @@ -147,6 +162,53 @@ static const value_string pn_io_ioxs_datastate[] = { { 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, @@ -180,6 +242,17 @@ static int * const ioxs_fields[] = { 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 @@ -359,7 +432,7 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, { proto_tree *data_tree = NULL; - /* Count & offset for comparation of the arrays */ + /* Count & offset for comparison of the arrays */ guint16 frameOffset; guint32 objectCounter; gboolean inputFlag; @@ -381,6 +454,7 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, guint8 statusbyte; guint8 controlbyte; + guint8 safety_io_data_length; guint16 number_io_data_objects_input_cr; guint16 number_iocs_input_cr; @@ -421,7 +495,7 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, 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, ENDPOINT_NONE, 0, 0, 0); + 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) { @@ -460,15 +534,15 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, 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; - number_iocs_input_cr = station_info->iocsNr; + 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; - number_iocs_output_cr = station_info->iocsNr; + number_io_data_objects_output_cr = station_info->ioDataObjectNr_out; + number_iocs_output_cr = station_info->iocsNr_out; } } } @@ -556,9 +630,15 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, 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->length - F_MESSAGE_TRAILER_4BYTE) > 0) { + 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, - (io_data_object->length - F_MESSAGE_TRAILER_4BYTE), &f_data); + safety_io_data_length, &f_data); } /* ---- Check for new PNIO data using togglebit ---- */ @@ -586,7 +666,14 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, else { /* Module is not PROFIsafe supported */ - offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); + 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) { @@ -751,9 +838,15 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, 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->length - F_MESSAGE_TRAILER_4BYTE) > 0) { + 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, - (io_data_object->length - F_MESSAGE_TRAILER_4BYTE), &f_data); + safety_io_data_length, &f_data); } /* ---- Check for new PNIO data using togglebit ---- */ @@ -780,7 +873,14 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, } /* End of PROFIsafe Module Handling */ else { /* Module is not PROFIsafe supported */ - offset = dissect_pn_user_data(tvb, offset, pinfo, IODataObject_tree, io_data_object->length, "IO Data"); + 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) { @@ -867,6 +967,90 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int 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) { @@ -960,7 +1144,7 @@ init_pn_io_rtc1(int proto) }, { &hf_pn_io_ps_sb_toggelBitChanged, { "Status Byte", "pn_io.ps.sb.toggle_d_changed", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_sb_toggelBitChange_slot_nr, @@ -980,7 +1164,7 @@ init_pn_io_rtc1(int proto) }, { &hf_pn_io_ps_cb_toggelBitChanged, { "Control Byte", "pn_io.ps.cb.toggle_h_changed", - FT_UINT8, BASE_DEC, NULL, 0x00, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_pn_io_ps_cb_toggelBitChange_slot_nr, @@ -1085,12 +1269,63 @@ init_pn_io_rtc1(int proto) 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_io_io_data_object, + &ett_pn_pa_profile_status }; static ei_register_info ei[] = { diff --git a/plugins/epan/profinet/packet-pn.c b/plugins/epan/profinet/packet-pn.c index 13da2c5963..66efda6a89 100644 --- a/plugins/epan/profinet/packet-pn.c +++ b/plugins/epan/profinet/packet-pn.c @@ -20,59 +20,59 @@ #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 int hf_pn_padding; +static int hf_pn_undecoded_data; +static int hf_pn_user_data; +static int hf_pn_user_bytes; +static int hf_pn_frag_bytes; +static int hf_pn_malformed; + +static int hf_pn_io_status; + +static int hf_pn_io_error_code; +static int hf_pn_io_error_decode; +static int hf_pn_io_error_code1; +static int hf_pn_io_error_code1_pniorw; +static int hf_pn_io_error_code1_pnio; +static int hf_pn_io_error_code2; +static int hf_pn_io_error_code2_pniorw; +static int hf_pn_io_error_code2_pnio_1; +static int hf_pn_io_error_code2_pnio_2; +static int hf_pn_io_error_code2_pnio_3; +static int hf_pn_io_error_code2_pnio_4; +static int hf_pn_io_error_code2_pnio_5; +static int hf_pn_io_error_code2_pnio_6; +static int hf_pn_io_error_code2_pnio_7; +static int hf_pn_io_error_code2_pnio_8; +static int hf_pn_io_error_code2_pnio_13; +static int hf_pn_io_error_code2_pnio_20; +static int hf_pn_io_error_code2_pnio_21; +static int hf_pn_io_error_code2_pnio_22; +static int hf_pn_io_error_code2_pnio_23; +static int hf_pn_io_error_code2_pnio_40; +static int hf_pn_io_error_code2_pnio_60; +static int hf_pn_io_error_code2_pnio_61; +static int hf_pn_io_error_code2_pnio_62; +static int hf_pn_io_error_code2_pnio_63; +static int hf_pn_io_error_code2_pnio_64; +static int hf_pn_io_error_code2_pnio_65; +static int hf_pn_io_error_code2_pnio_66; +static int hf_pn_io_error_code2_pnio_70; +static int hf_pn_io_error_code2_pnio_71; +static int hf_pn_io_error_code2_pnio_72; +static int hf_pn_io_error_code2_pnio_73; +static int hf_pn_io_error_code2_pnio_74; +static int hf_pn_io_error_code2_pnio_75; +static int hf_pn_io_error_code2_pnio_76; +static int hf_pn_io_error_code2_pnio_77; +static int hf_pn_io_error_code2_pnio_253; +static int hf_pn_io_error_code2_pnio_255; + +static gint ett_pn_io_status; + +static expert_field ei_pn_undecoded_data; +static expert_field ei_pn_io_error_code1; +static expert_field ei_pn_io_error_code2; static const value_string pn_io_error_code[] = { { 0x00, "OK" }, @@ -175,13 +175,17 @@ static const value_string pn_io_error_code1_pnio[] = { { 0x06 /* 6*/, "Connect: Faulty MCRBlockReq" }, { 0x07 /* 7*/, "Connect: Faulty ARRPCBlockReq" }, { 0x08 /* 8*/, "Read/Write Record: Faulty Record" }, - { 0x09 /* 9*/, "Connect: Faulty SubFrameBlock" }, - { 0x0A /* 10*/, "Connect: Faulty IRTFrameBlock" }, + { 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" }, @@ -190,16 +194,18 @@ static const value_string pn_io_error_code1_pnio[] = { { 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*/, "NRPM" }, - { 0x40 /* 64*/, "RMPM" }, + { 0x3f /* 63*/, "CTLDINA" }, + { 0x40 /* 64*/, "CMRPC" }, { 0x41 /* 65*/, "ALPMI" }, { 0x42 /* 66*/, "ALPMR" }, { 0x43 /* 67*/, "LMPM" }, - { 0x44 /* 68*/, "MMAC" }, + { 0x44 /* 68*/, "MAC" }, { 0x45 /* 69*/, "RPC" }, { 0x46 /* 70*/, "APMR" }, { 0x47 /* 71*/, "APMS" }, @@ -210,6 +216,38 @@ static const value_string pn_io_error_code1_pnio[] = { { 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 } @@ -601,6 +639,14 @@ static const value_string pn_io_error_code2_pnio_253[] = { { 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 } }; diff --git a/plugins/epan/profinet/packet-pn.h b/plugins/epan/profinet/packet-pn.h index d6ec27e1c5..6053fc3780 100644 --- a/plugins/epan/profinet/packet-pn.h +++ b/plugins/epan/profinet/packet-pn.h @@ -13,7 +13,7 @@ * * 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. + * detailed dissection of cyclic PNIO RTC1 dataframes. * */ @@ -26,6 +26,8 @@ /* ---- 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 */ @@ -36,8 +38,10 @@ typedef struct tagStationInfo { guint16 u16Vendor_id; guint16 u16Device_id; /* frame structure */ - guint16 ioDataObjectNr; - guint16 iocsNr; + guint16 ioDataObjectNr_in; + guint16 ioDataObjectNr_out; + guint16 iocsNr_in; + guint16 iocsNr_out; /* GSDfile station information */ gboolean gsdFound; gboolean gsdPathLength; @@ -70,6 +74,7 @@ typedef struct tagIocsObject { typedef struct tagIoDataObject { guint16 slotNr; guint16 subSlotNr; + guint32 api; guint32 moduleIdentNr; guint32 subModuleIdentNr; guint16 frameOffset; @@ -145,6 +150,9 @@ extern int dissect_pn_undecoded(tvbuff_t *tvb, int offset, packet_info *pinfo, 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); diff --git a/plugins/epan/stats_tree/CMakeLists.txt b/plugins/epan/stats_tree/CMakeLists.txt index ffd3129f29..a7a4543c7a 100644 --- a/plugins/epan/stats_tree/CMakeLists.txt +++ b/plugins/epan/stats_tree/CMakeLists.txt @@ -29,10 +29,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin_tap + "Statistics for ethernet frames" ${TAP_SRC} ) -add_plugin_library(stats_tree epan) +add_wireshark_epan_plugin_library(stats_tree) target_link_libraries(stats_tree epan) diff --git a/plugins/epan/stats_tree/pinfo_stats_tree.c b/plugins/epan/stats_tree/pinfo_stats_tree.c index 4600918ce4..4fc04cc662 100644 --- a/plugins/epan/stats_tree/pinfo_stats_tree.c +++ b/plugins/epan/stats_tree/pinfo_stats_tree.c @@ -16,6 +16,7 @@ #include <epan/prefs.h> #include <epan/uat-int.h> #include <epan/to_str.h> +#include <epan/dissectors/packet-ip.h> #include "pinfo_stats_tree.h" @@ -55,7 +56,7 @@ static void *uat_plen_record_copy_cb(void *n, const void *o, size_t siz _U_) { return n; } -static gboolean +static bool uat_plen_record_update_cb(void *r, char **err) { uat_plen_record_t *rec = (uat_plen_record_t*)r; @@ -97,8 +98,8 @@ 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 const gchar *st_str_ipv4 = "IPv4 Statistics" STATS_TREE_MENU_SEPARATOR "All Addresses"; +static const gchar *st_str_ipv6 = "IPv6 Statistics" STATS_TREE_MENU_SEPARATOR "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); @@ -115,11 +116,11 @@ static tap_packet_status ip_hosts_stats_tree_packet(stats_tree *st, packet_info 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_) { +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_) { +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); } @@ -128,8 +129,8 @@ 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_srcdst = "IPv4 Statistics" STATS_TREE_MENU_SEPARATOR "Source and Destination Addresses"; +static const gchar *st_str_ipv6_srcdst = "IPv6 Statistics" STATS_TREE_MENU_SEPARATOR "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"; @@ -158,8 +159,8 @@ static void ipv6_srcdst_stats_tree_init(stats_tree *st) { 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_src, + const gchar *st_str_src, int st_node_dst, const gchar *st_str_dst) { /* update source branch */ @@ -171,19 +172,19 @@ static tap_packet_status ip_srcdst_stats_tree_packet(stats_tree *st, 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_) { +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_) { +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 const gchar *st_str_ipv4_ptype = "IPv4 Statistics" STATS_TREE_MENU_SEPARATOR "IP Protocol Types"; +static const gchar *st_str_ipv6_ptype = "IPv6 Statistics" STATS_TREE_MENU_SEPARATOR "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); @@ -193,12 +194,12 @@ 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_) { +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_) { +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; } @@ -211,8 +212,8 @@ static tap_packet_status ipv6_ptype_stats_tree_packet(stats_tree *st, packet_inf */ 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 const gchar *st_str_ipv4_dsts = "IPv4 Statistics" STATS_TREE_MENU_SEPARATOR "Destinations and Ports"; +static const gchar *st_str_ipv6_dsts = "IPv6 Statistics" STATS_TREE_MENU_SEPARATOR "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); @@ -230,19 +231,57 @@ static tap_packet_status dsts_stats_tree_packet(stats_tree *st, packet_info *pin 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); - g_snprintf(str, sizeof(str) - 1, "%u", pinfo->destport); + 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_) { +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_) { +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); } +static int st_node_ipv4_src_ttls = -1; +static int st_node_ipv6_src_ttls = -1; +static const gchar* st_str_ipv4_src_ttls = "IPv4 Statistics" STATS_TREE_MENU_SEPARATOR "Source TTLs"; +static const gchar* st_str_ipv6_src_ttls = "IPv6 Statistics" STATS_TREE_MENU_SEPARATOR "Source Hop Limits"; + +static void ipv4_src_ttl_stats_tree_init(stats_tree* st) { + st_node_ipv4_src_ttls = stats_tree_create_node(st, st_str_ipv4_src_ttls, 0, STAT_DT_INT, TRUE); +} + +static void ipv6_src_ttl_stats_tree_init(stats_tree* st) { + st_node_ipv6_src_ttls = stats_tree_create_node(st, st_str_ipv6_src_ttls, 0, STAT_DT_INT, TRUE); +} + +static tap_packet_status src_ttl_stats_tree_packet(stats_tree* st, packet_info* pinfo, int st_node, const char* st_str, uint8_t ttl) { + static gchar str[128]; + int ip_src_node; + int ttl_node; + + tick_stat_node(st, st_str, 0, FALSE); + ip_src_node = tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_src), st_node, TRUE); + snprintf(str, sizeof(str) - 1, "%u", ttl); + ttl_node = tick_stat_node(st, str, ip_src_node, TRUE); + tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), ttl_node, TRUE); + return TAP_PACKET_REDRAW; +} + +static tap_packet_status ipv4_src_ttl_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* edt _U_, const void* p, tap_flags_t flags _U_) { + ws_ip4* iph = (ws_ip4*)p; + + return src_ttl_stats_tree_packet(st, pinfo, st_node_ipv4_src_ttls, st_str_ipv4_src_ttls, iph->ip_ttl); +} + +static tap_packet_status ipv6_src_ttl_stats_tree_packet(stats_tree* st, packet_info* pinfo, epan_dissect_t* edt _U_, const void* p, tap_flags_t flags _U_) { + ws_ip6* iph = (ws_ip6*)p; + + return src_ttl_stats_tree_packet(st, pinfo, st_node_ipv6_src_ttls, st_str_ipv6_src_ttls, iph->ip6_hop); +} + /* packet length stats_tree -- test range node */ static int st_node_plen = -1; static const gchar *st_str_plen = "Packet Lengths"; @@ -255,7 +294,7 @@ static void plen_stats_tree_init(stats_tree *st) { 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] = g_strdup_printf("%u and greater", + 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); @@ -264,7 +303,7 @@ static void plen_stats_tree_init(stats_tree *st) { } } -static tap_packet_status plen_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) { +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); @@ -286,13 +325,17 @@ void register_tap_listener_pinfo_stat_tree(void) 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("ip", "ip_ttl", st_str_ipv4_src_ttls, 0, ipv4_src_ttl_stats_tree_packet, ipv4_src_ttl_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_plugin("ipv6", "ipv6_hop", st_str_ipv6_src_ttls, 0, ipv6_src_ttl_stats_tree_packet, ipv6_src_ttl_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); + stats_tree_cfg *st_config = stats_tree_register("frame", "plen", st_str_plen, 0, plen_stats_tree_packet, plen_stats_tree_init, NULL); + stats_tree_set_group(st_config, REGISTER_STAT_GROUP_GENERIC); stat_module = prefs_register_stat("stat_tree", "Stats Tree", "Stats Tree", NULL); diff --git a/plugins/epan/transum/CMakeLists.txt b/plugins/epan/transum/CMakeLists.txt index dbf9dd28fb..64fd9a74a4 100644 --- a/plugins/epan/transum/CMakeLists.txt +++ b/plugins/epan/transum/CMakeLists.txt @@ -35,11 +35,12 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "Response time information based on the RTE model" ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) -add_plugin_library(transum epan) +add_wireshark_epan_plugin_library(transum) target_link_libraries(transum epan) diff --git a/plugins/epan/transum/decoders.c b/plugins/epan/transum/decoders.c index 4250245be7..c430f588ec 100644 --- a/plugins/epan/transum/decoders.c +++ b/plugins/epan/transum/decoders.c @@ -79,7 +79,7 @@ int decode_dcerpc(packet_info *pinfo _U_, proto_tree *tree, PKT_INFO* pkt_info) if (is_dcerpc_context_zero(pkt_info->dcerpc_pkt_type)) { /* This is needed to overcome an apparent Wireshark bug - found in the LUA code - is this still true in C? */ + found in the Lua code - is this still true in C? */ pkt_info->rrpd.session_id = 1; } else @@ -217,14 +217,25 @@ int decode_gtcp(packet_info *pinfo, proto_tree *tree, PKT_INFO* pkt_info) pkt_info->tcp_flags_reset = field_bool[0]; } - if (!extract_bool(tree, hf_of_interest[HF_INTEREST_TCP_RETRAN].hf, field_bool, &field_value_count)) { + /* + * This is an expert info, not a field with a value, so it's either + * present or not; if present, it's a retransmission. + */ + if (!extract_instance_count(tree, hf_of_interest[HF_INTEREST_TCP_RETRAN].hf, &field_value_count)) { if (field_value_count) - pkt_info->tcp_retran = field_bool[0]; + pkt_info->tcp_retran = TRUE; + else + pkt_info->tcp_retran = FALSE; } - if (!extract_bool(tree, hf_of_interest[HF_INTEREST_TCP_KEEP_ALIVE].hf, field_bool, &field_value_count)) { + /* + * Another expert info. + */ + if (!extract_instance_count(tree, hf_of_interest[HF_INTEREST_TCP_KEEP_ALIVE].hf, &field_value_count)) { if (field_value_count) - pkt_info->tcp_keep_alive = field_bool[0]; + pkt_info->tcp_retran = TRUE; + else + pkt_info->tcp_retran = FALSE; } /* we use the SSL Content Type to detect SSL Alerts */ diff --git a/plugins/epan/transum/extractors.c b/plugins/epan/transum/extractors.c index d52583436a..80475ae377 100644 --- a/plugins/epan/transum/extractors.c +++ b/plugins/epan/transum/extractors.c @@ -16,7 +16,7 @@ /* This function extracts a field value (e.g. tcp.len) from a tree. Because a packet may contain - multiple values for the the field the extracted values are returned in a result_array. The + multiple values for the field, the extracted values are returned in a result_array. The number of array entries is returned in element_count. Return is 0 if all went well. If this function return -1 it is probably because the tree did not @@ -41,7 +41,7 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t * for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++) { - result_array[i] = fvalue_get_uinteger(&((field_info*)finfo_array->pdata[i])->value); + result_array[i] = fvalue_get_uinteger(((field_info*)finfo_array->pdata[i])->value); } return 0; @@ -66,7 +66,7 @@ int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t * for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++) { - result_array[i] = fvalue_get_uinteger64(&((field_info*)finfo_array->pdata[i])->value); + result_array[i] = fvalue_get_uinteger64(((field_info*)finfo_array->pdata[i])->value); } return 0; @@ -91,7 +91,7 @@ int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t * for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++) { - result_array[i] = fvalue_get_sinteger64(&((field_info*)finfo_array->pdata[i])->value); + result_array[i] = fvalue_get_sinteger64(((field_info*)finfo_array->pdata[i])->value); } return 0; @@ -116,9 +116,10 @@ int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t for (size_t i = 0; i < *element_count && i < MAX_RETURNED_ELEMENTS; i++) { - fvalue_t *fv = &(((field_info*)finfo_array->pdata[i])->value); + fvalue_t *fv = ((field_info*)finfo_array->pdata[i])->value; - if (fv->value.uinteger) + ws_assert(fvalue_type_ftenum(fv) == FT_BOOLEAN); + if (fvalue_get_uinteger64(fv)) result_array[i] = TRUE; else result_array[i] = FALSE; @@ -128,6 +129,29 @@ int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t } /* + * Extract a count of the number of instances of a given field. + */ +int extract_instance_count(proto_tree *tree, int field_id, size_t *element_count) +{ + GPtrArray *finfo_array; + + *element_count = 0; + if (tree == NULL) { + return -1; + } + + finfo_array = proto_get_finfo_ptr_array(tree, field_id); + + if (finfo_array == NULL) { + return -1; + } + + *element_count = g_ptr_array_len(finfo_array); + + return 0; +} + +/* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: diff --git a/plugins/epan/transum/extractors.h b/plugins/epan/transum/extractors.h index 5bf575792f..d56134a6db 100644 --- a/plugins/epan/transum/extractors.h +++ b/plugins/epan/transum/extractors.h @@ -18,3 +18,4 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t * int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t *element_count); int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t *element_count); int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t *element_count); +int extract_instance_count(proto_tree *tree, int field_id, size_t *element_count); diff --git a/plugins/epan/transum/packet-transum.c b/plugins/epan/transum/packet-transum.c index e4f5973ce3..87903fc58f 100644 --- a/plugins/epan/transum/packet-transum.c +++ b/plugins/epan/transum/packet-transum.c @@ -130,27 +130,27 @@ static int highest_udp_stream_no; wmem_map_t *tcp_stream_exceptions; -static gint ett_transum = -1; -static gint ett_transum_header = -1; -static gint ett_transum_data = -1; - -static int proto_transum = -1; - -static int hf_tsum_status = -1; -//static int hf_tsum_time_units = -1; -static int hf_tsum_req_first_seg = -1; -static int hf_tsum_req_last_seg = -1; -static int hf_tsum_rsp_first_seg = -1; -static int hf_tsum_rsp_last_seg = -1; -static int hf_tsum_apdu_rsp_time = -1; -static int hf_tsum_service_time = -1; -static int hf_tsum_req_spread = -1; -static int hf_tsum_rsp_spread = -1; -static int hf_tsum_clip_filter = -1; -static int hf_tsum_calculation = -1; -static int hf_tsum_summary = -1; -static int hf_tsum_req_search = -1; -static int hf_tsum_rsp_search = -1; +static gint ett_transum; +static gint ett_transum_header; +static gint ett_transum_data; + +static int proto_transum; + +static int hf_tsum_status; +//static int hf_tsum_time_units; +static int hf_tsum_req_first_seg; +static int hf_tsum_req_last_seg; +static int hf_tsum_rsp_first_seg; +static int hf_tsum_rsp_last_seg; +static int hf_tsum_apdu_rsp_time; +static int hf_tsum_service_time; +static int hf_tsum_req_spread; +static int hf_tsum_rsp_spread; +static int hf_tsum_clip_filter; +static int hf_tsum_calculation; +static int hf_tsum_summary; +static int hf_tsum_req_search; +static int hf_tsum_rsp_search; static const enum_val_t capture_position_vals[] = { { "TRACE_CAP_CLIENT", "Client", TRACE_CAP_CLIENT }, @@ -818,7 +818,7 @@ static void cleanup_globals(void) /* This function adds the RTE data to the tree. The summary ptr is currently not used but will be used for summariser information once this feature has - been ported from the LUA code. */ + been ported from the Lua code. */ static void write_rte(RRPD *in_rrpd, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, char *summary) { nstime_t rte_art; @@ -831,7 +831,7 @@ static void write_rte(RRPD *in_rrpd, tvbuff_t *tvb, packet_info *pinfo, proto_tr if (in_rrpd->req_first_frame) { - pi = proto_tree_add_item(tree, proto_transum, tvb, 0, -1, ENC_NA); + pi = proto_tree_add_item(tree, proto_transum, tvb, 0, 0, ENC_NA); rte_tree = proto_item_add_subtree(pi, ett_transum); nstime_delta(&rte_reqspread, &(in_rrpd->req_last_rtime), &(in_rrpd->req_first_rtime)); diff --git a/plugins/epan/unistim/CMakeLists.txt b/plugins/epan/unistim/CMakeLists.txt index 8c349b8515..ade7e6d910 100644 --- a/plugins/epan/unistim/CMakeLists.txt +++ b/plugins/epan/unistim/CMakeLists.txt @@ -29,10 +29,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "Unified Networks IP Stimulus (UNIStim) dissection" ${DISSECTOR_SRC} ) -add_plugin_library(unistim epan) +add_wireshark_epan_plugin_library(unistim) target_link_libraries(unistim epan) diff --git a/plugins/epan/unistim/audio.h b/plugins/epan/unistim/audio.h index bc062cd406..743b4ac765 100644 --- a/plugins/epan/unistim/audio.h +++ b/plugins/epan/unistim/audio.h @@ -13,119 +13,119 @@ #ifndef UNISTIM_AUDIO_H #define UNISTIM_AUDIO_H -static int hf_audio_mgr_attr=-1; -static int hf_audio_mgr_opts=-1; -static int hf_audio_mgr_alert=-1; -static int hf_audio_mgr_adj_rx_vol=-1; -static int hf_audio_mgr_def_rx_vol=-1; -static int hf_audio_mgr_handset=-1; -static int hf_audio_mgr_headset=-1; -static int hf_audio_default_rx_vol_id=-1; - -static int hf_audio_mgr_opt_max_vol=-1; -static int hf_audio_mgr_opt_adj_vol=-1; -static int hf_audio_mgr_opt_aa_rx_vol_rpt=-1; -static int hf_audio_mgr_opt_hs_on_air=-1; -static int hf_audio_mgr_opt_hd_on_air=-1; -static int hf_audio_mgr_opt_noise_squelch=-1; - -static int hf_audio_mgr_mute=-1; -static int hf_audio_mgr_tx_rx=-1; -static int hf_audio_mgr_stream_id=-1; - -static int hf_audio_mgr_transducer_based_tone_id=-1; -static int hf_audio_mgr_attenuated=-1; -static int hf_audio_mgr_warbler_select=-1; -static int hf_audio_mgr_transducer_routing=-1; -static int hf_audio_mgr_tone_vol_range=-1; -static int hf_audio_mgr_cadence_select=-1; -static int hf_audio_special_tone=-1; -static int hf_audio_tone_level=-1; -static int hf_audio_visual_tones=-1; - -static int hf_audio_stream_based_tone_id=-1; -static int hf_audio_stream_based_tone_rx_tx=-1; -static int hf_audio_stream_based_tone_mute=-1; -static int hf_audio_stream_id=-1; -static int hf_audio_stream_based_volume=-1; - -static int hf_audio_apb_number=-1; -static int hf_audio_apb_op_code=-1; -static int hf_audio_apb_param_len=-1; -static int hf_audio_apb_data=-1; -static int hf_audio_vocoder_id=-1; -static int hf_audio_vocoder_param=-1; -static int hf_audio_vocoder_entity=-1; -static int hf_audio_vocoder_annexa=-1; -static int hf_audio_vocoder_annexb=-1; -static int hf_audio_sample_rate=-1; -static int hf_audio_rtp_type=-1; -static int hf_audio_bytes_per_frame=-1; - -static int hf_audio_rx_stream_id=-1; -static int hf_audio_tx_stream_id=-1; -static int hf_rx_vocoder_type=-1; -static int hf_tx_vocoder_type=-1; -static int hf_frames_per_packet=-1; -static int hf_audio_tos=-1; -static int hf_audio_precedence=-1; -static int hf_audio_frf_11=-1; -static int hf_rtcp_bucket_id=-1; -static int hf_audio_lcl_rtp_port=-1; -static int hf_audio_lcl_rtcp_port=-1; -static int hf_audio_far_rtp_port=-1; -static int hf_audio_far_rtcp_port=-1; -static int hf_audio_far_ip_add=-1; -static int hf_audio_rtcp_bucket_id=-1; -static int hf_audio_clear_bucket=-1; - -static int hf_audio_transducer_pair=-1; -static int hf_audio_rx_enable=-1; -static int hf_audio_tx_enable=-1; -static int hf_audio_sidetone_disable=-1; -static int hf_audio_destruct_additive=-1; -static int hf_audio_dont_force_active=-1; -static int hf_audio_source_descr=-1; -static int hf_audio_sdes_rtcp_bucket=-1; -static int hf_audio_desired_jitter=-1; -static int hf_audio_high_water_mark=-1; -static int hf_audio_early_packet_resync_thresh=-1; -static int hf_audio_late_packet_resync_thresh=-1; -static int hf_audio_resolve_phone_port=-1; -static int hf_audio_far_end_echo_port=-1; -static int hf_audio_far_end_ip_address=-1; -static int hf_audio_nat_port=-1; -static int hf_audio_nat_ip_address=-1; -static int hf_audio_direction_code=-1; -static int hf_audio_hf_support=-1; -static int hf_audio_opt_rpt_max=-1; -static int hf_audio_opt_rpt_adj_vol=-1; -static int hf_audio_opt_rpt_auto_adj_vol=-1; -static int hf_audio_opt_rpt_hs_on_air=-1; -static int hf_audio_opt_rpt_hd_on_air=-1; -static int hf_audio_opt_rpt_noise_squelch=-1; -static int hf_audio_rx_vol_apb_rpt=-1; -static int hf_audio_rx_vol_vol_up=-1; -static int hf_audio_rx_vol_vol_floor=-1; -static int hf_audio_rx_vol_vol_ceiling=-1; -static int hf_audio_current_adj_vol_id=-1; -static int hf_audio_current_rx_level=-1; -static int hf_audio_current_rx_range=-1; -static int hf_audio_cadence_select=-1; -static int hf_audio_warbler_select=-1; -static int hf_audio_open_stream_rpt=-1; -static int hf_audio_sdes_rpt_source_desc=-1; -static int hf_audio_sdes_rpt_buk_id=-1; -static int hf_audio_phone_port=-1; -static int hf_audio_phone_ip=-1; - -static int hf_audio_phone_add_len=-1; -static int hf_audio_nat_listen_port=-1; -static int hf_audio_nat_ip=-1; -static int hf_audio_nat_add_len=-1; -static int hf_audio_stream_direction_code=-1; -static int hf_audio_stream_state=-1; -static int hf_audio_transducer_list_length=-1; +static int hf_audio_mgr_attr; +static int hf_audio_mgr_opts; +static int hf_audio_mgr_alert; +static int hf_audio_mgr_adj_rx_vol; +static int hf_audio_mgr_def_rx_vol; +static int hf_audio_mgr_handset; +static int hf_audio_mgr_headset; +static int hf_audio_default_rx_vol_id; + +static int hf_audio_mgr_opt_max_vol; +static int hf_audio_mgr_opt_adj_vol; +static int hf_audio_mgr_opt_aa_rx_vol_rpt; +static int hf_audio_mgr_opt_hs_on_air; +static int hf_audio_mgr_opt_hd_on_air; +static int hf_audio_mgr_opt_noise_squelch; + +static int hf_audio_mgr_mute; +static int hf_audio_mgr_tx_rx; +static int hf_audio_mgr_stream_id; + +static int hf_audio_mgr_transducer_based_tone_id; +static int hf_audio_mgr_attenuated; +static int hf_audio_mgr_warbler_select; +static int hf_audio_mgr_transducer_routing; +static int hf_audio_mgr_tone_vol_range; +static int hf_audio_mgr_cadence_select; +static int hf_audio_special_tone; +static int hf_audio_tone_level; +static int hf_audio_visual_tones; + +static int hf_audio_stream_based_tone_id; +static int hf_audio_stream_based_tone_rx_tx; +static int hf_audio_stream_based_tone_mute; +static int hf_audio_stream_id; +static int hf_audio_stream_based_volume; + +static int hf_audio_apb_number; +static int hf_audio_apb_op_code; +static int hf_audio_apb_param_len; +static int hf_audio_apb_data; +static int hf_audio_vocoder_id; +static int hf_audio_vocoder_param; +static int hf_audio_vocoder_entity; +static int hf_audio_vocoder_annexa; +static int hf_audio_vocoder_annexb; +static int hf_audio_sample_rate; +static int hf_audio_rtp_type; +static int hf_audio_bytes_per_frame; + +static int hf_audio_rx_stream_id; +static int hf_audio_tx_stream_id; +static int hf_rx_vocoder_type; +static int hf_tx_vocoder_type; +static int hf_frames_per_packet; +static int hf_audio_tos; +static int hf_audio_precedence; +static int hf_audio_frf_11; +static int hf_rtcp_bucket_id; +static int hf_audio_lcl_rtp_port; +static int hf_audio_lcl_rtcp_port; +static int hf_audio_far_rtp_port; +static int hf_audio_far_rtcp_port; +static int hf_audio_far_ip_add; +static int hf_audio_rtcp_bucket_id; +static int hf_audio_clear_bucket; + +static int hf_audio_transducer_pair; +static int hf_audio_rx_enable; +static int hf_audio_tx_enable; +static int hf_audio_sidetone_disable; +static int hf_audio_destruct_additive; +static int hf_audio_dont_force_active; +static int hf_audio_source_descr; +static int hf_audio_sdes_rtcp_bucket; +static int hf_audio_desired_jitter; +static int hf_audio_high_water_mark; +static int hf_audio_early_packet_resync_thresh; +static int hf_audio_late_packet_resync_thresh; +static int hf_audio_resolve_phone_port; +static int hf_audio_far_end_echo_port; +static int hf_audio_far_end_ip_address; +static int hf_audio_nat_port; +static int hf_audio_nat_ip_address; +static int hf_audio_direction_code; +static int hf_audio_hf_support; +static int hf_audio_opt_rpt_max; +static int hf_audio_opt_rpt_adj_vol; +static int hf_audio_opt_rpt_auto_adj_vol; +static int hf_audio_opt_rpt_hs_on_air; +static int hf_audio_opt_rpt_hd_on_air; +static int hf_audio_opt_rpt_noise_squelch; +static int hf_audio_rx_vol_apb_rpt; +static int hf_audio_rx_vol_vol_up; +static int hf_audio_rx_vol_vol_floor; +static int hf_audio_rx_vol_vol_ceiling; +static int hf_audio_current_adj_vol_id; +static int hf_audio_current_rx_level; +static int hf_audio_current_rx_range; +static int hf_audio_cadence_select; +static int hf_audio_warbler_select; +static int hf_audio_open_stream_rpt; +static int hf_audio_sdes_rpt_source_desc; +static int hf_audio_sdes_rpt_buk_id; +static int hf_audio_phone_port; +static int hf_audio_phone_ip; + +static int hf_audio_phone_add_len; +static int hf_audio_nat_listen_port; +static int hf_audio_nat_ip; +static int hf_audio_nat_add_len; +static int hf_audio_stream_direction_code; +static int hf_audio_stream_state; +static int hf_audio_transducer_list_length; static const value_string audio_switch_msgs[]={ diff --git a/plugins/epan/unistim/basic.h b/plugins/epan/unistim/basic.h index 9429ce98e2..793c7e82dc 100644 --- a/plugins/epan/unistim/basic.h +++ b/plugins/epan/unistim/basic.h @@ -13,27 +13,27 @@ #ifndef UNISTIM_BASIC_H #define UNISTIM_BASIC_H -static int hf_basic_switch_query_flags=-1; -static int hf_basic_switch_query_attr=-1; -static int hf_basic_switch_query_opts=-1; -static int hf_basic_switch_query_fw=-1; -static int hf_basic_switch_query_hw_id=-1; -static int hf_basic_switch_query_it_type=-1; -static int hf_basic_switch_query_prod_eng_code=-1; -static int hf_basic_switch_query_gray_mkt_info=-1; -static int hf_basic_switch_options_secure=-1; -static int hf_basic_switch_element_id=-1; -static int hf_basic_switch_eeprom_data=-1; -static int hf_basic_switch_terminal_id=-1; +static int hf_basic_switch_query_flags; +static int hf_basic_switch_query_attr; +static int hf_basic_switch_query_opts; +static int hf_basic_switch_query_fw; +static int hf_basic_switch_query_hw_id; +static int hf_basic_switch_query_it_type; +static int hf_basic_switch_query_prod_eng_code; +static int hf_basic_switch_query_gray_mkt_info; +static int hf_basic_switch_options_secure; +static int hf_basic_switch_element_id; +static int hf_basic_switch_eeprom_data; +static int hf_basic_switch_terminal_id; -static int hf_basic_phone_eeprom_stat_cksum=-1; -static int hf_basic_phone_eeprom_dynam=-1; -static int hf_basic_phone_eeprom_net_config_cksum=-1; -static int hf_basic_phone_hw_id=-1; -static int hf_basic_phone_fw_ver=-1; -static int hf_basic_it_type=-1; -static int hf_basic_prod_eng_code=-1; -static int hf_basic_ether_address=-1; +static int hf_basic_phone_eeprom_stat_cksum; +static int hf_basic_phone_eeprom_dynam; +static int hf_basic_phone_eeprom_net_config_cksum; +static int hf_basic_phone_hw_id; +static int hf_basic_phone_fw_ver; +static int hf_basic_it_type; +static int hf_basic_prod_eng_code; +static int hf_basic_ether_address; static const value_string it_types[]={ {0x02,"i2004"}, diff --git a/plugins/epan/unistim/broadcast.h b/plugins/epan/unistim/broadcast.h index 4c85afc476..e8edd524bc 100644 --- a/plugins/epan/unistim/broadcast.h +++ b/plugins/epan/unistim/broadcast.h @@ -13,14 +13,14 @@ #ifndef UNISTIM_BROADCAST_H #define UNISTIM_BROADCAST_H -static int hf_broadcast_year=-1; -static int hf_broadcast_month=-1; -static int hf_broadcast_day=-1; -static int hf_broadcast_hour=-1; -static int hf_broadcast_minute=-1; -static int hf_broadcast_second=-1; -static int hf_broadcast_icon_state=-1; -static int hf_broadcast_icon_cadence=-1; +static int hf_broadcast_year; +static int hf_broadcast_month; +static int hf_broadcast_day; +static int hf_broadcast_hour; +static int hf_broadcast_minute; +static int hf_broadcast_second; +static int hf_broadcast_icon_state; +static int hf_broadcast_icon_cadence; static const value_string broadcast_switch_msgs[]={ diff --git a/plugins/epan/unistim/display.h b/plugins/epan/unistim/display.h index 829441d61f..7b478cdd72 100644 --- a/plugins/epan/unistim/display.h +++ b/plugins/epan/unistim/display.h @@ -13,102 +13,102 @@ #ifndef UNISTIM_DISPLAY_H #define UNISTIM_DISPLAY_H -static int hf_display_write_cursor_move=-1; -static int hf_display_write_clear_left=-1; -static int hf_display_write_clear_right=-1; -static int hf_display_write_shift_left=-1; -static int hf_display_write_shift_right=-1; -static int hf_display_write_highlight=-1; -static int hf_display_write_tag=-1; -static int hf_display_write_address_numeric=-1; -static int hf_display_write_address_context=-1; -static int hf_display_write_address_line=-1; -static int hf_display_write_address_soft_key=-1; -static int hf_display_write_address_soft_label=-1; -static int hf_display_write_address_softkey_id=-1; -static int hf_display_write_address_char_pos=-1; -static int hf_display_write_address_line_number=-1; -static int hf_display_cursor_move_cmd=-1; -static int hf_display_cursor_blink=-1; -static int hf_icon_id=-1; -static int hf_display_arrow=-1; -static int hf_display_clear_numeric =-1; -static int hf_display_clear_context =-1; -static int hf_display_clear_date =-1; -static int hf_display_clear_time =-1; -static int hf_display_clear_line =-1; -static int hf_display_clear_status_bar_icon =-1; -static int hf_display_clear_softkey =-1; -static int hf_display_clear_softkey_label =-1; -static int hf_display_clear_line_1 =-1; -static int hf_display_clear_line_2 =-1; -static int hf_display_clear_line_3 =-1; -static int hf_display_clear_line_4 =-1; -static int hf_display_clear_line_5 =-1; -static int hf_display_clear_line_6 =-1; -static int hf_display_clear_line_7 =-1; -static int hf_display_clear_line_8 =-1; -static int hf_display_clear_status_bar_icon_1 =-1; -static int hf_display_clear_status_bar_icon_2 =-1; -static int hf_display_clear_status_bar_icon_3 =-1; -static int hf_display_clear_status_bar_icon_4 =-1; -static int hf_display_clear_status_bar_icon_5 =-1; -static int hf_display_clear_status_bar_icon_6 =-1; -static int hf_display_clear_status_bar_icon_7 =-1; -static int hf_display_clear_status_bar_icon_8 =-1; -static int hf_display_clear_soft_key_1 =-1; -static int hf_display_clear_soft_key_2 =-1; -static int hf_display_clear_soft_key_3 =-1; -static int hf_display_clear_soft_key_4 =-1; -static int hf_display_clear_soft_key_5 =-1; -static int hf_display_clear_soft_key_6 =-1; -static int hf_display_clear_soft_key_7 =-1; -static int hf_display_clear_soft_key_8 =-1; -static int hf_display_clear_sk_label_key_id=-1; -static int hf_display_clear_all_slks=-1; +static int hf_display_write_cursor_move; +static int hf_display_write_clear_left; +static int hf_display_write_clear_right; +static int hf_display_write_shift_left; +static int hf_display_write_shift_right; +static int hf_display_write_highlight; +static int hf_display_write_tag; +static int hf_display_write_address_numeric; +static int hf_display_write_address_context; +static int hf_display_write_address_line; +static int hf_display_write_address_soft_key; +static int hf_display_write_address_soft_label; +static int hf_display_write_address_softkey_id; +static int hf_display_write_address_char_pos; +static int hf_display_write_address_line_number; +static int hf_display_cursor_move_cmd; +static int hf_display_cursor_blink; +static int hf_icon_id; +static int hf_display_arrow; +static int hf_display_clear_numeric; +static int hf_display_clear_context; +static int hf_display_clear_date; +static int hf_display_clear_time; +static int hf_display_clear_line; +static int hf_display_clear_status_bar_icon; +static int hf_display_clear_softkey; +static int hf_display_clear_softkey_label; +static int hf_display_clear_line_1; +static int hf_display_clear_line_2; +static int hf_display_clear_line_3; +static int hf_display_clear_line_4; +static int hf_display_clear_line_5; +static int hf_display_clear_line_6; +static int hf_display_clear_line_7; +static int hf_display_clear_line_8; +static int hf_display_clear_status_bar_icon_1; +static int hf_display_clear_status_bar_icon_2; +static int hf_display_clear_status_bar_icon_3; +static int hf_display_clear_status_bar_icon_4; +static int hf_display_clear_status_bar_icon_5; +static int hf_display_clear_status_bar_icon_6; +static int hf_display_clear_status_bar_icon_7; +static int hf_display_clear_status_bar_icon_8; +static int hf_display_clear_soft_key_1; +static int hf_display_clear_soft_key_2; +static int hf_display_clear_soft_key_3; +static int hf_display_clear_soft_key_4; +static int hf_display_clear_soft_key_5; +static int hf_display_clear_soft_key_6; +static int hf_display_clear_soft_key_7; +static int hf_display_clear_soft_key_8; +static int hf_display_clear_sk_label_key_id; +static int hf_display_clear_all_slks; -static int hf_display_line_width=-1; -static int hf_display_lines=-1; -static int hf_display_softkey_width=-1; -static int hf_display_softkeys=-1; -static int hf_display_icon=-1; -static int hf_display_softlabel_key_width=-1; -static int hf_display_context_width=-1; -static int hf_display_numeric_width=-1; -static int hf_display_time_width=-1; -static int hf_display_date_width=-1; -static int hf_display_char_dload=-1; -static int hf_display_freeform_icon_dload=-1; -static int hf_display_icon_type=-1; -static int hf_display_charsets=-1; -static int hf_display_contrast=-1; -static int hf_display_cursor_numeric=-1; -static int hf_display_cursor_context =-1; -static int hf_display_cursor_line =-1; -static int hf_display_cursor_softkey =-1; -static int hf_display_cursor_softkey_id =-1; -static int hf_display_cursor_char_pos =-1; -static int hf_display_cursor_line_number =-1; -static int hf_display_hlight_start=-1; -static int hf_display_hlight_end=-1; -static int hf_display_date_format=-1; -static int hf_display_time_format=-1; -static int hf_display_use_time_format=-1; -static int hf_display_use_date_format=-1; -static int hf_display_context_format=-1; -static int hf_display_context_field=-1; -static int hf_display_char_address=-1; -static int hf_display_layer_number=-1; -static int hf_display_layer_skey_id=-1; -static int hf_display_layer_all_skeys=-1; -static int hf_display_once_or_cyclic=-1; -static int hf_display_layer_duration=-1; -static int hf_display_call_timer_mode=-1; -static int hf_display_call_timer_reset=-1; -static int hf_display_call_timer_display=-1; -static int hf_display_call_timer_delay=-1; -static int hf_display_call_timer_id=-1; +static int hf_display_line_width; +static int hf_display_lines; +static int hf_display_softkey_width; +static int hf_display_softkeys; +static int hf_display_icon; +static int hf_display_softlabel_key_width; +static int hf_display_context_width; +static int hf_display_numeric_width; +static int hf_display_time_width; +static int hf_display_date_width; +static int hf_display_char_dload; +static int hf_display_freeform_icon_dload; +static int hf_display_icon_type; +static int hf_display_charsets; +static int hf_display_contrast; +static int hf_display_cursor_numeric; +static int hf_display_cursor_context; +static int hf_display_cursor_line; +static int hf_display_cursor_softkey; +static int hf_display_cursor_softkey_id; +static int hf_display_cursor_char_pos; +static int hf_display_cursor_line_number; +static int hf_display_hlight_start; +static int hf_display_hlight_end; +static int hf_display_date_format; +static int hf_display_time_format; +static int hf_display_use_time_format; +static int hf_display_use_date_format; +static int hf_display_context_format; +static int hf_display_context_field; +static int hf_display_char_address; +static int hf_display_layer_number; +static int hf_display_layer_skey_id; +static int hf_display_layer_all_skeys; +static int hf_display_once_or_cyclic; +static int hf_display_layer_duration; +static int hf_display_call_timer_mode; +static int hf_display_call_timer_reset; +static int hf_display_call_timer_display; +static int hf_display_call_timer_delay; +static int hf_display_call_timer_id; static const value_string arrow_dirs[]={ diff --git a/plugins/epan/unistim/expansion.h b/plugins/epan/unistim/expansion.h index 4081ca84fa..50ffc2a6ec 100644 --- a/plugins/epan/unistim/expansion.h +++ b/plugins/epan/unistim/expansion.h @@ -12,7 +12,7 @@ #ifndef UNISTIM_EXPANSION_H #define UNISTIM_EXPANSION_H -static int hf_expansion_softlabel_number=-1; +static int hf_expansion_softlabel_number; static const value_string expansion_switch_msgs[]={ {0x17,"Next Display/Write command regards expansion module"}, diff --git a/plugins/epan/unistim/key.h b/plugins/epan/unistim/key.h index 43acba8d63..bf7d68b35e 100644 --- a/plugins/epan/unistim/key.h +++ b/plugins/epan/unistim/key.h @@ -14,32 +14,32 @@ #define UNISTIM_KEY_H -static int hf_key_icon_id=-1; -static int hf_key_led_cadence=-1; -static int hf_key_led_id=-1; -static int hf_key_programmable_keys=-1; -static int hf_keys_soft_keys=-1; -static int hf_keys_hd_key=-1; -static int hf_keys_mute_key=-1; -static int hf_keys_quit_key=-1; -static int hf_keys_copy_key=-1; -static int hf_keys_mwi_key=-1; -static int hf_keys_num_nav_keys=-1; -static int hf_keys_num_conspic_keys=-1; -static int hf_keys_send_key_rel=-1; -static int hf_keys_enable_vol=-1; -static int hf_keys_conspic_prog_key=-1; -static int hf_keys_acd_super_control=-1; -static int hf_keys_local_dial_feedback=-1; -static int hf_keys_admin_command=-1; -static int hf_keys_logical_icon_id=-1; -static int hf_keys_repeat_timer_one=-1; -static int hf_keys_repeat_timer_two=-1; -static int hf_keys_led_id=-1; -static int hf_keys_phone_icon_id=-1; -static int hf_keys_cadence_on_time=-1; -static int hf_keys_cadence_off_time=-1; -static int hf_keys_user_activity_timeout=-1; +static int hf_key_icon_id; +static int hf_key_led_cadence; +static int hf_key_led_id; +static int hf_key_programmable_keys; +static int hf_keys_soft_keys; +static int hf_keys_hd_key; +static int hf_keys_mute_key; +static int hf_keys_quit_key; +static int hf_keys_copy_key; +static int hf_keys_mwi_key; +static int hf_keys_num_nav_keys; +static int hf_keys_num_conspic_keys; +static int hf_keys_send_key_rel; +static int hf_keys_enable_vol; +static int hf_keys_conspic_prog_key; +static int hf_keys_acd_super_control; +static int hf_keys_local_dial_feedback; +static int hf_keys_admin_command; +static int hf_keys_logical_icon_id; +static int hf_keys_repeat_timer_one; +static int hf_keys_repeat_timer_two; +static int hf_keys_led_id; +static int hf_keys_phone_icon_id; +static int hf_keys_cadence_on_time; +static int hf_keys_cadence_off_time; +static int hf_keys_user_activity_timeout; static const value_string keys_led_ids[]={ {0x00,"Message Waiting LED"}, diff --git a/plugins/epan/unistim/network.h b/plugins/epan/unistim/network.h index 561ef8dcb1..06ee76bf8f 100644 --- a/plugins/epan/unistim/network.h +++ b/plugins/epan/unistim/network.h @@ -14,48 +14,48 @@ #define UNISTIM_NETWORK_H -static int hf_net_diag_flag=-1; -static int hf_net_managers_flag=-1; -static int hf_net_attributes_flag=-1; -static int hf_net_serv_info_flag=-1; -static int hf_net_options_flag=-1; -static int hf_net_sanity_flag=-1; -static int hf_net_enable_diag=-1; -static int hf_net_enable_rudp=-1; -static int hf_net_server_id=-1; -static int hf_net_server_port=-1; -static int hf_net_server_action=-1; -static int hf_net_server_retry_count=-1; -static int hf_net_server_failover_id=-1; -static int hf_net_server_ip_address=-1; -static int hf_net_server_time_out=-1; -static int hf_net_server_config_element=-1; -static int hf_net_server_recovery_time_low=-1; -static int hf_net_server_recovery_time_high=-1; -static int hf_net_phone_rx_ovr_flag=-1; -static int hf_net_phone_tx_ovr_flag=-1; -static int hf_net_phone_rx_empty_flag=-1; -static int hf_net_phone_invalid_msg_flag=-1; -static int hf_net_phone_eeprom_insane_flag=-1; -static int hf_net_phone_eeprom_unsafe_flag=-1; -static int hf_net_phone_diag=-1; -static int hf_net_phone_rudp=-1; +static int hf_net_diag_flag; +static int hf_net_managers_flag; +static int hf_net_attributes_flag; +static int hf_net_serv_info_flag; +static int hf_net_options_flag; +static int hf_net_sanity_flag; +static int hf_net_enable_diag; +static int hf_net_enable_rudp; +static int hf_net_server_id; +static int hf_net_server_port; +static int hf_net_server_action; +static int hf_net_server_retry_count; +static int hf_net_server_failover_id; +static int hf_net_server_ip_address; +static int hf_net_server_time_out; +static int hf_net_server_config_element; +static int hf_net_server_recovery_time_low; +static int hf_net_server_recovery_time_high; +static int hf_net_phone_rx_ovr_flag; +static int hf_net_phone_tx_ovr_flag; +static int hf_net_phone_rx_empty_flag; +static int hf_net_phone_invalid_msg_flag; +static int hf_net_phone_eeprom_insane_flag; +static int hf_net_phone_eeprom_unsafe_flag; +static int hf_net_phone_diag; +static int hf_net_phone_rudp; -static int hf_net_phone_primary_server_id=-1; -static int hf_net_phone_server_port=-1; -static int hf_net_phone_server_action=-1; -static int hf_net_phone_server_retry_count=-1; -static int hf_net_phone_server_failover_id=-1; -static int hf_net_phone_server_ip=-1; -static int hf_net_file_xfer_mode =-1; -static int hf_net_force_download =-1; -static int hf_net_use_file_server_port =-1; -static int hf_net_use_local_port=-1; -static int hf_net_file_server_port=-1; -static int hf_net_local_port=-1; -static int hf_net_file_server_address=-1; -static int hf_net_full_pathname=-1; -static int hf_net_file_identifier=-1; +static int hf_net_phone_primary_server_id; +static int hf_net_phone_server_port; +static int hf_net_phone_server_action; +static int hf_net_phone_server_retry_count; +static int hf_net_phone_server_failover_id; +static int hf_net_phone_server_ip; +static int hf_net_file_xfer_mode; +static int hf_net_force_download; +static int hf_net_use_file_server_port; +static int hf_net_use_local_port; +static int hf_net_file_server_port; +static int hf_net_local_port; +static int hf_net_file_server_address; +static int hf_net_full_pathname; +static int hf_net_file_identifier; static const value_string file_xfer_modes[]={ {0x00,"TFTP"}, @@ -73,8 +73,8 @@ static const value_string action_bytes[]={ {0,NULL} }; -static int hf_key_code=-1; -static int hf_key_command=-1; +static int hf_key_code; +static int hf_key_command; static const value_string key_cmds[]={ {0x00,"Key Released"}, diff --git a/plugins/epan/unistim/packet-unistim.c b/plugins/epan/unistim/packet-unistim.c index 493f2a481a..58b01eccd0 100644 --- a/plugins/epan/unistim/packet-unistim.c +++ b/plugins/epan/unistim/packet-unistim.c @@ -32,8 +32,10 @@ void proto_register_unistim(void); +static dissector_handle_t unistim_handle; + static unistim_info_t *uinfo; -static int unistim_tap = -1; +static int unistim_tap; void proto_reg_handoff_unistim(void); static void dissect_payload(proto_tree *unistim_tree,tvbuff_t *tvb,gint offset, packet_info *pinfo); @@ -72,37 +74,37 @@ static gint dissect_uftp_message(proto_tree *unistim_tree, packet_info *pinfo, tvbuff_t *tvb,gint offset); -static int proto_unistim = -1; -static int hf_unistim_seq_nu = -1; -static int hf_unistim_packet_type = -1; -static int hf_unistim_payload = -1; -static int hf_unistim_cmd_add = -1; -static int hf_unistim_len =-1; -static int hf_terminal_id=-1; -static int hf_basic_bit_field=-1; - -static int hf_basic_switch_cmd=-1; -static int hf_basic_phone_cmd=-1; -static int hf_broadcast_switch_cmd=-1; -/* static int hf_broadcast_phone_cmd=-1; */ -static int hf_audio_switch_cmd=-1; -static int hf_audio_phone_cmd=-1; -static int hf_display_switch_cmd=-1; -static int hf_display_phone_cmd=-1; -static int hf_key_switch_cmd=-1; -static int hf_key_phone_cmd=-1; -static int hf_network_switch_cmd=-1; -static int hf_network_phone_cmd=-1; -static int hf_expansion_switch_cmd=-1; -static int hf_expansion_phone_cmd=-1; -static int hf_module_key_number=-1; - -static int hf_generic_data=-1; -static int hf_generic_string=-1; - -static gint ett_unistim = -1; - -static expert_field ei_unistim_len = EI_INIT; +static int proto_unistim; +static int hf_unistim_seq_nu; +static int hf_unistim_packet_type; +static int hf_unistim_payload; +static int hf_unistim_cmd_add; +static int hf_unistim_len; +static int hf_terminal_id; +static int hf_basic_bit_field; + +static int hf_basic_switch_cmd; +static int hf_basic_phone_cmd; +static int hf_broadcast_switch_cmd; +/* static int hf_broadcast_phone_cmd; */ +static int hf_audio_switch_cmd; +static int hf_audio_phone_cmd; +static int hf_display_switch_cmd; +static int hf_display_phone_cmd; +static int hf_key_switch_cmd; +static int hf_key_phone_cmd; +static int hf_network_switch_cmd; +static int hf_network_phone_cmd; +static int hf_expansion_switch_cmd; +static int hf_expansion_phone_cmd; +static int hf_module_key_number; + +static int hf_generic_data; +static int hf_generic_string; + +static gint ett_unistim; + +static expert_field ei_unistim_len; static const value_string packet_names[]={ {0,"NAK"}, @@ -290,7 +292,7 @@ dissect_payload(proto_tree *overall_unistim_tree,tvbuff_t *tvb, gint offset, pac break; } - /* Handle UFTP seperately because it is significantly different + /* Handle UFTP separately because it is significantly different than standard UNISTIM */ while (tvb_reported_length_remaining(tvb, offset) > 0) offset = dissect_unistim_message(unistim_tree,pinfo,tvb,offset); @@ -2660,43 +2662,43 @@ proto_register_unistim(void){ }, { &hf_net_server_id, {"Download Server ID","unistim.download.id",FT_UINT8, - BASE_HEX, VALS(network_server_id),0x00,NULL,HFILL} + BASE_HEX, VALS(network_server_id),0x0,NULL,HFILL} }, { &hf_net_server_port, {"Download Server Port","unistim.download.port",FT_UINT16, - BASE_DEC, NULL,0x00,NULL,HFILL} + BASE_DEC, NULL,0x0,NULL,HFILL} }, { &hf_net_server_action, {"Download Server Action","unistim.download.action",FT_UINT8, - BASE_HEX, VALS(server_action),0x00,NULL,HFILL} + BASE_HEX, VALS(server_action),0x0,NULL,HFILL} }, { &hf_net_server_retry_count, {"Download Retry Count","unistim.download.retry",FT_UINT8, - BASE_DEC, NULL,0x00,NULL,HFILL} + BASE_DEC, NULL,0x0,NULL,HFILL} }, { &hf_net_server_failover_id, {"Download Failover Server ID","unistim.download.failover",FT_UINT8, - BASE_HEX, VALS(network_server_id),0x00,NULL,HFILL} + BASE_HEX, VALS(network_server_id),0x0,NULL,HFILL} }, { &hf_net_server_ip_address, {"Download Server Address","unistim.download.address",FT_IPv4, - BASE_NONE, NULL,0x00,NULL,HFILL} + BASE_NONE, NULL,0x0,NULL,HFILL} }, { &hf_net_server_time_out, {"Watchdog Timeout","unistim.watchdog.timeout",FT_UINT16, - BASE_DEC, NULL,0x00,NULL,HFILL} + BASE_DEC, NULL,0x0,NULL,HFILL} }, { &hf_net_server_config_element, {"Configure Network Element","unistim.config.element",FT_UINT8, - BASE_HEX, VALS(network_elements),0x00,NULL,HFILL} + BASE_HEX, VALS(network_elements),0x0,NULL,HFILL} }, { &hf_net_server_recovery_time_low, {"Recovery Procedure Idle Low Boundary","unistim.recovery.low",FT_UINT16, - BASE_DEC, NULL,0x00,NULL,HFILL} + BASE_DEC, NULL,0x0,NULL,HFILL} }, { &hf_net_server_recovery_time_high, {"Recovery Procedure Idle High Boundary","unistim.recovery.high",FT_UINT16, - BASE_DEC, NULL,0x00,NULL,HFILL} + BASE_DEC, NULL,0x0,NULL,HFILL} }, { &hf_net_phone_rx_ovr_flag, {"Receive Buffer Overflow","unistim.receive.overflow", @@ -2774,11 +2776,11 @@ proto_register_unistim(void){ }, { &hf_basic_switch_element_id, {"Basic Element ID","unistim.basic.element.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_basic_switch_eeprom_data, {"EEProm Data","unistim.basic.eeprom.data",FT_BYTES, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_basic_phone_eeprom_stat_cksum, {"Basic Phone EEProm Static Checksum","unistim.static.cksum",FT_UINT8, @@ -2786,19 +2788,19 @@ proto_register_unistim(void){ }, { &hf_basic_phone_eeprom_dynam, {"Basic Phone EEProm Dynamic Checksum","unistim.dynam.cksum",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_basic_phone_eeprom_net_config_cksum, {"Basic Phone EEProm Net Config Checksum","unistim.netconfig.cksum",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_basic_phone_hw_id, {"Basic Phone Hardware ID","unistim.basic.hw.id",FT_BYTES, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_basic_phone_fw_ver, {"Basic Phone Firmware Version","unistim.basic.fw.ver",FT_STRING, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_key_code, {"Key Name","unistim.key.name",FT_UINT8, @@ -2850,7 +2852,7 @@ proto_register_unistim(void){ }, { &hf_audio_default_rx_vol_id, {"Audio Manager Default Receive Volume ID","unistim.audio.volume.id",FT_UINT8, - BASE_HEX,VALS(default_rx_vol_id),0x00,NULL,HFILL} + BASE_HEX,VALS(default_rx_vol_id),0x0,NULL,HFILL} }, { &hf_audio_mgr_opt_max_vol, {"Audio Manager Enable Max Tone Volume","unistim.audio.max.tone",FT_BOOLEAN, @@ -2886,7 +2888,7 @@ proto_register_unistim(void){ }, { &hf_audio_mgr_stream_id, {"Audio Manager Stream ID","unistim.audio.stream.id",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_mgr_transducer_based_tone_id, {"Audio Manager Transducer Based Tone On","unistim.audio.transducer.on",FT_UINT8, @@ -2914,7 +2916,7 @@ proto_register_unistim(void){ }, { &hf_audio_special_tone, {"Special Tone Select","unistim.special.tone.select",FT_UINT8, - BASE_HEX,VALS(special_tones_vals),0x00,NULL,HFILL} + BASE_HEX,VALS(special_tones_vals),0x0,NULL,HFILL} }, { &hf_audio_tone_level, {"Tone Level","unistim.audio.tone.level",FT_UINT8, @@ -2938,63 +2940,63 @@ proto_register_unistim(void){ }, { &hf_audio_stream_id, {"Stream ID","unistim.audio.stream.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_audio_stream_based_volume, {"Stream Based Volume ID","unistim.stream.volume.id",FT_UINT8, - BASE_HEX,VALS(stream_base_vol_level),0x00,NULL,HFILL} + BASE_HEX,VALS(stream_base_vol_level),0x0,NULL,HFILL} }, { &hf_basic_switch_terminal_id, {"Terminal ID assigned by Switch","unistim.switch.terminal.id",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_basic_it_type, {"IT (Phone) Type","unistim.it.type",FT_UINT8, - BASE_HEX,VALS(it_types),0x00,NULL,HFILL} + BASE_HEX,VALS(it_types),0x0,NULL,HFILL} }, { &hf_basic_prod_eng_code, {"Product Engineering Code for phone","unistim.basic.eng.code",FT_STRING, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_net_phone_primary_server_id, {"Phone Primary Server ID","unistim.net.phone.primary.id",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_phone_server_port, {"Port Number","unistim.server.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_phone_server_action, {"Action","unistim.server.action.byte",FT_UINT8, - BASE_HEX,VALS(action_bytes),0x00,NULL,HFILL} + BASE_HEX,VALS(action_bytes),0x0,NULL,HFILL} }, { &hf_net_phone_server_retry_count, {"Number of times to Retry","unistim.server.retry.count",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_phone_server_failover_id, {"Failover Server ID","unistim.server.failover.id",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_phone_server_ip, {"IP address","unistim.server.ip.address",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_apb_number, {"APB Number","unistim.audio.apb.number",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { & hf_audio_apb_op_code, {"APB Operation Code","unistim.audio.apb.op.code",FT_UINT8, - BASE_HEX,VALS(apb_op_codes),0x00,NULL,HFILL} + BASE_HEX,VALS(apb_op_codes),0x0,NULL,HFILL} }, { &hf_audio_apb_param_len, {"APB Operation Parameter Length","unistim.apb.param.len",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_apb_data, {"APB Operation Data","unistim.apb.operation.data",FT_BYTES, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_display_write_address_numeric, {"Is Address Numeric","unistim.write.address.numeric",FT_BOOLEAN, @@ -3054,7 +3056,7 @@ proto_register_unistim(void){ }, { &hf_display_write_tag, {"Tag for text","unistim.display.text.tag",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_display_cursor_move_cmd, {"Cursor Movement Command","unistim.cursor.move.cmd",FT_UINT8, @@ -3066,7 +3068,7 @@ proto_register_unistim(void){ }, { &hf_audio_vocoder_id, {"Vocoder Protocol","unistim.vocoder.id",FT_UINT8, - BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL} + BASE_HEX,VALS(vocoder_ids),0x0,NULL,HFILL} }, { &hf_audio_vocoder_param, {"Vocoder Config Param","unistim.vocoder.config.param",FT_UINT8, @@ -3086,35 +3088,35 @@ proto_register_unistim(void){ }, { &hf_audio_sample_rate, {"Sample Rate","unistim.audio.sample.rate",FT_UINT8, - BASE_HEX,VALS(sample_rates),0x00,NULL,HFILL} + BASE_HEX,VALS(sample_rates),0x0,NULL,HFILL} }, { &hf_audio_rtp_type, {"RTP Type","unistim.audio.rtp.type",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_audio_bytes_per_frame, {"Bytes Per Frame","unistim.audio.bytes.per.frame",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_rx_stream_id, {"Receive Stream Id","unistim.rx.stream.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_audio_tx_stream_id, {"Transmit Stream Id","unistim.tx.stream.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_rx_vocoder_type, {"Receive Vocoder Protocol","unistim.vocoder.id",FT_UINT8, - BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL} + BASE_HEX,VALS(vocoder_ids),0x0,NULL,HFILL} }, { &hf_tx_vocoder_type, {"Transmit Vocoder Protocol","unistim.vocoder.id",FT_UINT8, - BASE_HEX,VALS(vocoder_ids),0x00,NULL,HFILL} + BASE_HEX,VALS(vocoder_ids),0x0,NULL,HFILL} }, { &hf_frames_per_packet, {"Frames Per Packet","unistim.vocoder.frames.per.packet",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_tos, {"Type of Service","unistim.audio.type.service",FT_UINT8, @@ -3130,31 +3132,31 @@ proto_register_unistim(void){ }, { &hf_audio_lcl_rtp_port, {"Phone RTP Port","unistim.local.rtp.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_lcl_rtcp_port, {"Phone RTCP Port","unistim.local.rtcp.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_far_rtp_port, {"Distant RTP Port","unistim.far.rtp.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_far_rtcp_port, {"Distant RTCP Port","unistim.far.rtcp.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_far_ip_add, {"Distant IP Address for RT[C]P","unistim.far.ip.address",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_rtcp_bucket_id, {"RTCP Bucket ID","unistim.rtcp.bucket.id",FT_UINT16, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_key_icon_id, {"Icon ID","unistim.key.icon.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_display_clear_numeric, {"Numeric Index Field in InfoBar","unistim.display.clear.numeric",FT_BOOLEAN, @@ -3302,7 +3304,7 @@ proto_register_unistim(void){ }, { &hf_basic_ether_address, {"Phone Ethernet Address","unistim.phone.ether",FT_ETHER, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_rtcp_bucket_id, {"RTCP Bucket ID","unistim.audio.rtcp.bucket.id",FT_UINT8, @@ -3314,7 +3316,7 @@ proto_register_unistim(void){ }, { &hf_display_arrow, {"Arrow Display Direction","unistim.arrow.direction",FT_UINT8, - BASE_HEX,VALS(arrow_dirs),0x00,NULL,HFILL} + BASE_HEX,VALS(arrow_dirs),0x0,NULL,HFILL} }, { &hf_audio_transducer_pair, {"Audio Transducer Pair","unistim.transducer.pairs",FT_UINT8, @@ -3333,7 +3335,7 @@ proto_register_unistim(void){ 8,NULL,AUDIO_SIDETONE_DISABLE,NULL,HFILL} }, { &hf_audio_destruct_additive, - {"Destructive/Additive","unistim.destructive.active",FT_BOOLEAN, + {"Destructive/Additive","unistim.destructive.additive",FT_BOOLEAN, 8,TFS(&destruct_additive),AUDIO_DESTRUCT_ADD,NULL,HFILL} }, { &hf_audio_dont_force_active, @@ -3398,7 +3400,7 @@ proto_register_unistim(void){ }, { &hf_display_contrast, {"Phone Contrast Level","unistim.phone.contrast.level",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_display_cursor_numeric, {"Numeric Index Field","unistim.field.numeric",FT_BOOLEAN, @@ -3430,11 +3432,11 @@ proto_register_unistim(void){ }, { &hf_display_hlight_start, {"Display Highlight Start Position","unistim.hilite.start.pos",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_display_hlight_end, {"Display Highlight End Position","unistim.hilite.end.pos",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_display_date_format, {"Date Format","unistim.display.date.format",FT_UINT8, @@ -3462,11 +3464,11 @@ proto_register_unistim(void){ }, { &hf_display_char_address, {"Display Character Address","unistim.display.char.address",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_display_layer_number, {"Softkey Layer Number","unistim.softkey.layer.num",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_display_layer_skey_id, {"Softkey ID","unistim.layer.softkey.id",FT_UINT8, @@ -3482,7 +3484,7 @@ proto_register_unistim(void){ }, { &hf_display_layer_duration, {"Display Duration (20ms steps)","unistim.layer.display.duration",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_key_programmable_keys, {"Number of Programmable Keys","unistim.num.prog.keys",FT_UINT8, @@ -3550,39 +3552,39 @@ proto_register_unistim(void){ }, { &hf_audio_desired_jitter, {"Desired Jitter","unistim.audio.desired.jitter",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_high_water_mark, {"Threshold of audio frames where jitter buffer removes frames","unistim.high.water.mark",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_early_packet_resync_thresh, {"Threshold in x/8000 sec where packets are too early","unistim.early.packet.thresh",FT_UINT32, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_late_packet_resync_thresh, {"Threshold in x/8000 sec where packets are too late","unistim.late.packet.thresh",FT_UINT32, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_resolve_phone_port, {"Resolve Phone Port","unistim.resolve.phone.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_far_end_echo_port, {"Resolve Far End Port","unistim.resolve.far.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_far_end_ip_address, {"Resolve Far End IP","unistim.resolve.far.ip",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_nat_port, {"NAT Port","unistim.audio.nat.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_nat_ip_address, {"NAT IP Address","unistim.audio.nat.ip",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_direction_code, {"Stream Direction Code","unistim.audio.direction.codes",FT_UINT8, @@ -3639,11 +3641,11 @@ proto_register_unistim(void){ }, { &hf_audio_current_rx_level, {"Current RX Volume Level","unistim.current.rx.vol.level",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_current_rx_range, {"Current RX Volume Range","unistim.current.rx.vol.range",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_cadence_select, {"Alerting Cadence Select","unistim.alert.cad.sel",FT_UINT8, @@ -3655,7 +3657,7 @@ proto_register_unistim(void){ }, { &hf_audio_open_stream_rpt, {"Open Stream Report","unistim.open.audio.stream.rpt",FT_UINT8, - BASE_HEX,VALS(stream_result),0x00,NULL,HFILL} + BASE_HEX,VALS(stream_result),0x0,NULL,HFILL} }, { &hf_audio_sdes_rpt_source_desc, {"Report Source Description","unistim.rpt.src.desc",FT_UINT8, @@ -3667,27 +3669,27 @@ proto_register_unistim(void){ }, { &hf_audio_phone_port, {"Phone Listen Port","unistim.phone.listen.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_phone_ip, {"Phone Listen Address","unistim.phone.listen.address",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_phone_add_len, {"Phone Address Length","unistim.phone.address.len",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_nat_listen_port, {"NAT Listen Port","unistim.nat.listen.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_nat_ip, {"NAT Listen Address","unistim.nat.listen.address",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_audio_nat_add_len, {"NAT Address Length","unistim.nat.address.len",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_audio_stream_direction_code, {"Audio Stream Direction","unistim.audio.stream.direction",FT_UINT8, @@ -3699,7 +3701,7 @@ proto_register_unistim(void){ }, { &hf_audio_transducer_list_length, {"Transducer List Length","unistim.trans.list.len",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_file_xfer_mode, {"File Transfer Mode","unistim.net.file.xfer.mode",FT_UINT8, @@ -3719,23 +3721,23 @@ proto_register_unistim(void){ }, { &hf_net_file_server_port, {"File Server Port","unistim.net.file.server.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_full_pathname, {"Full Pathname","unistim.net.full_pathname",FT_STRINGZ, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_net_file_identifier, {"File Identifier","unistim.net.file_identifier",FT_STRINGZ, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_net_local_port, {"Local XFer Port","unistim.net.local.xfer.port",FT_UINT16, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_net_file_server_address, {"File Server IP Address","unistim.net.file.server.address",FT_IPv4, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_keys_admin_command, {"Admin Command","unistim.key.icon.admin.cmd",FT_UINT8, @@ -3743,35 +3745,35 @@ proto_register_unistim(void){ }, { &hf_keys_logical_icon_id, {"Logical Icon ID","unistim.keys.logical.icon.id",FT_UINT16, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_keys_repeat_timer_one, {"Key Repeat Timer 1 Value","unistim.keys.repeat.time.one",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_keys_repeat_timer_two, {"Key Repeat Timer 2 Value","unistim.keys.repeat.time.two",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_keys_led_id, {"Led ID","unistim.keys.led.id",FT_UINT8, - BASE_HEX,VALS(keys_led_ids),0x00,NULL,HFILL} + BASE_HEX,VALS(keys_led_ids),0x0,NULL,HFILL} }, { &hf_keys_phone_icon_id, {"Phone Icon ID","unistim.keys.phone.icon.id",FT_UINT8, - BASE_HEX,NULL,0x00,NULL,HFILL} + BASE_HEX,NULL,0x0,NULL,HFILL} }, { &hf_keys_cadence_on_time, {"Indicator Cadence On Time","unistim.keys.cadence.on.time",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_keys_cadence_off_time, {"Indicator Cadence Off Time","unistim.keys.cadence.off.time",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_keys_user_activity_timeout, {"User Activity Timeout Value","unistim.keys.user.timeout.value",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, { &hf_display_call_timer_mode, {"Call Timer Mode","unistim.display.call.timer.mode",FT_BOOLEAN, @@ -3807,18 +3809,18 @@ proto_register_unistim(void){ }, { &hf_expansion_softlabel_number, {"Module Soft Label Number","unistim.expansion.label.number",FT_UINT8, - BASE_DEC,NULL,0x00,NULL,HFILL} + BASE_DEC,NULL,0x0,NULL,HFILL} }, /****LAST****/ { &hf_generic_string, {"DATA","unistim.generic.string_data",FT_STRING, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} }, { &hf_generic_data, {"DATA","unistim.generic.data",FT_BYTES, - BASE_NONE,NULL,0x00,NULL,HFILL} + BASE_NONE,NULL,0x0,NULL,HFILL} } }; @@ -3835,6 +3837,7 @@ proto_register_unistim(void){ expert_module_t* expert_unistim; proto_unistim=proto_register_protocol("UNISTIM Protocol", "UNISTIM", "unistim"); + unistim_handle=register_dissector("unistim", dissect_unistim,proto_unistim); proto_register_subtree_array(ett,array_length(ett)); proto_register_field_array(proto_unistim,hf,array_length(hf)); @@ -3846,10 +3849,6 @@ proto_register_unistim(void){ void proto_reg_handoff_unistim(void) { - - dissector_handle_t unistim_handle; - - unistim_handle=create_dissector_handle(dissect_unistim,proto_unistim); dissector_add_for_decode_as_with_preference("udp.port", unistim_handle); } diff --git a/plugins/epan/unistim/uftp.h b/plugins/epan/unistim/uftp.h index 865f23b5e9..c6d9fa7acb 100644 --- a/plugins/epan/unistim/uftp.h +++ b/plugins/epan/unistim/uftp.h @@ -13,11 +13,11 @@ #ifndef UNISTIM_UFTP_H #define UNISTIM_UFTP_H -static int hf_uftp_datablock_size=-1; -static int hf_uftp_datablock_limit=-1; -static int hf_uftp_filename=-1; -static int hf_uftp_datablock=-1; -static int hf_uftp_command=-1; +static int hf_uftp_datablock_size; +static int hf_uftp_datablock_limit; +static int hf_uftp_filename; +static int hf_uftp_datablock; +static int hf_uftp_command; static const value_string uftp_commands[]={ {0x00,"Connection Granted"}, diff --git a/plugins/epan/wimax/CMakeLists.txt b/plugins/epan/wimax/CMakeLists.txt index 449805ec90..15fee28525 100644 --- a/plugins/epan/wimax/CMakeLists.txt +++ b/plugins/epan/wimax/CMakeLists.txt @@ -75,11 +75,12 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "WiMax Protocol dissector" ${DISSECTOR_SRC} ${DISSECTOR_SUPPORT_SRC} ) -add_plugin_library(wimax epan) +add_wireshark_epan_plugin_library(wimax) target_link_libraries(wimax epan) diff --git a/plugins/epan/wimax/mac_hd_generic_decoder.c b/plugins/epan/wimax/mac_hd_generic_decoder.c index d083103a60..6bf8bf6fa5 100644 --- a/plugins/epan/wimax/mac_hd_generic_decoder.c +++ b/plugins/epan/wimax/mac_hd_generic_decoder.c @@ -75,20 +75,20 @@ static gint arq_feedback_payload_decoder(tvbuff_t *tvb, packet_info *pinfo, prot /* Static variables */ static reassembly_table payload_reassembly_table; -gint proto_mac_header_generic_decoder = -1; -static gint ett_mac_header_generic_decoder = -1; -/* static gint ett_mac_subheader_decoder = -1; */ -static gint ett_mac_mesh_subheader_decoder = -1; -static gint ett_mac_frag_subheader_decoder = -1; -static gint ett_mac_grant_mgmt_subheader_decoder = -1; -static gint ett_mac_pkt_subheader_decoder = -1; -static gint ett_mac_fast_fb_subheader_decoder = -1; -static gint ett_mac_ext_subheader_decoder = -1; -static gint ett_mac_ext_subheader_dl_decoder = -1; -static gint ett_mac_ext_subheader_ul_decoder = -1; -static gint ett_mac_arq_fb_payload_decoder = -1; -static gint ett_mac_data_pdu_decoder = -1; -static gint hf_mac_header_generic_value_bytes = -1; +gint proto_mac_header_generic_decoder; +static gint ett_mac_header_generic_decoder; +/* static gint ett_mac_subheader_decoder; */ +static gint ett_mac_mesh_subheader_decoder; +static gint ett_mac_frag_subheader_decoder; +static gint ett_mac_grant_mgmt_subheader_decoder; +static gint ett_mac_pkt_subheader_decoder; +static gint ett_mac_fast_fb_subheader_decoder; +static gint ett_mac_ext_subheader_decoder; +static gint ett_mac_ext_subheader_dl_decoder; +static gint ett_mac_ext_subheader_ul_decoder; +static gint ett_mac_arq_fb_payload_decoder; +static gint ett_mac_data_pdu_decoder; +static gint hf_mac_header_generic_value_bytes; static guint frag_type, frag_len; static guint extended_type, arq_fb_payload, seq_number; @@ -142,23 +142,23 @@ static address save_dst; #define WIMAX_MAC_HEADER_GENERIC_EKS_MASK 0x30 #define WIMAX_MAC_HEADER_GENERIC_LEN_MASK 0x07 -static int hf_mac_header_generic_ht = -1; -static int hf_mac_header_generic_ec = -1; -static int hf_mac_header_generic_type_0 = -1; -static int hf_mac_header_generic_type_1 = -1; -static int hf_mac_header_generic_type_2 = -1; -static int hf_mac_header_generic_type_3 = -1; -static int hf_mac_header_generic_type_4 = -1; -static int hf_mac_header_generic_type_5 = -1; -static int hf_mac_header_generic_esf = -1; -static int hf_mac_header_generic_ci = -1; -static int hf_mac_header_generic_eks = -1; -static int hf_mac_header_generic_rsv = -1; -static int hf_mac_header_generic_len = -1; -static int hf_mac_header_generic_cid = -1; -static int hf_mac_header_generic_hcs = -1; -static int hf_mac_header_generic_crc = -1; -static int hf_mac_header_generic_crc_status = -1; +static int hf_mac_header_generic_ht; +static int hf_mac_header_generic_ec; +static int hf_mac_header_generic_type_0; +static int hf_mac_header_generic_type_1; +static int hf_mac_header_generic_type_2; +static int hf_mac_header_generic_type_3; +static int hf_mac_header_generic_type_4; +static int hf_mac_header_generic_type_5; +static int hf_mac_header_generic_esf; +static int hf_mac_header_generic_ci; +static int hf_mac_header_generic_eks; +static int hf_mac_header_generic_rsv; +static int hf_mac_header_generic_len; +static int hf_mac_header_generic_cid; +static int hf_mac_header_generic_hcs; +static int hf_mac_header_generic_crc; +static int hf_mac_header_generic_crc_status; /* MAC Header types */ static const value_string ht_msgs[] = @@ -369,21 +369,21 @@ static const value_string fb_types[] = }; /* common fields */ -static gint hf_mac_header_generic_ext_subheader_rsv = -1; +static gint hf_mac_header_generic_ext_subheader_rsv; /* DL sub-header */ -static gint hf_mac_header_generic_ext_subheader_type_dl = -1; -static gint hf_mac_header_generic_ext_subheader_sdu_sn = -1; -static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_pscid = -1; -static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_op = -1; -static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswe = -1; -static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswb = -1; -static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_rsv = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_uiuc = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_fb_type = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_ofdma_symbol_offset = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_subchannel_offset = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_slots = -1; -static gint hf_mac_header_generic_ext_subheader_fb_req_frame_offset = -1; +static gint hf_mac_header_generic_ext_subheader_type_dl; +static gint hf_mac_header_generic_ext_subheader_sdu_sn; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_pscid; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_op; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswe; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_fswb; +static gint hf_mac_header_generic_ext_subheader_dl_sleep_control_rsv; +static gint hf_mac_header_generic_ext_subheader_fb_req_uiuc; +static gint hf_mac_header_generic_ext_subheader_fb_req_fb_type; +static gint hf_mac_header_generic_ext_subheader_fb_req_ofdma_symbol_offset; +static gint hf_mac_header_generic_ext_subheader_fb_req_subchannel_offset; +static gint hf_mac_header_generic_ext_subheader_fb_req_slots; +static gint hf_mac_header_generic_ext_subheader_fb_req_frame_offset; /* DL Sleep Control Operations */ static const value_string dl_sleep_control_ops[] = @@ -394,24 +394,24 @@ static const value_string dl_sleep_control_ops[] = }; /* UL sub-header */ -static gint hf_mac_header_generic_ext_subheader_type_ul = -1; -static gint hf_mac_header_generic_ext_subheader_mimo_mode_fb_type = -1; -static gint hf_mac_header_generic_ext_subheader_mimo_fb_content = -1; -static gint hf_mac_header_generic_ext_subheader_ul_tx_pwr_rep = -1; -static gint hf_mac_header_generic_ext_subheader_mini_fb_type = -1; -static gint hf_mac_header_generic_ext_subheader_mini_fb_content = -1; +static gint hf_mac_header_generic_ext_subheader_type_ul; +static gint hf_mac_header_generic_ext_subheader_mimo_mode_fb_type; +static gint hf_mac_header_generic_ext_subheader_mimo_fb_content; +static gint hf_mac_header_generic_ext_subheader_ul_tx_pwr_rep; +static gint hf_mac_header_generic_ext_subheader_mini_fb_type; +static gint hf_mac_header_generic_ext_subheader_mini_fb_content; /* common fields */ -static gint hf_mac_header_generic_ext_subheader_pdu_sn_short = -1; -static gint hf_mac_header_generic_ext_subheader_pdu_sn_long = -1; +static gint hf_mac_header_generic_ext_subheader_pdu_sn_short; +static gint hf_mac_header_generic_ext_subheader_pdu_sn_long; /* SN Request subheader */ #define SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_1_MASK 0x01 #define SN_REQUEST_SUBHEADER_SN_REPORT_INDICATION_2_MASK 0x02 #define SN_REQUEST_SUBHEADER_RESERVED_MASK 0xFC -static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_1 = -1; -static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_2 = -1; -static gint hf_mac_header_generic_ext_subheader_sn_req_rsv = -1; +static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_1; +static gint hf_mac_header_generic_ext_subheader_sn_req_rep_ind_2; +static gint hf_mac_header_generic_ext_subheader_sn_req_rsv; /* SN Report Indication message */ static const value_string sn_rep_msg[] = { @@ -421,7 +421,7 @@ static const value_string sn_rep_msg[] = }; /* Mesh Subheader */ -static gint hf_mac_header_generic_mesh_subheader = -1; +static gint hf_mac_header_generic_mesh_subheader; /* Fragmentation Subheader (table 8) */ #define FRAGMENTATION_SUBHEADER_FC_MASK 0xC000 /*0x0003*/ @@ -438,13 +438,13 @@ static gint hf_mac_header_generic_mesh_subheader = -1; #define FIRST_FRAG 2 #define MIDDLE_FRAG 3 -static gint hf_mac_header_generic_frag_subhd_fc = -1; -static gint hf_mac_header_generic_frag_subhd_fc_ext = -1; -static gint hf_mac_header_generic_frag_subhd_bsn = -1; -static gint hf_mac_header_generic_frag_subhd_fsn = -1; -static gint hf_mac_header_generic_frag_subhd_fsn_ext = -1; -static gint hf_mac_header_generic_frag_subhd_rsv = -1; -static gint hf_mac_header_generic_frag_subhd_rsv_ext = -1; +static gint hf_mac_header_generic_frag_subhd_fc; +static gint hf_mac_header_generic_frag_subhd_fc_ext; +static gint hf_mac_header_generic_frag_subhd_bsn; +static gint hf_mac_header_generic_frag_subhd_fsn; +static gint hf_mac_header_generic_frag_subhd_fsn_ext; +static gint hf_mac_header_generic_frag_subhd_rsv; +static gint hf_mac_header_generic_frag_subhd_rsv_ext; /* Fragment Types */ static const value_string frag_types[] = @@ -465,20 +465,20 @@ static const value_string frag_types[] = #define FRAG_LENGTH_MASK 0x0007FF00 -static gint hf_mac_header_generic_packing_subhd_fc = -1; -static gint hf_mac_header_generic_packing_subhd_fc_ext = -1; -static gint hf_mac_header_generic_packing_subhd_bsn = -1; -static gint hf_mac_header_generic_packing_subhd_fsn = -1; -static gint hf_mac_header_generic_packing_subhd_fsn_ext = -1; -static gint hf_mac_header_generic_packing_subhd_len = -1; -static gint hf_mac_header_generic_packing_subhd_len_ext = -1; +static gint hf_mac_header_generic_packing_subhd_fc; +static gint hf_mac_header_generic_packing_subhd_fc_ext; +static gint hf_mac_header_generic_packing_subhd_bsn; +static gint hf_mac_header_generic_packing_subhd_fsn; +static gint hf_mac_header_generic_packing_subhd_fsn_ext; +static gint hf_mac_header_generic_packing_subhd_len; +static gint hf_mac_header_generic_packing_subhd_len_ext; /* Fast-feedback Allocation Subheader (table 13) */ #define FAST_FEEDBACK_ALLOCATION_OFFSET_MASK 0xFC /*0x3F*/ #define FAST_FEEDBACK_FEEDBACK_TYPE_MASK 0x03 /*0xC0*/ -static gint hf_mac_header_generic_fast_fb_subhd_alloc_offset = -1; -static gint hf_mac_header_generic_fast_fb_subhd_fb_type = -1; +static gint hf_mac_header_generic_fast_fb_subhd_alloc_offset; +static gint hf_mac_header_generic_fast_fb_subhd_fb_type; /* Grant Management Subheader (table 9 & 10) */ #define GRANT_MGMT_SUBHEADER_UGS_SI_MASK 0x8000 /*0x0001*/ @@ -501,18 +501,18 @@ typedef enum SCHEDULE_SERVICE_TYPE_UGS } SCHEDULE_SERVICE_TYPE_e; -static gint hf_mac_header_generic_grant_mgmt_ugs_tree = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_si = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_pm = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fli = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fl = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_rsv = -1; -static gint hf_mac_header_generic_grant_mgmt_ext_rtps_tree = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ext_pbr = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fli = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fl = -1; -static gint hf_mac_header_generic_grant_mgmt_ext_pbr_tree = -1; -static gint hf_mac_header_generic_grant_mgmt_subhd_pbr = -1; +static gint hf_mac_header_generic_grant_mgmt_ugs_tree; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_si; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_pm; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fli; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_fl; +static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_rsv; +static gint hf_mac_header_generic_grant_mgmt_ext_rtps_tree; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_pbr; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fli; +static gint hf_mac_header_generic_grant_mgmt_subhd_ext_fl; +static gint hf_mac_header_generic_grant_mgmt_ext_pbr_tree; +static gint hf_mac_header_generic_grant_mgmt_subhd_pbr; /* Slip Indicators */ static const value_string si_msgs[] = @@ -555,27 +555,27 @@ static const value_string fli_msgs[] = #define ARQ_FB_IE_SEQ2_LENGTH_6_MASK 0x007E /*0x7E00*/ #define ARQ_FB_IE_RSV_MASK 0x0001 /*0x8000*/ -static gint hf_mac_header_generic_arq_fb_ie_cid = -1; -static gint hf_mac_header_generic_arq_fb_ie_last = -1; -static gint hf_mac_header_generic_arq_fb_ie_ack_type = -1; -static gint hf_mac_header_generic_arq_fb_ie_bsn = -1; -static gint hf_mac_header_generic_arq_fb_ie_num_maps = -1; -static gint hf_ack_type_reserved = -1; -static gint hf_mac_header_generic_arq_fb_ie_sel_ack_map = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq_format = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq1_length = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq2_length = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq3_length = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map_2 = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq1_length_6 = -1; -static gint hf_mac_header_generic_arq_fb_ie_seq2_length_6 = -1; -static gint hf_mac_header_generic_arq_fb_ie_rsv = -1; -static gint hf_mac_header_payload_fragment = -1; - -static expert_field ei_mac_crc_malformed = EI_INIT; -static expert_field ei_mac_crc_missing = EI_INIT; -static expert_field ei_mac_header_generic_crc = EI_INIT; +static gint hf_mac_header_generic_arq_fb_ie_cid; +static gint hf_mac_header_generic_arq_fb_ie_last; +static gint hf_mac_header_generic_arq_fb_ie_ack_type; +static gint hf_mac_header_generic_arq_fb_ie_bsn; +static gint hf_mac_header_generic_arq_fb_ie_num_maps; +static gint hf_ack_type_reserved; +static gint hf_mac_header_generic_arq_fb_ie_sel_ack_map; +static gint hf_mac_header_generic_arq_fb_ie_seq_format; +static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map; +static gint hf_mac_header_generic_arq_fb_ie_seq1_length; +static gint hf_mac_header_generic_arq_fb_ie_seq2_length; +static gint hf_mac_header_generic_arq_fb_ie_seq3_length; +static gint hf_mac_header_generic_arq_fb_ie_seq_ack_map_2; +static gint hf_mac_header_generic_arq_fb_ie_seq1_length_6; +static gint hf_mac_header_generic_arq_fb_ie_seq2_length_6; +static gint hf_mac_header_generic_arq_fb_ie_rsv; +static gint hf_mac_header_payload_fragment; + +static expert_field ei_mac_crc_malformed; +static expert_field ei_mac_crc_missing; +static expert_field ei_mac_header_generic_crc; /* Last IE Indicators */ static const value_string last_ie_msgs[] = diff --git a/plugins/epan/wimax/mac_hd_type1_decoder.c b/plugins/epan/wimax/mac_hd_type1_decoder.c index 6713e920d7..128be653b6 100644 --- a/plugins/epan/wimax/mac_hd_type1_decoder.c +++ b/plugins/epan/wimax/mac_hd_type1_decoder.c @@ -30,9 +30,9 @@ extern gint proto_mac_header_generic_decoder; -static gint proto_mac_header_type_1_decoder = -1; -static gint ett_mac_header_type_1_decoder = -1; -static gint hf_mac_header_type_1_value_bytes = -1; +static gint proto_mac_header_type_1_decoder; +static gint ett_mac_header_type_1_decoder; +static gint hf_mac_header_type_1_value_bytes; #define WIMAX_MAC_HEADER_SIZE 6 @@ -64,7 +64,7 @@ static const char *type1_subtype_abbrv[TYPE_I_SUBTYPE_MAX] = #define WIMAX_MAC_HEADER_TYPE_1_SUB_TYPE_MASK 0x38 -/* WIMAX MAC HEADER TYPE I FILEDS */ +/* WIMAX MAC HEADER TYPE I FIELDS */ /* 1st to 3rd bytes */ /* Common Fields */ #define WIMAX_MAC_HEADER_TYPE_1_HT 0x800000 @@ -106,40 +106,40 @@ static const char *type1_subtype_abbrv[TYPE_I_SUBTYPE_MAX] = *#define WIMAX_MAC_HEADER_TYPE_1_HCS 0xFF */ /* Common Fields */ -static int hf_mac_header_type_1_ht = -1; -static int hf_mac_header_type_1_ec = -1; -static int hf_mac_header_type_1_type = -1; +static int hf_mac_header_type_1_ht; +static int hf_mac_header_type_1_ec; +static int hf_mac_header_type_1_type; /* type 0 & type 1 only */ -static int hf_mac_header_type_1_br = -1; +static int hf_mac_header_type_1_br; /* type 3, type 4, & type 5 only */ -static int hf_mac_header_type_1_br_3 = -1; +static int hf_mac_header_type_1_br_3; /* type 2 only */ -static int hf_mac_header_type_1_diuc = -1; -static int hf_mac_header_type_1_ultxpwr = -1; -static int hf_mac_header_type_1_ulhdrm = -1; -static int hf_mac_header_type_1_rsv_2 = -1; +static int hf_mac_header_type_1_diuc; +static int hf_mac_header_type_1_ultxpwr; +static int hf_mac_header_type_1_ulhdrm; +static int hf_mac_header_type_1_rsv_2; /* type 3 only */ -static int hf_mac_header_type_1_ultxpwr_3 = -1; +static int hf_mac_header_type_1_ultxpwr_3; /* type 4 only */ -static int hf_mac_header_type_1_cinr = -1; -static int hf_mac_header_type_1_dci = -1; +static int hf_mac_header_type_1_cinr; +static int hf_mac_header_type_1_dci; /* type 5 only */ -static int hf_mac_header_type_1_pscid = -1; -static int hf_mac_header_type_1_op = -1; -static int hf_mac_header_type_1_rsv_5 = -1; +static int hf_mac_header_type_1_pscid; +static int hf_mac_header_type_1_op; +static int hf_mac_header_type_1_rsv_5; /* type 6 only */ -static int hf_mac_header_type_1_last = -1; -static int hf_mac_header_type_1_sdu_sn1 = -1; -static int hf_mac_header_type_1_sdu_sn2 = -1; -static int hf_mac_header_type_1_sdu_sn3 = -1; +static int hf_mac_header_type_1_last; +static int hf_mac_header_type_1_sdu_sn1; +static int hf_mac_header_type_1_sdu_sn2; +static int hf_mac_header_type_1_sdu_sn3; /* type 7 only */ -static int hf_mac_header_type_1_fb_type = -1; -static int hf_mac_header_type_1_fbssi = -1; -static int hf_mac_header_type_1_period = -1; -static int hf_mac_header_type_1_rsv_7 = -1; +static int hf_mac_header_type_1_fb_type; +static int hf_mac_header_type_1_fbssi; +static int hf_mac_header_type_1_period; +static int hf_mac_header_type_1_rsv_7; /* Common Fields */ -static int hf_mac_header_type_1_cid = -1; -static int hf_mac_header_type_1_hcs = -1; +static int hf_mac_header_type_1_cid; +static int hf_mac_header_type_1_hcs; /* MAC Header Type I Sub-Types */ static const value_string sub_types[] = @@ -260,7 +260,7 @@ static int dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(ti_tree, hf_mac_header_type_1_ultxpwr, tvb, offset, 3, ENC_BIG_ENDIAN); /* Decode and display the UL Headroom */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_ulhdrm, tvb, offset, 3, ENC_BIG_ENDIAN); - /* Decode and display the reserved filed */ + /* Decode and display the reserved field */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_2, tvb, offset, 3, ENC_BIG_ENDIAN); break; case BR_WITH_UL_TX_POWER_REPORT: @@ -284,7 +284,7 @@ static int dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(ti_tree, hf_mac_header_type_1_pscid, tvb, offset, 3, ENC_BIG_ENDIAN); /* Decode and display the Operation */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_op, tvb, offset, 3, ENC_BIG_ENDIAN); - /* Decode and display the reserved filed */ + /* Decode and display the reserved field */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_5, tvb, offset, 3, ENC_BIG_ENDIAN); break; case SN_REPORT: @@ -302,9 +302,9 @@ static int dissect_mac_header_type_1_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(ti_tree, hf_mac_header_type_1_fb_type, tvb, offset, 3, ENC_BIG_ENDIAN); /* Decode and display the FBSSI */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_fbssi, tvb, offset, 3, ENC_BIG_ENDIAN); - /* Decode and display the Prreferred-period */ + /* Decode and display the Preferred-period */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_period, tvb, offset, 3, ENC_BIG_ENDIAN); - /* Decode and display the reserved filed */ + /* Decode and display the reserved field */ proto_tree_add_item(ti_tree, hf_mac_header_type_1_rsv_7, tvb, offset, 3, ENC_BIG_ENDIAN); break; } diff --git a/plugins/epan/wimax/mac_hd_type2_decoder.c b/plugins/epan/wimax/mac_hd_type2_decoder.c index 466b4b2024..8f241d986c 100644 --- a/plugins/epan/wimax/mac_hd_type2_decoder.c +++ b/plugins/epan/wimax/mac_hd_type2_decoder.c @@ -30,9 +30,9 @@ extern gint proto_mac_header_generic_decoder; -static gint proto_mac_header_type_2_decoder = -1; -static gint ett_mac_header_type_2_decoder = -1; -static gint hf_mac_header_type_2_value_bytes = -1; +static gint proto_mac_header_type_2_decoder; +static gint ett_mac_header_type_2_decoder; +static gint hf_mac_header_type_2_value_bytes; #define WIMAX_MAC_HEADER_SIZE 6 @@ -81,23 +81,23 @@ static const char *type2_fb_type_abbrv[TYPE_II_FB_TYPE_MAX] = #define WIMAX_MAC_HEADER_TYPE_2_TYPE 0x20 #define WIMAX_MAC_HEADER_TYPE_2_CII 0x10 #define WIMAX_MAC_HEADER_TYPE_2_FB_TYPE 0x0F -static int hf_mac_header_type_2_ht = -1; -static int hf_mac_header_type_2_ec = -1; -static int hf_mac_header_type_2_type = -1; -static int hf_mac_header_type_2_cii = -1; -static int hf_mac_header_type_2_fb_type = -1; +static int hf_mac_header_type_2_ht; +static int hf_mac_header_type_2_ec; +static int hf_mac_header_type_2_type; +static int hf_mac_header_type_2_cii; +static int hf_mac_header_type_2_fb_type; /* 2nd to 5th bytes (varies by different fb types) */ -static int hf_mac_header_type_2_cid = -1; -static int hf_mac_header_type_2_no_cid = -1; +static int hf_mac_header_type_2_cid; +static int hf_mac_header_type_2_no_cid; /* CQI and MIMO Feedback */ /* 2nd & 3rd bytes */ #define WIMAX_MAC_HEADER_TYPE_2_CQI_FB_TYPE 0xE000 #define WIMAX_MAC_HEADER_TYPE_2_CQI_PAYLOAD 0x1F80 #define WIMAX_MAC_HEADER_TYPE_2_CQI_RSV 0x007F -static int hf_mac_header_type_2_cqi_fb_type = -1; -static int hf_mac_header_type_2_cqi_payload = -1; -static int hf_mac_header_type_2_cqi_rsv = -1; +static int hf_mac_header_type_2_cqi_fb_type; +static int hf_mac_header_type_2_cqi_payload; +static int hf_mac_header_type_2_cqi_rsv; /* 4th & 5th without CID */ /*#define WIMAX_MAC_HEADER_TYPE_2_NO_CID 0xFFFF*/ @@ -105,8 +105,8 @@ static int hf_mac_header_type_2_cqi_rsv = -1; /* 2nd byte */ #define WIMAX_MAC_HEADER_TYPE_2_DL_AVE_CINR 0xF800 #define WIMAX_MAC_HEADER_TYPE_2_DL_AVE_RSV 0x07FF -static int hf_mac_header_type_2_dl_ave_cinr = -1; -static int hf_mac_header_type_2_dl_ave_rsv = -1; +static int hf_mac_header_type_2_dl_ave_cinr; +static int hf_mac_header_type_2_dl_ave_rsv; /* MIMO Coefficients Feedback */ /* 2nd & 3rd bytes */ @@ -114,26 +114,26 @@ static int hf_mac_header_type_2_dl_ave_rsv = -1; #define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_AI 0x3000 #define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF 0x0F80 #define WIMAX_MAC_HEADER_TYPE_2_MIMO_COEF_RSV 0x007F -static int hf_mac_header_type_2_mimo_coef_ni = -1; -static int hf_mac_header_type_2_mimo_coef_ai = -1; -static int hf_mac_header_type_2_mimo_coef = -1; -static int hf_mac_header_type_2_mimo_coef_rsv = -1; +static int hf_mac_header_type_2_mimo_coef_ni; +static int hf_mac_header_type_2_mimo_coef_ai; +static int hf_mac_header_type_2_mimo_coef; +static int hf_mac_header_type_2_mimo_coef_rsv; /* Preferred DL Channel DIUC Feedback */ /* 2nd byte */ #define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DIUC 0xF000 #define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_DCD 0x0F00 #define WIMAX_MAC_HEADER_TYPE_2_DL_CHAN_RSV 0x00FF -static int hf_mac_header_type_2_dl_chan_diuc = -1; -static int hf_mac_header_type_2_dl_chan_dcd = -1; -static int hf_mac_header_type_2_dl_chan_rsv = -1; +static int hf_mac_header_type_2_dl_chan_diuc; +static int hf_mac_header_type_2_dl_chan_dcd; +static int hf_mac_header_type_2_dl_chan_rsv; /* UL Transmission Power */ /* 2nd byte */ #define WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR 0xFF00 #define WIMAX_MAC_HEADER_TYPE_2_UL_TX_PWR_RSV 0x00FF -static int hf_mac_header_type_2_ul_tx_pwr = -1; -static int hf_mac_header_type_2_ul_tx_pwr_rsv = -1; +static int hf_mac_header_type_2_ul_tx_pwr; +static int hf_mac_header_type_2_ul_tx_pwr_rsv; /* PHY Channel Feedback */ /* 2nd to 4th bytes */ @@ -141,10 +141,10 @@ static int hf_mac_header_type_2_ul_tx_pwr_rsv = -1; #define WIMAX_MAC_HEADER_TYPE_2_PHY_UL_TX_PWR 0x0FF000 #define WIMAX_MAC_HEADER_TYPE_2_PHY_UL_HDRM 0x000FC0 #define WIMAX_MAC_HEADER_TYPE_2_PHY_RSV 0x00003F -static int hf_mac_header_type_2_phy_diuc = -1; -static int hf_mac_header_type_2_phy_ul_tx_pwr = -1; -static int hf_mac_header_type_2_phy_ul_hdrm = -1; -static int hf_mac_header_type_2_phy_rsv = -1; +static int hf_mac_header_type_2_phy_diuc; +static int hf_mac_header_type_2_phy_ul_tx_pwr; +static int hf_mac_header_type_2_phy_ul_hdrm; +static int hf_mac_header_type_2_phy_rsv; /* AMC Band Indication Bitmap */ /* 2nd to 5th bytes */ @@ -153,27 +153,27 @@ static int hf_mac_header_type_2_phy_rsv = -1; #define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_2 0x00007C00 #define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_3 0x000003E0 #define WIMAX_MAC_HEADER_TYPE_2_AMC_CQI_4 0x0000001F -static int hf_mac_header_type_2_amc_bitmap = -1; -static int hf_mac_header_type_2_amc_cqi_1 = -1; -static int hf_mac_header_type_2_amc_cqi_2 = -1; -static int hf_mac_header_type_2_amc_cqi_3 = -1; -static int hf_mac_header_type_2_amc_cqi_4 = -1; +static int hf_mac_header_type_2_amc_bitmap; +static int hf_mac_header_type_2_amc_cqi_1; +static int hf_mac_header_type_2_amc_cqi_2; +static int hf_mac_header_type_2_amc_cqi_3; +static int hf_mac_header_type_2_amc_cqi_4; /* Life Span of Short-term Precoding Feedback */ /* 2nd byte */ #define WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN 0xF000 #define WIMAX_MAC_HEADER_TYPE_2_LIFE_SPAN_RSV 0x0FFF -static int hf_mac_header_type_2_life_span = -1; -static int hf_mac_header_type_2_life_span_rsv = -1; +static int hf_mac_header_type_2_life_span; +static int hf_mac_header_type_2_life_span_rsv; /* Multiple Types of Feedback */ /* 2nd to 5th bytes ??? */ #define WIMAX_MAC_HEADER_TYPE_2_MT_NUM_FB_TYPES 0xC0000000 #define WIMAX_MAC_HEADER_TYPE_2_MT_OCCU_FB_TYPE 0x3C000000 #define WIMAX_MAC_HEADER_TYPE_2_MT_FB_CONTENTS 0x03FFFFFF -static int hf_mac_header_type_2_mt_num_fb_types = -1; -static int hf_mac_header_type_2_mt_occu_fb_type = -1; -static int hf_mac_header_type_2_mt_fb_contents = -1; +static int hf_mac_header_type_2_mt_num_fb_types; +static int hf_mac_header_type_2_mt_occu_fb_type; +static int hf_mac_header_type_2_mt_fb_contents; /* Long-term Precoding Feedback */ /* 2nd & 3rd bytes */ @@ -181,17 +181,17 @@ static int hf_mac_header_type_2_mt_fb_contents = -1; #define WIMAX_MAC_HEADER_TYPE_2_LT_RANK 0x0300 #define WIMAX_MAC_HEADER_TYPE_2_LT_FEC_QAM 0x00FC #define WIMAX_MAC_HEADER_TYPE_2_LT_RSV 0x0003 -static int hf_mac_header_type_2_lt_id_fb = -1; -static int hf_mac_header_type_2_lt_rank = -1; -static int hf_mac_header_type_2_lt_fec_qam = -1; -static int hf_mac_header_type_2_lt_rsv = -1; +static int hf_mac_header_type_2_lt_id_fb; +static int hf_mac_header_type_2_lt_rank; +static int hf_mac_header_type_2_lt_fec_qam; +static int hf_mac_header_type_2_lt_rsv; /* Combined DL Average CINR of Active BSs */ /* 2nd & 3rd bytes */ #define WIMAX_MAC_HEADER_TYPE_2_COMB_DL_AVE 0xF800 #define WIMAX_MAC_HEADER_TYPE_2_COMB_DL_RSV 0x0EFF -static int hf_mac_header_type_2_comb_dl_ave = -1; -static int hf_mac_header_type_2_comb_dl_rsv = -1; +static int hf_mac_header_type_2_comb_dl_ave; +static int hf_mac_header_type_2_comb_dl_rsv; /* MIMO Channel Feedback */ /* 2nd byte */ @@ -211,28 +211,28 @@ static int hf_mac_header_type_2_comb_dl_rsv = -1; #define WIMAX_MAC_HEADER_TYPE_2_MI 0x0000C0 #define WIMAX_MAC_HEADER_TYPE_2_CT 0x000020 #define WIMAX_MAC_HEADER_TYPE_2_CQI 0x00001F -static int hf_mac_header_type_2_mimo_diuc = -1; -static int hf_mac_header_type_2_mimo_pbwi = -1; -static int hf_mac_header_type_2_mimo_slpb = -1; -static int hf_mac_header_type_2_mimo_bpri = -1; -static int hf_mac_header_type_2_mimo_bpri_cid = -1; -static int hf_mac_header_type_2_mimo_cid = -1; -static int hf_mac_header_type_2_mimo_cti = -1; -static int hf_mac_header_type_2_mimo_ai_0 = -1; -static int hf_mac_header_type_2_mimo_ai_1 = -1; -static int hf_mac_header_type_2_mimo_ai_2 = -1; -static int hf_mac_header_type_2_mimo_ai_3 = -1; -static int hf_mac_header_type_2_mimo_mi = -1; -static int hf_mac_header_type_2_mimo_ct = -1; -static int hf_mac_header_type_2_mimo_cqi = -1; +static int hf_mac_header_type_2_mimo_diuc; +static int hf_mac_header_type_2_mimo_pbwi; +static int hf_mac_header_type_2_mimo_slpb; +static int hf_mac_header_type_2_mimo_bpri; +static int hf_mac_header_type_2_mimo_bpri_cid; +static int hf_mac_header_type_2_mimo_cid; +static int hf_mac_header_type_2_mimo_cti; +static int hf_mac_header_type_2_mimo_ai_0; +static int hf_mac_header_type_2_mimo_ai_1; +static int hf_mac_header_type_2_mimo_ai_2; +static int hf_mac_header_type_2_mimo_ai_3; +static int hf_mac_header_type_2_mimo_mi; +static int hf_mac_header_type_2_mimo_ct; +static int hf_mac_header_type_2_mimo_cqi; /* CINR Feedback */ /* 2nd byte */ /*#define WIMAX_MAC_HEADER_TYPE_2_CINR_MEAN 0xFF*/ /* 3rd byte */ /*#define WIMAX_MAC_HEADER_TYPE_2_CINR_DEVI 0xFF*/ -static int hf_mac_header_type_2_cinr_mean = -1; -static int hf_mac_header_type_2_cinr_devi = -1; +static int hf_mac_header_type_2_cinr_mean; +static int hf_mac_header_type_2_cinr_devi; /* Close-loop MIMO Feedback */ /* 2nd & 3rd bytes */ @@ -247,21 +247,21 @@ static int hf_mac_header_type_2_cinr_devi = -1; #define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CODEBOOK_ID 0x3F00 #define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_CQI_2 0x00F8 #define WIMAX_MAC_HEADER_TYPE_2_CL_MIMO_RSV_2 0x000E -static int hf_mac_header_type_2_cl_mimo_type = -1; -static int hf_mac_header_type_2_cl_mimo_ant_id = -1; -static int hf_mac_header_type_2_cl_mimo_cqi = -1; -static int hf_mac_header_type_2_cl_mimo_cqi_1 = -1; -static int hf_mac_header_type_2_cl_mimo_cqi_2 = -1; -static int hf_mac_header_type_2_cl_mimo_rsv = -1; -static int hf_mac_header_type_2_cl_mimo_rsv_1 = -1; -static int hf_mac_header_type_2_cl_mimo_rsv_2 = -1; -static int hf_mac_header_type_2_cl_mimo_streams = -1; -static int hf_mac_header_type_2_cl_mimo_ant_sel = -1; -static int hf_mac_header_type_2_cl_mimo_codebook_id = -1; +static int hf_mac_header_type_2_cl_mimo_type; +static int hf_mac_header_type_2_cl_mimo_ant_id; +static int hf_mac_header_type_2_cl_mimo_cqi; +static int hf_mac_header_type_2_cl_mimo_cqi_1; +static int hf_mac_header_type_2_cl_mimo_cqi_2; +static int hf_mac_header_type_2_cl_mimo_rsv; +static int hf_mac_header_type_2_cl_mimo_rsv_1; +static int hf_mac_header_type_2_cl_mimo_rsv_2; +static int hf_mac_header_type_2_cl_mimo_streams; +static int hf_mac_header_type_2_cl_mimo_ant_sel; +static int hf_mac_header_type_2_cl_mimo_codebook_id; /* last byte */ /*#define WIMAX_MAC_HEADER_TYPE_2_HCS 0xFF*/ -static int hf_mac_header_type_2_hcs = -1; +static int hf_mac_header_type_2_hcs; /* CID Inclusion Indication messages */ static const value_string cii_msgs[] = @@ -624,7 +624,7 @@ static int dissect_mac_header_type_2_decoder(tvbuff_t *tvb, packet_info *pinfo, /* Decode and display the Long-term precoding feedback */ /* Feedback of index */ proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_id_fb, tvb, offset, 2, ENC_BIG_ENDIAN); - /* rank of prrecoding codebook */ + /* rank of precoding codebook */ proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_rank, tvb, offset, 2, ENC_BIG_ENDIAN); /* EFC and QAM feedback */ proto_tree_add_item(ti_tree, hf_mac_header_type_2_lt_fec_qam, tvb, offset, 2, ENC_BIG_ENDIAN); diff --git a/plugins/epan/wimax/mac_mgmt_msg_decoder.c b/plugins/epan/wimax/mac_mgmt_msg_decoder.c index 57c039777a..767dc342ce 100644 --- a/plugins/epan/wimax/mac_mgmt_msg_decoder.c +++ b/plugins/epan/wimax/mac_mgmt_msg_decoder.c @@ -23,13 +23,13 @@ void proto_register_mac_mgmt_msg(void); void proto_reg_handoff_mac_mgmt_msg(void); -static gint proto_mac_mgmt_msg_decoder = -1; -static gint ett_mac_mgmt_msg_decoder = -1; +static gint proto_mac_mgmt_msg_decoder; +static gint ett_mac_mgmt_msg_decoder; -static gint hf_mac_mgmt_msg_type = -1; -static gint hf_mac_mgmt_msg_values = -1; +static gint hf_mac_mgmt_msg_type; +static gint hf_mac_mgmt_msg_values; -static expert_field ei_empty_payload = EI_INIT; +static expert_field ei_empty_payload; static dissector_table_t subdissector_message_table; diff --git a/plugins/epan/wimax/msg_aas_beam.c b/plugins/epan/wimax/msg_aas_beam.c index 72d8eeb4b9..68d14900c6 100644 --- a/plugins/epan/wimax/msg_aas_beam.c +++ b/plugins/epan/wimax/msg_aas_beam.c @@ -35,10 +35,12 @@ extern gint proto_mac_mgmt_msg_aas_fbck_decoder; void proto_register_mac_mgmt_msg_aas_beam(void); void proto_reg_handoff_mac_mgmt_msg_aas_beam(void); -static gint proto_mac_mgmt_msg_aas_beam_decoder = -1; -static gint ett_mac_mgmt_msg_aas_beam_select_decoder = -1; -static gint ett_mac_mgmt_msg_aas_beam_req_decoder = -1; -static gint ett_mac_mgmt_msg_aas_beam_rsp_decoder = -1; +static dissector_handle_t aas_handle; + +static gint proto_mac_mgmt_msg_aas_beam_decoder; +static gint ett_mac_mgmt_msg_aas_beam_select_decoder; +static gint ett_mac_mgmt_msg_aas_beam_req_decoder; +static gint ett_mac_mgmt_msg_aas_beam_rsp_decoder; #ifdef OFDM static const value_string vals_report_types[] = @@ -59,19 +61,19 @@ static const value_string vals_resolution_parameter[] = #endif /* fix fields */ -/* static gint hf_aas_beam_unknown_type = -1; */ -static gint hf_aas_beam_select_index = -1; -static gint hf_aas_beam_select_reserved = -1; +/* static gint hf_aas_beam_unknown_type; */ +static gint hf_aas_beam_select_index; +static gint hf_aas_beam_select_reserved; #ifdef OFDM -static gint hf_aas_beam_frame_number = -1; -static gint hf_aas_beam_feedback_request_number = -1; -static gint hf_aas_beam_measurement_report_type = -1; -static gint hf_aas_beam_resolution_parameter = -1; -static gint hf_aas_beam_beam_bit_mask = -1; -static int hf_aas_beam_freq_value_re = -1; -static int hf_aas_beam_freq_value_im = -1; -static int hf_aas_beam_rssi_value = -1; -static int hf_aas_beam_cinr_value = -1; +static gint hf_aas_beam_frame_number; +static gint hf_aas_beam_feedback_request_number; +static gint hf_aas_beam_measurement_report_type; +static gint hf_aas_beam_resolution_parameter; +static gint hf_aas_beam_beam_bit_mask; +static int hf_aas_beam_freq_value_re; +static int hf_aas_beam_freq_value_im; +static int hf_aas_beam_rssi_value; +static int hf_aas_beam_cinr_value; #endif @@ -311,19 +313,16 @@ void proto_register_mac_mgmt_msg_aas_beam(void) proto_register_field_array(proto_mac_mgmt_msg_aas_beam_decoder, hf_aas_beam, array_length(hf_aas_beam)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder, -1); + aas_handle = register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder, proto_mac_mgmt_msg_aas_beam_decoder); #ifdef OFDM - register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder, -1); - register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder, -1); + register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder, proto_mac_mgmt_msg_aas_beam_decoder); + register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder, proto_mac_mgmt_msg_aas_beam_decoder); #endif } void proto_reg_handoff_mac_mgmt_msg_aas_beam(void) { - dissector_handle_t aas_handle; - - aas_handle = create_dissector_handle(dissect_mac_mgmt_msg_aas_beam_select_decoder, proto_mac_mgmt_msg_aas_beam_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_BEAM_SELECT, aas_handle); } diff --git a/plugins/epan/wimax/msg_aas_fbck.c b/plugins/epan/wimax/msg_aas_fbck.c index 1fb53d97ea..2d0df5c47d 100644 --- a/plugins/epan/wimax/msg_aas_fbck.c +++ b/plugins/epan/wimax/msg_aas_fbck.c @@ -33,9 +33,12 @@ void proto_register_mac_mgmt_msg_aas_fbck(void); void proto_reg_handoff_mac_mgmt_msg_aas(void); -static gint proto_mac_mgmt_msg_aas_fbck_decoder = -1; -static gint ett_mac_mgmt_msg_aas_fbck_req_decoder = -1; -static gint ett_mac_mgmt_msg_aas_fbck_rsp_decoder = -1; +static dissector_handle_t aas_req_handle; +static dissector_handle_t aas_rsp_handle; + +static gint proto_mac_mgmt_msg_aas_fbck_decoder; +static gint ett_mac_mgmt_msg_aas_fbck_req_decoder; +static gint ett_mac_mgmt_msg_aas_fbck_rsp_decoder; static const value_string vals_data_types[] = { @@ -63,23 +66,23 @@ static const value_string vals_resolutions_1[] = }; /* fix fields */ -/* static int hf_aas_fbck_unknown_type = -1; */ -static int hf_aas_fbck_frame_number = -1; -static int hf_aas_fbck_number_of_frames = -1; -static int hf_aas_fbck_req_data_type = -1; -static int hf_aas_fbck_rsp_data_type = -1; -static int hf_aas_fbck_req_counter = -1; -static int hf_aas_fbck_rsp_counter = -1; -static int hf_aas_fbck_req_resolution_0 = -1; -static int hf_aas_fbck_rsp_resolution_0 = -1; -static int hf_aas_fbck_req_resolution_1 = -1; -static int hf_aas_fbck_rsp_resolution_1 = -1; -static int hf_aas_fbck_req_reserved = -1; -static int hf_aas_fbck_rsp_reserved = -1; -static int hf_aas_fbck_freq_value_re = -1; -static int hf_aas_fbck_freq_value_im = -1; -static int hf_aas_fbck_rssi_value = -1; -static int hf_aas_fbck_cinr_value = -1; +/* static int hf_aas_fbck_unknown_type; */ +static int hf_aas_fbck_frame_number; +static int hf_aas_fbck_number_of_frames; +static int hf_aas_fbck_req_data_type; +static int hf_aas_fbck_rsp_data_type; +static int hf_aas_fbck_req_counter; +static int hf_aas_fbck_rsp_counter; +static int hf_aas_fbck_req_resolution_0; +static int hf_aas_fbck_rsp_resolution_0; +static int hf_aas_fbck_req_resolution_1; +static int hf_aas_fbck_rsp_resolution_1; +static int hf_aas_fbck_req_reserved; +static int hf_aas_fbck_rsp_reserved; +static int hf_aas_fbck_freq_value_re; +static int hf_aas_fbck_freq_value_im; +static int hf_aas_fbck_rssi_value; +static int hf_aas_fbck_cinr_value; static int dissect_mac_mgmt_msg_aas_fbck_req_decoder(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) @@ -321,18 +324,15 @@ void proto_register_mac_mgmt_msg_aas_fbck(void) proto_register_field_array(proto_mac_mgmt_msg_aas_fbck_decoder, hf_aas_fbck, array_length(hf_aas_fbck)); proto_register_subtree_array(ett, array_length(ett)); + aas_req_handle = register_dissector("mac_mgmt_msg_aas_feedback_req_handler", dissect_mac_mgmt_msg_aas_fbck_req_decoder, proto_mac_mgmt_msg_aas_fbck_decoder); + aas_rsp_handle = register_dissector("mac_mgmt_msg_aas_feedback_rsp_handler", dissect_mac_mgmt_msg_aas_fbck_rsp_decoder, proto_mac_mgmt_msg_aas_fbck_decoder); } void proto_reg_handoff_mac_mgmt_msg_aas(void) { - dissector_handle_t aas_handle; - - aas_handle = create_dissector_handle(dissect_mac_mgmt_msg_aas_fbck_req_decoder, proto_mac_mgmt_msg_aas_fbck_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_FBCK_REQ, aas_handle); - - aas_handle = create_dissector_handle(dissect_mac_mgmt_msg_aas_fbck_rsp_decoder, proto_mac_mgmt_msg_aas_fbck_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_FBCK_RSP, aas_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_FBCK_REQ, aas_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_FBCK_RSP, aas_rsp_handle); } /* diff --git a/plugins/epan/wimax/msg_arq.c b/plugins/epan/wimax/msg_arq.c index 0f208cae97..9753f8bdc5 100644 --- a/plugins/epan/wimax/msg_arq.c +++ b/plugins/epan/wimax/msg_arq.c @@ -22,10 +22,17 @@ void proto_register_mac_mgmt_msg_arq_feedback(void); void proto_reg_handoff_mac_mgmt_msg_arq(void); +static int dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); +static int dissect_mac_mgmt_msg_arq_discard_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); +static int dissect_mac_mgmt_msg_arq_reset_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); -static gint proto_mac_mgmt_msg_arq_decoder = -1; +static dissector_handle_t arq_feedback_handle; +static dissector_handle_t arq_discard_handle; +static dissector_handle_t arq_reset_handle; -static gint ett_mac_mgmt_msg_arq_decoder = -1; +static gint proto_mac_mgmt_msg_arq_decoder; + +static gint ett_mac_mgmt_msg_arq_decoder; /* Setup protocol subtree array */ static gint *ett[] = @@ -35,31 +42,31 @@ static gint *ett[] = /* ARQ fields */ -static gint hf_arq_cid = -1; -static gint hf_arq_last = -1; -static gint hf_arq_ack_type = -1; -static gint hf_ack_type_reserved = -1; -static gint hf_arq_bsn = -1; -static gint hf_arq_num_ack_maps = -1; -static gint hf_arq_selective_map = -1; -static gint hf_arq_seq_format = -1; -static gint hf_arq_0seq_ack_map = -1; -static gint hf_arq_0seq1_len = -1; -static gint hf_arq_0seq2_len = -1; -static gint hf_arq_1seq_ack_map = -1; -static gint hf_arq_1seq1_len = -1; -static gint hf_arq_1seq2_len = -1; -static gint hf_arq_1seq3_len = -1; -static gint hf_arq_reserved = -1; - -static gint hf_arq_discard_cid = -1; -static gint hf_arq_discard_reserved = -1; -static gint hf_arq_discard_bsn = -1; - -static gint hf_arq_reset_cid = -1; -static gint hf_arq_reset_type = -1; -static gint hf_arq_reset_direction = -1; -static gint hf_arq_reset_reserved = -1; +static gint hf_arq_cid; +static gint hf_arq_last; +static gint hf_arq_ack_type; +static gint hf_ack_type_reserved; +static gint hf_arq_bsn; +static gint hf_arq_num_ack_maps; +static gint hf_arq_selective_map; +static gint hf_arq_seq_format; +static gint hf_arq_0seq_ack_map; +static gint hf_arq_0seq1_len; +static gint hf_arq_0seq2_len; +static gint hf_arq_1seq_ack_map; +static gint hf_arq_1seq1_len; +static gint hf_arq_1seq2_len; +static gint hf_arq_1seq3_len; +static gint hf_arq_reserved; + +static gint hf_arq_discard_cid; +static gint hf_arq_discard_reserved; +static gint hf_arq_discard_bsn; + +static gint hf_arq_reset_cid; +static gint hf_arq_reset_type; +static gint hf_arq_reset_direction; +static gint hf_arq_reset_reserved; /* STRING RESOURCES */ @@ -283,6 +290,9 @@ void proto_register_mac_mgmt_msg_arq_feedback(void) proto_register_field_array(proto_mac_mgmt_msg_arq_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + arq_feedback_handle = register_dissector("mac_mgmt_msg_arq_feedback_handler", dissect_mac_mgmt_msg_arq_feedback_decoder, proto_mac_mgmt_msg_arq_decoder); + arq_discard_handle = register_dissector("mac_mgmt_msg_arq_discard_handler", dissect_mac_mgmt_msg_arq_discard_decoder, proto_mac_mgmt_msg_arq_decoder); + arq_reset_handle = register_dissector("mac_mgmt_msg_arq_reset_handler", dissect_mac_mgmt_msg_arq_reset_decoder, proto_mac_mgmt_msg_arq_decoder); } /* Decode ARQ-Feedback messages. */ @@ -417,16 +427,9 @@ static int dissect_mac_mgmt_msg_arq_reset_decoder(tvbuff_t *tvb, packet_info *pi void proto_reg_handoff_mac_mgmt_msg_arq(void) { - dissector_handle_t arq_handle; - - arq_handle = create_dissector_handle(dissect_mac_mgmt_msg_arq_feedback_decoder, proto_mac_mgmt_msg_arq_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_FEEDBACK, arq_handle); - - arq_handle = create_dissector_handle(dissect_mac_mgmt_msg_arq_discard_decoder, proto_mac_mgmt_msg_arq_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_DISCARD, arq_handle); - - arq_handle = create_dissector_handle(dissect_mac_mgmt_msg_arq_reset_decoder, proto_mac_mgmt_msg_arq_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_RESET, arq_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_FEEDBACK, arq_feedback_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_DISCARD, arq_discard_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_RESET, arq_reset_handle); } /* diff --git a/plugins/epan/wimax/msg_clk_cmp.c b/plugins/epan/wimax/msg_clk_cmp.c index 8063b55f62..b57e13e8b1 100644 --- a/plugins/epan/wimax/msg_clk_cmp.c +++ b/plugins/epan/wimax/msg_clk_cmp.c @@ -22,16 +22,18 @@ void proto_register_mac_mgmt_msg_clk_cmp(void); void proto_reg_handoff_mac_mgmt_msg_clk_cmp(void); -static gint proto_mac_mgmt_msg_clk_cmp_decoder = -1; +static dissector_handle_t clk_cmp_handle; -static gint ett_mac_mgmt_msg_clk_cmp_decoder = -1; +static gint proto_mac_mgmt_msg_clk_cmp_decoder; + +static gint ett_mac_mgmt_msg_clk_cmp_decoder; /* CLK_CMP fields */ -static gint hf_clk_cmp_clock_count = -1; -static gint hf_clk_cmp_clock_id = -1; -static gint hf_clk_cmp_seq_number = -1; -static gint hf_clk_cmp_comparison_value = -1; -/* static gint hf_clk_cmp_invalid_tlv = -1; */ +static gint hf_clk_cmp_clock_count; +static gint hf_clk_cmp_clock_id; +static gint hf_clk_cmp_seq_number; +static gint hf_clk_cmp_comparison_value; +/* static gint hf_clk_cmp_invalid_tlv; */ /* Decode CLK_CMP messages. */ @@ -125,15 +127,13 @@ void proto_register_mac_mgmt_msg_clk_cmp(void) proto_register_field_array(proto_mac_mgmt_msg_clk_cmp_decoder, hf_clk_cmp, array_length(hf_clk_cmp)); proto_register_subtree_array(ett, array_length(ett)); + clk_cmp_handle = register_dissector("mac_mgmt_msg_clk_cmp_handler", dissect_mac_mgmt_msg_clk_cmp_decoder, proto_mac_mgmt_msg_clk_cmp_decoder); } void proto_reg_handoff_mac_mgmt_msg_clk_cmp(void) { - dissector_handle_t handle; - - handle = create_dissector_handle(dissect_mac_mgmt_msg_clk_cmp_decoder, proto_mac_mgmt_msg_clk_cmp_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_CLK_CMP, handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_CLK_CMP, clk_cmp_handle); } /* diff --git a/plugins/epan/wimax/msg_dcd.c b/plugins/epan/wimax/msg_dcd.c index 26472b21ee..91c62751ae 100644 --- a/plugins/epan/wimax/msg_dcd.c +++ b/plugins/epan/wimax/msg_dcd.c @@ -31,88 +31,92 @@ extern gboolean include_cor2_changes; void proto_register_mac_mgmt_msg_dcd(void); void proto_reg_handoff_mac_mgmt_msg_dcd(void); -static gint proto_mac_mgmt_msg_dcd_decoder = -1; -static gint ett_mac_mgmt_msg_dcd_decoder = -1; +static dissector_handle_t dcd_handle; + +static gint proto_mac_mgmt_msg_dcd_decoder; +static gint ett_mac_mgmt_msg_dcd_decoder; /* fix fields */ -static gint hf_dcd_downlink_channel_id = -1; -static gint hf_dcd_config_change_count = -1; -static gint hf_dcd_dl_burst_profile_rsv = -1; -static gint hf_dcd_dl_burst_profile_diuc = -1; +static gint hf_dcd_downlink_channel_id; +static gint hf_dcd_config_change_count; +static gint hf_dcd_dl_burst_profile_rsv; +static gint hf_dcd_dl_burst_profile_diuc; -static gint hf_dcd_bs_eirp = -1; -static gint hf_dcd_frame_duration = -1; -static gint hf_dcd_phy_type = -1; -static gint hf_dcd_power_adjustment = -1; -static gint hf_dcd_channel_nr = -1; -static gint hf_dcd_ttg = -1; -static gint hf_dcd_rtg = -1; +static gint hf_dcd_bs_eirp; +static gint hf_dcd_frame_duration; +static gint hf_dcd_phy_type; +static gint hf_dcd_power_adjustment; +static gint hf_dcd_channel_nr; +static gint hf_dcd_ttg; +static gint hf_dcd_rtg; #ifdef WIMAX_16D_2004 -static gint hf_dcd_rss = -1; +static gint hf_dcd_rss; #endif -static gint hf_dcd_channel_switch_frame_nr = -1; -static gint hf_dcd_frequency = -1; -static gint hf_dcd_bs_id = -1; -static gint hf_dcd_frame_duration_code = -1; -static gint hf_dcd_frame_nr = -1; +static gint hf_dcd_channel_switch_frame_nr; +static gint hf_dcd_frequency; +static gint hf_dcd_bs_id; +static gint hf_dcd_frame_duration_code; +static gint hf_dcd_frame_nr; #ifdef WIMAX_16D_2004 -static gint hf_dcd_size_cqich_id = -1; +static gint hf_dcd_size_cqich_id; +static gint hf_dcd_h_arq_ack_delay_dl; +#else +static gint hf_dcd_h_arq_ack_delay_ul; #endif -static gint hf_dcd_h_arq_ack_delay = -1; -static gint hf_dcd_mac_version = -1; -static gint hf_dcd_restart_count = -1; +static gint hf_dcd_mac_version; +static gint hf_dcd_restart_count; -/* static gint hf_dl_burst_reserved = -1; */ -/* static gint hf_dl_burst_diuc = -1; */ -static gint hf_dcd_burst_freq = -1; -static gint hf_dcd_burst_fec = -1; -static gint hf_dcd_burst_diuc_exit_threshold = -1; -static gint hf_dcd_burst_diuc_entry_threshold = -1; -static gint hf_dcd_burst_tcs = -1; -static gint hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone = -1; -static gint hf_dcd_tlv_t_20_maximum_retransmission = -1; -static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter = -1; -static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements = -1; -static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements = -1; -static gint hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap = -1; +/* static gint hf_dl_burst_reserved; */ +/* static gint hf_dl_burst_diuc; */ +static gint hf_dcd_burst_freq; +static gint hf_dcd_burst_fec; +static gint hf_dcd_burst_diuc_exit_threshold; +static gint hf_dcd_burst_diuc_entry_threshold; +static gint hf_dcd_burst_tcs; +static gint hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone; +static gint hf_dcd_tlv_t_20_maximum_retransmission; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements; +static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements; +static gint hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap; -static gint hf_dcd_tlv_t_34_dl_region_definition = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_num_region = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_reserved = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_symbol_offset = -1; -static gint hf_dcd_eirxp = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_num_symbols = -1; -static gint hf_dcd_tlv_t_34_dl_region_definition_num_subchannels = -1; -static gint hf_dcd_tlv_t_50_ho_type_support = -1; -static gint hf_dcd_tlv_t_50_ho_type_support_ho = -1; -static gint hf_dcd_tlv_t_50_ho_type_support_mdho = -1; -static gint hf_dcd_tlv_t_50_ho_type_support_fbss_ho = -1; -static gint hf_dcd_tlv_t_50_ho_type_support_reserved = -1; -static gint hf_dcd_tlv_t_31_h_add_threshold = -1; -static gint hf_dcd_tlv_t_45_paging_interval_length = -1; -static gint hf_dcd_tlv_t_45_paging_interval_reserved = -1; -static gint hf_dcd_tlv_t_32_h_delete_threshold = -1; -static gint hf_dcd_tlv_t_33_asr = -1; -static gint hf_dcd_tlv_t_33_asr_m = -1; -static gint hf_dcd_tlv_t_33_asr_l = -1; -static gint hf_dcd_tlv_t_35_paging_group_id = -1; -static gint hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap = -1; -static gint hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap = -1; -static gint hf_dcd_tlv_t_51_hysteresis_margin = -1; -static gint hf_dcd_tlv_t_52_time_to_trigger_duration = -1; -static gint hf_dcd_tlv_t_60_noise_interference = -1; -static gint hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types = -1; +static gint hf_dcd_tlv_t_34_dl_region_definition; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_region; +static gint hf_dcd_tlv_t_34_dl_region_definition_reserved; +static gint hf_dcd_tlv_t_34_dl_region_definition_symbol_offset; +static gint hf_dcd_eirxp; +static gint hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_symbols; +static gint hf_dcd_tlv_t_34_dl_region_definition_num_subchannels; +static gint hf_dcd_tlv_t_50_ho_type_support; +static gint hf_dcd_tlv_t_50_ho_type_support_ho; +static gint hf_dcd_tlv_t_50_ho_type_support_mdho; +static gint hf_dcd_tlv_t_50_ho_type_support_fbss_ho; +static gint hf_dcd_tlv_t_50_ho_type_support_reserved; +static gint hf_dcd_tlv_t_31_h_add_threshold; +static gint hf_dcd_tlv_t_45_paging_interval_length; +static gint hf_dcd_tlv_t_45_paging_interval_reserved; +static gint hf_dcd_tlv_t_32_h_delete_threshold; +static gint hf_dcd_tlv_t_33_asr; +static gint hf_dcd_tlv_t_33_asr_m; +static gint hf_dcd_tlv_t_33_asr_l; +static gint hf_dcd_tlv_t_35_paging_group_id; +static gint hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap; +static gint hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap; +static gint hf_dcd_tlv_t_51_hysteresis_margin; +static gint hf_dcd_tlv_t_52_time_to_trigger_duration; +static gint hf_dcd_tlv_t_60_noise_interference; +static gint hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types; -static gint hf_dcd_tlv_t_541_type_function_action = -1; -static gint hf_dcd_tlv_t_541_type = -1; -static gint hf_dcd_tlv_t_541_function = -1; -static gint hf_dcd_tlv_t_541_action = -1; -static gint hf_dcd_tlv_t_542_trigger_value = -1; -static gint hf_dcd_tlv_t_543_trigger_averaging_duration = -1; +static gint hf_dcd_tlv_t_541_type_function_action; +static gint hf_dcd_tlv_t_541_type; +static gint hf_dcd_tlv_t_541_function; +static gint hf_dcd_tlv_t_541_action; +static gint hf_dcd_tlv_t_542_trigger_value; +static gint hf_dcd_tlv_t_543_trigger_averaging_duration; -static gint hf_dcd_unknown_type = -1; -static gint hf_dcd_invalid_tlv = -1; +static gint hf_dcd_unknown_type; +static gint hf_dcd_invalid_tlv; /* DCD DIUC messages (table 143) */ static const value_string diuc_msgs[] = @@ -521,7 +525,11 @@ static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, p #endif case DCD_H_ARQ_ACK_DELAY: { - add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); +#ifdef WIMAX_16D_2004 + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay_dl, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); +#else + add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay_ul, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN); +#endif break; } case DCD_MAC_VERSION: @@ -968,7 +976,7 @@ void proto_register_mac_mgmt_msg_dcd(void) }, #ifdef WIMAX_16D_2004 { - &hf_dcd_h_arq_ack_delay, + &hf_dcd_h_arq_ack_delay_dl, { "H-ARQ ACK Delay for DL Burst", "wmx.dcd.h_arq_ack_delay_dl_burst", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, "", HFILL @@ -976,7 +984,7 @@ void proto_register_mac_mgmt_msg_dcd(void) }, #else { - &hf_dcd_h_arq_ack_delay, + &hf_dcd_h_arq_ack_delay_ul, { "H-ARQ ACK Delay for UL Burst", "wmx.dcd.h_arq_ack_delay_ul_burst", FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, NULL, HFILL @@ -1227,13 +1235,11 @@ void proto_register_mac_mgmt_msg_dcd(void) proto_register_field_array(proto_mac_mgmt_msg_dcd_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + dcd_handle = register_dissector("mac_mgmt_msg_dcd_handler", dissect_mac_mgmt_msg_dcd_decoder, proto_mac_mgmt_msg_dcd_decoder); } void proto_reg_handoff_mac_mgmt_msg_dcd(void) { - dissector_handle_t dcd_handle; - - dcd_handle = create_dissector_handle(dissect_mac_mgmt_msg_dcd_decoder, proto_mac_mgmt_msg_dcd_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DCD, dcd_handle); } diff --git a/plugins/epan/wimax/msg_dlmap.c b/plugins/epan/wimax/msg_dlmap.c index 66f9a14df1..420ca1fc24 100644 --- a/plugins/epan/wimax/msg_dlmap.c +++ b/plugins/epan/wimax/msg_dlmap.c @@ -28,6 +28,8 @@ extern gboolean include_cor2_changes; void proto_register_mac_mgmt_msg_dlmap(void); void proto_reg_handoff_mac_mgmt_msg_dlmap(void); +static dissector_handle_t dlmap_handle; + #define MAC_MGMT_MSG_DLMAP 2 #define XBIT_HF(bits, hf) \ @@ -65,56 +67,56 @@ gint STC_Zone_Matrix = 0; gint INC_CID = 0; gint sub_dl_ul_map = 0; -static gint proto_mac_mgmt_msg_dlmap_decoder = -1; - -static gint ett_dlmap = -1; -static gint ett_dlmap_ie = -1; -/* static gint ett_dlmap_c_ie = -1; */ -static gint ett_109x = -1; /* SUB-DL-UL-MAP */ -static gint ett_109x_dl = -1; -static gint ett_109x_ul = -1; -static gint ett_275_phy = -1; -static gint ett_275_1 = -1; -static gint ett_277 = -1; -static gint ett_277b = -1; -static gint ett_278 = -1; -static gint ett_279 = -1; -static gint ett_280 = -1; -static gint ett_281 = -1; -static gint ett_282 = -1; -static gint ett_283 = -1; -static gint ett_284 = -1; -static gint ett_285 = -1; -static gint ett_286 = -1; -static gint ett_286a = -1; -static gint ett_286b = -1; -static gint ett_286c = -1; -static gint ett_286d = -1; -static gint ett_286e = -1; -static gint ett_286f = -1; -static gint ett_286g = -1; -static gint ett_286h = -1; -static gint ett_286i = -1; -static gint ett_286j = -1; -static gint ett_286k = -1; -static gint ett_286l = -1; -static gint ett_286m = -1; -static gint ett_286n = -1; -static gint ett_286o = -1; -static gint ett_286p = -1; -static gint ett_286q = -1; -static gint ett_286r = -1; -static gint ett_286s = -1; -static gint ett_286t = -1; -static gint ett_286u = -1; -static gint ett_286v = -1; -static gint ett_286w = -1; -static gint ett_286x = -1; -static gint ett_286y = -1; -static gint ett_286z = -1; -static gint ett_305 = -1; -/* static gint ett_305_dl = -1; */ -static gint ett_308a = -1; +static gint proto_mac_mgmt_msg_dlmap_decoder; + +static gint ett_dlmap; +static gint ett_dlmap_ie; +/* static gint ett_dlmap_c_ie; */ +static gint ett_109x; /* SUB-DL-UL-MAP */ +static gint ett_109x_dl; +static gint ett_109x_ul; +static gint ett_275_phy; +static gint ett_275_1; +static gint ett_277; +static gint ett_277b; +static gint ett_278; +static gint ett_279; +static gint ett_280; +static gint ett_281; +static gint ett_282; +static gint ett_283; +static gint ett_284; +static gint ett_285; +static gint ett_286; +static gint ett_286a; +static gint ett_286b; +static gint ett_286c; +static gint ett_286d; +static gint ett_286e; +static gint ett_286f; +static gint ett_286g; +static gint ett_286h; +static gint ett_286i; +static gint ett_286j; +static gint ett_286k; +static gint ett_286l; +static gint ett_286m; +static gint ett_286n; +static gint ett_286o; +static gint ett_286p; +static gint ett_286q; +static gint ett_286r; +static gint ett_286s; +static gint ett_286t; +static gint ett_286u; +static gint ett_286v; +static gint ett_286w; +static gint ett_286x; +static gint ett_286y; +static gint ett_286z; +static gint ett_305; +/* static gint ett_305_dl; */ +static gint ett_308a; #define DCD_DOWNLINK_BURST_PROFILE 1 #define DCD_BS_EIRP 2 @@ -232,368 +234,368 @@ static const value_string frames_per_second[] = }; /* dl-map fields */ -static gint hf_dlmap_phy_fdur = -1; -static gint hf_dlmap_phy_fdur_ms = -1; -static gint hf_dlmap_phy_fdur_per_sec = -1; -static gint hf_dlmap_phy_fnum = -1; -/* static gint hf_dlmap_fch_expected = -1; */ -static gint hf_dlmap_dcd = -1; -static gint hf_dlmap_bsid = -1; -static gint hf_dlmap_ofdma_sym = -1; -/* static gint hf_dlmap_ie = -1; */ -static gint hf_dlmap_ie_diuc = -1; -static gint hf_dlmap_ie_reserved_extended2_duic = -1; -static gint hf_dlmap_ie_reserved_extended_duic = -1; -static gint hf_dlmap_ie_diuc_ext = -1; -static gint hf_dlmap_ie_diuc_ext2 = -1; -static gint hf_dlmap_ie_length = -1; -static gint hf_dlmap_ie_bitmap = -1; -static gint hf_dlmap_ie_bitmap_cqi = -1; -static gint hf_dlmap_ie_bitmap_pusc = -1; -static gint hf_dlmap_ie_bitmap_opt_pusc = -1; -static gint hf_dlmap_ie_bitmap_amc = -1; -static gint hf_dlmap_ie_bitmap_aas = -1; -static gint hf_dlmap_ie_bitmap_periodic_ranging = -1; -static gint hf_dlmap_ie_bitmap_sounding = -1; -static gint hf_dlmap_ie_bitmap_mimo = -1; -static gint hf_dlmap_ie_ncid = -1; -static gint hf_dlmap_ie_cid = -1; -static gint hf_dlmap_ie_offsym = -1; -static gint hf_dlmap_ie_offsub = -1; -static gint hf_dlmap_ie_boosting = -1; -static gint hf_dlmap_ie_numsym = -1; -static gint hf_dlmap_ie_numsub = -1; -static gint hf_dlmap_ie_rep = -1; -static gint hf_dlmap_ie_offsym2 = -1; -static gint hf_dlmap_ie_offsub2 = -1; -static gint hf_dlmap_ie_boosting2 = -1; -static gint hf_dlmap_ie_numsym2 = -1; -static gint hf_dlmap_ie_numsub2 = -1; -static gint hf_dlmap_ie_rep2 = -1; - -/* static gint hf_dlmap_xie_diuc = -1; */ -/* static gint hf_dlmap_xie_len = -1; */ - -static gint hf_dlmapc_compr = -1; -static gint hf_dlmapc_ulmap = -1; -static gint hf_dlmapc_rsv = -1; -static gint hf_dlmapc_len = -1; -/* static gint hf_dlmapc_sync = -1; */ -static gint hf_dlmapc_opid = -1; -static gint hf_dlmapc_secid = -1; -static gint hf_dlmapc_count = -1; +static gint hf_dlmap_phy_fdur; +static gint hf_dlmap_phy_fdur_ms; +static gint hf_dlmap_phy_fdur_per_sec; +static gint hf_dlmap_phy_fnum; +/* static gint hf_dlmap_fch_expected; */ +static gint hf_dlmap_dcd; +static gint hf_dlmap_bsid; +static gint hf_dlmap_ofdma_sym; +/* static gint hf_dlmap_ie; */ +static gint hf_dlmap_ie_diuc; +static gint hf_dlmap_ie_reserved_extended2_duic; +static gint hf_dlmap_ie_reserved_extended_duic; +static gint hf_dlmap_ie_diuc_ext; +static gint hf_dlmap_ie_diuc_ext2; +static gint hf_dlmap_ie_length; +static gint hf_dlmap_ie_bitmap; +static gint hf_dlmap_ie_bitmap_cqi; +static gint hf_dlmap_ie_bitmap_pusc; +static gint hf_dlmap_ie_bitmap_opt_pusc; +static gint hf_dlmap_ie_bitmap_amc; +static gint hf_dlmap_ie_bitmap_aas; +static gint hf_dlmap_ie_bitmap_periodic_ranging; +static gint hf_dlmap_ie_bitmap_sounding; +static gint hf_dlmap_ie_bitmap_mimo; +static gint hf_dlmap_ie_ncid; +static gint hf_dlmap_ie_cid; +static gint hf_dlmap_ie_offsym; +static gint hf_dlmap_ie_offsub; +static gint hf_dlmap_ie_boosting; +static gint hf_dlmap_ie_numsym; +static gint hf_dlmap_ie_numsub; +static gint hf_dlmap_ie_rep; +static gint hf_dlmap_ie_offsym2; +static gint hf_dlmap_ie_offsub2; +static gint hf_dlmap_ie_boosting2; +static gint hf_dlmap_ie_numsym2; +static gint hf_dlmap_ie_numsub2; +static gint hf_dlmap_ie_rep2; + +/* static gint hf_dlmap_xie_diuc; */ +/* static gint hf_dlmap_xie_len; */ + +static gint hf_dlmapc_compr; +static gint hf_dlmapc_ulmap; +static gint hf_dlmapc_rsv; +static gint hf_dlmapc_len; +/* static gint hf_dlmapc_sync; */ +static gint hf_dlmapc_opid; +static gint hf_dlmapc_secid; +static gint hf_dlmapc_count; #if 0 -static gint hf_109x_cmi = -1; -static gint hf_109x_len = -1; -static gint hf_109x_rcid = -1; -static gint hf_109x_haoi = -1; -static gint hf_109x_dl = -1; -static gint hf_109x_ul = -1; -static gint hf_109x_dlie = -1; -static gint hf_109x_symofs = -1; -static gint hf_109x_subofs = -1; -static gint hf_109x_rsv = -1; +static gint hf_109x_cmi; +static gint hf_109x_len; +static gint hf_109x_rcid; +static gint hf_109x_haoi; +static gint hf_109x_dl; +static gint hf_109x_ul; +static gint hf_109x_dlie; +static gint hf_109x_symofs; +static gint hf_109x_subofs; +static gint hf_109x_rsv; #endif -static gint hf_308a_cmi = -1; -static gint hf_308a_ulmap = -1; -static gint hf_308a_type = -1; -static gint hf_308a_mult = -1; -static gint hf_308a_rsv = -1; -static gint hf_mac_header_compress_dlmap_crc = -1; -static gint hf_mac_header_compress_dlmap_crc_status = -1; -static gint hf_crc16 = -1; -static gint hf_crc16_status = -1; -static gint hf_padding = -1; -static gint hf_cid_mask = -1; -static gint hf_reserved = -1; +static gint hf_308a_cmi; +static gint hf_308a_ulmap; +static gint hf_308a_type; +static gint hf_308a_mult; +static gint hf_308a_rsv; +static gint hf_mac_header_compress_dlmap_crc; +static gint hf_mac_header_compress_dlmap_crc_status; +static gint hf_crc16; +static gint hf_crc16_status; +static gint hf_padding; +static gint hf_cid_mask; +static gint hf_reserved; /* Generated via "one time" script to help create filterable fields */ -static int hf_dlmap_rcid_ie_cid = -1; -static int hf_dlmap_rcid_ie_prefix = -1; -static int hf_dlmap_rcid_ie_cid11 = -1; -static int hf_dlmap_rcid_ie_cid7 = -1; -static int hf_dlmap_rcid_ie_cid3 = -1; -static int hf_dlmap_dedicated_dl_control_length = -1; -static int hf_dlmap_dedicated_dl_control_control_header = -1; -static int hf_dlmap_dedicated_dl_control_num_sdma_layers = -1; -static int hf_dlmap_dedicated_mimo_dl_control_length = -1; -static int hf_dlmap_dedicated_mimo_dl_control_control_header_mimo_control_info = -1; -static int hf_dlmap_dedicated_mimo_dl_control_control_header_cqi_control_info = -1; -static int hf_dlmap_dedicated_mimo_dl_control_control_header_closed_mimo_control_info = -1; -static int hf_dlmap_dedicated_mimo_dl_control_n_layer = -1; -static int hf_dlmap_dedicated_mimo_dl_control_matrix = -1; -static int hf_dlmap_dedicated_mimo_dl_control_num_beamformed_streams = -1; -static int hf_dlmap_dedicated_mimo_dl_control_period = -1; -static int hf_dlmap_dedicated_mimo_dl_control_frame_offset = -1; -static int hf_dlmap_dedicated_mimo_dl_control_duration = -1; -static int hf_dlmap_dedicated_mimo_dl_control_allocation_index = -1; -static int hf_dlmap_dedicated_mimo_dl_control_cqich_num = -1; -static int hf_dlmap_dedicated_mimo_dl_control_feedback_type = -1; -static int hf_dlmap_dedicated_mimo_dl_control_antenna_grouping_index = -1; -static int hf_dlmap_dedicated_mimo_dl_control_num_stream = -1; -static int hf_dlmap_dedicated_mimo_dl_control_antenna_selection_index = -1; -static int hf_dlmap_dedicated_mimo_dl_control_codebook_precoding_index = -1; -static int hf_dlmap_n_sub_burst_isi = -1; -static int hf_dlmap_harq_chase_n_ack_channel = -1; -static int hf_dlmap_harq_chase_duration = -1; -static int hf_dlmap_harq_chase_sub_burst_diuc_indicator = -1; -static int hf_dlmap_reserved_uint = -1; -static int hf_dlmap_harq_chase_diuc = -1; -static int hf_dlmap_harq_chase_repetition_coding_indication = -1; -static int hf_dlmap_harq_chase_acid = -1; -static int hf_dlmap_harq_chase_ai_sn = -1; -static int hf_dlmap_harq_chase_ack_disable = -1; -static int hf_dlmap_harq_chase_dedicated_dl_control_indicator = -1; -static int hf_dlmap_harq_chase_allocation_index = -1; -static int hf_dlmap_harq_chase_period = -1; -static int hf_dlmap_harq_chase_frame_offset = -1; -static int hf_dlmap_harq_ir_ctc_n_ack_channel = -1; -static int hf_dlmap_harq_ir_ctc_nep = -1; -static int hf_dlmap_harq_ir_ctc_nsch = -1; -static int hf_dlmap_harq_ir_ctc_spid = -1; -static int hf_dlmap_harq_ir_ctc_acid = -1; -static int hf_dlmap_harq_ir_ctc_ai_sn = -1; -static int hf_dlmap_harq_ir_ctc_ack_disable = -1; -static int hf_dlmap_harq_ir_ctc_dedicated_dl_control_indicator = -1; -static int hf_dlmap_harq_ir_ctc_duration = -1; -static int hf_dlmap_harq_ir_ctc_allocation_index = -1; -static int hf_dlmap_harq_ir_ctc_period = -1; -static int hf_dlmap_harq_ir_ctc_frame_offset = -1; -static int hf_dlmap_harq_ir_cc_n_ack_channel = -1; -static int hf_dlmap_harq_ir_cc_duration = -1; -static int hf_dlmap_harq_ir_cc_sub_burst_diuc_indicator = -1; -static int hf_dlmap_harq_ir_cc_diuc = -1; -static int hf_dlmap_harq_ir_cc_repetition_coding_indication = -1; -static int hf_dlmap_harq_ir_cc_acid = -1; -static int hf_dlmap_harq_ir_cc_ai_sn = -1; -static int hf_dlmap_harq_ir_cc_spid = -1; -static int hf_dlmap_harq_ir_cc_ack_disable = -1; -static int hf_dlmap_harq_ir_cc_dedicated_dl_control_indicator = -1; -static int hf_dlmap_harq_ir_cc_allocation_index = -1; -static int hf_dlmap_harq_ir_cc_period = -1; -static int hf_dlmap_harq_ir_cc_frame_offset = -1; -static int hf_dlmap_mimo_dl_chase_harq_n_ack_channel = -1; -static int hf_dlmap_mimo_dl_chase_harq_mu_indicator = -1; -static int hf_dlmap_mimo_dl_chase_harq_dedicated_mimo_dl_control_indicator = -1; -static int hf_dlmap_mimo_dl_chase_harq_ack_disable = -1; -static int hf_dlmap_mimo_dl_chase_harq_duration = -1; -static int hf_dlmap_mimo_dl_chase_harq_diuc = -1; -static int hf_dlmap_mimo_dl_chase_harq_repetition_coding_indication = -1; -static int hf_dlmap_mimo_dl_chase_harq_acid = -1; -static int hf_dlmap_mimo_dl_chase_harq_ai_sn = -1; -static int hf_dlmap_mimo_dl_ir_harq_n_ack_channel = -1; -static int hf_dlmap_mimo_dl_ir_harq_mu_indicator = -1; -static int hf_dlmap_mimo_dl_ir_harq_dedicated_mimo_dl_control_indicator = -1; -static int hf_dlmap_mimo_dl_ir_harq_ack_disable = -1; -static int hf_dlmap_mimo_dl_ir_harq_nsch = -1; -static int hf_dlmap_mimo_dl_ir_harq_nep = -1; -static int hf_dlmap_mimo_dl_ir_harq_spid = -1; -static int hf_dlmap_mimo_dl_ir_harq_acid = -1; -static int hf_dlmap_mimo_dl_ir_harq_ai_sn = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_n_ack_channel = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_mu_indicator = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_dedicated_mimo_dl_control_indicator = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_ack_disable = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_duration = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_diuc = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_repetition_coding_indication = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_acid = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_ai_sn = -1; -static int hf_dlmap_mimo_dl_ir_harq_cc_spid = -1; -static int hf_dlmap_mimo_dl_stc_harq_n_ack_channel = -1; -static int hf_dlmap_mimo_dl_stc_harq_tx_count = -1; -static int hf_dlmap_mimo_dl_stc_harq_duration = -1; -static int hf_dlmap_mimo_dl_stc_harq_sub_burst_offset_indication = -1; -static int hf_dlmap_mimo_dl_stc_harq_sub_burst_offset = -1; -static int hf_dlmap_mimo_dl_stc_harq_ack_disable = -1; -static int hf_dlmap_mimo_dl_stc_harq_dedicated_mimo_dl_control_indicator = -1; -static int hf_dlmap_mimo_dl_stc_harq_diuc = -1; -static int hf_dlmap_mimo_dl_stc_harq_repetition_coding_indication = -1; -static int hf_dlmap_mimo_dl_stc_harq_acid = -1; -static int hf_dlmap_mbs_map_extended_2_diuc = -1; -static int hf_dlmap_mbs_map_mbs_zone_identifier = -1; -static int hf_dlmap_mbs_map_macro_diversity_enhanced = -1; -static int hf_dlmap_mbs_map_permutation = -1; -static int hf_dlmap_mbs_map_dl_permbase = -1; -static int hf_dlmap_mbs_map_prbs_id = -1; -static int hf_dlmap_mbs_map_ofdma_symbol_offset = -1; -static int hf_dlmap_mbs_map_diuc_change_indication = -1; -static int hf_dlmap_mbs_map_boosting = -1; -static int hf_dlmap_mbs_map_diuc = -1; -static int hf_dlmap_mbs_map_num_subchannels = -1; -static int hf_dlmap_mbs_map_num_ofdma_symbols = -1; -static int hf_dlmap_mbs_map_repetition_coding_indication = -1; -static int hf_dlmap_mbs_map_cid = -1; -static int hf_dlmap_mbs_map_ofdma_symbols_offset = -1; -static int hf_dlmap_mbs_map_subchannel_offset = -1; -static int hf_dlmap_mbs_map_slc_3_indication = -1; -static int hf_dlmap_mbs_map_next_mbs_map_ie_frame_offset = -1; -static int hf_dlmap_skip_extended_2_diuc = -1; -static int hf_dlmap_skip_mode = -1; -static int hf_dlmap_harq_dl_map_extended_2_diuc = -1; -static int hf_dlmap_harq_dl_map_rcid_type = -1; -static int hf_dlmap_harq_dl_map_boosting = -1; -static int hf_dlmap_harq_dl_map_region_id_use_indicator = -1; -static int hf_dlmap_harq_dl_map_ofdma_symbol_offset = -1; -static int hf_dlmap_harq_dl_map_subchannel_offset = -1; -static int hf_dlmap_harq_dl_map_number_of_ofdma_symbols = -1; -static int hf_dlmap_harq_dl_map_number_of_subchannels = -1; -static int hf_dlmap_harq_dl_map_rectangular_sub_burst_indicator = -1; -static int hf_dlmap_harq_dl_map_region_id = -1; -static int hf_dlmap_harq_dl_map_mode = -1; -static int hf_dlmap_harq_dl_map_sub_burst_ie_length = -1; -static int hf_dlmap_harq_dl_map_reserved_mode = -1; -static int hf_dlmap_harq_ack_bitmap_data = -1; -static int hf_dlmap_enhanced_dl_map_extended_2_diuc = -1; -static int hf_dlmap_enhanced_dl_map_num_assignment = -1; -static int hf_dlmap_enhanced_dl_map_n_cid = -1; -static int hf_dlmap_enhanced_dl_map_cid = -1; -static int hf_dlmap_enhanced_dl_map_diuc = -1; -static int hf_dlmap_enhanced_dl_map_boosting = -1; -static int hf_dlmap_enhanced_dl_map_repetition_coding_indication = -1; -static int hf_dlmap_enhanced_dl_map_region_id = -1; -static int hf_dlmap_aas_sdma_dl_extended_2_diuc = -1; -static int hf_dlmap_aas_sdma_dl_rcid_type = -1; -static int hf_dlmap_aas_sdma_dl_num_burst_region = -1; -static int hf_dlmap_aas_sdma_dl_ofdma_symbol_offset = -1; -static int hf_dlmap_aas_sdma_dl_subchannel_offset = -1; -static int hf_dlmap_aas_sdma_dl_num_ofdma_triple_symbols = -1; -static int hf_dlmap_aas_sdma_dl_num_subchannels = -1; -static int hf_dlmap_aas_sdma_dl_number_of_users = -1; -static int hf_dlmap_aas_sdma_dl_encoding_mode = -1; -static int hf_dlmap_aas_sdma_dl_cqich_allocation = -1; -static int hf_dlmap_aas_sdma_dl_ackch_allocation = -1; -static int hf_dlmap_aas_sdma_dl_pilot_pattern_modifier = -1; -static int hf_dlmap_aas_sdma_dl_preamble_modifier_index = -1; -static int hf_dlmap_aas_sdma_dl_pilot_pattern = -1; -static int hf_dlmap_aas_sdma_dl_diuc = -1; -static int hf_dlmap_aas_sdma_dl_repetition_coding_indication = -1; -static int hf_dlmap_aas_sdma_dl_ack_ch_index = -1; -static int hf_dlmap_aas_sdma_dl_acid = -1; -static int hf_dlmap_aas_sdma_dl_ai_sn = -1; -static int hf_dlmap_aas_sdma_dl_nep = -1; -static int hf_dlmap_aas_sdma_dl_nsch = -1; -static int hf_dlmap_aas_sdma_dl_spid = -1; -static int hf_dlmap_aas_sdma_dl_allocation_index = -1; -static int hf_dlmap_aas_sdma_dl_period = -1; -static int hf_dlmap_aas_sdma_dl_frame_offset = -1; -static int hf_dlmap_aas_sdma_dl_duration = -1; -static int hf_dlmap_channel_measurement_channel_nr = -1; -static int hf_dlmap_channel_measurement_ofdma_symbol_offset = -1; -static int hf_dlmap_channel_measurement_cid = -1; -static int hf_dlmap_stc_zone_ofdma_symbol_offset = -1; -static int hf_dlmap_stc_zone_permutations = -1; -static int hf_dlmap_stc_zone_use_all_sc_indicator = -1; -static int hf_dlmap_stc_zone_stc = -1; -static int hf_dlmap_stc_zone_matrix_indicator = -1; -static int hf_dlmap_stc_zone_dl_permbase = -1; -static int hf_dlmap_stc_zone_prbs_id = -1; -static int hf_dlmap_stc_zone_amc_type = -1; -static int hf_dlmap_stc_zone_midamble_presence = -1; -static int hf_dlmap_stc_zone_midamble_boosting = -1; -static int hf_dlmap_stc_zone_2_3_antenna_select = -1; -static int hf_dlmap_stc_zone_dedicated_pilots = -1; -static int hf_dlmap_aas_dl_ofdma_symbol_offset = -1; -static int hf_dlmap_aas_dl_permutation = -1; -static int hf_dlmap_aas_dl_dl_permbase = -1; -static int hf_dlmap_aas_dl_downlink_preamble_config = -1; -static int hf_dlmap_aas_dl_preamble_type = -1; -static int hf_dlmap_aas_dl_prbs_id = -1; -static int hf_dlmap_aas_dl_diversity_map = -1; -static int hf_dlmap_data_location_another_bs_segment = -1; -static int hf_dlmap_data_location_another_bs_used_subchannels = -1; -static int hf_dlmap_data_location_another_bs_diuc = -1; -static int hf_dlmap_data_location_another_bs_frame_advance = -1; -static int hf_dlmap_data_location_another_bs_ofdma_symbol_offset = -1; -static int hf_dlmap_data_location_another_bs_subchannel_offset = -1; -static int hf_dlmap_data_location_another_bs_boosting = -1; -static int hf_dlmap_data_location_another_bs_preamble_index = -1; -static int hf_dlmap_data_location_another_bs_num_ofdma_symbols = -1; -static int hf_dlmap_data_location_another_bs_num_subchannels = -1; -static int hf_dlmap_data_location_another_bs_repetition_coding_indication = -1; -static int hf_dlmap_data_location_another_bs_cid = -1; -static int hf_dlmap_harq_map_pointer_diuc = -1; -static int hf_dlmap_harq_map_pointer_num_slots = -1; -static int hf_dlmap_harq_map_pointer_repetition_coding_indication = -1; -static int hf_dlmap_harq_map_pointer_map_version = -1; -static int hf_dlmap_harq_map_pointer_idle_users = -1; -static int hf_dlmap_harq_map_pointer_sleep_users = -1; -static int hf_dlmap_harq_map_pointer_cid_mask_length = -1; -static int hf_dlmap_phymod_dl_preamble_modifier_type = -1; -static int hf_dlmap_phymod_dl_preamble_frequency_shift_index = -1; -static int hf_dlmap_phymod_dl_preamble_time_shift_index = -1; -static int hf_dlmap_phymod_dl_pilot_pattern_modifier = -1; -static int hf_dlmap_phymod_dl_pilot_pattern_index = -1; -static int hf_dlmap_broadcast_ctrl_ptr_dcd_ucd_transmission_frame = -1; -static int hf_dlmap_broadcast_ctrl_ptr_skip_broadcast_system_update = -1; -static int hf_dlmap_broadcast_ctrl_ptr_broadcast_system_update_type = -1; -static int hf_dlmap_broadcast_ctrl_ptr_broadcast_system_update_transmission_frame = -1; -static int hf_dlmap_dl_pusc_burst_allocation_cid = -1; -static int hf_dlmap_dl_pusc_burst_allocation_diuc = -1; -static int hf_dlmap_dl_pusc_burst_allocation_segment = -1; -static int hf_dlmap_dl_pusc_burst_allocation_boosting = -1; -static int hf_dlmap_dl_pusc_burst_allocation_idcell = -1; -static int hf_dlmap_dl_pusc_burst_allocation_dl_permbase = -1; -static int hf_dlmap_dl_pusc_burst_allocation_prbs_id = -1; -static int hf_dlmap_dl_pusc_burst_allocation_repetition_coding_indication = -1; -static int hf_dlmap_dl_pusc_burst_allocation_used_subchannels = -1; -static int hf_dlmap_dl_pusc_burst_allocation_ofdma_symbol_offset = -1; -static int hf_dlmap_dl_pusc_burst_allocation_num_ofdma_symbols = -1; -static int hf_dlmap_dl_pusc_burst_allocation_subchannel_offset = -1; -static int hf_dlmap_dl_pusc_burst_allocation_num_subchannels = -1; -static int hf_dlmap_pusc_asca_alloc_diuc = -1; -static int hf_dlmap_pusc_asca_alloc_short_basic_cid = -1; -static int hf_dlmap_pusc_asca_alloc_ofdma_symbol_offset = -1; -static int hf_dlmap_pusc_asca_alloc_subchannel_offset = -1; -static int hf_dlmap_pusc_asca_alloc_num_ofdma_symbols = -1; -static int hf_dlmap_pusc_asca_alloc_num_symbols = -1; -static int hf_dlmap_pusc_asca_alloc_repetition_coding_information = -1; -static int hf_dlmap_pusc_asca_alloc_permutation_id = -1; -static int hf_dlmap_reduced_aas_num_ie = -1; -static int hf_dlmap_reduced_aas_periodicity = -1; -static int hf_dlmap_reduced_aas_cid_included = -1; -static int hf_dlmap_reduced_aas_dcd_count_included = -1; -static int hf_dlmap_reduced_aas_phy_modification_included = -1; -static int hf_dlmap_reduced_aas_cqich_control_indicator = -1; -static int hf_dlmap_reduced_aas_encoding_mode = -1; -static int hf_dlmap_reduced_aas_separate_mcs_enabled = -1; -static int hf_dlmap_reduced_aas_duration = -1; -static int hf_dlmap_reduced_aas_diuc = -1; -static int hf_dlmap_reduced_aas_repetition_coding_indication = -1; -static int hf_dlmap_reduced_aas_cid = -1; -static int hf_dlmap_reduced_aas_allocation_index = -1; -static int hf_dlmap_reduced_aas_report_period = -1; -static int hf_dlmap_reduced_aas_frame_offset = -1; -static int hf_dlmap_reduced_aas_report_duration = -1; -static int hf_dlmap_reduced_aas_cqi_measurement_type = -1; -static int hf_dlmap_reduced_aas_dcd_count = -1; -static int hf_dlmap_reduced_aas_preamble_select = -1; -static int hf_dlmap_reduced_aas_preamble_shift_index = -1; -static int hf_dlmap_reduced_aas_pilot_pattern_modifier = -1; -static int hf_dlmap_reduced_aas_pilot_pattern_index = -1; -static int hf_dlmap_reduced_aas_dl_frame_offset = -1; -static int hf_dlmap_reduced_aas_zone_symbol_offset = -1; -static int hf_dlmap_reduced_aas_ofdma_symbol_offset = -1; -static int hf_dlmap_reduced_aas_subchannel_offset = -1; -static int hf_dlmap_reduced_aas_num_ofdma_triple_symbol = -1; -static int hf_dlmap_reduced_aas_num_subchannels = -1; -static int hf_dlmap_reduced_aas_num_ofdma_symbols = -1; -static int hf_dlmap_reduced_aas_diuc_nep = -1; -static int hf_dlmap_reduced_aas_dl_harq_ack_bitmap = -1; -static int hf_dlmap_reduced_aas_ack_allocation_index = -1; -static int hf_dlmap_reduced_aas_acid = -1; -static int hf_dlmap_reduced_aas_ai_sn = -1; -static int hf_dlmap_reduced_aas_nsch = -1; -static int hf_dlmap_reduced_aas_spid = -1; - - - -static expert_field ei_dlmap_not_implemented = EI_INIT; -static expert_field ei_crc16 = EI_INIT; -static expert_field ei_mac_header_compress_dlmap_crc = EI_INIT; -static expert_field ei_mac_header_invalid_length = EI_INIT; +static int hf_dlmap_rcid_ie_cid; +static int hf_dlmap_rcid_ie_prefix; +static int hf_dlmap_rcid_ie_cid11; +static int hf_dlmap_rcid_ie_cid7; +static int hf_dlmap_rcid_ie_cid3; +static int hf_dlmap_dedicated_dl_control_length; +static int hf_dlmap_dedicated_dl_control_control_header; +static int hf_dlmap_dedicated_dl_control_num_sdma_layers; +static int hf_dlmap_dedicated_mimo_dl_control_length; +static int hf_dlmap_dedicated_mimo_dl_control_control_header_mimo_control_info; +static int hf_dlmap_dedicated_mimo_dl_control_control_header_cqi_control_info; +static int hf_dlmap_dedicated_mimo_dl_control_control_header_closed_mimo_control_info; +static int hf_dlmap_dedicated_mimo_dl_control_n_layer; +static int hf_dlmap_dedicated_mimo_dl_control_matrix; +static int hf_dlmap_dedicated_mimo_dl_control_num_beamformed_streams; +static int hf_dlmap_dedicated_mimo_dl_control_period; +static int hf_dlmap_dedicated_mimo_dl_control_frame_offset; +static int hf_dlmap_dedicated_mimo_dl_control_duration; +static int hf_dlmap_dedicated_mimo_dl_control_allocation_index; +static int hf_dlmap_dedicated_mimo_dl_control_cqich_num; +static int hf_dlmap_dedicated_mimo_dl_control_feedback_type; +static int hf_dlmap_dedicated_mimo_dl_control_antenna_grouping_index; +static int hf_dlmap_dedicated_mimo_dl_control_num_stream; +static int hf_dlmap_dedicated_mimo_dl_control_antenna_selection_index; +static int hf_dlmap_dedicated_mimo_dl_control_codebook_precoding_index; +static int hf_dlmap_n_sub_burst_isi; +static int hf_dlmap_harq_chase_n_ack_channel; +static int hf_dlmap_harq_chase_duration; +static int hf_dlmap_harq_chase_sub_burst_diuc_indicator; +static int hf_dlmap_reserved_uint; +static int hf_dlmap_harq_chase_diuc; +static int hf_dlmap_harq_chase_repetition_coding_indication; +static int hf_dlmap_harq_chase_acid; +static int hf_dlmap_harq_chase_ai_sn; +static int hf_dlmap_harq_chase_ack_disable; +static int hf_dlmap_harq_chase_dedicated_dl_control_indicator; +static int hf_dlmap_harq_chase_allocation_index; +static int hf_dlmap_harq_chase_period; +static int hf_dlmap_harq_chase_frame_offset; +static int hf_dlmap_harq_ir_ctc_n_ack_channel; +static int hf_dlmap_harq_ir_ctc_nep; +static int hf_dlmap_harq_ir_ctc_nsch; +static int hf_dlmap_harq_ir_ctc_spid; +static int hf_dlmap_harq_ir_ctc_acid; +static int hf_dlmap_harq_ir_ctc_ai_sn; +static int hf_dlmap_harq_ir_ctc_ack_disable; +static int hf_dlmap_harq_ir_ctc_dedicated_dl_control_indicator; +static int hf_dlmap_harq_ir_ctc_duration; +static int hf_dlmap_harq_ir_ctc_allocation_index; +static int hf_dlmap_harq_ir_ctc_period; +static int hf_dlmap_harq_ir_ctc_frame_offset; +static int hf_dlmap_harq_ir_cc_n_ack_channel; +static int hf_dlmap_harq_ir_cc_duration; +static int hf_dlmap_harq_ir_cc_sub_burst_diuc_indicator; +static int hf_dlmap_harq_ir_cc_diuc; +static int hf_dlmap_harq_ir_cc_repetition_coding_indication; +static int hf_dlmap_harq_ir_cc_acid; +static int hf_dlmap_harq_ir_cc_ai_sn; +static int hf_dlmap_harq_ir_cc_spid; +static int hf_dlmap_harq_ir_cc_ack_disable; +static int hf_dlmap_harq_ir_cc_dedicated_dl_control_indicator; +static int hf_dlmap_harq_ir_cc_allocation_index; +static int hf_dlmap_harq_ir_cc_period; +static int hf_dlmap_harq_ir_cc_frame_offset; +static int hf_dlmap_mimo_dl_chase_harq_n_ack_channel; +static int hf_dlmap_mimo_dl_chase_harq_mu_indicator; +static int hf_dlmap_mimo_dl_chase_harq_dedicated_mimo_dl_control_indicator; +static int hf_dlmap_mimo_dl_chase_harq_ack_disable; +static int hf_dlmap_mimo_dl_chase_harq_duration; +static int hf_dlmap_mimo_dl_chase_harq_diuc; +static int hf_dlmap_mimo_dl_chase_harq_repetition_coding_indication; +static int hf_dlmap_mimo_dl_chase_harq_acid; +static int hf_dlmap_mimo_dl_chase_harq_ai_sn; +static int hf_dlmap_mimo_dl_ir_harq_n_ack_channel; +static int hf_dlmap_mimo_dl_ir_harq_mu_indicator; +static int hf_dlmap_mimo_dl_ir_harq_dedicated_mimo_dl_control_indicator; +static int hf_dlmap_mimo_dl_ir_harq_ack_disable; +static int hf_dlmap_mimo_dl_ir_harq_nsch; +static int hf_dlmap_mimo_dl_ir_harq_nep; +static int hf_dlmap_mimo_dl_ir_harq_spid; +static int hf_dlmap_mimo_dl_ir_harq_acid; +static int hf_dlmap_mimo_dl_ir_harq_ai_sn; +static int hf_dlmap_mimo_dl_ir_harq_cc_n_ack_channel; +static int hf_dlmap_mimo_dl_ir_harq_cc_mu_indicator; +static int hf_dlmap_mimo_dl_ir_harq_cc_dedicated_mimo_dl_control_indicator; +static int hf_dlmap_mimo_dl_ir_harq_cc_ack_disable; +static int hf_dlmap_mimo_dl_ir_harq_cc_duration; +static int hf_dlmap_mimo_dl_ir_harq_cc_diuc; +static int hf_dlmap_mimo_dl_ir_harq_cc_repetition_coding_indication; +static int hf_dlmap_mimo_dl_ir_harq_cc_acid; +static int hf_dlmap_mimo_dl_ir_harq_cc_ai_sn; +static int hf_dlmap_mimo_dl_ir_harq_cc_spid; +static int hf_dlmap_mimo_dl_stc_harq_n_ack_channel; +static int hf_dlmap_mimo_dl_stc_harq_tx_count; +static int hf_dlmap_mimo_dl_stc_harq_duration; +static int hf_dlmap_mimo_dl_stc_harq_sub_burst_offset_indication; +static int hf_dlmap_mimo_dl_stc_harq_sub_burst_offset; +static int hf_dlmap_mimo_dl_stc_harq_ack_disable; +static int hf_dlmap_mimo_dl_stc_harq_dedicated_mimo_dl_control_indicator; +static int hf_dlmap_mimo_dl_stc_harq_diuc; +static int hf_dlmap_mimo_dl_stc_harq_repetition_coding_indication; +static int hf_dlmap_mimo_dl_stc_harq_acid; +static int hf_dlmap_mbs_map_extended_2_diuc; +static int hf_dlmap_mbs_map_mbs_zone_identifier; +static int hf_dlmap_mbs_map_macro_diversity_enhanced; +static int hf_dlmap_mbs_map_permutation; +static int hf_dlmap_mbs_map_dl_permbase; +static int hf_dlmap_mbs_map_prbs_id; +static int hf_dlmap_mbs_map_ofdma_symbol_offset; +static int hf_dlmap_mbs_map_diuc_change_indication; +static int hf_dlmap_mbs_map_boosting; +static int hf_dlmap_mbs_map_diuc; +static int hf_dlmap_mbs_map_num_subchannels; +static int hf_dlmap_mbs_map_num_ofdma_symbols; +static int hf_dlmap_mbs_map_repetition_coding_indication; +static int hf_dlmap_mbs_map_cid; +static int hf_dlmap_mbs_map_ofdma_symbols_offset; +static int hf_dlmap_mbs_map_subchannel_offset; +static int hf_dlmap_mbs_map_slc_3_indication; +static int hf_dlmap_mbs_map_next_mbs_map_ie_frame_offset; +static int hf_dlmap_skip_extended_2_diuc; +static int hf_dlmap_skip_mode; +static int hf_dlmap_harq_dl_map_extended_2_diuc; +static int hf_dlmap_harq_dl_map_rcid_type; +static int hf_dlmap_harq_dl_map_boosting; +static int hf_dlmap_harq_dl_map_region_id_use_indicator; +static int hf_dlmap_harq_dl_map_ofdma_symbol_offset; +static int hf_dlmap_harq_dl_map_subchannel_offset; +static int hf_dlmap_harq_dl_map_number_of_ofdma_symbols; +static int hf_dlmap_harq_dl_map_number_of_subchannels; +static int hf_dlmap_harq_dl_map_rectangular_sub_burst_indicator; +static int hf_dlmap_harq_dl_map_region_id; +static int hf_dlmap_harq_dl_map_mode; +static int hf_dlmap_harq_dl_map_sub_burst_ie_length; +static int hf_dlmap_harq_dl_map_reserved_mode; +static int hf_dlmap_harq_ack_bitmap_data; +static int hf_dlmap_enhanced_dl_map_extended_2_diuc; +static int hf_dlmap_enhanced_dl_map_num_assignment; +static int hf_dlmap_enhanced_dl_map_n_cid; +static int hf_dlmap_enhanced_dl_map_cid; +static int hf_dlmap_enhanced_dl_map_diuc; +static int hf_dlmap_enhanced_dl_map_boosting; +static int hf_dlmap_enhanced_dl_map_repetition_coding_indication; +static int hf_dlmap_enhanced_dl_map_region_id; +static int hf_dlmap_aas_sdma_dl_extended_2_diuc; +static int hf_dlmap_aas_sdma_dl_rcid_type; +static int hf_dlmap_aas_sdma_dl_num_burst_region; +static int hf_dlmap_aas_sdma_dl_ofdma_symbol_offset; +static int hf_dlmap_aas_sdma_dl_subchannel_offset; +static int hf_dlmap_aas_sdma_dl_num_ofdma_triple_symbols; +static int hf_dlmap_aas_sdma_dl_num_subchannels; +static int hf_dlmap_aas_sdma_dl_number_of_users; +static int hf_dlmap_aas_sdma_dl_encoding_mode; +static int hf_dlmap_aas_sdma_dl_cqich_allocation; +static int hf_dlmap_aas_sdma_dl_ackch_allocation; +static int hf_dlmap_aas_sdma_dl_pilot_pattern_modifier; +static int hf_dlmap_aas_sdma_dl_preamble_modifier_index; +static int hf_dlmap_aas_sdma_dl_pilot_pattern; +static int hf_dlmap_aas_sdma_dl_diuc; +static int hf_dlmap_aas_sdma_dl_repetition_coding_indication; +static int hf_dlmap_aas_sdma_dl_ack_ch_index; +static int hf_dlmap_aas_sdma_dl_acid; +static int hf_dlmap_aas_sdma_dl_ai_sn; +static int hf_dlmap_aas_sdma_dl_nep; +static int hf_dlmap_aas_sdma_dl_nsch; +static int hf_dlmap_aas_sdma_dl_spid; +static int hf_dlmap_aas_sdma_dl_allocation_index; +static int hf_dlmap_aas_sdma_dl_period; +static int hf_dlmap_aas_sdma_dl_frame_offset; +static int hf_dlmap_aas_sdma_dl_duration; +static int hf_dlmap_channel_measurement_channel_nr; +static int hf_dlmap_channel_measurement_ofdma_symbol_offset; +static int hf_dlmap_channel_measurement_cid; +static int hf_dlmap_stc_zone_ofdma_symbol_offset; +static int hf_dlmap_stc_zone_permutations; +static int hf_dlmap_stc_zone_use_all_sc_indicator; +static int hf_dlmap_stc_zone_stc; +static int hf_dlmap_stc_zone_matrix_indicator; +static int hf_dlmap_stc_zone_dl_permbase; +static int hf_dlmap_stc_zone_prbs_id; +static int hf_dlmap_stc_zone_amc_type; +static int hf_dlmap_stc_zone_midamble_presence; +static int hf_dlmap_stc_zone_midamble_boosting; +static int hf_dlmap_stc_zone_2_3_antenna_select; +static int hf_dlmap_stc_zone_dedicated_pilots; +static int hf_dlmap_aas_dl_ofdma_symbol_offset; +static int hf_dlmap_aas_dl_permutation; +static int hf_dlmap_aas_dl_dl_permbase; +static int hf_dlmap_aas_dl_downlink_preamble_config; +static int hf_dlmap_aas_dl_preamble_type; +static int hf_dlmap_aas_dl_prbs_id; +static int hf_dlmap_aas_dl_diversity_map; +static int hf_dlmap_data_location_another_bs_segment; +static int hf_dlmap_data_location_another_bs_used_subchannels; +static int hf_dlmap_data_location_another_bs_diuc; +static int hf_dlmap_data_location_another_bs_frame_advance; +static int hf_dlmap_data_location_another_bs_ofdma_symbol_offset; +static int hf_dlmap_data_location_another_bs_subchannel_offset; +static int hf_dlmap_data_location_another_bs_boosting; +static int hf_dlmap_data_location_another_bs_preamble_index; +static int hf_dlmap_data_location_another_bs_num_ofdma_symbols; +static int hf_dlmap_data_location_another_bs_num_subchannels; +static int hf_dlmap_data_location_another_bs_repetition_coding_indication; +static int hf_dlmap_data_location_another_bs_cid; +static int hf_dlmap_harq_map_pointer_diuc; +static int hf_dlmap_harq_map_pointer_num_slots; +static int hf_dlmap_harq_map_pointer_repetition_coding_indication; +static int hf_dlmap_harq_map_pointer_map_version; +static int hf_dlmap_harq_map_pointer_idle_users; +static int hf_dlmap_harq_map_pointer_sleep_users; +static int hf_dlmap_harq_map_pointer_cid_mask_length; +static int hf_dlmap_phymod_dl_preamble_modifier_type; +static int hf_dlmap_phymod_dl_preamble_frequency_shift_index; +static int hf_dlmap_phymod_dl_preamble_time_shift_index; +static int hf_dlmap_phymod_dl_pilot_pattern_modifier; +static int hf_dlmap_phymod_dl_pilot_pattern_index; +static int hf_dlmap_broadcast_ctrl_ptr_dcd_ucd_transmission_frame; +static int hf_dlmap_broadcast_ctrl_ptr_skip_broadcast_system_update; +static int hf_dlmap_broadcast_ctrl_ptr_broadcast_system_update_type; +static int hf_dlmap_broadcast_ctrl_ptr_broadcast_system_update_transmission_frame; +static int hf_dlmap_dl_pusc_burst_allocation_cid; +static int hf_dlmap_dl_pusc_burst_allocation_diuc; +static int hf_dlmap_dl_pusc_burst_allocation_segment; +static int hf_dlmap_dl_pusc_burst_allocation_boosting; +static int hf_dlmap_dl_pusc_burst_allocation_idcell; +static int hf_dlmap_dl_pusc_burst_allocation_dl_permbase; +static int hf_dlmap_dl_pusc_burst_allocation_prbs_id; +static int hf_dlmap_dl_pusc_burst_allocation_repetition_coding_indication; +static int hf_dlmap_dl_pusc_burst_allocation_used_subchannels; +static int hf_dlmap_dl_pusc_burst_allocation_ofdma_symbol_offset; +static int hf_dlmap_dl_pusc_burst_allocation_num_ofdma_symbols; +static int hf_dlmap_dl_pusc_burst_allocation_subchannel_offset; +static int hf_dlmap_dl_pusc_burst_allocation_num_subchannels; +static int hf_dlmap_pusc_asca_alloc_diuc; +static int hf_dlmap_pusc_asca_alloc_short_basic_cid; +static int hf_dlmap_pusc_asca_alloc_ofdma_symbol_offset; +static int hf_dlmap_pusc_asca_alloc_subchannel_offset; +static int hf_dlmap_pusc_asca_alloc_num_ofdma_symbols; +static int hf_dlmap_pusc_asca_alloc_num_symbols; +static int hf_dlmap_pusc_asca_alloc_repetition_coding_information; +static int hf_dlmap_pusc_asca_alloc_permutation_id; +static int hf_dlmap_reduced_aas_num_ie; +static int hf_dlmap_reduced_aas_periodicity; +static int hf_dlmap_reduced_aas_cid_included; +static int hf_dlmap_reduced_aas_dcd_count_included; +static int hf_dlmap_reduced_aas_phy_modification_included; +static int hf_dlmap_reduced_aas_cqich_control_indicator; +static int hf_dlmap_reduced_aas_encoding_mode; +static int hf_dlmap_reduced_aas_separate_mcs_enabled; +static int hf_dlmap_reduced_aas_duration; +static int hf_dlmap_reduced_aas_diuc; +static int hf_dlmap_reduced_aas_repetition_coding_indication; +static int hf_dlmap_reduced_aas_cid; +static int hf_dlmap_reduced_aas_allocation_index; +static int hf_dlmap_reduced_aas_report_period; +static int hf_dlmap_reduced_aas_frame_offset; +static int hf_dlmap_reduced_aas_report_duration; +static int hf_dlmap_reduced_aas_cqi_measurement_type; +static int hf_dlmap_reduced_aas_dcd_count; +static int hf_dlmap_reduced_aas_preamble_select; +static int hf_dlmap_reduced_aas_preamble_shift_index; +static int hf_dlmap_reduced_aas_pilot_pattern_modifier; +static int hf_dlmap_reduced_aas_pilot_pattern_index; +static int hf_dlmap_reduced_aas_dl_frame_offset; +static int hf_dlmap_reduced_aas_zone_symbol_offset; +static int hf_dlmap_reduced_aas_ofdma_symbol_offset; +static int hf_dlmap_reduced_aas_subchannel_offset; +static int hf_dlmap_reduced_aas_num_ofdma_triple_symbol; +static int hf_dlmap_reduced_aas_num_subchannels; +static int hf_dlmap_reduced_aas_num_ofdma_symbols; +static int hf_dlmap_reduced_aas_diuc_nep; +static int hf_dlmap_reduced_aas_dl_harq_ack_bitmap; +static int hf_dlmap_reduced_aas_ack_allocation_index; +static int hf_dlmap_reduced_aas_acid; +static int hf_dlmap_reduced_aas_ai_sn; +static int hf_dlmap_reduced_aas_nsch; +static int hf_dlmap_reduced_aas_spid; + + + +static expert_field ei_dlmap_not_implemented; +static expert_field ei_crc16; +static expert_field ei_mac_header_compress_dlmap_crc; +static expert_field ei_mac_header_invalid_length; /* Copied and renamed from proto.c because global value_strings don't work for plugins */ static const value_string plugin_proto_checksum_vals[] = { @@ -3458,13 +3460,11 @@ void proto_register_mac_mgmt_msg_dlmap(void) proto_register_subtree_array(ett, array_length(ett)); expert_mac_mgmt_msg_dlmap = expert_register_protocol(proto_mac_mgmt_msg_dlmap_decoder); expert_register_field_array(expert_mac_mgmt_msg_dlmap, ei, array_length(ei)); + dlmap_handle = register_dissector("mac_mgmt_msg_dlmap_handler", dissect_mac_mgmt_msg_dlmap_decoder, proto_mac_mgmt_msg_dlmap_decoder); } void proto_reg_handoff_mac_mgmt_msg_dlmap(void) { - dissector_handle_t dlmap_handle; - - dlmap_handle = create_dissector_handle(dissect_mac_mgmt_msg_dlmap_decoder, proto_mac_mgmt_msg_dlmap_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DL_MAP, dlmap_handle); } diff --git a/plugins/epan/wimax/msg_dreg.c b/plugins/epan/wimax/msg_dreg.c index dcc142ad47..71f9316f1d 100644 --- a/plugins/epan/wimax/msg_dreg.c +++ b/plugins/epan/wimax/msg_dreg.c @@ -28,13 +28,18 @@ void proto_register_mac_mgmt_msg_dreg_req(void); void proto_register_mac_mgmt_msg_dreg_cmd(void); void proto_reg_handoff_mac_mgmt_msg_dreg(void); +static dissector_handle_t dreg_req_handle; +static dissector_handle_t dreg_cmd_handle; + /* Forward reference */ static void dissect_dreg_tlv(proto_tree *dreg_tree, gint tlv_type, tvbuff_t *tvb, guint tlv_offset, guint tlv_len); +static int dissect_mac_mgmt_msg_dreg_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); +static int dissect_mac_mgmt_msg_dreg_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); -static gint proto_mac_mgmt_msg_dreg_req_decoder = -1; -static gint proto_mac_mgmt_msg_dreg_cmd_decoder = -1; +static gint proto_mac_mgmt_msg_dreg_req_decoder; +static gint proto_mac_mgmt_msg_dreg_cmd_decoder; -static gint ett_mac_mgmt_msg_dreg_decoder = -1; +static gint ett_mac_mgmt_msg_dreg_decoder; /* Setup protocol subtree array */ static gint *ett[] = @@ -43,29 +48,29 @@ static gint *ett[] = }; /* DREG fields */ -/* static gint hf_ack_type_reserved = -1; */ -static gint hf_dreg_cmd_action = -1; -static gint hf_dreg_cmd_action_cor2 = -1; -static gint hf_dreg_cmd_reserved = -1; -static gint hf_dreg_paging_cycle = -1; -static gint hf_dreg_paging_offset = -1; -static gint hf_dreg_paging_group_id = -1; -static gint hf_dreg_req_duration = -1; -static gint hf_paging_controller_id = -1; -static gint hf_mac_hash_skip_threshold = -1; -static gint hf_dreg_paging_cycle_request = -1; -static gint hf_dreg_retain_ms_service_sbc = -1; -static gint hf_dreg_retain_ms_service_pkm = -1; -static gint hf_dreg_retain_ms_service_reg = -1; -static gint hf_dreg_retain_ms_service_network_address = -1; -static gint hf_dreg_retain_ms_service_tod = -1; -static gint hf_dreg_retain_ms_service_tftp = -1; -static gint hf_dreg_retain_ms_service_full_service = -1; -static gint hf_dreg_consider_paging_pref = -1; -static gint hf_tlv_value = -1; -static gint hf_dreg_req_action = -1; -static gint hf_dreg_req_reserved = -1; -static gint hf_dreg_invalid_tlv = -1; +/* static gint hf_ack_type_reserved; */ +static gint hf_dreg_cmd_action; +static gint hf_dreg_cmd_action_cor2; +static gint hf_dreg_cmd_reserved; +static gint hf_dreg_paging_cycle; +static gint hf_dreg_paging_offset; +static gint hf_dreg_paging_group_id; +static gint hf_dreg_req_duration; +static gint hf_paging_controller_id; +static gint hf_mac_hash_skip_threshold; +static gint hf_dreg_paging_cycle_request; +static gint hf_dreg_retain_ms_service_sbc; +static gint hf_dreg_retain_ms_service_pkm; +static gint hf_dreg_retain_ms_service_reg; +static gint hf_dreg_retain_ms_service_network_address; +static gint hf_dreg_retain_ms_service_tod; +static gint hf_dreg_retain_ms_service_tftp; +static gint hf_dreg_retain_ms_service_full_service; +static gint hf_dreg_consider_paging_pref; +static gint hf_tlv_value; +static gint hf_dreg_req_action; +static gint hf_dreg_req_reserved; +static gint hf_dreg_invalid_tlv; /* STRING RESOURCES */ static const value_string vals_dreg_req_code[] = { @@ -341,6 +346,7 @@ void proto_register_mac_mgmt_msg_dreg_req(void) proto_register_field_array(proto_mac_mgmt_msg_dreg_req_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + dreg_req_handle = register_dissector("mac_mgmt_msg_dreg_req_handler", dissect_mac_mgmt_msg_dreg_req_decoder, proto_mac_mgmt_msg_dreg_req_decoder); } /* Register Wimax Mac Payload Protocol and Dissector */ @@ -351,6 +357,7 @@ void proto_register_mac_mgmt_msg_dreg_cmd(void) "WiMax DREG-CMD", /* short name */ "wmx.dreg_cmd" /* abbrev */ ); + dreg_cmd_handle = register_dissector("mac_mgmt_msg_dreg_cmd_handler", dissect_mac_mgmt_msg_dreg_cmd_decoder, proto_mac_mgmt_msg_dreg_cmd_decoder); } /* Decode DREG-REQ messages. */ @@ -504,13 +511,8 @@ static int dissect_mac_mgmt_msg_dreg_cmd_decoder(tvbuff_t *tvb, packet_info *pin void proto_reg_handoff_mac_mgmt_msg_dreg(void) { - dissector_handle_t dreg_handle; - - dreg_handle = create_dissector_handle(dissect_mac_mgmt_msg_dreg_req_decoder, proto_mac_mgmt_msg_dreg_req_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DREG_REQ, dreg_handle); - - dreg_handle = create_dissector_handle(dissect_mac_mgmt_msg_dreg_cmd_decoder, proto_mac_mgmt_msg_dreg_cmd_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DREG_CMD, dreg_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DREG_REQ, dreg_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DREG_CMD, dreg_cmd_handle); } /* diff --git a/plugins/epan/wimax/msg_dsa.c b/plugins/epan/wimax/msg_dsa.c index 96480914e3..4f8c650e2c 100644 --- a/plugins/epan/wimax/msg_dsa.c +++ b/plugins/epan/wimax/msg_dsa.c @@ -27,14 +27,18 @@ void proto_register_mac_mgmt_msg_dsa(void); void proto_reg_handoff_mac_mgmt_msg_dsa(void); -static gint proto_mac_mgmt_msg_dsa_decoder = -1; -static gint ett_mac_mgmt_msg_dsa_req_decoder = -1; -static gint ett_mac_mgmt_msg_dsa_rsp_decoder = -1; -static gint ett_mac_mgmt_msg_dsa_ack_decoder = -1; +static dissector_handle_t dsa_req_handle; +static dissector_handle_t dsa_rsp_handle; +static dissector_handle_t dsa_ack_handle; + +static gint proto_mac_mgmt_msg_dsa_decoder; +static gint ett_mac_mgmt_msg_dsa_req_decoder; +static gint ett_mac_mgmt_msg_dsa_rsp_decoder; +static gint ett_mac_mgmt_msg_dsa_ack_decoder; /* fix fields */ -static gint hf_dsa_transaction_id = -1; -static gint hf_dsa_confirmation_code = -1; +static gint hf_dsa_transaction_id; +static gint hf_dsa_confirmation_code; static int dissect_mac_mgmt_msg_dsa_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -152,21 +156,18 @@ void proto_register_mac_mgmt_msg_dsa(void) proto_register_field_array(proto_mac_mgmt_msg_dsa_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + dsa_req_handle = register_dissector("mac_mgmt_msg_dsa_req_handler", dissect_mac_mgmt_msg_dsa_req_decoder, proto_mac_mgmt_msg_dsa_decoder); + dsa_rsp_handle = register_dissector("mac_mgmt_msg_dsa_rsp_handler", dissect_mac_mgmt_msg_dsa_rsp_decoder, proto_mac_mgmt_msg_dsa_decoder); + dsa_ack_handle = register_dissector("mac_mgmt_msg_dsa_ack_handler", dissect_mac_mgmt_msg_dsa_ack_decoder, proto_mac_mgmt_msg_dsa_decoder); } void proto_reg_handoff_mac_mgmt_msg_dsa (void) { - dissector_handle_t dsa_handle; - - dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_req_decoder, proto_mac_mgmt_msg_dsa_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_REQ, dsa_handle); - - dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_rsp_decoder, proto_mac_mgmt_msg_dsa_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_RSP, dsa_handle); - - dsa_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsa_ack_decoder, proto_mac_mgmt_msg_dsa_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_ACK, dsa_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_REQ, dsa_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_RSP, dsa_rsp_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSA_ACK, dsa_ack_handle); } /* diff --git a/plugins/epan/wimax/msg_dsc.c b/plugins/epan/wimax/msg_dsc.c index 7afc6bc855..e196621d8d 100644 --- a/plugins/epan/wimax/msg_dsc.c +++ b/plugins/epan/wimax/msg_dsc.c @@ -27,14 +27,18 @@ void proto_register_mac_mgmt_msg_dsc(void); void proto_reg_handoff_mac_mgmt_msg_dsc(void); -static gint proto_mac_mgmt_msg_dsc_decoder = -1; -static gint ett_mac_mgmt_msg_dsc_req_decoder = -1; -static gint ett_mac_mgmt_msg_dsc_rsp_decoder = -1; -static gint ett_mac_mgmt_msg_dsc_ack_decoder = -1; +static dissector_handle_t dsc_req_handle; +static dissector_handle_t dsc_rsp_handle; +static dissector_handle_t dsc_ack_handle; + +static gint proto_mac_mgmt_msg_dsc_decoder; +static gint ett_mac_mgmt_msg_dsc_req_decoder; +static gint ett_mac_mgmt_msg_dsc_rsp_decoder; +static gint ett_mac_mgmt_msg_dsc_ack_decoder; /* fix fields */ -static gint hf_dsc_transaction_id = -1; -static gint hf_dsc_confirmation_code = -1; +static gint hf_dsc_transaction_id; +static gint hf_dsc_confirmation_code; static int dissect_mac_mgmt_msg_dsc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -154,22 +158,17 @@ void proto_register_mac_mgmt_msg_dsc(void) proto_register_field_array(proto_mac_mgmt_msg_dsc_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("mac_mgmt_msg_dsc_rsp_handler", dissect_mac_mgmt_msg_dsc_rsp_decoder, -1); + dsc_req_handle = register_dissector("mac_mgmt_msg_dsc_req_handler", dissect_mac_mgmt_msg_dsc_req_decoder, proto_mac_mgmt_msg_dsc_decoder); + dsc_rsp_handle = register_dissector("mac_mgmt_msg_dsc_rsp_handler", dissect_mac_mgmt_msg_dsc_rsp_decoder, proto_mac_mgmt_msg_dsc_decoder); + dsc_ack_handle = register_dissector("mac_mgmt_msg_dsc_ack_handler", dissect_mac_mgmt_msg_dsc_ack_decoder, proto_mac_mgmt_msg_dsc_decoder); } void proto_reg_handoff_mac_mgmt_msg_dsc(void) { - dissector_handle_t dsc_handle; - - dsc_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsc_req_decoder, proto_mac_mgmt_msg_dsc_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_REQ, dsc_handle); - - dsc_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsc_rsp_decoder, proto_mac_mgmt_msg_dsc_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_RSP, dsc_handle); - - dsc_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsc_ack_decoder, proto_mac_mgmt_msg_dsc_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_ACK, dsc_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_REQ, dsc_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_RSP, dsc_rsp_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSC_ACK, dsc_ack_handle); } /* diff --git a/plugins/epan/wimax/msg_dsd.c b/plugins/epan/wimax/msg_dsd.c index 86f90c8fa7..6433336caa 100644 --- a/plugins/epan/wimax/msg_dsd.c +++ b/plugins/epan/wimax/msg_dsd.c @@ -28,20 +28,23 @@ void proto_register_mac_mgmt_msg_dsd(void); void proto_reg_handoff_mac_mgmt_msg_dsd(void); -static gint proto_mac_mgmt_msg_dsd_decoder = -1; -static gint ett_mac_mgmt_msg_dsd_req_decoder = -1; -static gint ett_mac_mgmt_msg_dsd_rsp_decoder = -1; -/* static gint ett_dsd_ul_sfe_decoder = -1; */ -/* static gint ett_dsd_dl_sfe_decoder = -1; */ -/* static gint ett_dsd_hmac_tuple = -1; */ -/* static gint ett_dsd_cmac_tuple = -1; */ +static dissector_handle_t dsd_req_handle; +static dissector_handle_t dsd_rsp_handle; + +static gint proto_mac_mgmt_msg_dsd_decoder; +static gint ett_mac_mgmt_msg_dsd_req_decoder; +static gint ett_mac_mgmt_msg_dsd_rsp_decoder; +/* static gint ett_dsd_ul_sfe_decoder; */ +/* static gint ett_dsd_dl_sfe_decoder; */ +/* static gint ett_dsd_hmac_tuple; */ +/* static gint ett_dsd_cmac_tuple; */ /* fix fields */ -static gint hf_dsd_transaction_id = -1; -static gint hf_dsd_service_flow_id = -1; -static gint hf_dsd_confirmation_code = -1; -static gint hf_dsd_invalid_tlv = -1; -static gint hf_dsd_unknown_type = -1; +static gint hf_dsd_transaction_id; +static gint hf_dsd_service_flow_id; +static gint hf_dsd_confirmation_code; +static gint hf_dsd_invalid_tlv; +static gint hf_dsd_unknown_type; static int dissect_mac_mgmt_msg_dsd_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -249,18 +252,16 @@ void proto_register_mac_mgmt_msg_dsd(void) proto_register_field_array(proto_mac_mgmt_msg_dsd_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + dsd_req_handle = register_dissector("mac_mgmt_msg_dsd_req_handler", dissect_mac_mgmt_msg_dsd_req_decoder, proto_mac_mgmt_msg_dsd_decoder); + dsd_rsp_handle = register_dissector("mac_mgmt_msg_dsd_rsp_handler", dissect_mac_mgmt_msg_dsd_rsp_decoder, proto_mac_mgmt_msg_dsd_decoder); } void proto_reg_handoff_mac_mgmt_msg_dsd(void) { - dissector_handle_t dsd_handle; - - dsd_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsd_req_decoder, proto_mac_mgmt_msg_dsd_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSD_REQ, dsd_handle); - - dsd_handle = create_dissector_handle(dissect_mac_mgmt_msg_dsd_rsp_decoder, proto_mac_mgmt_msg_dsd_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSD_RSP, dsd_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSD_REQ, dsd_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSD_RSP, dsd_rsp_handle); } diff --git a/plugins/epan/wimax/msg_dsx_rvd.c b/plugins/epan/wimax/msg_dsx_rvd.c index 1dfdbc70f5..3ae81b4dbe 100644 --- a/plugins/epan/wimax/msg_dsx_rvd.c +++ b/plugins/epan/wimax/msg_dsx_rvd.c @@ -22,12 +22,14 @@ void proto_register_mac_mgmt_msg_dsx_rvd(void); void proto_reg_handoff_mac_mgmt_msg_dsx_rvd(void); -static gint proto_mac_mgmt_msg_dsx_rvd_decoder = -1; -static gint ett_mac_mgmt_msg_dsx_rvd_decoder = -1; +static dissector_handle_t dsx_rvd_handle; + +static gint proto_mac_mgmt_msg_dsx_rvd_decoder; +static gint ett_mac_mgmt_msg_dsx_rvd_decoder; /* fix fields */ -static gint hf_dsx_rvd_transaction_id = -1; -static gint hf_dsx_rvd_confirmation_code = -1; +static gint hf_dsx_rvd_transaction_id; +static gint hf_dsx_rvd_confirmation_code; /* Decode DSX-RVD messages. */ @@ -82,15 +84,13 @@ void proto_register_mac_mgmt_msg_dsx_rvd(void) proto_register_field_array(proto_mac_mgmt_msg_dsx_rvd_decoder, hf_dsx_rvd, array_length(hf_dsx_rvd)); proto_register_subtree_array(ett, array_length(ett)); + dsx_rvd_handle = register_dissector("mac_mgmt_msg_dsx_rvd_handler", dissect_mac_mgmt_msg_dsx_rvd_decoder, proto_mac_mgmt_msg_dsx_rvd_decoder); } void proto_reg_handoff_mac_mgmt_msg_dsx_rvd(void) { - dissector_handle_t handle; - - handle = create_dissector_handle(dissect_mac_mgmt_msg_dsx_rvd_decoder, proto_mac_mgmt_msg_dsx_rvd_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSX_RVD, handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DSX_RVD, dsx_rvd_handle); } /* diff --git a/plugins/epan/wimax/msg_fpc.c b/plugins/epan/wimax/msg_fpc.c index 457a4d0e8e..e1e2bfa999 100644 --- a/plugins/epan/wimax/msg_fpc.c +++ b/plugins/epan/wimax/msg_fpc.c @@ -23,16 +23,18 @@ void proto_register_mac_mgmt_msg_fpc(void); void proto_reg_handoff_mac_mgmt_msg_fpc(void); -static gint proto_mac_mgmt_msg_fpc_decoder = -1; +static dissector_handle_t fpc_handle; -static gint ett_mac_mgmt_msg_fpc_decoder = -1; +static gint proto_mac_mgmt_msg_fpc_decoder; + +static gint ett_mac_mgmt_msg_fpc_decoder; /* FPC fields */ -static gint hf_fpc_number_of_stations = -1; -static gint hf_fpc_basic_cid = -1; -static gint hf_fpc_power_adjust = -1; -static gint hf_fpc_power_measurement_frame = -1; -/* static gint hf_fpc_invalid_tlv = -1; */ +static gint hf_fpc_number_of_stations; +static gint hf_fpc_basic_cid; +static gint hf_fpc_power_adjust; +static gint hf_fpc_power_measurement_frame; +/* static gint hf_fpc_invalid_tlv; */ /* Decode FPC messages. */ @@ -141,14 +143,12 @@ void proto_register_mac_mgmt_msg_fpc(void) proto_register_field_array(proto_mac_mgmt_msg_fpc_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + fpc_handle = register_dissector("mac_mgmt_msg_fpc_handler", dissect_mac_mgmt_msg_fpc_decoder, proto_mac_mgmt_msg_fpc_decoder); } void proto_reg_handoff_mac_mgmt_msg_fpc(void) { - dissector_handle_t fpc_handle; - - fpc_handle = create_dissector_handle(dissect_mac_mgmt_msg_fpc_decoder, proto_mac_mgmt_msg_fpc_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_FPC, fpc_handle); } diff --git a/plugins/epan/wimax/msg_pkm.c b/plugins/epan/wimax/msg_pkm.c index f4bd760ca7..37e61d372b 100644 --- a/plugins/epan/wimax/msg_pkm.c +++ b/plugins/epan/wimax/msg_pkm.c @@ -28,9 +28,13 @@ void proto_register_mac_mgmt_msg_pkm(void); void proto_reg_handoff_mac_mgmt_msg_pkm(void); -static gint proto_mac_mgmt_msg_pkm_decoder = -1; -static gint ett_mac_mgmt_msg_pkm_req_decoder = -1; -static gint ett_mac_mgmt_msg_pkm_rsp_decoder = -1; +static dissector_handle_t mac_mgmt_msg_pkm_req_handle; +static dissector_handle_t mac_mgmt_msg_pkm_rsp_handle; + + +static gint proto_mac_mgmt_msg_pkm_decoder; +static gint ett_mac_mgmt_msg_pkm_req_decoder; +static gint ett_mac_mgmt_msg_pkm_rsp_decoder; static const value_string vals_pkm_msg_code[] = { @@ -66,8 +70,8 @@ static const value_string vals_pkm_msg_code[] = }; /* fix fields */ -static gint hf_pkm_msg_code = -1; -static gint hf_pkm_msg_pkm_id = -1; +static gint hf_pkm_msg_code; +static gint hf_pkm_msg_pkm_id; /* Wimax Mac PKM-REQ Message Dissector */ @@ -150,16 +154,13 @@ void proto_register_mac_mgmt_msg_pkm(void) proto_register_field_array(proto_mac_mgmt_msg_pkm_decoder, hf_pkm, array_length(hf_pkm)); proto_register_subtree_array(ett_pkm, array_length(ett_pkm)); + mac_mgmt_msg_pkm_req_handle = register_dissector("mac_mgmt_msg_pkm_req_handler", dissect_mac_mgmt_msg_pkm_req_decoder, proto_mac_mgmt_msg_pkm_decoder); + mac_mgmt_msg_pkm_rsp_handle = register_dissector("mac_mgmt_msg_pkm_rsp_handler", dissect_mac_mgmt_msg_pkm_rsp_decoder, proto_mac_mgmt_msg_pkm_decoder); } void proto_reg_handoff_mac_mgmt_msg_pkm(void) { - dissector_handle_t mac_mgmt_msg_pkm_req_handle; - dissector_handle_t mac_mgmt_msg_pkm_rsp_handle; - - mac_mgmt_msg_pkm_req_handle = create_dissector_handle(dissect_mac_mgmt_msg_pkm_req_decoder, proto_mac_mgmt_msg_pkm_decoder); dissector_add_uint( "wmx.mgmtmsg", MAC_MGMT_MSG_PKM_REQ, mac_mgmt_msg_pkm_req_handle ); - mac_mgmt_msg_pkm_rsp_handle = create_dissector_handle(dissect_mac_mgmt_msg_pkm_rsp_decoder, proto_mac_mgmt_msg_pkm_decoder); dissector_add_uint( "wmx.mgmtmsg", MAC_MGMT_MSG_PKM_RSP, mac_mgmt_msg_pkm_rsp_handle ); } diff --git a/plugins/epan/wimax/msg_pmc.c b/plugins/epan/wimax/msg_pmc.c index d03a4a70d1..c11c709a07 100644 --- a/plugins/epan/wimax/msg_pmc.c +++ b/plugins/epan/wimax/msg_pmc.c @@ -25,11 +25,16 @@ extern gboolean include_cor2_changes; void proto_register_mac_mgmt_msg_pmc_req(void); void proto_register_mac_mgmt_msg_pmc_rsp(void); void proto_reg_handoff_mac_mgmt_msg_pmc(void); +static int dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); +static int dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data); -static gint proto_mac_mgmt_msg_pmc_req_decoder = -1; -static gint proto_mac_mgmt_msg_pmc_rsp_decoder = -1; +static dissector_handle_t pmc_req_handle; +static dissector_handle_t pmc_rsp_handle; -static gint ett_mac_mgmt_msg_pmc_decoder = -1; +static gint proto_mac_mgmt_msg_pmc_req_decoder; +static gint proto_mac_mgmt_msg_pmc_rsp_decoder; + +static gint ett_mac_mgmt_msg_pmc_decoder; /* Setup protocol subtree array */ static gint *ett[] = @@ -38,14 +43,14 @@ static gint *ett[] = }; /* PMC fields */ -static gint hf_pmc_req_pwr_control_mode_change = -1; -static gint hf_pmc_req_pwr_control_mode_change_cor2 = -1; -static gint hf_pmc_req_tx_power_level = -1; -static gint hf_pmc_req_confirmation = -1; -static gint hf_pmc_req_reserved = -1; -static gint hf_pmc_rsp_start_frame = -1; -static gint hf_pmc_rsp_power_adjust = -1; -static gint hf_pmc_rsp_offset_BS_per_MS = -1; +static gint hf_pmc_req_pwr_control_mode_change; +static gint hf_pmc_req_pwr_control_mode_change_cor2; +static gint hf_pmc_req_tx_power_level; +static gint hf_pmc_req_confirmation; +static gint hf_pmc_req_reserved; +static gint hf_pmc_rsp_start_frame; +static gint hf_pmc_rsp_power_adjust; +static gint hf_pmc_rsp_offset_BS_per_MS; /* STRING RESOURCES */ static const value_string vals_pmc_req_pwr[] = { @@ -142,6 +147,7 @@ void proto_register_mac_mgmt_msg_pmc_req(void) proto_register_field_array(proto_mac_mgmt_msg_pmc_req_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + pmc_req_handle = register_dissector("mac_mgmt_msg_pmc_req_handler", dissect_mac_mgmt_msg_pmc_req_decoder, proto_mac_mgmt_msg_pmc_req_decoder); } /* Register Wimax Mac Payload Protocol and Dissector */ @@ -152,6 +158,7 @@ void proto_register_mac_mgmt_msg_pmc_rsp(void) "WiMax PMC-RSP", /* short name */ "wmx.pmc_rsp" /* abbrev */ ); + pmc_rsp_handle = register_dissector("mac_mgmt_msg_pmc_rsp_handler", dissect_mac_mgmt_msg_pmc_rsp_decoder, proto_mac_mgmt_msg_pmc_rsp_decoder); } /* Decode PMC-REQ messages. */ @@ -223,13 +230,8 @@ static int dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t *tvb, packet_info *pinf void proto_reg_handoff_mac_mgmt_msg_pmc(void) { - dissector_handle_t pmc_handle; - - pmc_handle = create_dissector_handle(dissect_mac_mgmt_msg_pmc_req_decoder, proto_mac_mgmt_msg_pmc_req_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_REQ, pmc_handle); - - pmc_handle = create_dissector_handle(dissect_mac_mgmt_msg_pmc_rsp_decoder, proto_mac_mgmt_msg_pmc_rsp_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_RSP, pmc_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_REQ, pmc_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_RSP, pmc_rsp_handle); } /* diff --git a/plugins/epan/wimax/msg_prc_lt_ctrl.c b/plugins/epan/wimax/msg_prc_lt_ctrl.c index e4dc9ccd1f..084d5ba0c3 100644 --- a/plugins/epan/wimax/msg_prc_lt_ctrl.c +++ b/plugins/epan/wimax/msg_prc_lt_ctrl.c @@ -23,14 +23,16 @@ void proto_register_mac_mgmt_msg_prc_lt_ctrl(void); void proto_reg_handoff_mac_mgmt_msg_prc_lt_ctrl(void); -static gint proto_mac_mgmt_msg_prc_lt_ctrl_decoder = -1; +static dissector_handle_t prc_handle; -static gint ett_mac_mgmt_msg_prc_lt_ctrl_decoder = -1; +static gint proto_mac_mgmt_msg_prc_lt_ctrl_decoder; + +static gint ett_mac_mgmt_msg_prc_lt_ctrl_decoder; /* PRC-LT-CTRL fields */ -static gint hf_prc_lt_ctrl_precoding = -1; -static gint hf_prc_lt_ctrl_precoding_delay = -1; -/* static gint hf_prc_lt_ctrl_invalid_tlv = -1; */ +static gint hf_prc_lt_ctrl_precoding; +static gint hf_prc_lt_ctrl_precoding_delay; +/* static gint hf_prc_lt_ctrl_invalid_tlv; */ static const value_string vals_turn_on[] = { {0, "Turn off"}, @@ -83,7 +85,7 @@ void proto_register_mac_mgmt_msg_prc_lt_ctrl(void) &hf_prc_lt_ctrl_precoding, { "Setup/Tear-down long-term precoding with feedback", - "wimax.prc_lt_ctrl.precoding", + "wmx.prc_lt_ctrl.precoding", FT_UINT8, BASE_DEC, VALS(vals_turn_on), 0x80, NULL, HFILL } }, @@ -91,7 +93,7 @@ void proto_register_mac_mgmt_msg_prc_lt_ctrl(void) &hf_prc_lt_ctrl_precoding_delay, { "BS precoding application delay", - "wimax.prc_lt_ctrl.precoding_delay", + "wmx.prc_lt_ctrl.precoding_delay", FT_UINT8, BASE_DEC, NULL, 0x60, NULL, HFILL } } @@ -106,20 +108,18 @@ void proto_register_mac_mgmt_msg_prc_lt_ctrl(void) proto_mac_mgmt_msg_prc_lt_ctrl_decoder = proto_register_protocol ( "WiMax PRC-LT-CTRL Message", /* name */ "WiMax PRC-LT-CTRL (prc)", /* short name */ - "wmx.prc" /* abbrev */ + "wmx.prc_lt_ctrl" /* abbrev */ ); proto_register_field_array(proto_mac_mgmt_msg_prc_lt_ctrl_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + prc_handle = register_dissector("mac_mgmt_msg_prc_lt_ctrl_handler", dissect_mac_mgmt_msg_prc_lt_ctrl_decoder, proto_mac_mgmt_msg_prc_lt_ctrl_decoder); } void proto_reg_handoff_mac_mgmt_msg_prc_lt_ctrl(void) { - dissector_handle_t handle; - - handle = create_dissector_handle(dissect_mac_mgmt_msg_prc_lt_ctrl_decoder, proto_mac_mgmt_msg_prc_lt_ctrl_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PRC_LT_CTRL, handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PRC_LT_CTRL, prc_handle); } /* diff --git a/plugins/epan/wimax/msg_reg_req.c b/plugins/epan/wimax/msg_reg_req.c index bd68b91695..3387776498 100644 --- a/plugins/epan/wimax/msg_reg_req.c +++ b/plugins/epan/wimax/msg_reg_req.c @@ -28,121 +28,123 @@ extern gboolean include_cor2_changes; void proto_register_mac_mgmt_msg_reg_req(void); void proto_reg_handoff_mac_mgmt_msg_reg_req(void); -static gint proto_mac_mgmt_msg_reg_req_decoder = -1; -static gint ett_mac_mgmt_msg_reg_req_decoder = -1; +static dissector_handle_t reg_req_handle; + +static gint proto_mac_mgmt_msg_reg_req_decoder; +static gint ett_mac_mgmt_msg_reg_req_decoder; /* REG-REQ fields */ -static gint hf_reg_ss_mgmt_support = -1; -static gint hf_reg_ip_mgmt_mode = -1; -static gint hf_reg_ip_version = -1; -static gint hf_reg_req_secondary_mgmt_cid = -1; -static gint hf_reg_ul_cids = -1; -static gint hf_reg_max_classifiers = -1; -static gint hf_reg_phs = -1; -static gint hf_reg_arq = -1; -static gint hf_reg_dsx_flow_control = -1; -static gint hf_reg_mac_crc_support = -1; -static gint hf_reg_mca_flow_control = -1; -static gint hf_reg_mcast_polling_cids = -1; -static gint hf_reg_num_dl_trans_cid = -1; -static gint hf_reg_mac_address = -1; -static gint hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame = -1; -static gint hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame = -1; -static gint hf_reg_tlv_t_21_packing_support = -1; -static gint hf_reg_tlv_t_22_mac_extended_rtps_support = -1; -static gint hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms = -1; -static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcp = -1; -static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_mobile_ipv4 = -1; -static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcpv6 = -1; -static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_ipv6 = -1; -static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_rsvd = -1; -static gint hf_reg_tlv_t_27_handover_fbss_mdho_ho_disable = -1; -static gint hf_reg_tlv_t_27_handover_fbss_mdho_dl_rf_monitoring_maps = -1; -static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_single_map = -1; -static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_maps = -1; -static gint hf_reg_tlv_t_27_handover_mdho_ul_multiple = -1; -static gint hf_reg_tlv_t_27_handover_reserved = -1; -static gint hf_reg_tlv_t_29_ho_process_opt_ms_timer = -1; -static gint hf_reg_tlv_t_31_mobility_handover = -1; -static gint hf_reg_tlv_t_31_mobility_sleep_mode = -1; -static gint hf_reg_tlv_t_31_mobility_idle_mode = -1; -static gint hf_reg_req_tlv_t_32_sleep_mode_recovery_time = -1; -static gint hf_ms_previous_ip_address_v4 = -1; -static gint hf_ms_previous_ip_address_v6 = -1; -static gint hf_idle_mode_timeout = -1; -static gint hf_reg_req_tlv_t_45_ms_periodic_ranging_timer = -1; -static gint hf_reg_tlv_t_40_arq_ack_type_selective_ack_entry = -1; -static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_entry = -1; -static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_with_selective_ack_entry = -1; -static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_with_block_sequence_ack = -1; -static gint hf_reg_tlv_t_40_arq_ack_type_reserved = -1; -static gint hf_reg_tlv_t_41_ho_connections_param_processing_time = -1; -static gint hf_reg_tlv_t_42_ho_tek_processing_time = -1; -static gint hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support = -1; -static gint hf_reg_tlv_t_43_bandwidth_request_cinr_report_header_support = -1; -static gint hf_reg_tlv_t_43_cqich_allocation_request_header_support = -1; -static gint hf_reg_tlv_t_43_phy_channel_report_header_support = -1; -static gint hf_reg_tlv_t_43_bandwidth_request_ul_sleep_control_header_support = -1; -static gint hf_reg_tlv_t_43_sn_report_header_support = -1; -static gint hf_reg_tlv_t_43_feedback_header_support = -1; -static gint hf_reg_tlv_t_43_sdu_sn_extended_subheader_support_and_parameter = -1; -static gint hf_reg_tlv_t_43_sdu_sn_parameter = -1; -static gint hf_reg_tlv_t_43_dl_sleep_control_extended_subheader = -1; -static gint hf_reg_tlv_t_43_feedback_request_extended_subheader = -1; -static gint hf_reg_tlv_t_43_mimo_mode_feedback_extended_subheader = -1; -static gint hf_reg_tlv_t_43_ul_tx_power_report_extended_subheader = -1; -static gint hf_reg_tlv_t_43_mini_feedback_extended_subheader = -1; -static gint hf_reg_tlv_t_43_sn_request_extended_subheader = -1; -static gint hf_reg_tlv_t_43_pdu_sn_short_extended_subheader = -1; -static gint hf_reg_tlv_t_43_pdu_sn_long_extended_subheader = -1; -static gint hf_reg_tlv_t_43_reserved = -1; -static gint hf_reg_tlv_t_46_handover_indication_readiness_timer = -1; -static gint hf_reg_req_min_time_for_intra_fa = -1; -static gint hf_reg_req_min_time_for_inter_fa = -1; -static gint hf_reg_encap_atm_4 = -1; -static gint hf_reg_encap_ipv4_4 = -1; -static gint hf_reg_encap_ipv6_4 = -1; -static gint hf_reg_encap_802_3_4 = -1; -static gint hf_reg_encap_802_1q_4 = -1; -static gint hf_reg_encap_ipv4_802_3_4 = -1; -static gint hf_reg_encap_ipv6_802_3_4 = -1; -static gint hf_reg_encap_ipv4_802_1q_4 = -1; -static gint hf_reg_encap_ipv6_802_1q_4 = -1; -static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_4 = -1; -static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_4 = -1; -static gint hf_reg_encap_packet_ip_rohc_header_compression_4 = -1; -static gint hf_reg_encap_packet_ip_ecrtp_header_compression_4 = -1; -static gint hf_reg_encap_rsvd_4 = -1; -static gint hf_reg_encap_atm_2 = -1; -static gint hf_reg_encap_ipv4_2 = -1; -static gint hf_reg_encap_ipv6_2 = -1; -static gint hf_reg_encap_802_3_2 = -1; -static gint hf_reg_encap_802_1q_2 = -1; -static gint hf_reg_encap_ipv4_802_3_2 = -1; -static gint hf_reg_encap_ipv6_802_3_2 = -1; -static gint hf_reg_encap_ipv4_802_1q_2 = -1; -static gint hf_reg_encap_ipv6_802_1q_2 = -1; -static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_2 = -1; -static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_2 = -1; -static gint hf_reg_encap_packet_ip_rohc_header_compression_2 = -1; -static gint hf_reg_encap_packet_ip_ecrtp_header_compression_2 = -1; -static gint hf_reg_encap_rsvd_2 = -1; -static gint hf_tlv_type = -1; -static gint hf_reg_invalid_tlv = -1; -static gint hf_reg_power_saving_class_type_i = -1; -static gint hf_reg_power_saving_class_type_ii = -1; -static gint hf_reg_power_saving_class_type_iii = -1; -static gint hf_reg_multi_active_power_saving_classes = -1; -static gint hf_reg_total_power_saving_class_instances = -1; -static gint hf_reg_power_saving_class_reserved = -1; -static gint hf_reg_power_saving_class_capability = -1; -static gint hf_reg_ip_phs_sdu_encap = -1; -static gint hf_reg_tlv_t_26_method_alloc_ip_addr_secondary_mgmnt_conn = -1; -static gint hf_reg_tlv_t_27_handover_supported = -1; -static gint hf_reg_tlv_t_31_mobility_features_supported = -1; -static gint hf_reg_tlv_t_40_arq_ack_type = -1; -static gint hf_reg_tlv_t_43_mac_header_ext_header_support = -1; -static gint hf_reg_req_bs_switching_timer = -1; +static gint hf_reg_ss_mgmt_support; +static gint hf_reg_ip_mgmt_mode; +static gint hf_reg_ip_version; +static gint hf_reg_req_secondary_mgmt_cid; +static gint hf_reg_ul_cids; +static gint hf_reg_max_classifiers; +static gint hf_reg_phs; +static gint hf_reg_arq; +static gint hf_reg_dsx_flow_control; +static gint hf_reg_mac_crc_support; +static gint hf_reg_mca_flow_control; +static gint hf_reg_mcast_polling_cids; +static gint hf_reg_num_dl_trans_cid; +static gint hf_reg_mac_address; +static gint hf_reg_tlv_t_20_1_max_mac_level_data_per_dl_frame; +static gint hf_reg_tlv_t_20_2_max_mac_level_data_per_ul_frame; +static gint hf_reg_tlv_t_21_packing_support; +static gint hf_reg_tlv_t_22_mac_extended_rtps_support; +static gint hf_reg_tlv_t_23_max_num_bursts_concurrently_to_the_ms; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcp; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_mobile_ipv4; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_dhcpv6; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_ipv6; +static gint hf_reg_method_for_allocating_ip_addr_sec_mgmt_conn_rsvd; +static gint hf_reg_tlv_t_27_handover_fbss_mdho_ho_disable; +static gint hf_reg_tlv_t_27_handover_fbss_mdho_dl_rf_monitoring_maps; +static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_single_map; +static gint hf_reg_tlv_t_27_handover_mdho_dl_monitoring_maps; +static gint hf_reg_tlv_t_27_handover_mdho_ul_multiple; +static gint hf_reg_tlv_t_27_handover_reserved; +static gint hf_reg_tlv_t_29_ho_process_opt_ms_timer; +static gint hf_reg_tlv_t_31_mobility_handover; +static gint hf_reg_tlv_t_31_mobility_sleep_mode; +static gint hf_reg_tlv_t_31_mobility_idle_mode; +static gint hf_reg_req_tlv_t_32_sleep_mode_recovery_time; +static gint hf_ms_previous_ip_address_v4; +static gint hf_ms_previous_ip_address_v6; +static gint hf_idle_mode_timeout; +static gint hf_reg_req_tlv_t_45_ms_periodic_ranging_timer; +static gint hf_reg_tlv_t_40_arq_ack_type_selective_ack_entry; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_entry; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_with_selective_ack_entry; +static gint hf_reg_tlv_t_40_arq_ack_type_cumulative_ack_with_block_sequence_ack; +static gint hf_reg_tlv_t_40_arq_ack_type_reserved; +static gint hf_reg_tlv_t_41_ho_connections_param_processing_time; +static gint hf_reg_tlv_t_42_ho_tek_processing_time; +static gint hf_reg_tlv_t_43_bandwidth_request_ul_tx_power_report_header_support; +static gint hf_reg_tlv_t_43_bandwidth_request_cinr_report_header_support; +static gint hf_reg_tlv_t_43_cqich_allocation_request_header_support; +static gint hf_reg_tlv_t_43_phy_channel_report_header_support; +static gint hf_reg_tlv_t_43_bandwidth_request_ul_sleep_control_header_support; +static gint hf_reg_tlv_t_43_sn_report_header_support; +static gint hf_reg_tlv_t_43_feedback_header_support; +static gint hf_reg_tlv_t_43_sdu_sn_extended_subheader_support_and_parameter; +static gint hf_reg_tlv_t_43_sdu_sn_parameter; +static gint hf_reg_tlv_t_43_dl_sleep_control_extended_subheader; +static gint hf_reg_tlv_t_43_feedback_request_extended_subheader; +static gint hf_reg_tlv_t_43_mimo_mode_feedback_extended_subheader; +static gint hf_reg_tlv_t_43_ul_tx_power_report_extended_subheader; +static gint hf_reg_tlv_t_43_mini_feedback_extended_subheader; +static gint hf_reg_tlv_t_43_sn_request_extended_subheader; +static gint hf_reg_tlv_t_43_pdu_sn_short_extended_subheader; +static gint hf_reg_tlv_t_43_pdu_sn_long_extended_subheader; +static gint hf_reg_tlv_t_43_reserved; +static gint hf_reg_tlv_t_46_handover_indication_readiness_timer; +static gint hf_reg_req_min_time_for_intra_fa; +static gint hf_reg_req_min_time_for_inter_fa; +static gint hf_reg_encap_atm_4; +static gint hf_reg_encap_ipv4_4; +static gint hf_reg_encap_ipv6_4; +static gint hf_reg_encap_802_3_4; +static gint hf_reg_encap_802_1q_4; +static gint hf_reg_encap_ipv4_802_3_4; +static gint hf_reg_encap_ipv6_802_3_4; +static gint hf_reg_encap_ipv4_802_1q_4; +static gint hf_reg_encap_ipv6_802_1q_4; +static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_4; +static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_4; +static gint hf_reg_encap_packet_ip_rohc_header_compression_4; +static gint hf_reg_encap_packet_ip_ecrtp_header_compression_4; +static gint hf_reg_encap_rsvd_4; +static gint hf_reg_encap_atm_2; +static gint hf_reg_encap_ipv4_2; +static gint hf_reg_encap_ipv6_2; +static gint hf_reg_encap_802_3_2; +static gint hf_reg_encap_802_1q_2; +static gint hf_reg_encap_ipv4_802_3_2; +static gint hf_reg_encap_ipv6_802_3_2; +static gint hf_reg_encap_ipv4_802_1q_2; +static gint hf_reg_encap_ipv6_802_1q_2; +static gint hf_reg_encap_packet_8023_ethernet_and_rohc_header_compression_2; +static gint hf_reg_encap_packet_8023_ethernet_and_ecrtp_header_compression_2; +static gint hf_reg_encap_packet_ip_rohc_header_compression_2; +static gint hf_reg_encap_packet_ip_ecrtp_header_compression_2; +static gint hf_reg_encap_rsvd_2; +static gint hf_tlv_type; +static gint hf_reg_invalid_tlv; +static gint hf_reg_power_saving_class_type_i; +static gint hf_reg_power_saving_class_type_ii; +static gint hf_reg_power_saving_class_type_iii; +static gint hf_reg_multi_active_power_saving_classes; +static gint hf_reg_total_power_saving_class_instances; +static gint hf_reg_power_saving_class_reserved; +static gint hf_reg_power_saving_class_capability; +static gint hf_reg_ip_phs_sdu_encap; +static gint hf_reg_tlv_t_26_method_alloc_ip_addr_secondary_mgmnt_conn; +static gint hf_reg_tlv_t_27_handover_supported; +static gint hf_reg_tlv_t_31_mobility_features_supported; +static gint hf_reg_tlv_t_40_arq_ack_type; +static gint hf_reg_tlv_t_43_mac_header_ext_header_support; +static gint hf_reg_req_bs_switching_timer; /* STRING RESOURCES */ @@ -1416,13 +1418,11 @@ void proto_register_mac_mgmt_msg_reg_req(void) proto_register_field_array(proto_mac_mgmt_msg_reg_req_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + reg_req_handle = register_dissector("mac_mgmt_msg_reg_req_handler", dissect_mac_mgmt_msg_reg_req_decoder, proto_mac_mgmt_msg_reg_req_decoder); } void proto_reg_handoff_mac_mgmt_msg_reg_req(void) { - dissector_handle_t reg_req_handle; - - reg_req_handle = create_dissector_handle(dissect_mac_mgmt_msg_reg_req_decoder, proto_mac_mgmt_msg_reg_req_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REG_REQ, reg_req_handle); } diff --git a/plugins/epan/wimax/msg_reg_rsp.c b/plugins/epan/wimax/msg_reg_rsp.c index 2c07e1e186..1f4efd1577 100644 --- a/plugins/epan/wimax/msg_reg_rsp.c +++ b/plugins/epan/wimax/msg_reg_rsp.c @@ -28,26 +28,28 @@ void proto_register_mac_mgmt_msg_reg_rsp(void); void proto_reg_handoff_mac_mgmt_msg_reg_rsp(void); +static dissector_handle_t reg_rsp_handle; + extern gboolean include_cor2_changes; static dissector_handle_t dsc_rsp_handle = NULL; -static gint proto_mac_mgmt_msg_reg_rsp_decoder = -1; -static gint ett_mac_mgmt_msg_reg_rsp_decoder = -1; -static gint ett_reg_rsp_message_tree = -1; +static gint proto_mac_mgmt_msg_reg_rsp_decoder; +static gint ett_mac_mgmt_msg_reg_rsp_decoder; +static gint ett_reg_rsp_message_tree; /* NCT messages */ /* REG-RSP fields */ -static gint hf_reg_rsp_status = -1; -static gint hf_tlv_type = -1; -/* static gint hf_tlv_value = -1; */ -static gint hf_reg_rsp_secondary_mgmt_cid = -1; -static gint hf_reg_invalid_tlv = -1; -static gint hf_reg_rsp_new_cid_after_ho = -1; -static gint hf_reg_rsp_service_flow_id = -1; -static gint hf_reg_rsp_system_resource_retain_time = -1; -static gint hf_reg_total_provisioned_sf = -1; +static gint hf_reg_rsp_status; +static gint hf_tlv_type; +/* static gint hf_tlv_value; */ +static gint hf_reg_rsp_secondary_mgmt_cid; +static gint hf_reg_invalid_tlv; +static gint hf_reg_rsp_new_cid_after_ho; +static gint hf_reg_rsp_service_flow_id; +static gint hf_reg_rsp_system_resource_retain_time; +static gint hf_reg_total_provisioned_sf; /* STRING RESOURCES */ @@ -340,16 +342,12 @@ void proto_register_mac_mgmt_msg_reg_rsp(void) proto_register_field_array(proto_mac_mgmt_msg_reg_rsp_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("mac_mgmt_msg_reg_rsp_handler", dissect_mac_mgmt_msg_reg_rsp_decoder, -1); + reg_rsp_handle = register_dissector("mac_mgmt_msg_reg_rsp_handler", dissect_mac_mgmt_msg_reg_rsp_decoder, proto_mac_mgmt_msg_reg_rsp_decoder); } void proto_reg_handoff_mac_mgmt_msg_reg_rsp(void) { - dissector_handle_t reg_rsp_handle; - dsc_rsp_handle = find_dissector("mac_mgmt_msg_dsc_rsp_handler"); - - reg_rsp_handle = create_dissector_handle(dissect_mac_mgmt_msg_reg_rsp_decoder, proto_mac_mgmt_msg_reg_rsp_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REG_RSP, reg_rsp_handle); } diff --git a/plugins/epan/wimax/msg_rep.c b/plugins/epan/wimax/msg_rep.c index b527015128..7f4b582514 100644 --- a/plugins/epan/wimax/msg_rep.c +++ b/plugins/epan/wimax/msg_rep.c @@ -28,9 +28,12 @@ void proto_register_mac_mgmt_msg_rep(void); void proto_reg_handoff_mac_mgmt_msg_rep(void); -static gint proto_mac_mgmt_msg_rep_decoder = -1; -static gint ett_mac_mgmt_msg_rep_req_decoder = -1; -static gint ett_mac_mgmt_msg_rep_rsp_decoder = -1; +static dissector_handle_t rep_req_handle; +static dissector_handle_t rep_rsp_handle; + +static gint proto_mac_mgmt_msg_rep_decoder; +static gint ett_mac_mgmt_msg_rep_req_decoder; +static gint ett_mac_mgmt_msg_rep_rsp_decoder; static const value_string vals_channel_types[] = { @@ -78,112 +81,112 @@ static const value_string vals_type_of_measurements[] = }; /* fix fields */ -static gint hf_rep_unknown_type = -1; -static gint hf_rep_invalid_tlv = -1; +static gint hf_rep_unknown_type; +static gint hf_rep_invalid_tlv; -static gint hf_rep_req_report_request = -1; -static gint hf_rep_req_report_type = -1; -static gint hf_rep_req_rep_type_bit0 = -1; -static gint hf_rep_req_rep_type_bit1 = -1; -static gint hf_rep_req_rep_type_bit2 = -1; -static gint hf_rep_req_rep_type_bit3_6 = -1; -static gint hf_rep_req_rep_type_bit7 = -1; -static gint hf_rep_req_channel_number = -1; -static gint hf_rep_req_channel_type = -1; -static gint hf_rep_req_channel_type_request = -1; -static gint hf_rep_req_channel_type_reserved = -1; -static gint hf_rep_req_zone_spec_phy_cinr_request = -1; -static gint hf_rep_req_preamble_phy_cinr_request = -1; -static gint hf_rep_req_zone_spec_effective_cinr_request = -1; -static gint hf_rep_req_preamble_effective_cinr_request = -1; -static gint hf_rep_req_channel_selectivity_report = -1; +static gint hf_rep_req_report_request; +static gint hf_rep_req_report_type; +static gint hf_rep_req_rep_type_bit0; +static gint hf_rep_req_rep_type_bit1; +static gint hf_rep_req_rep_type_bit2; +static gint hf_rep_req_rep_type_bit3_6; +static gint hf_rep_req_rep_type_bit7; +static gint hf_rep_req_channel_number; +static gint hf_rep_req_channel_type; +static gint hf_rep_req_channel_type_request; +static gint hf_rep_req_channel_type_reserved; +static gint hf_rep_req_zone_spec_phy_cinr_request; +static gint hf_rep_req_preamble_phy_cinr_request; +static gint hf_rep_req_zone_spec_effective_cinr_request; +static gint hf_rep_req_preamble_effective_cinr_request; +static gint hf_rep_req_channel_selectivity_report; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit0_2 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit3 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit4 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit5_6 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit7 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit8_13 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit14_17 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit18 = -1; -static gint hf_rep_req_zone_spec_phy_cinr_req_bit19_23 = -1; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit0_2; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit3; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit4; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit5_6; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit7; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit8_13; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit14_17; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit18; +static gint hf_rep_req_zone_spec_phy_cinr_req_bit19_23; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit0_2 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit3 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit4 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit5_6 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit7 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit8_13 = -1; -static gint hf_rep_req_zone_spec_effective_cinr_req_bit14_15 = -1; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit0_2; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit3; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit4; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit5_6; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit7; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit8_13; +static gint hf_rep_req_zone_spec_effective_cinr_req_bit14_15; -static gint hf_rep_req_preamble_phy_cinr_req_bit0_1 = -1; -static gint hf_rep_req_preamble_phy_cinr_req_bit2_5 = -1; -static gint hf_rep_req_preamble_phy_cinr_req_bit6 = -1; -static gint hf_rep_req_preamble_phy_cinr_req_bit7 = -1; +static gint hf_rep_req_preamble_phy_cinr_req_bit0_1; +static gint hf_rep_req_preamble_phy_cinr_req_bit2_5; +static gint hf_rep_req_preamble_phy_cinr_req_bit6; +static gint hf_rep_req_preamble_phy_cinr_req_bit7; -static gint hf_rep_req_preamble_effective_cinr_req_bit0_1 = -1; -static gint hf_rep_req_preamble_effective_cinr_req_bit2_7 = -1; +static gint hf_rep_req_preamble_effective_cinr_req_bit0_1; +static gint hf_rep_req_preamble_effective_cinr_req_bit2_7; -static gint hf_rep_req_channel_selectivity_rep_bit0 = -1; -static gint hf_rep_req_channel_selectivity_rep_bit1_7 = -1; +static gint hf_rep_req_channel_selectivity_rep_bit0; +static gint hf_rep_req_channel_selectivity_rep_bit1_7; -static gint hf_rep_rsp_report_type = -1; -static gint hf_rep_rsp_report_type_channel_number = -1; -static gint hf_rep_rsp_report_type_frame_number = -1; -static gint hf_rep_rsp_report_type_duration = -1; -static gint hf_rep_rsp_report_type_basic_report = -1; -static gint hf_rep_rsp_report_type_basic_report_bit0 = -1; -static gint hf_rep_rsp_report_type_basic_report_bit1 = -1; -static gint hf_rep_rsp_report_type_basic_report_bit2 = -1; -static gint hf_rep_rsp_report_type_basic_report_bit3 = -1; -static gint hf_rep_rsp_report_type_basic_report_reserved = -1; -static gint hf_rep_rsp_report_type_cinr_report = -1; -static gint hf_rep_rsp_report_type_cinr_report_mean = -1; -static gint hf_rep_rsp_report_type_cinr_report_deviation = -1; -static gint hf_rep_rsp_report_type_rssi_report = -1; -static gint hf_rep_rsp_report_type_rssi_report_mean = -1; -static gint hf_rep_rsp_report_type_rssi_report_deviation = -1; -static gint hf_rep_rsp_current_transmitted_power = -1; -static gint hf_rep_rsp_channel_type_report = -1; -static gint hf_rep_rsp_channel_type_subchannel = -1; -static gint hf_rep_rsp_channel_type_band_amc = -1; -static gint hf_rep_rsp_channel_type_safety_channel = -1; -static gint hf_rep_rsp_channel_type_enhanced_band_amc = -1; -static gint hf_rep_rsp_channel_type_sounding = -1; +static gint hf_rep_rsp_report_type; +static gint hf_rep_rsp_report_type_channel_number; +static gint hf_rep_rsp_report_type_frame_number; +static gint hf_rep_rsp_report_type_duration; +static gint hf_rep_rsp_report_type_basic_report; +static gint hf_rep_rsp_report_type_basic_report_bit0; +static gint hf_rep_rsp_report_type_basic_report_bit1; +static gint hf_rep_rsp_report_type_basic_report_bit2; +static gint hf_rep_rsp_report_type_basic_report_bit3; +static gint hf_rep_rsp_report_type_basic_report_reserved; +static gint hf_rep_rsp_report_type_cinr_report; +static gint hf_rep_rsp_report_type_cinr_report_mean; +static gint hf_rep_rsp_report_type_cinr_report_deviation; +static gint hf_rep_rsp_report_type_rssi_report; +static gint hf_rep_rsp_report_type_rssi_report_mean; +static gint hf_rep_rsp_report_type_rssi_report_deviation; +static gint hf_rep_rsp_current_transmitted_power; +static gint hf_rep_rsp_channel_type_report; +static gint hf_rep_rsp_channel_type_subchannel; +static gint hf_rep_rsp_channel_type_band_amc; +static gint hf_rep_rsp_channel_type_safety_channel; +static gint hf_rep_rsp_channel_type_enhanced_band_amc; +static gint hf_rep_rsp_channel_type_sounding; -static gint hf_rep_rsp_zone_spec_phy_cinr_report = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_mean = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_report_type = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1 = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_deviation = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2 = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc0 = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc1 = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_fusc = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_optional_fusc = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel = -1; -static gint hf_rep_rsp_zone_spec_phy_cinr_rep_amc = -1; -static gint hf_rep_rsp_preamble_phy_cinr_report = -1; -static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_1 = -1; -static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_3 = -1; -static gint hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_report = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_report_type = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id = -1; -static gint hf_rep_rsp_preamble_effective_cinr_report = -1; -static gint hf_rep_rsp_preamble_effective_cinr_rep_cqich_id = -1; -static gint hf_rep_rsp_channel_selectivity_report = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc0 = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc1 = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_fusc = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_optional_fusc = -1; -static gint hf_rep_rsp_zone_spec_effective_cinr_rep_amc_aas = -1; -static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_1 = -1; -static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_3 = -1; -static gint hf_rep_rsp_channel_selectivity_rep_frequency_a = -1; -static gint hf_rep_rsp_channel_selectivity_rep_frequency_b = -1; -static gint hf_rep_rsp_channel_selectivity_rep_frequency_c = -1; +static gint hf_rep_rsp_zone_spec_phy_cinr_report; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_mean; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_report_type; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_deviation; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_reserved2; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc0; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_pusc_sc1; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_fusc; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_optional_fusc; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_safety_channel; +static gint hf_rep_rsp_zone_spec_phy_cinr_rep_amc; +static gint hf_rep_rsp_preamble_phy_cinr_report; +static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_1; +static gint hf_rep_rsp_preamble_phy_cinr_rep_configuration_3; +static gint hf_rep_rsp_preamble_phy_cinr_rep_band_amc_zone; +static gint hf_rep_rsp_zone_spec_effective_cinr_report; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_effective_cinr; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_report_type; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_cqich_id; +static gint hf_rep_rsp_preamble_effective_cinr_report; +static gint hf_rep_rsp_preamble_effective_cinr_rep_cqich_id; +static gint hf_rep_rsp_channel_selectivity_report; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc0; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_pusc_sc1; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_fusc; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_optional_fusc; +static gint hf_rep_rsp_zone_spec_effective_cinr_rep_amc_aas; +static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_1; +static gint hf_rep_rsp_preamble_effective_cinr_rep_configuration_3; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_a; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_b; +static gint hf_rep_rsp_channel_selectivity_rep_frequency_c; /* bit masks */ #define REP_REQ_REPORT_TYPE_BIT0 0x01 @@ -1536,18 +1539,15 @@ void proto_register_mac_mgmt_msg_rep(void) proto_register_field_array(proto_mac_mgmt_msg_rep_decoder, hf_rep, array_length(hf_rep)); proto_register_subtree_array(ett_rep, array_length(ett_rep)); + rep_req_handle = register_dissector("mac_mgmt_msg_rep_req_handler", dissect_mac_mgmt_msg_rep_req_decoder, proto_mac_mgmt_msg_rep_decoder); + rep_rsp_handle = register_dissector("mac_mgmt_msg_rep_rsp_handler", dissect_mac_mgmt_msg_rep_rsp_decoder, proto_mac_mgmt_msg_rep_decoder); } void proto_reg_handoff_mac_mgmt_msg_rep(void) { - dissector_handle_t rep_handle; - - rep_handle = create_dissector_handle(dissect_mac_mgmt_msg_rep_req_decoder, proto_mac_mgmt_msg_rep_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REP_REQ, rep_handle); - - rep_handle = create_dissector_handle(dissect_mac_mgmt_msg_rep_rsp_decoder, proto_mac_mgmt_msg_rep_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REP_RSP, rep_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REP_REQ, rep_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_REP_RSP, rep_rsp_handle); } /* diff --git a/plugins/epan/wimax/msg_res_cmd.c b/plugins/epan/wimax/msg_res_cmd.c index e612120b5e..50212474f2 100644 --- a/plugins/epan/wimax/msg_res_cmd.c +++ b/plugins/epan/wimax/msg_res_cmd.c @@ -28,12 +28,14 @@ void proto_register_mac_mgmt_msg_res_cmd(void); void proto_reg_handoff_mac_mgmt_msg_res_cmd(void); -static gint proto_mac_mgmt_msg_res_cmd_decoder = -1; -static gint ett_mac_mgmt_msg_res_cmd_decoder = -1; +static dissector_handle_t res_cmd_handle; + +static gint proto_mac_mgmt_msg_res_cmd_decoder; +static gint ett_mac_mgmt_msg_res_cmd_decoder; /* fix fields */ -static gint hf_res_cmd_unknown_type = -1; -static gint hf_res_cmd_invalid_tlv = -1; +static gint hf_res_cmd_unknown_type; +static gint hf_res_cmd_invalid_tlv; /* Wimax Mac RES-CMD Message Dissector */ @@ -129,15 +131,13 @@ void proto_register_mac_mgmt_msg_res_cmd(void) proto_register_field_array(proto_mac_mgmt_msg_res_cmd_decoder, hf_res_cmd, array_length(hf_res_cmd)); proto_register_subtree_array(ett_res_cmd, array_length(ett_res_cmd)); + res_cmd_handle = register_dissector("mac_mgmt_msg_res_handler", dissect_mac_mgmt_msg_res_cmd_decoder, proto_mac_mgmt_msg_res_cmd_decoder); } void proto_reg_handoff_mac_mgmt_msg_res_cmd(void) { - dissector_handle_t handle; - - handle = create_dissector_handle(dissect_mac_mgmt_msg_res_cmd_decoder, proto_mac_mgmt_msg_res_cmd_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RES_CMD, handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RES_CMD, res_cmd_handle); } /* diff --git a/plugins/epan/wimax/msg_rng_req.c b/plugins/epan/wimax/msg_rng_req.c index 3b11d0cc33..0d14cd672f 100644 --- a/plugins/epan/wimax/msg_rng_req.c +++ b/plugins/epan/wimax/msg_rng_req.c @@ -24,50 +24,52 @@ void proto_register_mac_mgmt_msg_rng_req(void); void proto_reg_handoff_mac_mgmt_msg_rng_req(void); +static dissector_handle_t rng_req_handle; + extern gboolean include_cor2_changes; -static gint proto_mac_mgmt_msg_rng_req_decoder = -1; -static gint ett_mac_mgmt_msg_rng_req_decoder = -1; +static gint proto_mac_mgmt_msg_rng_req_decoder; +static gint ett_mac_mgmt_msg_rng_req_decoder; /* RNG-REQ fields */ -static gint hf_rng_req_reserved = -1; -static gint hf_rng_req_dl_burst_profile_diuc = -1; -static gint hf_rng_req_dl_burst_profile_lsb_ccc = -1; -static gint hf_rng_req_ss_mac_address = -1; -static gint hf_rng_req_ranging_anomalies_max_power = -1; -static gint hf_rng_req_ranging_anomalies_min_power = -1; -static gint hf_rng_req_ranging_anomalies_timing_adj = -1; -static gint hf_rng_req_aas_broadcast = -1; -static gint hf_rng_req_serving_bs_id = -1; -static gint hf_rng_req_ranging_purpose_ho_indication = -1; -static gint hf_rng_req_ranging_purpose_location_update_request = -1; -static gint hf_rng_req_ranging_purpose_reserved = -1; -static gint hf_rng_req_ho_id = -1; -static gint hf_rng_req_power_down_indicator = -1; -static gint hf_rng_req_repetition_coding_level = -1; -static gint hf_rng_req_requested_downlink_repetition_coding_level_reserved = -1; -static gint hf_rng_req_cmac_key_count = -1; -static gint hf_rng_definition_of_power_saving_class_present = -1; -static gint hf_rng_activation_of_power_saving_class = -1; -static gint hf_rng_trf_ind_required = -1; -static gint hf_rng_power_saving_class_reserved = -1; -static gint hf_rng_power_saving_class_id = -1; -static gint hf_rng_power_saving_class_type = -1; -static gint hf_rng_power_saving_first_sleep_window_frame = -1; -static gint hf_rng_power_saving_initial_sleep_window = -1; -static gint hf_rng_power_saving_listening_window = -1; -static gint hf_rng_power_saving_final_sleep_window_base = -1; -static gint hf_rng_power_saving_final_sleep_window_exp = -1; -static gint hf_rng_power_saving_slpid = -1; -static gint hf_rng_power_saving_included_cid = -1; -static gint hf_rng_power_saving_mgmt_connection_direction = -1; -static gint hf_tlv_type = -1; -static gint hf_rng_invalid_tlv = -1; -static gint hf_rng_power_saving_class_flags = -1; -static gint hf_rng_req_dl_burst_profile = -1; -static gint hf_rng_req_ranging_anomalies = -1; -static gint hf_rng_req_ranging_purpose_indication = -1; -static gint hf_rng_req_requested_rep_coding_level = -1; +static gint hf_rng_req_reserved; +static gint hf_rng_req_dl_burst_profile_diuc; +static gint hf_rng_req_dl_burst_profile_lsb_ccc; +static gint hf_rng_req_ss_mac_address; +static gint hf_rng_req_ranging_anomalies_max_power; +static gint hf_rng_req_ranging_anomalies_min_power; +static gint hf_rng_req_ranging_anomalies_timing_adj; +static gint hf_rng_req_aas_broadcast; +static gint hf_rng_req_serving_bs_id; +static gint hf_rng_req_ranging_purpose_ho_indication; +static gint hf_rng_req_ranging_purpose_location_update_request; +static gint hf_rng_req_ranging_purpose_reserved; +static gint hf_rng_req_ho_id; +static gint hf_rng_req_power_down_indicator; +static gint hf_rng_req_repetition_coding_level; +static gint hf_rng_req_requested_downlink_repetition_coding_level_reserved; +static gint hf_rng_req_cmac_key_count; +static gint hf_rng_definition_of_power_saving_class_present; +static gint hf_rng_activation_of_power_saving_class; +static gint hf_rng_trf_ind_required; +static gint hf_rng_power_saving_class_reserved; +static gint hf_rng_power_saving_class_id; +static gint hf_rng_power_saving_class_type; +static gint hf_rng_power_saving_first_sleep_window_frame; +static gint hf_rng_power_saving_initial_sleep_window; +static gint hf_rng_power_saving_listening_window; +static gint hf_rng_power_saving_final_sleep_window_base; +static gint hf_rng_power_saving_final_sleep_window_exp; +static gint hf_rng_power_saving_slpid; +static gint hf_rng_power_saving_included_cid; +static gint hf_rng_power_saving_mgmt_connection_direction; +static gint hf_tlv_type; +static gint hf_rng_invalid_tlv; +static gint hf_rng_power_saving_class_flags; +static gint hf_rng_req_dl_burst_profile; +static gint hf_rng_req_ranging_anomalies; +static gint hf_rng_req_ranging_purpose_indication; +static gint hf_rng_req_requested_rep_coding_level; /* STRING RESOURCES */ @@ -606,13 +608,11 @@ void proto_register_mac_mgmt_msg_rng_req(void) proto_register_field_array(proto_mac_mgmt_msg_rng_req_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + rng_req_handle = register_dissector("mac_mgmt_msg_rng_req_handler", dissect_mac_mgmt_msg_rng_req_decoder, proto_mac_mgmt_msg_rng_req_decoder); } void proto_reg_handoff_mac_mgmt_msg_rng_req(void) { - dissector_handle_t rng_req_handle; - - rng_req_handle = create_dissector_handle(dissect_mac_mgmt_msg_rng_req_decoder, proto_mac_mgmt_msg_rng_req_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RNG_REQ, rng_req_handle); } diff --git a/plugins/epan/wimax/msg_rng_rsp.c b/plugins/epan/wimax/msg_rng_rsp.c index 9754922e0f..b1d859b62a 100644 --- a/plugins/epan/wimax/msg_rng_rsp.c +++ b/plugins/epan/wimax/msg_rng_rsp.c @@ -26,72 +26,74 @@ void proto_reg_handoff_mac_mgmt_msg_rng_rsp(void); extern gboolean include_cor2_changes; + +static dissector_handle_t rng_rsp_handle = NULL; static dissector_handle_t sbc_rsp_handle = NULL; static dissector_handle_t reg_rsp_handle = NULL; -static gint proto_mac_mgmt_msg_rng_rsp_decoder = -1; -static gint ett_mac_mgmt_msg_rng_rsp_decoder = -1; -static gint ett_rng_rsp_message_tree = -1; +static gint proto_mac_mgmt_msg_rng_rsp_decoder; +static gint ett_mac_mgmt_msg_rng_rsp_decoder; +static gint ett_rng_rsp_message_tree; /* RNG-RSP fields */ -static gint hf_rng_req_reserved = -1; -/* static gint hf_rng_rsp_ul_channel_id = -1; */ -static gint hf_rng_rsp_timing_adjust = -1; -static gint hf_rng_rsp_power_level_adjust = -1; -static gint hf_rng_rsp_offset_freq_adjust = -1; -static gint hf_rng_rsp_ranging_status = -1; -static gint hf_rng_rsp_dl_freq_override = -1; -static gint hf_rng_rsp_ul_chan_id_override = -1; -static gint hf_rng_rsp_dl_operational_burst_profile = -1; -static gint hf_rng_rsp_dl_operational_burst_profile_diuc = -1; -static gint hf_rng_rsp_dl_operational_burst_profile_ccc = -1; -static gint hf_rng_rsp_ss_mac_address = -1; -static gint hf_rng_rsp_basic_cid = -1; -static gint hf_rng_rsp_primary_mgmt_cid = -1; -static gint hf_rng_rsp_broadcast = -1; -static gint hf_rng_rsp_frame_number = -1; -static gint hf_rng_rsp_opportunity_number = -1; -static gint hf_rng_rsp_service_level_prediction = -1; -static gint hf_rng_rsp_resource_retain_flag = -1; -static gint hf_rng_rsp_ho_process_optimization = -1; -static gint hf_rng_rsp_ho_process_optimization_0 = -1; -static gint hf_rng_rsp_ho_process_optimization_1_2 = -1; -static gint hf_rng_rsp_ho_process_optimization_3 = -1; -static gint hf_rng_rsp_ho_process_optimization_4 = -1; -static gint hf_rng_rsp_ho_process_optimization_5 = -1; -static gint hf_rng_rsp_ho_process_optimization_6 = -1; -static gint hf_rng_rsp_ho_process_optimization_7 = -1; -static gint hf_rng_rsp_ho_process_optimization_8 = -1; -static gint hf_rng_rsp_ho_process_optimization_9 = -1; -static gint hf_rng_rsp_ho_process_optimization_10 = -1; -static gint hf_rng_rsp_ho_process_optimization_11 = -1; -static gint hf_rng_rsp_ho_process_optimization_12 = -1; -static gint hf_rng_rsp_ho_process_optimization_13 = -1; -static gint hf_rng_rsp_ho_process_optimization_14 = -1; -static gint hf_rng_rsp_ho_process_optimization_15 = -1; +static gint hf_rng_req_reserved; +/* static gint hf_rng_rsp_ul_channel_id; */ +static gint hf_rng_rsp_timing_adjust; +static gint hf_rng_rsp_power_level_adjust; +static gint hf_rng_rsp_offset_freq_adjust; +static gint hf_rng_rsp_ranging_status; +static gint hf_rng_rsp_dl_freq_override; +static gint hf_rng_rsp_ul_chan_id_override; +static gint hf_rng_rsp_dl_operational_burst_profile; +static gint hf_rng_rsp_dl_operational_burst_profile_diuc; +static gint hf_rng_rsp_dl_operational_burst_profile_ccc; +static gint hf_rng_rsp_ss_mac_address; +static gint hf_rng_rsp_basic_cid; +static gint hf_rng_rsp_primary_mgmt_cid; +static gint hf_rng_rsp_broadcast; +static gint hf_rng_rsp_frame_number; +static gint hf_rng_rsp_opportunity_number; +static gint hf_rng_rsp_service_level_prediction; +static gint hf_rng_rsp_resource_retain_flag; +static gint hf_rng_rsp_ho_process_optimization; +static gint hf_rng_rsp_ho_process_optimization_0; +static gint hf_rng_rsp_ho_process_optimization_1_2; +static gint hf_rng_rsp_ho_process_optimization_3; +static gint hf_rng_rsp_ho_process_optimization_4; +static gint hf_rng_rsp_ho_process_optimization_5; +static gint hf_rng_rsp_ho_process_optimization_6; +static gint hf_rng_rsp_ho_process_optimization_7; +static gint hf_rng_rsp_ho_process_optimization_8; +static gint hf_rng_rsp_ho_process_optimization_9; +static gint hf_rng_rsp_ho_process_optimization_10; +static gint hf_rng_rsp_ho_process_optimization_11; +static gint hf_rng_rsp_ho_process_optimization_12; +static gint hf_rng_rsp_ho_process_optimization_13; +static gint hf_rng_rsp_ho_process_optimization_14; +static gint hf_rng_rsp_ho_process_optimization_15; /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */ -static gint hf_rng_rsp_dl_op_burst_profile_ofdma = -1; -static gint hf_rng_rsp_least_robust_diuc = -1; -static gint hf_rng_rsp_repetition_coding_indication = -1; -static gint hf_rng_rsp_config_change_count_of_dcd = -1; +static gint hf_rng_rsp_dl_op_burst_profile_ofdma; +static gint hf_rng_rsp_least_robust_diuc; +static gint hf_rng_rsp_repetition_coding_indication; +static gint hf_rng_rsp_config_change_count_of_dcd; /* Added the following to help implement RNG-RSP message encoding 22 (Table 367 in IEEE 802.16e-2007) */ -static gint hf_rng_rsp_ho_id = -1; -static gint hf_rng_rsp_location_update_response = -1; +static gint hf_rng_rsp_ho_id; +static gint hf_rng_rsp_location_update_response; /* Added the following to help implement RNG-RSP message encoding 24 (Table 367 in IEEE 802.16e-2007) */ -static gint hf_rng_rsp_paging_information = -1; -static gint hf_rng_rsp_paging_cycle = -1; -static gint hf_rng_rsp_paging_offset = -1; -static gint hf_rng_rsp_paging_group_id = -1; -static gint hf_rng_rsp_bs_random = -1; -static gint hf_rng_rsp_akid = -1; -static gint hf_rng_rsp_ranging_subchan = -1; -static gint hf_rng_rsp_time_symbol_reference = -1; -static gint hf_rng_rsp_subchannel_reference = -1; -static gint hf_rng_rsp_ranging_code_index = -1; -static gint hf_rng_rsp_frame_number2 = -1; -static gint hf_tlv_type = -1; -/* static gint hf_tlv_value = -1; */ -static gint hf_rng_invalid_tlv = -1; +static gint hf_rng_rsp_paging_information; +static gint hf_rng_rsp_paging_cycle; +static gint hf_rng_rsp_paging_offset; +static gint hf_rng_rsp_paging_group_id; +static gint hf_rng_rsp_bs_random; +static gint hf_rng_rsp_akid; +static gint hf_rng_rsp_ranging_subchan; +static gint hf_rng_rsp_time_symbol_reference; +static gint hf_rng_rsp_subchannel_reference; +static gint hf_rng_rsp_ranging_code_index; +static gint hf_rng_rsp_frame_number2; +static gint hf_tlv_type; +/* static gint hf_tlv_value; */ +static gint hf_rng_invalid_tlv; /* STRING RESOURCES */ @@ -935,13 +937,11 @@ void proto_register_mac_mgmt_msg_rng_rsp(void) proto_register_field_array(proto_mac_mgmt_msg_rng_rsp_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + rng_rsp_handle = register_dissector("mac_mgmt_msg_rng_rsp_handler", dissect_mac_mgmt_msg_rng_rsp_decoder, proto_mac_mgmt_msg_rng_rsp_decoder); } void proto_reg_handoff_mac_mgmt_msg_rng_rsp(void) { - dissector_handle_t rng_rsp_handle; - - rng_rsp_handle = create_dissector_handle(dissect_mac_mgmt_msg_rng_rsp_decoder, proto_mac_mgmt_msg_rng_rsp_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RNG_RSP, rng_rsp_handle); sbc_rsp_handle = find_dissector("mac_mgmt_msg_sbc_rsp_handler"); diff --git a/plugins/epan/wimax/msg_sbc.c b/plugins/epan/wimax/msg_sbc.c index 86eee71d4e..a605756f62 100644 --- a/plugins/epan/wimax/msg_sbc.c +++ b/plugins/epan/wimax/msg_sbc.c @@ -29,260 +29,263 @@ void proto_register_mac_mgmt_msg_sbc(void); void proto_reg_handoff_mac_mgmt_msg_sbc(void); +static dissector_handle_t sbc_req_handle; +static dissector_handle_t sbc_rsp_handle; + /* This is a global variable declared in mac_hd_generic_decoder.c, which determines whether * or not cor2 changes are included */ extern gboolean include_cor2_changes; -static gint proto_mac_mgmt_msg_sbc_decoder = -1; -static gint ett_mac_mgmt_msg_sbc_decoder = -1; -static gint ett_sbc_req_tlv_subtree = -1; -static gint ett_sbc_rsp_tlv_subtree = -1; +static gint proto_mac_mgmt_msg_sbc_decoder; +static gint ett_mac_mgmt_msg_sbc_decoder; +static gint ett_sbc_req_tlv_subtree; +static gint ett_sbc_rsp_tlv_subtree; /* fix fields */ -static gint hf_sbc_unknown_type = -1; +static gint hf_sbc_unknown_type; -static gint hf_sbc_bw_alloc_support = -1; -static gint hf_sbc_bw_alloc_support_rsvd0 = -1; -static gint hf_sbc_bw_alloc_support_duplex = -1; -static gint hf_sbc_bw_alloc_support_rsvd1 = -1; -static gint hf_sbc_curr_transmit_power = -1; -static gint hf_sbc_transition_gaps = -1; -static gint hf_sbc_ssttg = -1; -static gint hf_sbc_ssrtg = -1; -static gint hf_sbc_mac_pdu = -1; -static gint hf_sbc_mac_pdu_piggybacked = -1; -static gint hf_sbc_mac_pdu_fsn = -1; -static gint hf_sbc_mac_pdu_rsvd = -1; -static gint hf_sbc_max_transmit_power = -1; -static gint hf_sbc_bpsk = -1; -static gint hf_sbc_qpsk = -1; -static gint hf_sbc_qam16 = -1; -static gint hf_sbc_qam64 = -1; -static gint hf_sbc_current_transmitted_power = -1; -static gint hf_sbc_ss_fft_sizes = -1; -static gint hf_sbc_ss_fft_256 = -1; -static gint hf_sbc_ss_fft_2048 = -1; -static gint hf_sbc_ss_fft_128 = -1; -static gint hf_sbc_ss_fft_512 = -1; -static gint hf_sbc_ss_fft_1024 = -1; -static gint hf_sbc_ss_cinr_measure_capability = -1; -static gint hf_sbc_ss_phy_cinr_measurement_preamble = -1; -static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers = -1; -static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers = -1; -static gint hf_sbc_ss_effective_cinr_measurement_preamble = -1; -static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers = -1; -static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers = -1; -static gint hf_sbc_ss_support_2_concurrent_cqi_channels = -1; -static gint hf_sbc_ss_frequency_selectivity_characterization_report = -1; +static gint hf_sbc_bw_alloc_support; +static gint hf_sbc_bw_alloc_support_rsvd0; +static gint hf_sbc_bw_alloc_support_duplex; +static gint hf_sbc_bw_alloc_support_rsvd1; +static gint hf_sbc_curr_transmit_power; +static gint hf_sbc_transition_gaps; +static gint hf_sbc_ssttg; +static gint hf_sbc_ssrtg; +static gint hf_sbc_mac_pdu; +static gint hf_sbc_mac_pdu_piggybacked; +static gint hf_sbc_mac_pdu_fsn; +static gint hf_sbc_mac_pdu_rsvd; +static gint hf_sbc_max_transmit_power; +static gint hf_sbc_bpsk; +static gint hf_sbc_qpsk; +static gint hf_sbc_qam16; +static gint hf_sbc_qam64; +static gint hf_sbc_current_transmitted_power; +static gint hf_sbc_ss_fft_sizes; +static gint hf_sbc_ss_fft_256; +static gint hf_sbc_ss_fft_2048; +static gint hf_sbc_ss_fft_128; +static gint hf_sbc_ss_fft_512; +static gint hf_sbc_ss_fft_1024; +static gint hf_sbc_ss_cinr_measure_capability; +static gint hf_sbc_ss_phy_cinr_measurement_preamble; +static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_pilot_subcarriers; +static gint hf_sbc_ss_phy_cinr_measurement_permutation_zone_from_data_subcarriers; +static gint hf_sbc_ss_effective_cinr_measurement_preamble; +static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_pilot_subcarriers; +static gint hf_sbc_ss_effective_cinr_measurement_permutation_zone_from_data_subcarriers; +static gint hf_sbc_ss_support_2_concurrent_cqi_channels; +static gint hf_sbc_ss_frequency_selectivity_characterization_report; -static gint hf_sbc_ss_fft_rsvd1 = -1; -static gint hf_sbc_ss_fft_rsvd2 = -1; -static gint hf_sbc_ss_demodulator = -1; -static gint hf_sbc_ss_demodulator_64qam = -1; -static gint hf_sbc_ss_demodulator_btc = -1; -static gint hf_sbc_ss_demodulator_ctc = -1; -static gint hf_sbc_ss_demodulator_stc = -1; -static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver = -1; -static gint hf_sbc_ss_demodulator_harq_chase = -1; -static gint hf_sbc_ss_demodulator_harq_ctc_ir = -1; -static gint hf_sbc_ss_demodulator_reserved = -1; -/* static gint hf_sbc_ss_demodulator_reserved1 = -1; */ -static gint hf_sbc_ss_demodulator_64qam_2 = -1; -static gint hf_sbc_ss_demodulator_btc_2 = -1; -static gint hf_sbc_ss_demodulator_ctc_2 = -1; -static gint hf_sbc_ss_demodulator_stc_2 = -1; -static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver_2 = -1; -static gint hf_sbc_ss_demodulator_harq_chase_2 = -1; -static gint hf_sbc_ss_demodulator_harq_ctc_ir_2 = -1; -static gint hf_sbc_ss_demodulator_reserved_2 = -1; -static gint hf_sbc_ss_demodulator_harq_cc_ir_2 = -1; -static gint hf_sbc_ss_demodulator_ldpc_2 = -1; -static gint hf_sbc_ss_demodulator_dedicated_pilots_2 = -1; -static gint hf_sbc_ss_demodulator_reserved1_2 = -1; +static gint hf_sbc_ss_fft_rsvd1; +static gint hf_sbc_ss_fft_rsvd2; +static gint hf_sbc_ss_demodulator; +static gint hf_sbc_ss_demodulator_64qam; +static gint hf_sbc_ss_demodulator_btc; +static gint hf_sbc_ss_demodulator_ctc; +static gint hf_sbc_ss_demodulator_stc; +static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver; +static gint hf_sbc_ss_demodulator_harq_chase; +static gint hf_sbc_ss_demodulator_harq_ctc_ir; +static gint hf_sbc_ss_demodulator_reserved; +/* static gint hf_sbc_ss_demodulator_reserved1; */ +static gint hf_sbc_ss_demodulator_64qam_2; +static gint hf_sbc_ss_demodulator_btc_2; +static gint hf_sbc_ss_demodulator_ctc_2; +static gint hf_sbc_ss_demodulator_stc_2; +static gint hf_sbc_ss_demodulator_cc_with_optional_interleaver_2; +static gint hf_sbc_ss_demodulator_harq_chase_2; +static gint hf_sbc_ss_demodulator_harq_ctc_ir_2; +static gint hf_sbc_ss_demodulator_reserved_2; +static gint hf_sbc_ss_demodulator_harq_cc_ir_2; +static gint hf_sbc_ss_demodulator_ldpc_2; +static gint hf_sbc_ss_demodulator_dedicated_pilots_2; +static gint hf_sbc_ss_demodulator_reserved1_2; -static gint hf_sbc_ss_modulator = -1; -static gint hf_sbc_ss_modulator_64qam = -1; -static gint hf_sbc_ss_modulator_btc = -1; -static gint hf_sbc_ss_modulator_ctc = -1; -static gint hf_sbc_ss_modulator_stc = -1; -static gint hf_sbc_ss_modulator_harq_chase = -1; -static gint hf_sbc_ss_modulator_ctc_ir = -1; -static gint hf_sbc_ss_modulator_cc_ir = -1; -static gint hf_sbc_ss_modulator_ldpc = -1; +static gint hf_sbc_ss_modulator; +static gint hf_sbc_ss_modulator_64qam; +static gint hf_sbc_ss_modulator_btc; +static gint hf_sbc_ss_modulator_ctc; +static gint hf_sbc_ss_modulator_stc; +static gint hf_sbc_ss_modulator_harq_chase; +static gint hf_sbc_ss_modulator_ctc_ir; +static gint hf_sbc_ss_modulator_cc_ir; +static gint hf_sbc_ss_modulator_ldpc; -static gint hf_sbc_number_ul_arq_ack_channel = -1; -static gint hf_sbc_number_dl_arq_ack_channel = -1; -static gint hf_sbc_ss_permutation_support = -1; -static gint hf_sbc_ss_optimal_pusc = -1; -static gint hf_sbc_ss_optimal_fusc = -1; -static gint hf_sbc_ss_amc_1x6 = -1; -static gint hf_sbc_ss_amc_2x3 = -1; -static gint hf_sbc_ss_amc_3x2 = -1; -static gint hf_sbc_ss_amc_with_harq_map = -1; -static gint hf_sbc_ss_tusc1_support = -1; -static gint hf_sbc_ss_tusc2_support = -1; -static gint hf_sbc_ss_ofdma_aas_private = -1; -static gint hf_sbc_ofdma_aas_harq_map_capability = -1; -static gint hf_sbc_ofdma_aas_private_map_support = -1; -static gint hf_sbc_ofdma_aas_reduced_private_map_support = -1; -static gint hf_sbc_ofdma_aas_private_chain_enable = -1; -static gint hf_sbc_ofdma_aas_private_map_dl_frame_offset = -1; -static gint hf_sbc_ofdma_aas_private_ul_frame_offset = -1; -static gint hf_sbc_ofdma_aas_private_map_concurrency = -1; -static gint hf_sbc_ofdma_aas_capabilities = -1; -static gint hf_sbc_ss_ofdma_aas_zone = -1; -static gint hf_sbc_ss_ofdma_aas_diversity_map_scan = -1; -static gint hf_sbc_ss_ofdma_aas_fbck_rsp_support = -1; -static gint hf_sbc_ss_ofdma_downlink_aas_preamble = -1; -static gint hf_sbc_ss_ofdma_uplink_aas_preamble = -1; -static gint hf_sbc_ss_ofdma_aas_capabilities_rsvd = -1; +static gint hf_sbc_number_ul_arq_ack_channel; +static gint hf_sbc_number_dl_arq_ack_channel; +static gint hf_sbc_ss_permutation_support; +static gint hf_sbc_ss_optimal_pusc; +static gint hf_sbc_ss_optimal_fusc; +static gint hf_sbc_ss_amc_1x6; +static gint hf_sbc_ss_amc_2x3; +static gint hf_sbc_ss_amc_3x2; +static gint hf_sbc_ss_amc_with_harq_map; +static gint hf_sbc_ss_tusc1_support; +static gint hf_sbc_ss_tusc2_support; +static gint hf_sbc_ss_ofdma_aas_private; +static gint hf_sbc_ofdma_aas_harq_map_capability; +static gint hf_sbc_ofdma_aas_private_map_support; +static gint hf_sbc_ofdma_aas_reduced_private_map_support; +static gint hf_sbc_ofdma_aas_private_chain_enable; +static gint hf_sbc_ofdma_aas_private_map_dl_frame_offset; +static gint hf_sbc_ofdma_aas_private_ul_frame_offset; +static gint hf_sbc_ofdma_aas_private_map_concurrency; +static gint hf_sbc_ofdma_aas_capabilities; +static gint hf_sbc_ss_ofdma_aas_zone; +static gint hf_sbc_ss_ofdma_aas_diversity_map_scan; +static gint hf_sbc_ss_ofdma_aas_fbck_rsp_support; +static gint hf_sbc_ss_ofdma_downlink_aas_preamble; +static gint hf_sbc_ss_ofdma_uplink_aas_preamble; +static gint hf_sbc_ss_ofdma_aas_capabilities_rsvd; -static gint hf_sbc_tlv_t_167_association_type_support = -1; -static gint hf_sbc_tlv_t_167_association_type_support_bit0 = -1; -static gint hf_sbc_tlv_t_167_association_type_support_bit1 = -1; -static gint hf_sbc_tlv_t_167_association_type_support_bit2 = -1; -static gint hf_sbc_tlv_t_167_association_type_support_bit3 = -1; -static gint hf_sbc_tlv_t_167_association_type_support_bit4 = -1; -static gint hf_sbc_tlv_t_167_association_type_support_reserved = -1; -static gint hf_sbc_ofdma_ss_uplink_power_control_support = -1; -static gint hf_sbc_ofdma_ss_uplink_power_control_support_open_loop = -1; -static gint hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble = -1; -static gint hf_sbc_ofdma_ss_uplink_power_control_support_rsvd = -1; -/* static gint hf_sbc_ofdm_ss_minimum_num_of_frames = -1; */ -static gint hf_sbc_tlv_t_27_extension_capability = -1; -static gint hf_sbc_tlv_t_27_extension_capability_bit0 = -1; -static gint hf_sbc_tlv_t_27_extension_capability_reserved = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0 = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1 = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2 = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3 = -1; -static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved = -1; -static gint hf_sbc_tlv_t_171_minimum_num_of_frames = -1; -static gint hf_sbc_tlv_t_172_harq_map_capability = -1; -static gint hf_sbc_tlv_t_172_extended_harq_ie_capability = -1; -static gint hf_sbc_tlv_t_172_sub_map_capability_first_zone = -1; -static gint hf_sbc_tlv_t_172_sub_map_capability_other_zones = -1; -static gint hf_sbc_tlv_t_172_dl_region_definition_support = -1; -static gint hf_sbc_tlv_t_172_reserved = -1; -static gint hf_sbc_tlv_t_172 = -1; -static gint hf_sbc_tlv_t_173_ul_ctl_channel_support = -1; -static gint hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback = -1; -static gint hf_sbc_tlv_t_173_enhanced_fast_feedback = -1; -static gint hf_sbc_tlv_t_173_ul_ack = -1; -static gint hf_sbc_tlv_t_173_reserved = -1; -static gint hf_sbc_tlv_t_173_uep_fast_feedback = -1; -static gint hf_sbc_tlv_t_173_measurement_report = -1; -static gint hf_sbc_tlv_t_173_primary_secondary_fast_feedback = -1; -static gint hf_sbc_tlv_t_173_diuc_cqi_fast_feedback = -1; -static gint hf_sbc_tlv_t_174_ofdma_ms_csit_capability = -1; -static gint hf_sbc_tlv_t_174_csit_compatibility_type_a = -1; -static gint hf_sbc_tlv_t_174_csit_compatibility_type_b = -1; -static gint hf_sbc_tlv_t_174_power_assignment_capability = -1; -static gint hf_sbc_tlv_t_174_sounding_rsp_time_capability = -1; -static gint hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions = -1; -static gint hf_sbc_tlv_t_174_ss_csit_type_a_support = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b = -1; -static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved = -1; -static gint hf_sbc_tlv_t_174_ss_csit_reserved = -1; -static gint hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq = -1; -static gint hf_sbc_tlv_t_175_max_num_ul_harq_bst = -1; -static gint hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst = -1; -static gint hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm = -1; -static gint hf_sbc_tlv_t_176 = -1; -static gint hf_sbc_tlv_t_176_bit0 = -1; -static gint hf_sbc_tlv_t_176_bit1 = -1; -static gint hf_sbc_tlv_t_176_bit2 = -1; -/* static gint hf_sbc_tlv_t_176_bit2_cor2 = -1; */ -static gint hf_sbc_tlv_t_176_bit3 = -1; -static gint hf_sbc_tlv_t_176_bit4 = -1; -static gint hf_sbc_tlv_t_176_bit5 = -1; -static gint hf_sbc_tlv_t_176_bit6 = -1; -static gint hf_sbc_tlv_t_176_bit7 = -1; -static gint hf_sbc_tlv_t_176_bit8 = -1; -static gint hf_sbc_tlv_t_176_bit9 = -1; -static gint hf_sbc_tlv_t_176_bit10 = -1; -static gint hf_sbc_tlv_t_176_bit11 = -1; -static gint hf_sbc_tlv_t_176_bit12 = -1; -static gint hf_sbc_tlv_t_176_bit13 = -1; -static gint hf_sbc_tlv_t_176_bit14 = -1; -static gint hf_sbc_tlv_t_176_bit15 = -1; -static gint hf_sbc_tlv_t_176_bit16 = -1; -static gint hf_sbc_tlv_t_176_bit17 = -1; -static gint hf_sbc_tlv_t_176_bit18 = -1; -static gint hf_sbc_tlv_t_176_bit19 = -1; -static gint hf_sbc_tlv_t_176_reserved = -1; -static gint hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support = -1; -static gint hf_sbc_tlv_t_177_stc_matrix_a = -1; -static gint hf_sbc_tlv_t_177_stc_matrix_b_vertical = -1; -static gint hf_sbc_tlv_t_177_stc_matrix_b_horizontal = -1; -static gint hf_sbc_tlv_t_177_two_transmit_antennas = -1; -static gint hf_sbc_tlv_t_177_capable_of_transmit_diversity = -1; -static gint hf_sbc_tlv_t_177_capable_of_spacial_multiplexing = -1; -static gint hf_sbc_tlv_t_177_beamforming = -1; -static gint hf_sbc_tlv_t_177_adaptive_rate_ctl = -1; -static gint hf_sbc_tlv_t_177_single_antenna = -1; -static gint hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna = -1; -static gint hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas = -1; -static gint hf_sbc_tlv_t_177_capable_of_two_antenna = -1; -static gint hf_sbc_tlv_t_177_rsvd = -1; -static gint hf_sbc_tlv_t_178_sdma_pilot_capability = -1; -static gint hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone = -1; -static gint hf_sbc_tlv_t_178_reserved = -1; -static gint hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support = -1; -static gint hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec = -1; -static gint hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec = -1; -static gint hf_sbc_tlv_t_179_reserved = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1 = -1; -static gint hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP = -1; -static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2 = -1; -static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability = -1; -static gint hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining = -1; -static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl = -1; -static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1 = -1; -static gint hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining = -1; -static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul = -1; -static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2 = -1; +static gint hf_sbc_tlv_t_167_association_type_support; +static gint hf_sbc_tlv_t_167_association_type_support_bit0; +static gint hf_sbc_tlv_t_167_association_type_support_bit1; +static gint hf_sbc_tlv_t_167_association_type_support_bit2; +static gint hf_sbc_tlv_t_167_association_type_support_bit3; +static gint hf_sbc_tlv_t_167_association_type_support_bit4; +static gint hf_sbc_tlv_t_167_association_type_support_reserved; +static gint hf_sbc_ofdma_ss_uplink_power_control_support; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_open_loop; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_aas_preamble; +static gint hf_sbc_ofdma_ss_uplink_power_control_support_rsvd; +/* static gint hf_sbc_ofdm_ss_minimum_num_of_frames; */ +static gint hf_sbc_tlv_t_27_extension_capability; +static gint hf_sbc_tlv_t_27_extension_capability_bit0; +static gint hf_sbc_tlv_t_27_extension_capability_reserved; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit0; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit1; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit2; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_bit3; +static gint hf_sbc_tlv_t_28_ho_trigger_metric_support_reserved; +static gint hf_sbc_tlv_t_171_minimum_num_of_frames; +static gint hf_sbc_tlv_t_172_harq_map_capability; +static gint hf_sbc_tlv_t_172_extended_harq_ie_capability; +static gint hf_sbc_tlv_t_172_sub_map_capability_first_zone; +static gint hf_sbc_tlv_t_172_sub_map_capability_other_zones; +static gint hf_sbc_tlv_t_172_dl_region_definition_support; +static gint hf_sbc_tlv_t_172_reserved; +static gint hf_sbc_tlv_t_172; +static gint hf_sbc_tlv_t_173_ul_ctl_channel_support; +static gint hf_sbc_tlv_t_173_3_bit_mimo_fast_feedback; +static gint hf_sbc_tlv_t_173_enhanced_fast_feedback; +static gint hf_sbc_tlv_t_173_ul_ack; +static gint hf_sbc_tlv_t_173_reserved; +static gint hf_sbc_tlv_t_173_uep_fast_feedback; +static gint hf_sbc_tlv_t_173_measurement_report; +static gint hf_sbc_tlv_t_173_primary_secondary_fast_feedback; +static gint hf_sbc_tlv_t_173_diuc_cqi_fast_feedback; +static gint hf_sbc_tlv_t_174_ofdma_ms_csit_capability; +static gint hf_sbc_tlv_t_174_csit_compatibility_type_a; +static gint hf_sbc_tlv_t_174_csit_compatibility_type_b; +static gint hf_sbc_tlv_t_174_power_assignment_capability; +static gint hf_sbc_tlv_t_174_sounding_rsp_time_capability; +static gint hf_sbc_tlv_t_174_max_num_simultanous_sounding_instructions; +static gint hf_sbc_tlv_t_174_ss_csit_type_a_support; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_a; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_phy_set_b; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_harq_parameters_set; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_a; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_mac_set_b; +static gint hf_sbc_tlv_t_204_ofdma_parameters_sets_reserved; +static gint hf_sbc_tlv_t_174_ss_csit_reserved; +static gint hf_sbc_tlv_t_175_max_num_bst_per_frm_capability_harq; +static gint hf_sbc_tlv_t_175_max_num_ul_harq_bst; +static gint hf_sbc_tlv_t_175_max_num_ul_harq_per_frm_include_one_non_harq_bst; +static gint hf_sbc_tlv_t_175_max_num_dl_harq_bst_per_harq_per_frm; +static gint hf_sbc_tlv_t_176; +static gint hf_sbc_tlv_t_176_bit0; +static gint hf_sbc_tlv_t_176_bit1; +static gint hf_sbc_tlv_t_176_bit2; +/* static gint hf_sbc_tlv_t_176_bit2_cor2; */ +static gint hf_sbc_tlv_t_176_bit3; +static gint hf_sbc_tlv_t_176_bit4; +static gint hf_sbc_tlv_t_176_bit5; +static gint hf_sbc_tlv_t_176_bit6; +static gint hf_sbc_tlv_t_176_bit7; +static gint hf_sbc_tlv_t_176_bit8; +static gint hf_sbc_tlv_t_176_bit9; +static gint hf_sbc_tlv_t_176_bit10; +static gint hf_sbc_tlv_t_176_bit11; +static gint hf_sbc_tlv_t_176_bit12; +static gint hf_sbc_tlv_t_176_bit13; +static gint hf_sbc_tlv_t_176_bit14; +static gint hf_sbc_tlv_t_176_bit15; +static gint hf_sbc_tlv_t_176_bit16; +static gint hf_sbc_tlv_t_176_bit17; +static gint hf_sbc_tlv_t_176_bit18; +static gint hf_sbc_tlv_t_176_bit19; +static gint hf_sbc_tlv_t_176_reserved; +static gint hf_sbc_tlv_t_177_ofdma_ss_modulator_for_mimo_support; +static gint hf_sbc_tlv_t_177_stc_matrix_a; +static gint hf_sbc_tlv_t_177_stc_matrix_b_vertical; +static gint hf_sbc_tlv_t_177_stc_matrix_b_horizontal; +static gint hf_sbc_tlv_t_177_two_transmit_antennas; +static gint hf_sbc_tlv_t_177_capable_of_transmit_diversity; +static gint hf_sbc_tlv_t_177_capable_of_spacial_multiplexing; +static gint hf_sbc_tlv_t_177_beamforming; +static gint hf_sbc_tlv_t_177_adaptive_rate_ctl; +static gint hf_sbc_tlv_t_177_single_antenna; +static gint hf_sbc_tlv_t_177_collaborative_sm_with_one_antenna; +static gint hf_sbc_tlv_t_177_collaborative_sm_with_two_antennas; +static gint hf_sbc_tlv_t_177_capable_of_two_antenna; +static gint hf_sbc_tlv_t_177_rsvd; +static gint hf_sbc_tlv_t_178_sdma_pilot_capability; +static gint hf_sbc_tlv_t_178_sdma_pilot_pattern_support_for_amc_zone; +static gint hf_sbc_tlv_t_178_reserved; +static gint hf_sbc_tlv_t_179_ofdma_multiple_dl_burst_profile_support; +static gint hf_sbc_tlv_t_179_dl_bst_profile_for_multiple_fec; +static gint hf_sbc_tlv_t_179_ul_bst_profile_for_multiple_fec; +static gint hf_sbc_tlv_t_179_reserved; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_NEP; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_dl; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_aggregation_flag_for_ul; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved1; +static gint hf_sbc_tlv_t_162_ul_harq_incremental_redundancy_buffer_capability_NEP; +static gint hf_sbc_tlv_t_162_harq_incremental_redundancy_buffer_capability_reserved2; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability; +static gint hf_sbc_tlv_t_163_dl_harq_buffering_capability_for_chase_combining; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_dl; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved1; +static gint hf_sbc_tlv_t_163_ul_harq_buffering_capability_for_chase_combining; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_aggregation_flag_ul; +static gint hf_sbc_tlv_t_163_harq_chase_combining_and_cc_ir_buffer_capability_reserved2; -static gint hf_sbc_ss_demodulator_mimo_support = -1; -static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a = -1; -static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical = -1; -static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal = -1; -static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a = -1; -static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical = -1; -static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal = -1; -static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical = -1; -static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal = -1; -static gint hf_sbc_ss_demodulator_mimo_rsvd = -1; -static gint hf_sbc_ss_mimo_uplink_support = -1; -static gint hf_sbc_ss_mimo_uplink_support_2_ann_sttd = -1; -static gint hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical = -1; -static gint hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm = -1; -static gint hf_sbc_ss_mimo_uplink_support_rsvd = -1; +static gint hf_sbc_ss_demodulator_mimo_support; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_a; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_vertical; +static gint hf_sbc_ss_demodulator_mimo_2_ann_stc_matrix_b_horizontal; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_a; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_vertical; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_b_horizontal; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_vertical; +static gint hf_sbc_ss_demodulator_mimo_4_ann_stc_matrix_c_horizontal; +static gint hf_sbc_ss_demodulator_mimo_rsvd; +static gint hf_sbc_ss_mimo_uplink_support; +static gint hf_sbc_ss_mimo_uplink_support_2_ann_sttd; +static gint hf_sbc_ss_mimo_uplink_support_2_ann_sm_vertical; +static gint hf_sbc_ss_mimo_uplink_support_1_ann_coop_sm; +static gint hf_sbc_ss_mimo_uplink_support_rsvd; -static gint hf_sbc_power_save_class_types_capability = -1; -static gint hf_sbc_power_save_class_types_capability_bit0 = -1; -static gint hf_sbc_power_save_class_types_capability_bit1 = -1; -static gint hf_sbc_power_save_class_types_capability_bit2 = -1; -static gint hf_sbc_power_save_class_types_capability_bits34 = -1; -static gint hf_sbc_power_save_class_types_capability_bits567 = -1; +static gint hf_sbc_power_save_class_types_capability; +static gint hf_sbc_power_save_class_types_capability_bit0; +static gint hf_sbc_power_save_class_types_capability_bit1; +static gint hf_sbc_power_save_class_types_capability_bit2; +static gint hf_sbc_power_save_class_types_capability_bits34; +static gint hf_sbc_power_save_class_types_capability_bits567; -static gint hf_sbc_pkm_flow_control = -1; -static gint hf_sbc_auth_policy = -1; -static gint hf_sbc_privacy_802_16 = -1; -static gint hf_sbc_privacy_rsvd = -1; -static gint hf_sbc_max_security_associations = -1; +static gint hf_sbc_pkm_flow_control; +static gint hf_sbc_auth_policy; +static gint hf_sbc_privacy_802_16; +static gint hf_sbc_privacy_rsvd; +static gint hf_sbc_max_security_associations; -static gint hf_sbc_invalid_tlv = -1; +static gint hf_sbc_invalid_tlv; static const true_false_string tfs_sbc_bw_alloc_support_duplex = { @@ -2807,19 +2810,15 @@ void proto_register_mac_mgmt_msg_sbc(void) proto_register_field_array(proto_mac_mgmt_msg_sbc_decoder, hf_sbc, array_length(hf_sbc)); proto_register_subtree_array(ett_sbc, array_length(ett_sbc)); - register_dissector("mac_mgmt_msg_sbc_rsp_handler", dissect_mac_mgmt_msg_sbc_rsp_decoder, -1); + sbc_req_handle = register_dissector("mac_mgmt_msg_sbc_req_handler", dissect_mac_mgmt_msg_sbc_req_decoder, proto_mac_mgmt_msg_sbc_decoder); + sbc_rsp_handle = register_dissector("mac_mgmt_msg_sbc_rsp_handler", dissect_mac_mgmt_msg_sbc_rsp_decoder, proto_mac_mgmt_msg_sbc_decoder); } void proto_reg_handoff_mac_mgmt_msg_sbc(void) { - dissector_handle_t sbc_handle; - - sbc_handle = create_dissector_handle(dissect_mac_mgmt_msg_sbc_req_decoder, proto_mac_mgmt_msg_sbc_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_SBC_REQ, sbc_handle); - - sbc_handle = create_dissector_handle(dissect_mac_mgmt_msg_sbc_rsp_decoder, proto_mac_mgmt_msg_sbc_decoder); - dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_SBC_RSP, sbc_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_SBC_REQ, sbc_req_handle); + dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_SBC_RSP, sbc_rsp_handle); } diff --git a/plugins/epan/wimax/msg_ucd.c b/plugins/epan/wimax/msg_ucd.c index 6f5ffab431..5ad333cf77 100644 --- a/plugins/epan/wimax/msg_ucd.c +++ b/plugins/epan/wimax/msg_ucd.c @@ -28,94 +28,96 @@ void proto_register_mac_mgmt_msg_ucd(void); void proto_reg_handoff_mac_mgmt_msg_ucd(void); +static dissector_handle_t ucd_handle; + extern gboolean include_cor2_changes; guint cqich_id_size; /* Set for CQICH_Alloc_IE */ -static gint proto_mac_mgmt_msg_ucd_decoder = -1; -static gint ett_mac_mgmt_msg_ucd_decoder = -1; +static gint proto_mac_mgmt_msg_ucd_decoder; +static gint ett_mac_mgmt_msg_ucd_decoder; /* fix fields */ -static gint hf_ucd_res_timeout = -1; -static gint hf_ucd_bw_req_size = -1; -static gint hf_ucd_ranging_req_size = -1; -static gint hf_ucd_freq = -1; -/* static gint hf_ucd_subchan_params_num_chan = -1; */ -static gint hf_ucd_ul_allocated_subchannles_bitmap = -1; -/* static gint hf_ucd_subchan_params_num_sym = -1; */ -/* static gint hf_ucd_subchan_codes = -1; */ +static gint hf_ucd_res_timeout; +static gint hf_ucd_bw_req_size; +static gint hf_ucd_ranging_req_size; +static gint hf_ucd_freq; +/* static gint hf_ucd_subchan_params_num_chan; */ +static gint hf_ucd_ul_allocated_subchannles_bitmap; +/* static gint hf_ucd_subchan_params_num_sym; */ +/* static gint hf_ucd_subchan_codes; */ -static gint hf_ucd_ul_burst_reserved = -1; -static gint hf_ucd_ul_burst_uiuc = -1; -static gint hf_ucd_burst_fec = -1; -static gint hf_ucd_burst_ranging_data_ratio = -1; -/*static gint hf_ucd_burst_power_boost = -1; -*static gint hf_ucd_burst_tcs_enable = -1; +static gint hf_ucd_ul_burst_reserved; +static gint hf_ucd_ul_burst_uiuc; +static gint hf_ucd_burst_fec; +static gint hf_ucd_burst_ranging_data_ratio; +/*static gint hf_ucd_burst_power_boost; +*static gint hf_ucd_burst_tcs_enable; */ -static gint hf_ucd_tlv_t_159_band_amc_allocation_threshold = -1; -static gint hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap = -1; -static gint hf_ucd_tlv_t_160_band_amc_release_threshold = -1; -static gint hf_ucd_tlv_t_161_band_amc_allocation_timer = -1; -static gint hf_ucd_tlv_t_162_band_amc_release_timer = -1; -static gint hf_ucd_tlv_t_163_band_status_report_max_period = -1; -static gint hf_ucd_tlv_t_164_band_amc_retry_timer = -1; -static gint hf_ucd_tlv_t_171_harq_ack_delay_dl_burst = -1; -static gint hf_ucd_tlv_t_170_safety_channel_retry_timer = -1; -static gint hf_ucd_tlv_t_172_cqich_band_amc_transition_delay = -1; -static gint hf_ucd_tlv_t_174_maximum_retransmission = -1; -static gint hf_ucd_tlv_t_177_normalized_cn_override2 = -1; -static gint hf_ucd_tlv_t_177_normalized_cn_override2_first_line = -1; -static gint hf_ucd_tlv_t_177_normalized_cn_override2_list = -1; -static gint hf_ucd_tlv_t_176_size_of_cqich_id_field = -1; -static gint hf_ucd_tlv_t_186_upper_bound_aas_preamble = -1; -static gint hf_ucd_tlv_t_187_lower_bound_aas_preamble = -1; -static gint hf_ucd_tlv_t_188_allow_aas_beam_select_message = -1; -static gint hf_ucd_tlv_t_189_use_cqich_indication_flag = -1; -static gint hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step = -1; -static gint hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step = -1; -static gint hf_ucd_tlv_t_192_min_level_power_offset_adjustment = -1; -static gint hf_ucd_tlv_t_193_max_level_power_offset_adjustment = -1; -static gint hf_ucd_tlv_t_194_handover_ranging_codes = -1; -static gint hf_ucd_tlv_t_195_initial_ranging_interval = -1; -static gint hf_ucd_tlv_t_196_tx_power_report = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_threshold = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_interval = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_threshold_icqch = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_interval_icqch = -1; -static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg_icqch = -1; -/* static gint hf_ucd_tlv_t_197_normalized_cn_channel_sounding = -1; */ -static gint hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types = -1; -static gint hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation = -1; -static gint hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst = -1; -static gint hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg = -1; -static gint hf_ucd_tlv_t_207_ul_initial_transmit_timing = -1; -static gint hf_ucd_tlv_t_210_fast_feedback_region = -1; -static gint hf_ucd_tlv_t_211_harq_ack_region = -1; -static gint hf_ucd_tlv_t_212_ranging_region = -1; -static gint hf_ucd_tlv_t_213_sounding_region = -1; -static gint hf_ucd_tlv_t_150_initial_ranging_codes = -1; -static gint hf_ucd_tlv_t_151_periodic_ranging_codes = -1; -static gint hf_ucd_tlv_t_152_bandwidth_request_codes = -1; -static gint hf_ucd_tlv_t_155_start_of_ranging_codes_group = -1; -static gint hf_ucd_tlv_t_156_permutation_base = -1; -static gint hf_ucd_ho_ranging_start = -1; -static gint hf_ucd_ho_ranging_end = -1; -static gint hf_ucd_initial_range_backoff_start = -1; -static gint hf_ucd_initial_range_backoff_end = -1; -static gint hf_ucd_bandwidth_backoff_start = -1; -static gint hf_ucd_bandwidth_backoff_end = -1; -static gint hf_ucd_periodic_ranging_backoff_start = -1; -static gint hf_ucd_periodic_ranging_backoff_end = -1; -static gint hf_ucd_config_change_count = -1; -static gint hf_ucd_ranging_backoff_start = -1; -static gint hf_ucd_ranging_backoff_end = -1; -static gint hf_ucd_request_backoff_start = -1; -static gint hf_ucd_request_backoff_end = -1; +static gint hf_ucd_tlv_t_159_band_amc_allocation_threshold; +static gint hf_ucd_tlv_t_158_optional_permutation_ul_allocated_subchannels_bitmap; +static gint hf_ucd_tlv_t_160_band_amc_release_threshold; +static gint hf_ucd_tlv_t_161_band_amc_allocation_timer; +static gint hf_ucd_tlv_t_162_band_amc_release_timer; +static gint hf_ucd_tlv_t_163_band_status_report_max_period; +static gint hf_ucd_tlv_t_164_band_amc_retry_timer; +static gint hf_ucd_tlv_t_171_harq_ack_delay_dl_burst; +static gint hf_ucd_tlv_t_170_safety_channel_retry_timer; +static gint hf_ucd_tlv_t_172_cqich_band_amc_transition_delay; +static gint hf_ucd_tlv_t_174_maximum_retransmission; +static gint hf_ucd_tlv_t_177_normalized_cn_override2; +static gint hf_ucd_tlv_t_177_normalized_cn_override2_first_line; +static gint hf_ucd_tlv_t_177_normalized_cn_override2_list; +static gint hf_ucd_tlv_t_176_size_of_cqich_id_field; +static gint hf_ucd_tlv_t_186_upper_bound_aas_preamble; +static gint hf_ucd_tlv_t_187_lower_bound_aas_preamble; +static gint hf_ucd_tlv_t_188_allow_aas_beam_select_message; +static gint hf_ucd_tlv_t_189_use_cqich_indication_flag; +static gint hf_ucd_tlv_t_190_ms_specific_up_power_addjustment_step; +static gint hf_ucd_tlv_t_191_ms_specific_down_power_addjustment_step; +static gint hf_ucd_tlv_t_192_min_level_power_offset_adjustment; +static gint hf_ucd_tlv_t_193_max_level_power_offset_adjustment; +static gint hf_ucd_tlv_t_194_handover_ranging_codes; +static gint hf_ucd_tlv_t_195_initial_ranging_interval; +static gint hf_ucd_tlv_t_196_tx_power_report; +static gint hf_ucd_tlv_t_196_tx_power_report_threshold; +static gint hf_ucd_tlv_t_196_tx_power_report_interval; +static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg; +static gint hf_ucd_tlv_t_196_tx_power_report_threshold_icqch; +static gint hf_ucd_tlv_t_196_tx_power_report_interval_icqch; +static gint hf_ucd_tlv_t_196_tx_power_report_a_p_avg_icqch; +/* static gint hf_ucd_tlv_t_197_normalized_cn_channel_sounding; */ +static gint hf_ucd_tlv_t_202_uplink_burst_profile_for_multiple_fec_types; +static gint hf_ucd_tlv_t_203_ul_pusc_subchannel_rotation; +static gint hf_ucd_tlv_t_205_relative_power_offset_ul_harq_burst; +static gint hf_ucd_tlv_t_206_relative_power_offset_ul_burst_containing_mac_mgmt_msg; +static gint hf_ucd_tlv_t_207_ul_initial_transmit_timing; +static gint hf_ucd_tlv_t_210_fast_feedback_region; +static gint hf_ucd_tlv_t_211_harq_ack_region; +static gint hf_ucd_tlv_t_212_ranging_region; +static gint hf_ucd_tlv_t_213_sounding_region; +static gint hf_ucd_tlv_t_150_initial_ranging_codes; +static gint hf_ucd_tlv_t_151_periodic_ranging_codes; +static gint hf_ucd_tlv_t_152_bandwidth_request_codes; +static gint hf_ucd_tlv_t_155_start_of_ranging_codes_group; +static gint hf_ucd_tlv_t_156_permutation_base; +static gint hf_ucd_ho_ranging_start; +static gint hf_ucd_ho_ranging_end; +static gint hf_ucd_initial_range_backoff_start; +static gint hf_ucd_initial_range_backoff_end; +static gint hf_ucd_bandwidth_backoff_start; +static gint hf_ucd_bandwidth_backoff_end; +static gint hf_ucd_periodic_ranging_backoff_start; +static gint hf_ucd_periodic_ranging_backoff_end; +static gint hf_ucd_config_change_count; +static gint hf_ucd_ranging_backoff_start; +static gint hf_ucd_ranging_backoff_end; +static gint hf_ucd_request_backoff_start; +static gint hf_ucd_request_backoff_end; -/* static gint hf_ucd_unknown_type = -1; */ -static gint hf_ucd_invalid_tlv = -1; +/* static gint hf_ucd_unknown_type; */ +static gint hf_ucd_invalid_tlv; #if 0 static const value_string vals_dcd_burst_tcs[] = @@ -1219,13 +1221,11 @@ void proto_register_mac_mgmt_msg_ucd(void) proto_register_field_array(proto_mac_mgmt_msg_ucd_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + ucd_handle = register_dissector("mac_mgmt_msg_ucd_handler", dissect_mac_mgmt_msg_ucd_decoder, proto_mac_mgmt_msg_ucd_decoder); } void proto_reg_handoff_mac_mgmt_msg_ucd(void) { - dissector_handle_t ucd_handle; - - ucd_handle = create_dissector_handle(dissect_mac_mgmt_msg_ucd_decoder, proto_mac_mgmt_msg_ucd_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_UCD, ucd_handle); } diff --git a/plugins/epan/wimax/msg_ulmap.c b/plugins/epan/wimax/msg_ulmap.c index 6c703145b1..cdb0066c50 100644 --- a/plugins/epan/wimax/msg_ulmap.c +++ b/plugins/epan/wimax/msg_ulmap.c @@ -24,6 +24,8 @@ extern gboolean include_cor2_changes; +static dissector_handle_t ulmap_handle; + void proto_register_mac_mgmt_msg_ulmap(void); void proto_reg_handoff_mac_mgmt_msg_ulmap(void); @@ -55,54 +57,54 @@ extern gint ir_type; extern gint N_layer; extern gint RCID_Type; -static gint proto_mac_mgmt_msg_ulmap_decoder = -1; - -static gint ett_ulmap = -1; -static gint ett_ulmap_ie = -1; -static gint ett_ulmap_ffb = -1; -/* static gint ett_ulmap_c = -1; */ -/* static gint ett_ulmap_c_ie = -1; */ -/* static gint ett_ulmap_s = -1; */ -/* static gint ett_ulmap_s_ie = -1; */ -static gint ett_287_1 = -1; -static gint ett_287_2 = -1; -static gint ett_289 = -1; -static gint ett_290 = -1; -static gint ett_290b = -1; -static gint ett_291 = -1; -static gint ett_292 = -1; -static gint ett_293 = -1; -static gint ett_294 = -1; -static gint ett_295 = -1; -static gint ett_299 = -1; -static gint ett_300 = -1; -static gint ett_302 = -1; -static gint ett_302a = -1; -static gint ett_302b = -1; -static gint ett_302c = -1; -static gint ett_302d = -1; -static gint ett_302e = -1; -static gint ett_302f = -1; -static gint ett_302g = -1; -static gint ett_302h = -1; -static gint ett_302i = -1; -static gint ett_302j = -1; -static gint ett_302k = -1; -static gint ett_302l = -1; -static gint ett_302m = -1; -static gint ett_302n = -1; -static gint ett_302o = -1; -static gint ett_302p = -1; -static gint ett_302q = -1; -static gint ett_302r = -1; -static gint ett_302s = -1; -static gint ett_302t = -1; -static gint ett_302u = -1; -static gint ett_302v = -1; -static gint ett_306 = -1; -static gint ett_306_ul = -1; -static gint ett_308b = -1; -static gint ett_315d = -1; +static gint proto_mac_mgmt_msg_ulmap_decoder; + +static gint ett_ulmap; +static gint ett_ulmap_ie; +static gint ett_ulmap_ffb; +/* static gint ett_ulmap_c; */ +/* static gint ett_ulmap_c_ie; */ +/* static gint ett_ulmap_s; */ +/* static gint ett_ulmap_s_ie; */ +static gint ett_287_1; +static gint ett_287_2; +static gint ett_289; +static gint ett_290; +static gint ett_290b; +static gint ett_291; +static gint ett_292; +static gint ett_293; +static gint ett_294; +static gint ett_295; +static gint ett_299; +static gint ett_300; +static gint ett_302; +static gint ett_302a; +static gint ett_302b; +static gint ett_302c; +static gint ett_302d; +static gint ett_302e; +static gint ett_302f; +static gint ett_302g; +static gint ett_302h; +static gint ett_302i; +static gint ett_302j; +static gint ett_302k; +static gint ett_302l; +static gint ett_302m; +static gint ett_302n; +static gint ett_302o; +static gint ett_302p; +static gint ett_302q; +static gint ett_302r; +static gint ett_302s; +static gint ett_302t; +static gint ett_302u; +static gint ett_302v; +static gint ett_306; +static gint ett_306_ul; +static gint ett_308b; +static gint ett_315d; #define DCD_DOWNLINK_BURST_PROFILE 1 #define DCD_BS_EIRP 2 @@ -194,348 +196,348 @@ static const value_string boost_msgs[] = #endif /* ul-map fields */ -static gint hf_ulmap_reserved = -1; -static gint hf_ulmap_ucd_count = -1; -static gint hf_ulmap_alloc_start_time = -1; -static gint hf_ulmap_ofdma_sym = -1; -static gint hf_ulmap_ie_diuc_ext = -1; -static gint hf_ulmap_ie_diuc_ext2 = -1; -static gint hf_ulmap_ie_length = -1; -static gint hf_ulmap_ie_reserved_extended2_duic = -1; -static gint hf_ulmap_ie_reserved_extended_duic = -1; -/* static gint hf_ulmap_fch_expected = -1; */ - -/* static gint hf_ulmap_ie = -1; */ - -static gint hf_ulmap_ie_cid = -1; -static gint hf_ulmap_ie_uiuc = -1; -static gint hf_ulmap_uiuc12_symofs = -1; -static gint hf_ulmap_uiuc12_subofs = -1; -static gint hf_ulmap_uiuc12_numsym = -1; -static gint hf_ulmap_uiuc12_numsub = -1; -static gint hf_ulmap_uiuc12_method = -1; -static gint hf_ulmap_uiuc12_dri = -1; -static gint hf_ulmap_uiuc10_dur = -1; -static gint hf_ulmap_uiuc10_rep = -1; -static gint hf_ulmap_uiuc10_slot_offset = -1; - -static gint hf_ulmap_uiuc14_dur = -1; -static gint hf_ulmap_uiuc14_uiuc = -1; -static gint hf_ulmap_uiuc14_rep = -1; -static gint hf_ulmap_uiuc14_idx = -1; -static gint hf_ulmap_uiuc14_code = -1; -static gint hf_ulmap_uiuc14_sym = -1; -static gint hf_ulmap_uiuc14_sub = -1; -static gint hf_ulmap_uiuc14_bwr = -1; - -/* static gint hf_ulmap_uiuc11_ext = -1; */ -/* static gint hf_ulmap_uiuc11_len = -1; */ -/* static gint hf_ulmap_uiuc11_data = -1; */ -/* static gint hf_ulmap_uiuc15_ext = -1; */ -/* static gint hf_ulmap_uiuc15_len = -1; */ -/* static gint hf_ulmap_uiuc15_data = -1; */ - -static gint hf_ulmap_uiuc0_symofs = -1; -static gint hf_ulmap_uiuc0_subofs = -1; -static gint hf_ulmap_uiuc0_numsym = -1; -static gint hf_ulmap_uiuc0_numsub = -1; -static gint hf_ulmap_uiuc0_rsv = -1; - -static gint hf_ulmap_uiuc13_symofs = -1; -static gint hf_ulmap_uiuc13_subofs = -1; -static gint hf_ulmap_uiuc13_numsym = -1; -static gint hf_ulmap_uiuc13_numsub = -1; -static gint hf_ulmap_uiuc13_papr = -1; -static gint hf_ulmap_uiuc13_zone = -1; -static gint hf_ulmap_uiuc13_rsv = -1; -/* static gint hf_ulmap_crc16 = -1; */ -/* static gint hf_ulmap_crc16_status = -1; */ -static gint hf_ulmap_padding = -1; +static gint hf_ulmap_reserved; +static gint hf_ulmap_ucd_count; +static gint hf_ulmap_alloc_start_time; +static gint hf_ulmap_ofdma_sym; +static gint hf_ulmap_ie_diuc_ext; +static gint hf_ulmap_ie_diuc_ext2; +static gint hf_ulmap_ie_length; +static gint hf_ulmap_ie_reserved_extended2_duic; +static gint hf_ulmap_ie_reserved_extended_duic; +/* static gint hf_ulmap_fch_expected; */ + +/* static gint hf_ulmap_ie; */ + +static gint hf_ulmap_ie_cid; +static gint hf_ulmap_ie_uiuc; +static gint hf_ulmap_uiuc12_symofs; +static gint hf_ulmap_uiuc12_subofs; +static gint hf_ulmap_uiuc12_numsym; +static gint hf_ulmap_uiuc12_numsub; +static gint hf_ulmap_uiuc12_method; +static gint hf_ulmap_uiuc12_dri; +static gint hf_ulmap_uiuc10_dur; +static gint hf_ulmap_uiuc10_rep; +static gint hf_ulmap_uiuc10_slot_offset; + +static gint hf_ulmap_uiuc14_dur; +static gint hf_ulmap_uiuc14_uiuc; +static gint hf_ulmap_uiuc14_rep; +static gint hf_ulmap_uiuc14_idx; +static gint hf_ulmap_uiuc14_code; +static gint hf_ulmap_uiuc14_sym; +static gint hf_ulmap_uiuc14_sub; +static gint hf_ulmap_uiuc14_bwr; + +/* static gint hf_ulmap_uiuc11_ext; */ +/* static gint hf_ulmap_uiuc11_len; */ +/* static gint hf_ulmap_uiuc11_data; */ +/* static gint hf_ulmap_uiuc15_ext; */ +/* static gint hf_ulmap_uiuc15_len; */ +/* static gint hf_ulmap_uiuc15_data; */ + +static gint hf_ulmap_uiuc0_symofs; +static gint hf_ulmap_uiuc0_subofs; +static gint hf_ulmap_uiuc0_numsym; +static gint hf_ulmap_uiuc0_numsub; +static gint hf_ulmap_uiuc0_rsv; + +static gint hf_ulmap_uiuc13_symofs; +static gint hf_ulmap_uiuc13_subofs; +static gint hf_ulmap_uiuc13_numsym; +static gint hf_ulmap_uiuc13_numsub; +static gint hf_ulmap_uiuc13_papr; +static gint hf_ulmap_uiuc13_zone; +static gint hf_ulmap_uiuc13_rsv; +/* static gint hf_ulmap_crc16; */ +/* static gint hf_ulmap_crc16_status; */ +static gint hf_ulmap_padding; /* Generated via "one time" script to help create filterable fields */ -static int hf_ulmap_dedicated_ul_control_length = -1; -static int hf_ulmap_dedicated_ul_control_control_header = -1; -static int hf_ulmap_dedicated_ul_control_num_sdma_layers = -1; -static int hf_ulmap_dedicated_ul_control_pilot_pattern = -1; -static int hf_ulmap_dedicated_mimo_ul_control_matrix = -1; -static int hf_ulmap_dedicated_mimo_ul_control_n_layer = -1; -static int hf_ulmap_harq_chase_dedicated_ul_control_indicator = -1; -static int hf_ulmap_harq_chase_uiuc = -1; -static int hf_ulmap_harq_chase_repetition_coding_indication = -1; -static int hf_ulmap_harq_chase_duration = -1; -static int hf_ulmap_harq_chase_acid = -1; -static int hf_ulmap_harq_chase_ai_sn = -1; -static int hf_ulmap_harq_chase_ack_disable = -1; -static int hf_ulmap_reserved_uint = -1; -static int hf_ulmap_harq_ir_ctc_dedicated_ul_control_indicator = -1; -static int hf_ulmap_harq_ir_ctc_nep = -1; -static int hf_ulmap_harq_ir_ctc_nsch = -1; -static int hf_ulmap_harq_ir_ctc_spid = -1; -static int hf_ulmap_harq_ir_ctc_acin = -1; -static int hf_ulmap_harq_ir_ctc_ai_sn = -1; -static int hf_ulmap_harq_ir_ctc_ack_disable = -1; -static int hf_ulmap_harq_ir_cc_dedicated_ul_control_indicator = -1; -static int hf_ulmap_harq_ir_cc_uiuc = -1; -static int hf_ulmap_harq_ir_cc_repetition_coding_indication = -1; -static int hf_ulmap_harq_ir_cc_duration = -1; -static int hf_ulmap_harq_ir_cc_spid = -1; -static int hf_ulmap_harq_ir_cc_acid = -1; -static int hf_ulmap_harq_ir_cc_ai_sn = -1; -static int hf_ulmap_harq_ir_cc_ack_disable = -1; -static int hf_ulmap_mimo_ul_chase_harq_mu_indicator = -1; -static int hf_ulmap_mimo_ul_chase_harq_dedicated_mimo_ulcontrol_indicator = -1; -static int hf_ulmap_mimo_ul_chase_harq_ack_disable = -1; -static int hf_ulmap_mimo_ul_chase_harq_matrix = -1; -static int hf_ulmap_mimo_ul_chase_harq_duration = -1; -static int hf_ulmap_mimo_ul_chase_harq_uiuc = -1; -static int hf_ulmap_mimo_ul_chase_harq_repetition_coding_indication = -1; -static int hf_ulmap_mimo_ul_chase_harq_acid = -1; -static int hf_ulmap_mimo_ul_chase_harq_ai_sn = -1; -static int hf_ulmap_mimo_ul_ir_harq_mu_indicator = -1; -static int hf_ulmap_mimo_ul_ir_harq_dedicated_mimo_ul_control_indicator = -1; -static int hf_ulmap_mimo_ul_ir_harq_ack_disable = -1; -static int hf_ulmap_mimo_ul_ir_harq_matrix = -1; -static int hf_ulmap_mimo_ul_ir_harq_nsch = -1; -static int hf_ulmap_mimo_ul_ir_harq_nep = -1; -static int hf_ulmap_mimo_ul_ir_harq_spid = -1; -static int hf_ulmap_mimo_ul_ir_harq_acid = -1; -static int hf_ulmap_mimo_ul_ir_harq_ai_sn = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_mu_indicator = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_dedicated_mimo_ul_control_indicator = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_ack_disable = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_matrix = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_duration = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_uiuc = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_repetition_coding_indication = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_acid = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_ai_sn = -1; -static int hf_ulmap_mimo_ul_ir_harq_cc_spid = -1; -static int hf_ulmap_mimo_ul_stc_harq_tx_count = -1; -static int hf_ulmap_mimo_ul_stc_harq_duration = -1; -static int hf_ulmap_mimo_ul_stc_harq_sub_burst_offset_indication = -1; -static int hf_ulmap_mimo_ul_stc_harq_sub_burst_offset = -1; -static int hf_ulmap_mimo_ul_stc_harq_ack_disable = -1; -static int hf_ulmap_mimo_ul_stc_harq_uiuc = -1; -static int hf_ulmap_mimo_ul_stc_harq_repetition_coding_indication = -1; -static int hf_ulmap_mimo_ul_stc_harq_acid = -1; -static int hf_ulmap_power_control = -1; -static int hf_ulmap_power_measurement_frame = -1; -static int hf_ulmap_mini_subcha_alloc_extended_2_uiuc = -1; -static int hf_ulmap_mini_subcha_alloc_length = -1; -static int hf_ulmap_mini_subcha_alloc_ctype = -1; -static int hf_ulmap_mini_subcha_alloc_duration = -1; -static int hf_ulmap_mini_subcha_alloc_cid = -1; -static int hf_ulmap_mini_subcha_alloc_uiuc = -1; -static int hf_ulmap_mini_subcha_alloc_repetition = -1; -static int hf_ulmap_mini_subcha_alloc_padding = -1; -static int hf_ulmap_aas_ul_extended_uiuc = -1; -static int hf_ulmap_aas_ul_length = -1; -static int hf_ulmap_aas_ul_permutation = -1; -static int hf_ulmap_aas_ul_ul_permbase = -1; -static int hf_ulmap_aas_ul_ofdma_symbol_offset = -1; -static int hf_ulmap_aas_ul_aas_zone_length = -1; -static int hf_ulmap_aas_ul_uplink_preamble_config = -1; -static int hf_ulmap_aas_ul_preamble_type = -1; -static int hf_ulmap_cqich_alloc_extended_uiuc = -1; -static int hf_ulmap_cqich_alloc_length = -1; -static int hf_ulmap_cqich_alloc_cqich_id = -1; -static int hf_ulmap_cqich_alloc_allocation_offset = -1; -static int hf_ulmap_cqich_alloc_period = -1; -static int hf_ulmap_cqich_alloc_frame_offset = -1; -static int hf_ulmap_cqich_alloc_duration = -1; -static int hf_ulmap_cqich_alloc_report_configuration_included = -1; -static int hf_ulmap_cqich_alloc_feedback_type = -1; -static int hf_ulmap_cqich_alloc_report_type = -1; -static int hf_ulmap_cqich_alloc_cinr_preamble_report_type = -1; -static int hf_ulmap_cqich_alloc_zone_permutation = -1; -static int hf_ulmap_cqich_alloc_zone_type = -1; -static int hf_ulmap_cqich_alloc_zone_prbs_id = -1; -static int hf_ulmap_cqich_alloc_major_group_indication = -1; -static int hf_ulmap_cqich_alloc_pusc_major_group_bitmap = -1; -static int hf_ulmap_cqich_alloc_cinr_zone_measurement_type = -1; -static int hf_ulmap_cqich_alloc_averaging_parameter_included = -1; -static int hf_ulmap_cqich_alloc_averaging_parameter = -1; -static int hf_ulmap_cqich_alloc_mimo_permutation_feedback_cycle = -1; -static int hf_ulmap_zone_extended_uiuc = -1; -static int hf_ulmap_zone_length = -1; -static int hf_ulmap_zone_ofdma_symbol_offset = -1; -static int hf_ulmap_zone_permutation = -1; -static int hf_ulmap_zone_ul_permbase = -1; -static int hf_ulmap_zone_amc_type = -1; -static int hf_ulmap_zone_use_all_sc_indicator = -1; -static int hf_ulmap_zone_disable_subchannel_rotation = -1; -static int hf_ulmap_phymod_ul_extended_uiuc = -1; -static int hf_ulmap_phymod_ul_length = -1; -static int hf_ulmap_phymod_ul_preamble_modifier_type = -1; -static int hf_ulmap_phymod_ul_preamble_frequency_shift_index = -1; -static int hf_ulmap_phymod_ul_preamble_time_shift_index = -1; -static int hf_ulmap_phymod_ul_pilot_pattern_modifier = -1; -static int hf_ulmap_phymod_ul_pilot_pattern_index = -1; -static int hf_ulmap_fast_tracking_extended_uiuc = -1; -static int hf_ulmap_fast_tracking_length = -1; -static int hf_ulmap_fast_tracking_map_index = -1; -static int hf_ulmap_fast_tracking_power_correction = -1; -static int hf_ulmap_fast_tracking_frequency_correction = -1; -static int hf_ulmap_fast_tracking_time_correction = -1; -static int hf_ulmap_pusc_burst_allocation_extended_uiuc = -1; -static int hf_ulmap_pusc_burst_allocation_length = -1; -static int hf_ulmap_pusc_burst_allocation_uiuc = -1; -static int hf_ulmap_pusc_burst_allocation_segment = -1; -static int hf_ulmap_pusc_burst_allocation_ul_permbase = -1; -static int hf_ulmap_pusc_burst_allocation_ofdma_symbol_offset = -1; -static int hf_ulmap_pusc_burst_allocation_subchannel_offset = -1; -static int hf_ulmap_pusc_burst_allocation_duration = -1; -static int hf_ulmap_pusc_burst_allocation_repetition_coding_indication = -1; -static int hf_ulmap_fast_ranging_extended_uiuc = -1; -static int hf_ulmap_fast_ranging_length = -1; -static int hf_ulmap_fast_ranging_ho_id_indicator = -1; -static int hf_ulmap_fast_ranging_ho_id = -1; -static int hf_ulmap_fast_ranging_mac_address = -1; -static int hf_ulmap_fast_ranging_uiuc = -1; -static int hf_ulmap_fast_ranging_duration = -1; -static int hf_ulmap_fast_ranging_repetition_coding_indication = -1; -static int hf_ulmap_allocation_start_extended_uiuc = -1; -static int hf_ulmap_allocation_start_length = -1; -static int hf_ulmap_allocation_start_ofdma_symbol_offset = -1; -static int hf_ulmap_allocation_start_subchannel_offset = -1; -static int hf_ulmap_cqich_enhanced_alloc_extended_2_uiuc = -1; -static int hf_ulmap_cqich_enhanced_alloc_length = -1; -static int hf_ulmap_cqich_enhanced_alloc_cqich_id = -1; -static int hf_ulmap_cqich_enhanced_alloc_period = -1; -static int hf_ulmap_cqich_enhanced_alloc_frame_offset = -1; -static int hf_ulmap_cqich_enhanced_alloc_duration = -1; -static int hf_ulmap_cqich_enhanced_alloc_cqich_num = -1; -static int hf_ulmap_cqich_enhanced_alloc_feedback_type = -1; -static int hf_ulmap_cqich_enhanced_alloc_allocation_index = -1; -static int hf_ulmap_cqich_enhanced_alloc_cqich_type = -1; -static int hf_ulmap_cqich_enhanced_alloc_sttd_indication = -1; -static int hf_ulmap_cqich_enhanced_alloc_band_amc_precoding_mode = -1; -static int hf_ulmap_cqich_enhanced_alloc_nr_precoders_feedback = -1; -static int hf_ulmap_anchor_bs_switch_extended_2_uiuc = -1; -static int hf_ulmap_anchor_bs_switch_length = -1; -static int hf_ulmap_anchor_bs_switch_n_anchor_bs_switch = -1; -static int hf_ulmap_anchor_bs_switch_reduced_cid = -1; -static int hf_ulmap_anchor_bs_switch_action_code = -1; -static int hf_ulmap_anchor_bs_switch_action_time = -1; -static int hf_ulmap_anchor_bs_switch_temp_bs_id = -1; -static int hf_ulmap_anchor_bs_switch_ak_change_indicator = -1; -static int hf_ulmap_anchor_bs_switch_cqich_allocation_indicator = -1; -static int hf_ulmap_anchor_bs_switch_cqich_id = -1; -static int hf_ulmap_anchor_bs_switch_feedback_channel_offset = -1; -static int hf_ulmap_anchor_bs_switch_period = -1; -static int hf_ulmap_anchor_bs_switch_frame_offset = -1; -static int hf_ulmap_anchor_bs_switch_duration = -1; -static int hf_ulmap_anchor_bs_switch_mimo_permutation_feedback_code = -1; -static int hf_ulmap_sounding_command_extended_2_uiuc = -1; -static int hf_ulmap_sounding_command_length = -1; -static int hf_ulmap_sounding_command_type = -1; -static int hf_ulmap_sounding_command_send_sounding_report_flag = -1; -static int hf_ulmap_sounding_command_relevance_flag = -1; -static int hf_ulmap_sounding_command_relevance = -1; -static int hf_ulmap_sounding_command_include_additional_feedback = -1; -static int hf_ulmap_sounding_command_num_sounding_symbols = -1; -static int hf_ulmap_sounding_command_separability_type = -1; -static int hf_ulmap_sounding_command_max_cyclic_shift_index_p = -1; -static int hf_ulmap_sounding_command_decimation_value = -1; -static int hf_ulmap_sounding_command_decimation_offset_randomization = -1; -static int hf_ulmap_sounding_command_symbol_index = -1; -static int hf_ulmap_sounding_command_number_of_cids = -1; -static int hf_ulmap_sounding_command_shorted_basic_cid = -1; -static int hf_ulmap_sounding_command_power_assignment_method = -1; -static int hf_ulmap_sounding_command_power_boost = -1; -static int hf_ulmap_sounding_command_multi_antenna_flag = -1; -static int hf_ulmap_sounding_command_allocation_mode = -1; -static int hf_ulmap_sounding_command_band_bit_map = -1; -static int hf_ulmap_sounding_command_starting_frequency_band = -1; -static int hf_ulmap_sounding_command_number_of_frequency_bands = -1; -static int hf_ulmap_sounding_command_cyclic_time_shift_index = -1; -static int hf_ulmap_sounding_command_decimation_offset = -1; -static int hf_ulmap_sounding_command_use_same_symbol_for_additional_feedback = -1; -static int hf_ulmap_sounding_command_periodicity = -1; -static int hf_ulmap_sounding_command_permutation = -1; -static int hf_ulmap_sounding_command_dl_permbase = -1; -static int hf_ulmap_sounding_command_shortened_basic_cid = -1; -static int hf_ulmap_sounding_command_subchannel_offset = -1; -static int hf_ulmap_sounding_command_number_of_subchannels = -1; -static int hf_ulmap_harq_ulmap_extended_2_uiuc = -1; -static int hf_ulmap_harq_ulmap_length = -1; -static int hf_ulmap_harq_ulmap_rcid_type = -1; -static int hf_ulmap_harq_ulmap_mode = -1; -static int hf_ulmap_harq_ulmap_allocation_start_indication = -1; -static int hf_ulmap_harq_ulmap_ofdma_symbol_offset = -1; -static int hf_ulmap_harq_ulmap_subchannel_offset = -1; -static int hf_ulmap_harq_ulmap_n_sub_burst = -1; -static int hf_ulmap_harq_ackch_region_alloc_extended_2_uiuc = -1; -static int hf_ulmap_harq_ackch_region_alloc_length = -1; -static int hf_ulmap_harq_ackch_region_alloc_ofdma_symbol_offset = -1; -static int hf_ulmap_harq_ackch_region_alloc_subchannel_offset = -1; -static int hf_ulmap_harq_ackch_region_alloc_num_ofdma_symbols = -1; -static int hf_ulmap_harq_ackch_region_alloc_num_subchannels = -1; -static int hf_ulmap_aas_sdma_extended_2_uiuc = -1; -static int hf_ulmap_aas_sdma_length = -1; -static int hf_ulmap_aas_sdma_rcid_type = -1; -static int hf_ulmap_aas_sdma_num_burst_region = -1; -static int hf_ulmap_aas_sdma_slot_offset = -1; -static int hf_ulmap_aas_sdma_slot_duration = -1; -static int hf_ulmap_aas_sdma_number_of_users = -1; -static int hf_ulmap_aas_sdma_encoding_mode = -1; -static int hf_ulmap_aas_sdma_power_adjust = -1; -static int hf_ulmap_aas_sdma_pilot_pattern_modifier = -1; -static int hf_ulmap_aas_sdma_preamble_modifier_index = -1; -static int hf_ulmap_aas_sdma_pilot_pattern = -1; -static int hf_ulmap_aas_sdma_diuc = -1; -static int hf_ulmap_aas_sdma_repetition_coding_indication = -1; -static int hf_ulmap_aas_sdma_acid = -1; -static int hf_ulmap_aas_sdma_ai_sn = -1; -static int hf_ulmap_aas_sdma_nep = -1; -static int hf_ulmap_aas_sdma_nsch = -1; -static int hf_ulmap_aas_sdma_spid = -1; -static int hf_ulmap_aas_sdma_power_adjustment = -1; -static int hf_ulmap_feedback_polling_extended_2_uiuc = -1; -static int hf_ulmap_feedback_polling_length = -1; -static int hf_ulmap_feedback_polling_num_allocation = -1; -static int hf_ulmap_feedback_polling_dedicated_ul_allocation_included = -1; -static int hf_ulmap_feedback_polling_basic_cid = -1; -static int hf_ulmap_feedback_polling_allocation_duration = -1; -static int hf_ulmap_feedback_polling_type = -1; -static int hf_ulmap_feedback_polling_frame_offset = -1; -static int hf_ulmap_feedback_polling_period = -1; -static int hf_ulmap_feedback_polling_uiuc = -1; -static int hf_ulmap_feedback_polling_ofdma_symbol_offset = -1; -static int hf_ulmap_feedback_polling_subchannel_offset = -1; -static int hf_ulmap_feedback_polling_duration = -1; -static int hf_ulmap_feedback_polling_repetition_coding_indication = -1; -static int hf_ulmap_reduced_aas_aas_zone_configuration_included = -1; -static int hf_ulmap_reduced_aas_aas_zone_position_included = -1; -static int hf_ulmap_reduced_aas_ul_map_information_included = -1; -static int hf_ulmap_reduced_aas_phy_modification_included = -1; -static int hf_ulmap_reduced_aas_power_control_included = -1; -static int hf_ulmap_reduced_aas_include_feedback_header = -1; -static int hf_ulmap_reduced_aas_encoding_mode = -1; -static int hf_ulmap_reduced_aas_permutation = -1; -static int hf_ulmap_reduced_aas_ul_permbase = -1; -static int hf_ulmap_reduced_aas_preamble_indication = -1; -static int hf_ulmap_reduced_aas_padding = -1; -static int hf_ulmap_reduced_aas_zone_symbol_offset = -1; -static int hf_ulmap_reduced_aas_zone_length = -1; -static int hf_ulmap_reduced_aas_ucd_count = -1; -static int hf_ulmap_reduced_aas_private_map_alloc_start_time = -1; -static int hf_ulmap_reduced_aas_pilot_pattern_index = -1; -static int hf_ulmap_reduced_aas_preamble_select = -1; -static int hf_ulmap_reduced_aas_preamble_shift_index = -1; -static int hf_ulmap_reduced_aas_pilot_pattern_modifier = -1; -static int hf_ulmap_reduced_aas_power_control = -1; -static int hf_ulmap_reduced_aas_ul_frame_offset = -1; -static int hf_ulmap_reduced_aas_slot_offset = -1; -static int hf_ulmap_reduced_aas_slot_duration = -1; -static int hf_ulmap_reduced_aas_uiuc_nep = -1; -static int hf_ulmap_reduced_aas_acid = -1; -static int hf_ulmap_reduced_aas_ai_sn = -1; -static int hf_ulmap_reduced_aas_nsch = -1; -static int hf_ulmap_reduced_aas_spid = -1; -static int hf_ulmap_reduced_aas_repetition_coding_indication = -1; - -static expert_field ei_ulmap_not_implemented = EI_INIT; +static int hf_ulmap_dedicated_ul_control_length; +static int hf_ulmap_dedicated_ul_control_control_header; +static int hf_ulmap_dedicated_ul_control_num_sdma_layers; +static int hf_ulmap_dedicated_ul_control_pilot_pattern; +static int hf_ulmap_dedicated_mimo_ul_control_matrix; +static int hf_ulmap_dedicated_mimo_ul_control_n_layer; +static int hf_ulmap_harq_chase_dedicated_ul_control_indicator; +static int hf_ulmap_harq_chase_uiuc; +static int hf_ulmap_harq_chase_repetition_coding_indication; +static int hf_ulmap_harq_chase_duration; +static int hf_ulmap_harq_chase_acid; +static int hf_ulmap_harq_chase_ai_sn; +static int hf_ulmap_harq_chase_ack_disable; +static int hf_ulmap_reserved_uint; +static int hf_ulmap_harq_ir_ctc_dedicated_ul_control_indicator; +static int hf_ulmap_harq_ir_ctc_nep; +static int hf_ulmap_harq_ir_ctc_nsch; +static int hf_ulmap_harq_ir_ctc_spid; +static int hf_ulmap_harq_ir_ctc_acin; +static int hf_ulmap_harq_ir_ctc_ai_sn; +static int hf_ulmap_harq_ir_ctc_ack_disable; +static int hf_ulmap_harq_ir_cc_dedicated_ul_control_indicator; +static int hf_ulmap_harq_ir_cc_uiuc; +static int hf_ulmap_harq_ir_cc_repetition_coding_indication; +static int hf_ulmap_harq_ir_cc_duration; +static int hf_ulmap_harq_ir_cc_spid; +static int hf_ulmap_harq_ir_cc_acid; +static int hf_ulmap_harq_ir_cc_ai_sn; +static int hf_ulmap_harq_ir_cc_ack_disable; +static int hf_ulmap_mimo_ul_chase_harq_mu_indicator; +static int hf_ulmap_mimo_ul_chase_harq_dedicated_mimo_ulcontrol_indicator; +static int hf_ulmap_mimo_ul_chase_harq_ack_disable; +static int hf_ulmap_mimo_ul_chase_harq_matrix; +static int hf_ulmap_mimo_ul_chase_harq_duration; +static int hf_ulmap_mimo_ul_chase_harq_uiuc; +static int hf_ulmap_mimo_ul_chase_harq_repetition_coding_indication; +static int hf_ulmap_mimo_ul_chase_harq_acid; +static int hf_ulmap_mimo_ul_chase_harq_ai_sn; +static int hf_ulmap_mimo_ul_ir_harq_mu_indicator; +static int hf_ulmap_mimo_ul_ir_harq_dedicated_mimo_ul_control_indicator; +static int hf_ulmap_mimo_ul_ir_harq_ack_disable; +static int hf_ulmap_mimo_ul_ir_harq_matrix; +static int hf_ulmap_mimo_ul_ir_harq_nsch; +static int hf_ulmap_mimo_ul_ir_harq_nep; +static int hf_ulmap_mimo_ul_ir_harq_spid; +static int hf_ulmap_mimo_ul_ir_harq_acid; +static int hf_ulmap_mimo_ul_ir_harq_ai_sn; +static int hf_ulmap_mimo_ul_ir_harq_cc_mu_indicator; +static int hf_ulmap_mimo_ul_ir_harq_cc_dedicated_mimo_ul_control_indicator; +static int hf_ulmap_mimo_ul_ir_harq_cc_ack_disable; +static int hf_ulmap_mimo_ul_ir_harq_cc_matrix; +static int hf_ulmap_mimo_ul_ir_harq_cc_duration; +static int hf_ulmap_mimo_ul_ir_harq_cc_uiuc; +static int hf_ulmap_mimo_ul_ir_harq_cc_repetition_coding_indication; +static int hf_ulmap_mimo_ul_ir_harq_cc_acid; +static int hf_ulmap_mimo_ul_ir_harq_cc_ai_sn; +static int hf_ulmap_mimo_ul_ir_harq_cc_spid; +static int hf_ulmap_mimo_ul_stc_harq_tx_count; +static int hf_ulmap_mimo_ul_stc_harq_duration; +static int hf_ulmap_mimo_ul_stc_harq_sub_burst_offset_indication; +static int hf_ulmap_mimo_ul_stc_harq_sub_burst_offset; +static int hf_ulmap_mimo_ul_stc_harq_ack_disable; +static int hf_ulmap_mimo_ul_stc_harq_uiuc; +static int hf_ulmap_mimo_ul_stc_harq_repetition_coding_indication; +static int hf_ulmap_mimo_ul_stc_harq_acid; +static int hf_ulmap_power_control; +static int hf_ulmap_power_measurement_frame; +static int hf_ulmap_mini_subcha_alloc_extended_2_uiuc; +static int hf_ulmap_mini_subcha_alloc_length; +static int hf_ulmap_mini_subcha_alloc_ctype; +static int hf_ulmap_mini_subcha_alloc_duration; +static int hf_ulmap_mini_subcha_alloc_cid; +static int hf_ulmap_mini_subcha_alloc_uiuc; +static int hf_ulmap_mini_subcha_alloc_repetition; +static int hf_ulmap_mini_subcha_alloc_padding; +static int hf_ulmap_aas_ul_extended_uiuc; +static int hf_ulmap_aas_ul_length; +static int hf_ulmap_aas_ul_permutation; +static int hf_ulmap_aas_ul_ul_permbase; +static int hf_ulmap_aas_ul_ofdma_symbol_offset; +static int hf_ulmap_aas_ul_aas_zone_length; +static int hf_ulmap_aas_ul_uplink_preamble_config; +static int hf_ulmap_aas_ul_preamble_type; +static int hf_ulmap_cqich_alloc_extended_uiuc; +static int hf_ulmap_cqich_alloc_length; +static int hf_ulmap_cqich_alloc_cqich_id; +static int hf_ulmap_cqich_alloc_allocation_offset; +static int hf_ulmap_cqich_alloc_period; +static int hf_ulmap_cqich_alloc_frame_offset; +static int hf_ulmap_cqich_alloc_duration; +static int hf_ulmap_cqich_alloc_report_configuration_included; +static int hf_ulmap_cqich_alloc_feedback_type; +static int hf_ulmap_cqich_alloc_report_type; +static int hf_ulmap_cqich_alloc_cinr_preamble_report_type; +static int hf_ulmap_cqich_alloc_zone_permutation; +static int hf_ulmap_cqich_alloc_zone_type; +static int hf_ulmap_cqich_alloc_zone_prbs_id; +static int hf_ulmap_cqich_alloc_major_group_indication; +static int hf_ulmap_cqich_alloc_pusc_major_group_bitmap; +static int hf_ulmap_cqich_alloc_cinr_zone_measurement_type; +static int hf_ulmap_cqich_alloc_averaging_parameter_included; +static int hf_ulmap_cqich_alloc_averaging_parameter; +static int hf_ulmap_cqich_alloc_mimo_permutation_feedback_cycle; +static int hf_ulmap_zone_extended_uiuc; +static int hf_ulmap_zone_length; +static int hf_ulmap_zone_ofdma_symbol_offset; +static int hf_ulmap_zone_permutation; +static int hf_ulmap_zone_ul_permbase; +static int hf_ulmap_zone_amc_type; +static int hf_ulmap_zone_use_all_sc_indicator; +static int hf_ulmap_zone_disable_subchannel_rotation; +static int hf_ulmap_phymod_ul_extended_uiuc; +static int hf_ulmap_phymod_ul_length; +static int hf_ulmap_phymod_ul_preamble_modifier_type; +static int hf_ulmap_phymod_ul_preamble_frequency_shift_index; +static int hf_ulmap_phymod_ul_preamble_time_shift_index; +static int hf_ulmap_phymod_ul_pilot_pattern_modifier; +static int hf_ulmap_phymod_ul_pilot_pattern_index; +static int hf_ulmap_fast_tracking_extended_uiuc; +static int hf_ulmap_fast_tracking_length; +static int hf_ulmap_fast_tracking_map_index; +static int hf_ulmap_fast_tracking_power_correction; +static int hf_ulmap_fast_tracking_frequency_correction; +static int hf_ulmap_fast_tracking_time_correction; +static int hf_ulmap_pusc_burst_allocation_extended_uiuc; +static int hf_ulmap_pusc_burst_allocation_length; +static int hf_ulmap_pusc_burst_allocation_uiuc; +static int hf_ulmap_pusc_burst_allocation_segment; +static int hf_ulmap_pusc_burst_allocation_ul_permbase; +static int hf_ulmap_pusc_burst_allocation_ofdma_symbol_offset; +static int hf_ulmap_pusc_burst_allocation_subchannel_offset; +static int hf_ulmap_pusc_burst_allocation_duration; +static int hf_ulmap_pusc_burst_allocation_repetition_coding_indication; +static int hf_ulmap_fast_ranging_extended_uiuc; +static int hf_ulmap_fast_ranging_length; +static int hf_ulmap_fast_ranging_ho_id_indicator; +static int hf_ulmap_fast_ranging_ho_id; +static int hf_ulmap_fast_ranging_mac_address; +static int hf_ulmap_fast_ranging_uiuc; +static int hf_ulmap_fast_ranging_duration; +static int hf_ulmap_fast_ranging_repetition_coding_indication; +static int hf_ulmap_allocation_start_extended_uiuc; +static int hf_ulmap_allocation_start_length; +static int hf_ulmap_allocation_start_ofdma_symbol_offset; +static int hf_ulmap_allocation_start_subchannel_offset; +static int hf_ulmap_cqich_enhanced_alloc_extended_2_uiuc; +static int hf_ulmap_cqich_enhanced_alloc_length; +static int hf_ulmap_cqich_enhanced_alloc_cqich_id; +static int hf_ulmap_cqich_enhanced_alloc_period; +static int hf_ulmap_cqich_enhanced_alloc_frame_offset; +static int hf_ulmap_cqich_enhanced_alloc_duration; +static int hf_ulmap_cqich_enhanced_alloc_cqich_num; +static int hf_ulmap_cqich_enhanced_alloc_feedback_type; +static int hf_ulmap_cqich_enhanced_alloc_allocation_index; +static int hf_ulmap_cqich_enhanced_alloc_cqich_type; +static int hf_ulmap_cqich_enhanced_alloc_sttd_indication; +static int hf_ulmap_cqich_enhanced_alloc_band_amc_precoding_mode; +static int hf_ulmap_cqich_enhanced_alloc_nr_precoders_feedback; +static int hf_ulmap_anchor_bs_switch_extended_2_uiuc; +static int hf_ulmap_anchor_bs_switch_length; +static int hf_ulmap_anchor_bs_switch_n_anchor_bs_switch; +static int hf_ulmap_anchor_bs_switch_reduced_cid; +static int hf_ulmap_anchor_bs_switch_action_code; +static int hf_ulmap_anchor_bs_switch_action_time; +static int hf_ulmap_anchor_bs_switch_temp_bs_id; +static int hf_ulmap_anchor_bs_switch_ak_change_indicator; +static int hf_ulmap_anchor_bs_switch_cqich_allocation_indicator; +static int hf_ulmap_anchor_bs_switch_cqich_id; +static int hf_ulmap_anchor_bs_switch_feedback_channel_offset; +static int hf_ulmap_anchor_bs_switch_period; +static int hf_ulmap_anchor_bs_switch_frame_offset; +static int hf_ulmap_anchor_bs_switch_duration; +static int hf_ulmap_anchor_bs_switch_mimo_permutation_feedback_code; +static int hf_ulmap_sounding_command_extended_2_uiuc; +static int hf_ulmap_sounding_command_length; +static int hf_ulmap_sounding_command_type; +static int hf_ulmap_sounding_command_send_sounding_report_flag; +static int hf_ulmap_sounding_command_relevance_flag; +static int hf_ulmap_sounding_command_relevance; +static int hf_ulmap_sounding_command_include_additional_feedback; +static int hf_ulmap_sounding_command_num_sounding_symbols; +static int hf_ulmap_sounding_command_separability_type; +static int hf_ulmap_sounding_command_max_cyclic_shift_index_p; +static int hf_ulmap_sounding_command_decimation_value; +static int hf_ulmap_sounding_command_decimation_offset_randomization; +static int hf_ulmap_sounding_command_symbol_index; +static int hf_ulmap_sounding_command_number_of_cids; +static int hf_ulmap_sounding_command_shorted_basic_cid; +static int hf_ulmap_sounding_command_power_assignment_method; +static int hf_ulmap_sounding_command_power_boost; +static int hf_ulmap_sounding_command_multi_antenna_flag; +static int hf_ulmap_sounding_command_allocation_mode; +static int hf_ulmap_sounding_command_band_bit_map; +static int hf_ulmap_sounding_command_starting_frequency_band; +static int hf_ulmap_sounding_command_number_of_frequency_bands; +static int hf_ulmap_sounding_command_cyclic_time_shift_index; +static int hf_ulmap_sounding_command_decimation_offset; +static int hf_ulmap_sounding_command_use_same_symbol_for_additional_feedback; +static int hf_ulmap_sounding_command_periodicity; +static int hf_ulmap_sounding_command_permutation; +static int hf_ulmap_sounding_command_dl_permbase; +static int hf_ulmap_sounding_command_shortened_basic_cid; +static int hf_ulmap_sounding_command_subchannel_offset; +static int hf_ulmap_sounding_command_number_of_subchannels; +static int hf_ulmap_harq_ulmap_extended_2_uiuc; +static int hf_ulmap_harq_ulmap_length; +static int hf_ulmap_harq_ulmap_rcid_type; +static int hf_ulmap_harq_ulmap_mode; +static int hf_ulmap_harq_ulmap_allocation_start_indication; +static int hf_ulmap_harq_ulmap_ofdma_symbol_offset; +static int hf_ulmap_harq_ulmap_subchannel_offset; +static int hf_ulmap_harq_ulmap_n_sub_burst; +static int hf_ulmap_harq_ackch_region_alloc_extended_2_uiuc; +static int hf_ulmap_harq_ackch_region_alloc_length; +static int hf_ulmap_harq_ackch_region_alloc_ofdma_symbol_offset; +static int hf_ulmap_harq_ackch_region_alloc_subchannel_offset; +static int hf_ulmap_harq_ackch_region_alloc_num_ofdma_symbols; +static int hf_ulmap_harq_ackch_region_alloc_num_subchannels; +static int hf_ulmap_aas_sdma_extended_2_uiuc; +static int hf_ulmap_aas_sdma_length; +static int hf_ulmap_aas_sdma_rcid_type; +static int hf_ulmap_aas_sdma_num_burst_region; +static int hf_ulmap_aas_sdma_slot_offset; +static int hf_ulmap_aas_sdma_slot_duration; +static int hf_ulmap_aas_sdma_number_of_users; +static int hf_ulmap_aas_sdma_encoding_mode; +static int hf_ulmap_aas_sdma_power_adjust; +static int hf_ulmap_aas_sdma_pilot_pattern_modifier; +static int hf_ulmap_aas_sdma_preamble_modifier_index; +static int hf_ulmap_aas_sdma_pilot_pattern; +static int hf_ulmap_aas_sdma_diuc; +static int hf_ulmap_aas_sdma_repetition_coding_indication; +static int hf_ulmap_aas_sdma_acid; +static int hf_ulmap_aas_sdma_ai_sn; +static int hf_ulmap_aas_sdma_nep; +static int hf_ulmap_aas_sdma_nsch; +static int hf_ulmap_aas_sdma_spid; +static int hf_ulmap_aas_sdma_power_adjustment; +static int hf_ulmap_feedback_polling_extended_2_uiuc; +static int hf_ulmap_feedback_polling_length; +static int hf_ulmap_feedback_polling_num_allocation; +static int hf_ulmap_feedback_polling_dedicated_ul_allocation_included; +static int hf_ulmap_feedback_polling_basic_cid; +static int hf_ulmap_feedback_polling_allocation_duration; +static int hf_ulmap_feedback_polling_type; +static int hf_ulmap_feedback_polling_frame_offset; +static int hf_ulmap_feedback_polling_period; +static int hf_ulmap_feedback_polling_uiuc; +static int hf_ulmap_feedback_polling_ofdma_symbol_offset; +static int hf_ulmap_feedback_polling_subchannel_offset; +static int hf_ulmap_feedback_polling_duration; +static int hf_ulmap_feedback_polling_repetition_coding_indication; +static int hf_ulmap_reduced_aas_aas_zone_configuration_included; +static int hf_ulmap_reduced_aas_aas_zone_position_included; +static int hf_ulmap_reduced_aas_ul_map_information_included; +static int hf_ulmap_reduced_aas_phy_modification_included; +static int hf_ulmap_reduced_aas_power_control_included; +static int hf_ulmap_reduced_aas_include_feedback_header; +static int hf_ulmap_reduced_aas_encoding_mode; +static int hf_ulmap_reduced_aas_permutation; +static int hf_ulmap_reduced_aas_ul_permbase; +static int hf_ulmap_reduced_aas_preamble_indication; +static int hf_ulmap_reduced_aas_padding; +static int hf_ulmap_reduced_aas_zone_symbol_offset; +static int hf_ulmap_reduced_aas_zone_length; +static int hf_ulmap_reduced_aas_ucd_count; +static int hf_ulmap_reduced_aas_private_map_alloc_start_time; +static int hf_ulmap_reduced_aas_pilot_pattern_index; +static int hf_ulmap_reduced_aas_preamble_select; +static int hf_ulmap_reduced_aas_preamble_shift_index; +static int hf_ulmap_reduced_aas_pilot_pattern_modifier; +static int hf_ulmap_reduced_aas_power_control; +static int hf_ulmap_reduced_aas_ul_frame_offset; +static int hf_ulmap_reduced_aas_slot_offset; +static int hf_ulmap_reduced_aas_slot_duration; +static int hf_ulmap_reduced_aas_uiuc_nep; +static int hf_ulmap_reduced_aas_acid; +static int hf_ulmap_reduced_aas_ai_sn; +static int hf_ulmap_reduced_aas_nsch; +static int hf_ulmap_reduced_aas_spid; +static int hf_ulmap_reduced_aas_repetition_coding_indication; + +static expert_field ei_ulmap_not_implemented; /* This gets called each time a capture file is loaded. */ void init_wimax_globals(void) @@ -2918,13 +2920,11 @@ void proto_register_mac_mgmt_msg_ulmap(void) proto_register_subtree_array(ett, array_length(ett)); expert_mac_mgmt_msg_ulmap = expert_register_protocol(proto_mac_mgmt_msg_ulmap_decoder); expert_register_field_array(expert_mac_mgmt_msg_ulmap, ei, array_length(ei)); + ulmap_handle = register_dissector("mac_mgmt_msg_ulmap_handler", dissect_mac_mgmt_msg_ulmap_decoder, proto_mac_mgmt_msg_ulmap_decoder); } void proto_reg_handoff_mac_mgmt_msg_ulmap(void) { - dissector_handle_t ulmap_handle; - - ulmap_handle = create_dissector_handle(dissect_mac_mgmt_msg_ulmap_decoder, proto_mac_mgmt_msg_ulmap_decoder); dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_UL_MAP, ulmap_handle); } diff --git a/plugins/epan/wimax/packet-m2m.c b/plugins/epan/wimax/packet-m2m.c index 261fbcd1b4..c536b309f5 100644 --- a/plugins/epan/wimax/packet-m2m.c +++ b/plugins/epan/wimax/packet-m2m.c @@ -35,6 +35,7 @@ static void extended_tlv_decoder(packet_info *pinfo); void proto_tree_add_tlv(tlv_info_t *self, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree, gint hf, guint encoding); /* Global variables */ +static dissector_handle_t m2m_handle; static dissector_handle_t wimax_cdma_code_burst_handle; static dissector_handle_t wimax_ffb_burst_handle; static dissector_handle_t wimax_fch_burst_handle; @@ -44,13 +45,13 @@ static dissector_handle_t wimax_phy_attributes_burst_handle; static reassembly_table pdu_reassembly_table; -static gint proto_m2m = -1; +static gint proto_m2m; -static gint ett_m2m = -1; -static gint ett_m2m_tlv = -1; -static gint ett_m2m_fch = -1; -static gint ett_m2m_cdma = -1; -static gint ett_m2m_ffb = -1; +static gint ett_m2m; +static gint ett_m2m_tlv; +static gint ett_m2m_fch; +static gint ett_m2m_cdma; +static gint ett_m2m_ffb; /* TLV types (rev:0.2) */ #define TLV_PROTO_VER 1 @@ -117,31 +118,31 @@ static const value_string tlv_crc16_status[] = { 0, NULL } }; -static gint hf_m2m_sequence_number = -1; -static gint hf_m2m_frame_number = -1; -static gint hf_m2m_tlv_count = -1; - -static gint hf_m2m_type = -1; -static gint hf_m2m_len = -1; -static gint hf_m2m_len_size = -1; -/* static gint hf_m2m_value_bytes = -1; */ -static gint hf_wimax_invalid_tlv = -1; -static gint hf_m2m_value_protocol_vers_uint8 = -1; -static gint hf_m2m_value_burst_num_uint8 = -1; -static gint hf_m2m_value_frag_type_uint8 = -1; -static gint hf_m2m_value_frag_num_uint8 = -1; -static gint hf_m2m_value_pdu_burst = -1; -static gint hf_m2m_value_fast_fb = -1; -static gint hf_m2m_value_fch_burst_uint24 = -1; -static gint hf_m2m_value_cdma_code_uint24 = -1; -static gint hf_m2m_value_crc16_status_uint8 = -1; -static gint hf_m2m_value_burst_power_uint16 = -1; -static gint hf_m2m_value_burst_cinr_uint16 = -1; -static gint hf_m2m_value_preamble_uint16 = -1; -static gint hf_m2m_value_harq_ack_burst_bytes = -1; -static gint hf_m2m_phy_attributes = -1; - -static expert_field ei_m2m_unexpected_length = EI_INIT; +static gint hf_m2m_sequence_number; +static gint hf_m2m_frame_number; +static gint hf_m2m_tlv_count; + +static gint hf_m2m_type; +static gint hf_m2m_len; +static gint hf_m2m_len_size; +/* static gint hf_m2m_value_bytes; */ +static gint hf_wimax_invalid_tlv; +static gint hf_m2m_value_protocol_vers_uint8; +static gint hf_m2m_value_burst_num_uint8; +static gint hf_m2m_value_frag_type_uint8; +static gint hf_m2m_value_frag_num_uint8; +static gint hf_m2m_value_pdu_burst; +static gint hf_m2m_value_fast_fb; +static gint hf_m2m_value_fch_burst_uint24; +static gint hf_m2m_value_cdma_code_uint24; +static gint hf_m2m_value_crc16_status_uint8; +static gint hf_m2m_value_burst_power_uint16; +static gint hf_m2m_value_burst_cinr_uint16; +static gint hf_m2m_value_preamble_uint16; +static gint hf_m2m_value_harq_ack_burst_bytes; +static gint hf_m2m_phy_attributes; + +static expert_field ei_m2m_unexpected_length; /* WiMax MAC to MAC protocol dissector */ @@ -205,7 +206,8 @@ static int dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* get the TLV value offset */ tlv_offset = get_tlv_value_offset(&m2m_tlv_info); /* display TLV type */ - ti = proto_tree_add_protocol_format(m2m_tree, proto_m2m, tvb, offset, (tlv_len + tlv_offset), "%s", val_to_str(tlv_type, tlv_name, "Unknown TLV")); + ti = proto_tree_add_protocol_format(m2m_tree, proto_m2m, tvb, offset, (tlv_len + tlv_offset), "%s", + val_to_str_const(tlv_type, tlv_name, "Unknown TLV")); /* add TLV subtree */ tlv_tree = proto_item_add_subtree(ti, ett_m2m_tlv); /* update the offset */ @@ -240,7 +242,7 @@ static int dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void case TLV_FRAG_TYPE: /* add the description */ tlv_frag_type = tvb_get_guint8( tvb, offset ); - proto_item_append_text(ti, ": %s", val_to_str(tlv_frag_type, tlv_frag_type_name, "Unknown")); + proto_item_append_text(ti, ": %s", val_to_str_const(tlv_frag_type, tlv_frag_type_name, "Unknown")); hf = hf_m2m_value_frag_type_uint8; encoding = ENC_BIG_ENDIAN; expected_len = 1; @@ -307,7 +309,7 @@ static int dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void case TLV_CRC16_STATUS: /* add the description */ tlv_value = tvb_get_guint8( tvb, offset ); - proto_item_append_text(ti, ": %s", val_to_str(tlv_value, tlv_crc16_status, "Unknown")); + proto_item_append_text(ti, ": %s", val_to_str_const(tlv_value, tlv_crc16_status, "Unknown")); hf = hf_m2m_value_crc16_status_uint8; encoding = ENC_BIG_ENDIAN; expected_len = 1; @@ -772,6 +774,7 @@ void proto_register_m2m(void) proto_register_subtree_array(ett, array_length(ett)); expert_m2m = expert_register_protocol(proto_m2m); expert_register_field_array(expert_m2m, ei, array_length(ei)); + m2m_handle = register_dissector("mac_mgmt_msg_m2m_handler", dissect_m2m, proto_m2m); /* Register reassembly table */ reassembly_table_register(&pdu_reassembly_table, @@ -781,9 +784,6 @@ void proto_register_m2m(void) /* Register Wimax Mac to Mac Protocol handler */ void proto_reg_handoff_m2m(void) { - dissector_handle_t m2m_handle; - - m2m_handle = create_dissector_handle(dissect_m2m, proto_m2m); dissector_add_uint("ethertype", ETHERTYPE_WMX_M2M, m2m_handle); /* find the wimax handlers */ diff --git a/plugins/epan/wimax/packet-wmx.c b/plugins/epan/wimax/packet-wmx.c index 5a38b111ad..b6914b677c 100644 --- a/plugins/epan/wimax/packet-wmx.c +++ b/plugins/epan/wimax/packet-wmx.c @@ -28,7 +28,7 @@ void proto_register_wimax(void); void proto_reg_handoff_wimax(void); /* Global variables */ -gint proto_wimax = -1; +gint proto_wimax; gint8 arq_enabled = 0; gint scheduling_service_type = 0; gint mac_sdu_length = 49; /* default SDU size is 49 bytes (11.13.16) */ @@ -38,9 +38,9 @@ extern gboolean include_cor2_changes; address bs_address = ADDRESS_INIT_NONE; -static int hf_tlv_type = -1; -static int hf_tlv_length = -1; -static int hf_tlv_length_size = -1; +static int hf_tlv_type; +static int hf_tlv_length; +static int hf_tlv_length_size; #define MAX_NUM_TLVS 256 /* Global TLV array to retrieve unique subtree identifiers */ @@ -291,7 +291,6 @@ void proto_register_wimax(void) /* Register the ett TLV array to retrieve unique subtree identifiers */ for (i = 0; i < MAX_NUM_TLVS; i++) { - ett_tlv[i] = -1; ett_reg[i] = &ett_tlv[i]; } diff --git a/plugins/epan/wimax/wimax_cdma_code_decoder.c b/plugins/epan/wimax/wimax_cdma_code_decoder.c index 4f7382a8f0..d926078f3b 100644 --- a/plugins/epan/wimax/wimax_cdma_code_decoder.c +++ b/plugins/epan/wimax/wimax_cdma_code_decoder.c @@ -19,12 +19,12 @@ #include <epan/packet.h> #include "wimax-int.h" -static int proto_wimax_cdma_code_decoder = -1; -static gint ett_wimax_cdma_code_decoder = -1; +static int proto_wimax_cdma_code_decoder; +static gint ett_wimax_cdma_code_decoder; -static int hf_wimax_ranging_code = -1; -static int hf_wimax_ranging_symbol_offset = -1; -static int hf_wimax_ranging_subchannel_offset = -1; +static int hf_wimax_ranging_code; +static int hf_wimax_ranging_symbol_offset; +static int hf_wimax_ranging_subchannel_offset; static int dissect_wimax_cdma_code_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -98,7 +98,7 @@ void wimax_proto_register_wimax_cdma(void) proto_register_field_array(proto_wimax_cdma_code_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("wimax_cdma_code_burst_handler", dissect_wimax_cdma_code_decoder, -1); + register_dissector("wimax_cdma_code_burst_handler", dissect_wimax_cdma_code_decoder, proto_wimax_cdma_code_decoder); } diff --git a/plugins/epan/wimax/wimax_compact_dlmap_ie_decoder.c b/plugins/epan/wimax/wimax_compact_dlmap_ie_decoder.c index c69bd68752..2f4efafa90 100644 --- a/plugins/epan/wimax/wimax_compact_dlmap_ie_decoder.c +++ b/plugins/epan/wimax/wimax_compact_dlmap_ie_decoder.c @@ -49,16 +49,16 @@ static guint wimax_compact_dlmap_cqich_control_ie_decoder(proto_tree *tree, pack static guint wimax_cdlmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); guint wimax_extended_diuc_dependent_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); -static gint proto_wimax_compact_dlmap_ie_decoder = -1; +static gint proto_wimax_compact_dlmap_ie_decoder; #if 0 /* not used ?? */ -static gint ett_wimax_compact_dlmap_ie_decoder = -1; -static gint ett_wimax_format_configuration_ie_decoder = -1; -static gint ett_wimax_rcid_ie_decoder = -1; -static gint ett_wimax_harq_control_ie_decoder = -1; -static gint ett_wimax_extended_diuc_dependent_ie_decoder = -1; -static gint ett_wimax_cqich_control_ie_decoder = -1; -static gint ett_wimax_extension_type_ie_decoder = -1; +static gint ett_wimax_compact_dlmap_ie_decoder; +static gint ett_wimax_format_configuration_ie_decoder; +static gint ett_wimax_rcid_ie_decoder; +static gint ett_wimax_harq_control_ie_decoder; +static gint ett_wimax_extended_diuc_dependent_ie_decoder; +static gint ett_wimax_cqich_control_ie_decoder; +static gint ett_wimax_extension_type_ie_decoder; #endif /* New Format Indications */ @@ -143,78 +143,78 @@ static const value_string vals_allocation_modes[] = #define COMPANDED_SC_MASK_1 0x01F0 /* display indexies */ -static gint hf_cdlmap_dl_map_type = -1; -static gint hf_cdlmap_ul_map_append = -1; -static gint hf_cdlmap_reserved = -1; -static gint hf_cdlmap_nep_code = -1; -static gint hf_cdlmap_nsch_code = -1; -static gint hf_cdlmap_num_bands = -1; -static gint hf_cdlmap_band_index = -1; -static gint hf_cdlmap_nb_bitmap = -1; -static gint hf_cdlmap_dl_map_type_1 = -1; -static gint hf_cdlmap_ul_map_append_1 = -1; -static gint hf_cdlmap_reserved_1 = -1; -static gint hf_cdlmap_nep_code_1 = -1; -static gint hf_cdlmap_nsch_code_1 = -1; -static gint hf_cdlmap_num_bands_1 = -1; -/*static gint hf_cdlmap_band_index_1 = -1;*/ -static gint hf_cdlmap_nb_bitmap_1 = -1; - -static gint hf_cdlmap_shortened_diuc = -1; -static gint hf_cdlmap_companded_sc = -1; -static gint hf_cdlmap_shortened_uiuc = -1; -static gint hf_cdlmap_shortened_diuc_1 = -1; -static gint hf_cdlmap_companded_sc_1 = -1; -static gint hf_cdlmap_shortened_uiuc_1 = -1; - -static gint hf_cdlmap_bin_offset = -1; -static gint hf_cdlmap_bin_offset_1 = -1; - -static gint hf_cdlmap_diuc_num_of_subchannels = -1; -static gint hf_cdlmap_diuc_num_of_subchannels_1 = -1; -static gint hf_cdlmap_diuc_repetition_coding_indication = -1; -static gint hf_cdlmap_diuc_repetition_coding_indication_1 = -1; -static gint hf_cdlmap_diuc_reserved = -1; -static gint hf_cdlmap_diuc_reserved_1 = -1; - -static gint hf_cdlmap_bit_map_length = -1; -static gint hf_cdlmap_bit_map_length_1 = -1; -static gint hf_cdlmap_bit_map = -1; - -static gint hf_cdlmap_diuc = -1; -static gint hf_cdlmap_diuc_1 = -1; - -static gint hf_cdlmap_allocation_mode = -1; -static gint hf_cdlmap_allocation_mode_rsvd = -1; -static gint hf_cdlmap_num_subchannels = -1; -static gint hf_cdlmap_allocation_mode_1 = -1; -static gint hf_cdlmap_allocation_mode_rsvd_1 = -1; -static gint hf_cdlmap_num_subchannels_1 = -1; - -/* static gint hf_cdlmap_reserved_type = -1; */ -static gint hf_cdlmap_reserved_type_1 = -1; +static gint hf_cdlmap_dl_map_type; +static gint hf_cdlmap_ul_map_append; +static gint hf_cdlmap_reserved; +static gint hf_cdlmap_nep_code; +static gint hf_cdlmap_nsch_code; +static gint hf_cdlmap_num_bands; +static gint hf_cdlmap_band_index; +static gint hf_cdlmap_nb_bitmap; +static gint hf_cdlmap_dl_map_type_1; +static gint hf_cdlmap_ul_map_append_1; +static gint hf_cdlmap_reserved_1; +static gint hf_cdlmap_nep_code_1; +static gint hf_cdlmap_nsch_code_1; +static gint hf_cdlmap_num_bands_1; +/*static gint hf_cdlmap_band_index_1;*/ +static gint hf_cdlmap_nb_bitmap_1; + +static gint hf_cdlmap_shortened_diuc; +static gint hf_cdlmap_companded_sc; +static gint hf_cdlmap_shortened_uiuc; +static gint hf_cdlmap_shortened_diuc_1; +static gint hf_cdlmap_companded_sc_1; +static gint hf_cdlmap_shortened_uiuc_1; + +static gint hf_cdlmap_bin_offset; +static gint hf_cdlmap_bin_offset_1; + +static gint hf_cdlmap_diuc_num_of_subchannels; +static gint hf_cdlmap_diuc_num_of_subchannels_1; +static gint hf_cdlmap_diuc_repetition_coding_indication; +static gint hf_cdlmap_diuc_repetition_coding_indication_1; +static gint hf_cdlmap_diuc_reserved; +static gint hf_cdlmap_diuc_reserved_1; + +static gint hf_cdlmap_bit_map_length; +static gint hf_cdlmap_bit_map_length_1; +static gint hf_cdlmap_bit_map; + +static gint hf_cdlmap_diuc; +static gint hf_cdlmap_diuc_1; + +static gint hf_cdlmap_allocation_mode; +static gint hf_cdlmap_allocation_mode_rsvd; +static gint hf_cdlmap_num_subchannels; +static gint hf_cdlmap_allocation_mode_1; +static gint hf_cdlmap_allocation_mode_rsvd_1; +static gint hf_cdlmap_num_subchannels_1; + +/* static gint hf_cdlmap_reserved_type; */ +static gint hf_cdlmap_reserved_type_1; /* display indexies */ -static gint hf_format_config_ie_dl_map_type = -1; -static gint hf_format_config_ie_dl_map_type_1 = -1; -static gint hf_format_config_ie_dl_map_type_32 = -1; -static gint hf_format_config_ie_new_format_indication = -1; -static gint hf_format_config_ie_new_format_indication_1 = -1; -static gint hf_format_config_ie_new_format_indication_32 = -1; -static gint hf_format_config_ie_cid_type = -1; -static gint hf_format_config_ie_cid_type_1 = -1; -static gint hf_format_config_ie_safety_pattern = -1; -static gint hf_format_config_ie_safety_pattern_1 = -1; -static gint hf_format_config_ie_subchannel_type = -1; -static gint hf_format_config_ie_subchannel_type_1 = -1; -static gint hf_format_config_ie_max_logical_bands = -1; -static gint hf_format_config_ie_max_logical_bands_1 = -1; -static gint hf_format_config_ie_num_of_broadcast_symbol = -1; -static gint hf_format_config_ie_num_of_broadcast_symbol_1 = -1; -static gint hf_format_config_ie_num_of_dl_band_amc_symbol = -1; -static gint hf_format_config_ie_num_of_dl_band_amc_symbol_1 = -1; -static gint hf_format_config_ie_num_of_ul_band_amc_symbol = -1; -static gint hf_format_config_ie_num_of_ul_band_amc_symbol_1 = -1; +static gint hf_format_config_ie_dl_map_type; +static gint hf_format_config_ie_dl_map_type_1; +static gint hf_format_config_ie_dl_map_type_32; +static gint hf_format_config_ie_new_format_indication; +static gint hf_format_config_ie_new_format_indication_1; +static gint hf_format_config_ie_new_format_indication_32; +static gint hf_format_config_ie_cid_type; +static gint hf_format_config_ie_cid_type_1; +static gint hf_format_config_ie_safety_pattern; +static gint hf_format_config_ie_safety_pattern_1; +static gint hf_format_config_ie_subchannel_type; +static gint hf_format_config_ie_subchannel_type_1; +static gint hf_format_config_ie_max_logical_bands; +static gint hf_format_config_ie_max_logical_bands_1; +static gint hf_format_config_ie_num_of_broadcast_symbol; +static gint hf_format_config_ie_num_of_broadcast_symbol_1; +static gint hf_format_config_ie_num_of_dl_band_amc_symbol; +static gint hf_format_config_ie_num_of_dl_band_amc_symbol_1; +static gint hf_format_config_ie_num_of_ul_band_amc_symbol; +static gint hf_format_config_ie_num_of_ul_band_amc_symbol_1; /* Format Configuration IE Masks */ #define FORMAT_CONFIG_IE_DL_MAP_TYPE_MASK 0xE0000000 @@ -235,18 +235,18 @@ static gint hf_format_config_ie_num_of_ul_band_amc_symbol_1 = -1; #define NUM_UL_AMC_SYMBOLS_MASK 0x000003F0 /* display indexies */ -static gint hf_harq_rcid_ie_prefix = -1; -static gint hf_harq_rcid_ie_prefix_1 = -1; -static gint hf_harq_rcid_ie_normal_cid = -1; -static gint hf_harq_rcid_ie_normal_cid_1 = -1; -static gint hf_harq_rcid_ie_cid3 = -1; -static gint hf_harq_rcid_ie_cid3_1 = -1; -static gint hf_harq_rcid_ie_cid7 = -1; -static gint hf_harq_rcid_ie_cid7_1 = -1; -static gint hf_harq_rcid_ie_cid11 = -1; -static gint hf_harq_rcid_ie_cid11_1 = -1; -static gint hf_harq_rcid_ie_cid11_2 = -1; -static gint hf_harq_rcid_ie_cid11_3 = -1; +static gint hf_harq_rcid_ie_prefix; +static gint hf_harq_rcid_ie_prefix_1; +static gint hf_harq_rcid_ie_normal_cid; +static gint hf_harq_rcid_ie_normal_cid_1; +static gint hf_harq_rcid_ie_cid3; +static gint hf_harq_rcid_ie_cid3_1; +static gint hf_harq_rcid_ie_cid7; +static gint hf_harq_rcid_ie_cid7_1; +static gint hf_harq_rcid_ie_cid11; +static gint hf_harq_rcid_ie_cid11_1; +static gint hf_harq_rcid_ie_cid11_2; +static gint hf_harq_rcid_ie_cid11_3; /* Masks */ #define WIMAX_RCID_IE_NORMAL_CID_MASK_1 0x0FFFF0 @@ -260,16 +260,16 @@ static gint hf_harq_rcid_ie_cid11_3 = -1; #define WIMAX_RCID_IE_CID11_MASK_1 0x07FF /* HARQ MAP HARQ Control IE display indexies */ -static gint hf_harq_control_ie_prefix = -1; -static gint hf_harq_control_ie_ai_sn = -1; -static gint hf_harq_control_ie_spid = -1; -static gint hf_harq_control_ie_acid = -1; -static gint hf_harq_control_ie_reserved = -1; -static gint hf_harq_control_ie_prefix_1 = -1; -static gint hf_harq_control_ie_ai_sn_1 = -1; -static gint hf_harq_control_ie_spid_1 = -1; -static gint hf_harq_control_ie_acid_1 = -1; -static gint hf_harq_control_ie_reserved_1 = -1; +static gint hf_harq_control_ie_prefix; +static gint hf_harq_control_ie_ai_sn; +static gint hf_harq_control_ie_spid; +static gint hf_harq_control_ie_acid; +static gint hf_harq_control_ie_reserved; +static gint hf_harq_control_ie_prefix_1; +static gint hf_harq_control_ie_ai_sn_1; +static gint hf_harq_control_ie_spid_1; +static gint hf_harq_control_ie_acid_1; +static gint hf_harq_control_ie_reserved_1; /* Masks */ #define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK 0x80 @@ -284,18 +284,18 @@ static gint hf_harq_control_ie_reserved_1 = -1; #define WIMAX_HARQ_CONTROL_IE_RESERVED_MASK_1 0x0700 /* HARQ MAP CQICH Control IE display indexies */ -static gint hf_cqich_control_ie_indicator = -1; -static gint hf_cqich_control_ie_alloc_id = -1; -static gint hf_cqich_control_ie_period = -1; -static gint hf_cqich_control_ie_frame_offset = -1; -static gint hf_cqich_control_ie_duration = -1; -static gint hf_cqich_control_ie_cqi_rep_threshold = -1; -static gint hf_cqich_control_ie_indicator_1 = -1; -static gint hf_cqich_control_ie_alloc_id_1 = -1; -static gint hf_cqich_control_ie_period_1 = -1; -static gint hf_cqich_control_ie_frame_offset_1 = -1; -static gint hf_cqich_control_ie_duration_1 = -1; -static gint hf_cqich_control_ie_cqi_rep_threshold_1 = -1; +static gint hf_cqich_control_ie_indicator; +static gint hf_cqich_control_ie_alloc_id; +static gint hf_cqich_control_ie_period; +static gint hf_cqich_control_ie_frame_offset; +static gint hf_cqich_control_ie_duration; +static gint hf_cqich_control_ie_cqi_rep_threshold; +static gint hf_cqich_control_ie_indicator_1; +static gint hf_cqich_control_ie_alloc_id_1; +static gint hf_cqich_control_ie_period_1; +static gint hf_cqich_control_ie_frame_offset_1; +static gint hf_cqich_control_ie_duration_1; +static gint hf_cqich_control_ie_cqi_rep_threshold_1; /* Masks */ #define WIMAX_CQICH_CONTROL_IE_INDICATOR_MASK 0x8000 @@ -319,37 +319,37 @@ static gint hf_cqich_control_ie_cqi_rep_threshold_1 = -1; #define EXTENSION_LENGTH_MASK 0x00F0 #define EXTENSION_LENGTH_MASK_1 0x000F -static gint hf_cdlmap_extension_type = -1; -static gint hf_cdlmap_extension_subtype = -1; -static gint hf_cdlmap_extension_length = -1; -static gint hf_cdlmap_extension_type_1 = -1; -static gint hf_cdlmap_extension_subtype_1 = -1; -static gint hf_cdlmap_extension_length_1 = -1; +static gint hf_cdlmap_extension_type; +static gint hf_cdlmap_extension_subtype; +static gint hf_cdlmap_extension_length; +static gint hf_cdlmap_extension_type_1; +static gint hf_cdlmap_extension_subtype_1; +static gint hf_cdlmap_extension_length_1; -static gint hf_cdlmap_extension_time_diversity_mbs = -1; -static gint hf_cdlmap_extension_harq_mode = -1; -static gint hf_cdlmap_extension_unknown_sub_type = -1; -static gint hf_cdlmap_extension_time_diversity_mbs_1 = -1; -static gint hf_cdlmap_extension_harq_mode_1 = -1; -static gint hf_cdlmap_extension_unknown_sub_type_1 = -1; +static gint hf_cdlmap_extension_time_diversity_mbs; +static gint hf_cdlmap_extension_harq_mode; +static gint hf_cdlmap_extension_unknown_sub_type; +static gint hf_cdlmap_extension_time_diversity_mbs_1; +static gint hf_cdlmap_extension_harq_mode_1; +static gint hf_cdlmap_extension_unknown_sub_type_1; /* Extended DIUC dependent IE display indexies */ -static gint hf_extended_diuc_dependent_ie_diuc = -1; -static gint hf_extended_diuc_dependent_ie_diuc_1 = -1; -static gint hf_extended_diuc_dependent_ie_length = -1; -static gint hf_extended_diuc_dependent_ie_length_1 = -1; -static gint hf_extended_diuc_dependent_ie_channel_measurement = -1; -static gint hf_extended_diuc_dependent_ie_stc_zone = -1; -static gint hf_extended_diuc_dependent_ie_aas_dl = -1; -static gint hf_extended_diuc_dependent_ie_data_location = -1; -static gint hf_extended_diuc_dependent_ie_cid_switch = -1; -static gint hf_extended_diuc_dependent_ie_mimo_dl_basic = -1; -static gint hf_extended_diuc_dependent_ie_mimo_dl_enhanced = -1; -static gint hf_extended_diuc_dependent_ie_harq_map_pointer = -1; -static gint hf_extended_diuc_dependent_ie_phymod_dl = -1; -static gint hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation = -1; -static gint hf_extended_diuc_dependent_ie_ul_interference_and_noise_level = -1; -static gint hf_extended_diuc_dependent_ie_unknown_diuc = -1; +static gint hf_extended_diuc_dependent_ie_diuc; +static gint hf_extended_diuc_dependent_ie_diuc_1; +static gint hf_extended_diuc_dependent_ie_length; +static gint hf_extended_diuc_dependent_ie_length_1; +static gint hf_extended_diuc_dependent_ie_channel_measurement; +static gint hf_extended_diuc_dependent_ie_stc_zone; +static gint hf_extended_diuc_dependent_ie_aas_dl; +static gint hf_extended_diuc_dependent_ie_data_location; +static gint hf_extended_diuc_dependent_ie_cid_switch; +static gint hf_extended_diuc_dependent_ie_mimo_dl_basic; +static gint hf_extended_diuc_dependent_ie_mimo_dl_enhanced; +static gint hf_extended_diuc_dependent_ie_harq_map_pointer; +static gint hf_extended_diuc_dependent_ie_phymod_dl; +static gint hf_extended_diuc_dependent_ie_dl_pusc_burst_allocation; +static gint hf_extended_diuc_dependent_ie_ul_interference_and_noise_level; +static gint hf_extended_diuc_dependent_ie_unknown_diuc; /* Compact DL-MAP IE Types (table 89) */ diff --git a/plugins/epan/wimax/wimax_compact_ulmap_ie_decoder.c b/plugins/epan/wimax/wimax_compact_ulmap_ie_decoder.c index efa90abd9e..0968a3be51 100644 --- a/plugins/epan/wimax/wimax_compact_ulmap_ie_decoder.c +++ b/plugins/epan/wimax/wimax_compact_ulmap_ie_decoder.c @@ -46,14 +46,14 @@ static guint wimax_compact_ulmap_rcid_ie_decoder(proto_tree *tree, packet_info * static guint wimax_compact_ulmap_harq_control_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); static guint wimax_culmap_extension_ie_decoder(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint nibble_offset); -static gint proto_wimax_compact_ulmap_ie_decoder = -1; +static gint proto_wimax_compact_ulmap_ie_decoder; #if 0 /* not used ?? */ -static gint ett_wimax_compact_ulmap_ie_decoder = -1; -static gint ett_wimax_rcid_ie_decoder = -1; -static gint ett_wimax_harq_control_ie_decoder = -1; -static gint ett_wimax_extended_uiuc_dependent_ie_decoder = -1; -static gint ett_wimax_extension_type_ie_decoder = -1; +static gint ett_wimax_compact_ulmap_ie_decoder; +static gint ett_wimax_rcid_ie_decoder; +static gint ett_wimax_harq_control_ie_decoder; +static gint ett_wimax_extended_uiuc_dependent_ie_decoder; +static gint ett_wimax_extension_type_ie_decoder; #endif /* Prefixes */ @@ -122,83 +122,83 @@ static const value_string vals_ctypes[] = #define ALLOCATION_MODE_MASK_1 0x0C /* display indexies */ -static gint hf_culmap_ul_map_type = -1; -static gint hf_culmap_reserved = -1; -static gint hf_culmap_nep_code = -1; -static gint hf_culmap_nsch_code = -1; -static gint hf_culmap_num_bands = -1; -static gint hf_culmap_band_index = -1; -static gint hf_culmap_nb_bitmap = -1; -static gint hf_culmap_ul_map_type_1 = -1; -static gint hf_culmap_reserved_1 = -1; -static gint hf_culmap_nep_code_1 = -1; -static gint hf_culmap_nsch_code_1 = -1; -static gint hf_culmap_num_bands_1 = -1; -/*static gint hf_culmap_band_index_1 = -1;*/ -static gint hf_culmap_nb_bitmap_1 = -1; - -static gint hf_culmap_shortened_uiuc = -1; -static gint hf_culmap_companded_sc = -1; -static gint hf_culmap_shortened_uiuc_1 = -1; -static gint hf_culmap_companded_sc_1 = -1; - -static gint hf_culmap_bin_offset = -1; -static gint hf_culmap_bin_offset_1 = -1; - -static gint hf_culmap_uiuc_ofdma_symbol_offset = -1; -static gint hf_culmap_uiuc_ofdma_symbol_offset_1 = -1; -static gint hf_culmap_uiuc_subchannel_offset_7 = -1; -static gint hf_culmap_uiuc_num_of_ofdma_symbols_7 = -1; -static gint hf_culmap_uiuc_num_of_subchannels_7 = -1; -static gint hf_culmap_uiuc_ranging_method = -1; -static gint hf_culmap_uiuc_reserved = -1; -static gint hf_culmap_uiuc_subchannel_offset_7_1 = -1; -static gint hf_culmap_uiuc_num_of_ofdma_symbols_7_1 = -1; -static gint hf_culmap_uiuc_num_of_subchannels_7_1 = -1; -static gint hf_culmap_uiuc_ranging_method_1 = -1; -static gint hf_culmap_uiuc_reserved_1 = -1; -static gint hf_culmap_uiuc_repetition_coding_indication = -1; -static gint hf_culmap_uiuc_repetition_coding_indication_1 = -1; -/* static gint hf_culmap_uiuc_reserved1 = -1; */ -/* static gint hf_culmap_uiuc_reserved11_1 = -1; */ -static gint hf_culmap_uiuc_subchannel_offset = -1; -static gint hf_culmap_uiuc_subchannel_offset_1 = -1; -static gint hf_culmap_uiuc_num_of_ofdma_symbols = -1; -static gint hf_culmap_uiuc_num_of_ofdma_symbols_1 = -1; -static gint hf_culmap_uiuc_num_of_subchannels = -1; -static gint hf_culmap_uiuc_num_of_subchannels_1 = -1; - -static gint hf_culmap_harq_region_change_indication = -1; -static gint hf_culmap_harq_region_change_indication_1 = -1; -static gint hf_culmap_cqi_region_change_indication = -1; -static gint hf_culmap_cqi_region_change_indication_1 = -1; - -static gint hf_culmap_uiuc = -1; -static gint hf_culmap_uiuc_1 = -1; - -static gint hf_culmap_allocation_mode = -1; -static gint hf_culmap_allocation_mode_rsvd = -1; -static gint hf_culmap_num_subchannels = -1; -static gint hf_culmap_allocation_mode_1 = -1; -static gint hf_culmap_allocation_mode_rsvd_1 = -1; -static gint hf_culmap_num_subchannels_1 = -1; - -/* static gint hf_culmap_reserved_type = -1; */ -static gint hf_culmap_reserved_type_1 = -1; +static gint hf_culmap_ul_map_type; +static gint hf_culmap_reserved; +static gint hf_culmap_nep_code; +static gint hf_culmap_nsch_code; +static gint hf_culmap_num_bands; +static gint hf_culmap_band_index; +static gint hf_culmap_nb_bitmap; +static gint hf_culmap_ul_map_type_1; +static gint hf_culmap_reserved_1; +static gint hf_culmap_nep_code_1; +static gint hf_culmap_nsch_code_1; +static gint hf_culmap_num_bands_1; +/*static gint hf_culmap_band_index_1;*/ +static gint hf_culmap_nb_bitmap_1; + +static gint hf_culmap_shortened_uiuc; +static gint hf_culmap_companded_sc; +static gint hf_culmap_shortened_uiuc_1; +static gint hf_culmap_companded_sc_1; + +static gint hf_culmap_bin_offset; +static gint hf_culmap_bin_offset_1; + +static gint hf_culmap_uiuc_ofdma_symbol_offset; +static gint hf_culmap_uiuc_ofdma_symbol_offset_1; +static gint hf_culmap_uiuc_subchannel_offset_7; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_7; +static gint hf_culmap_uiuc_num_of_subchannels_7; +static gint hf_culmap_uiuc_ranging_method; +static gint hf_culmap_uiuc_reserved; +static gint hf_culmap_uiuc_subchannel_offset_7_1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_7_1; +static gint hf_culmap_uiuc_num_of_subchannels_7_1; +static gint hf_culmap_uiuc_ranging_method_1; +static gint hf_culmap_uiuc_reserved_1; +static gint hf_culmap_uiuc_repetition_coding_indication; +static gint hf_culmap_uiuc_repetition_coding_indication_1; +/* static gint hf_culmap_uiuc_reserved1; */ +/* static gint hf_culmap_uiuc_reserved11_1; */ +static gint hf_culmap_uiuc_subchannel_offset; +static gint hf_culmap_uiuc_subchannel_offset_1; +static gint hf_culmap_uiuc_num_of_ofdma_symbols; +static gint hf_culmap_uiuc_num_of_ofdma_symbols_1; +static gint hf_culmap_uiuc_num_of_subchannels; +static gint hf_culmap_uiuc_num_of_subchannels_1; + +static gint hf_culmap_harq_region_change_indication; +static gint hf_culmap_harq_region_change_indication_1; +static gint hf_culmap_cqi_region_change_indication; +static gint hf_culmap_cqi_region_change_indication_1; + +static gint hf_culmap_uiuc; +static gint hf_culmap_uiuc_1; + +static gint hf_culmap_allocation_mode; +static gint hf_culmap_allocation_mode_rsvd; +static gint hf_culmap_num_subchannels; +static gint hf_culmap_allocation_mode_1; +static gint hf_culmap_allocation_mode_rsvd_1; +static gint hf_culmap_num_subchannels_1; + +/* static gint hf_culmap_reserved_type; */ +static gint hf_culmap_reserved_type_1; /* display indexies */ -static gint hf_rcid_ie_prefix = -1; -static gint hf_rcid_ie_prefix_1 = -1; -static gint hf_rcid_ie_normal_cid = -1; -static gint hf_rcid_ie_normal_cid_1 = -1; -static gint hf_rcid_ie_cid3 = -1; -static gint hf_rcid_ie_cid3_1 = -1; -static gint hf_rcid_ie_cid7 = -1; -static gint hf_rcid_ie_cid7_1 = -1; -static gint hf_rcid_ie_cid11 = -1; -static gint hf_rcid_ie_cid11_1 = -1; -static gint hf_rcid_ie_cid11_2 = -1; -static gint hf_rcid_ie_cid11_3 = -1; +static gint hf_rcid_ie_prefix; +static gint hf_rcid_ie_prefix_1; +static gint hf_rcid_ie_normal_cid; +static gint hf_rcid_ie_normal_cid_1; +static gint hf_rcid_ie_cid3; +static gint hf_rcid_ie_cid3_1; +static gint hf_rcid_ie_cid7; +static gint hf_rcid_ie_cid7_1; +static gint hf_rcid_ie_cid11; +static gint hf_rcid_ie_cid11_1; +static gint hf_rcid_ie_cid11_2; +static gint hf_rcid_ie_cid11_3; /* Masks */ #define WIMAX_RCID_IE_NORMAL_CID_MASK_1 0x0FFFF0 @@ -212,16 +212,16 @@ static gint hf_rcid_ie_cid11_3 = -1; #define WIMAX_RCID_IE_CID11_MASK_1 0x07FF /* HARQ MAP HARQ Control IE display indexies */ -static gint hf_harq_control_ie_prefix = -1; -static gint hf_harq_control_ie_ai_sn = -1; -static gint hf_harq_control_ie_spid = -1; -static gint hf_harq_control_ie_acid = -1; -static gint hf_harq_control_ie_reserved = -1; -static gint hf_harq_control_ie_prefix_1 = -1; -static gint hf_harq_control_ie_ai_sn_1 = -1; -static gint hf_harq_control_ie_spid_1 = -1; -static gint hf_harq_control_ie_acid_1 = -1; -static gint hf_harq_control_ie_reserved_1 = -1; +static gint hf_harq_control_ie_prefix; +static gint hf_harq_control_ie_ai_sn; +static gint hf_harq_control_ie_spid; +static gint hf_harq_control_ie_acid; +static gint hf_harq_control_ie_reserved; +static gint hf_harq_control_ie_prefix_1; +static gint hf_harq_control_ie_ai_sn_1; +static gint hf_harq_control_ie_spid_1; +static gint hf_harq_control_ie_acid_1; +static gint hf_harq_control_ie_reserved_1; /* Masks */ #define WIMAX_HARQ_CONTROL_IE_PREFIX_MASK 0x80 @@ -243,19 +243,19 @@ static gint hf_harq_control_ie_reserved_1 = -1; #define EXTENSION_LENGTH_MASK 0x00F0 #define EXTENSION_LENGTH_MASK_1 0x000F -static gint hf_culmap_extension_type = -1; -static gint hf_culmap_extension_subtype = -1; -static gint hf_culmap_extension_length = -1; -static gint hf_culmap_extension_type_1 = -1; -static gint hf_culmap_extension_subtype_1 = -1; -static gint hf_culmap_extension_length_1 = -1; +static gint hf_culmap_extension_type; +static gint hf_culmap_extension_subtype; +static gint hf_culmap_extension_length; +static gint hf_culmap_extension_type_1; +static gint hf_culmap_extension_subtype_1; +static gint hf_culmap_extension_length_1; -/* static gint hf_culmap_extension_time_diversity_mbs = -1; */ -static gint hf_culmap_extension_harq_mode = -1; -static gint hf_culmap_extension_unknown_sub_type = -1; -/* static gint hf_culmap_extension_time_diversity_mbs_1 = -1; */ -static gint hf_culmap_extension_harq_mode_1 = -1; -static gint hf_culmap_extension_unknown_sub_type_1 = -1; +/* static gint hf_culmap_extension_time_diversity_mbs; */ +static gint hf_culmap_extension_harq_mode; +static gint hf_culmap_extension_unknown_sub_type; +/* static gint hf_culmap_extension_time_diversity_mbs_1; */ +static gint hf_culmap_extension_harq_mode_1; +static gint hf_culmap_extension_unknown_sub_type_1; /* UL-MAP CDMA Allocation IE */ #define CDMA_ALLOCATION_DURATION_MASK 0xFC00 @@ -275,22 +275,22 @@ static gint hf_culmap_extension_unknown_sub_type_1 = -1; #define CDMA_ALLOCATION_RANGING_SUBCHANNEL_MASK_1 0x00000FE0 #define CDMA_ALLOCATION_BW_REQUEST_MANDATORY_MASK_1 0x00000010 -static gint hf_cdma_allocation_duration = -1; -static gint hf_cdma_allocation_uiuc = -1; -static gint hf_cdma_allocation_repetition = -1; -static gint hf_cdma_allocation_frame_number_index = -1; -static gint hf_cdma_allocation_ranging_code = -1; -static gint hf_cdma_allocation_ranging_symbol = -1; -static gint hf_cdma_allocation_ranging_subchannel = -1; -static gint hf_cdma_allocation_bw_req = -1; -static gint hf_cdma_allocation_duration_1 = -1; -static gint hf_cdma_allocation_uiuc_1 = -1; -static gint hf_cdma_allocation_repetition_1 = -1; -static gint hf_cdma_allocation_frame_number_index_1 = -1; -static gint hf_cdma_allocation_ranging_code_1 = -1; -static gint hf_cdma_allocation_ranging_symbol_1 = -1; -static gint hf_cdma_allocation_ranging_subchannel_1 = -1; -static gint hf_cdma_allocation_bw_req_1 = -1; +static gint hf_cdma_allocation_duration; +static gint hf_cdma_allocation_uiuc; +static gint hf_cdma_allocation_repetition; +static gint hf_cdma_allocation_frame_number_index; +static gint hf_cdma_allocation_ranging_code; +static gint hf_cdma_allocation_ranging_symbol; +static gint hf_cdma_allocation_ranging_subchannel; +static gint hf_cdma_allocation_bw_req; +static gint hf_cdma_allocation_duration_1; +static gint hf_cdma_allocation_uiuc_1; +static gint hf_cdma_allocation_repetition_1; +static gint hf_cdma_allocation_frame_number_index_1; +static gint hf_cdma_allocation_ranging_code_1; +static gint hf_cdma_allocation_ranging_symbol_1; +static gint hf_cdma_allocation_ranging_subchannel_1; +static gint hf_cdma_allocation_bw_req_1; /* UL-MAP Extended UIUCs (table 290a) */ #define MINI_SUBCHANNEL_CTYPE_MASK 0xC0 @@ -312,42 +312,42 @@ static gint hf_cdma_allocation_bw_req_1 = -1; #define MINI_SUBCHANNEL_PADDING_MASK 0xF0 #define MINI_SUBCHANNEL_PADDING_MASK_1 0x0000000F -static gint hf_extended_uiuc_ie_uiuc = -1; -static gint hf_extended_uiuc_ie_length = -1; -static gint hf_extended_uiuc_ie_uiuc_1 = -1; -static gint hf_extended_uiuc_ie_length_1 = -1; -static gint hf_extended_uiuc_ie_power_control = -1; -static gint hf_extended_uiuc_ie_power_measurement_frame = -1; -static gint hf_extended_uiuc_ie_power_control_24 = -1; -static gint hf_extended_uiuc_ie_power_measurement_frame_24 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype_16 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration_16 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_1 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_1 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_1 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_2 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_2 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_2 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_3 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_3 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_3 = -1; -static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1 = -1; -static gint hf_extended_uiuc_ie_aas_ul = -1; -static gint hf_extended_uiuc_ie_cqich_alloc = -1; -static gint hf_extended_uiuc_ie_ul_zone = -1; -static gint hf_extended_uiuc_ie_phymod_ul = -1; -static gint hf_extended_uiuc_ie_mimo_ul_basic = -1; -static gint hf_extended_uiuc_ie_fast_tracking = -1; -static gint hf_extended_uiuc_ie_ul_pusc_burst_allocation = -1; -static gint hf_extended_uiuc_ie_fast_ranging = -1; -static gint hf_extended_uiuc_ie_ul_allocation_start = -1; -static gint hf_extended_uiuc_ie_unknown_uiuc = -1; +static gint hf_extended_uiuc_ie_uiuc; +static gint hf_extended_uiuc_ie_length; +static gint hf_extended_uiuc_ie_uiuc_1; +static gint hf_extended_uiuc_ie_length_1; +static gint hf_extended_uiuc_ie_power_control; +static gint hf_extended_uiuc_ie_power_measurement_frame; +static gint hf_extended_uiuc_ie_power_control_24; +static gint hf_extended_uiuc_ie_power_measurement_frame_24; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_ctype_16; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_duration_16; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_1; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_2; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_2; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_2; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_cid_3; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_uiuc_3; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_repetition_3; +static gint hf_extended_uiuc_ie_mini_subchannel_alloc_padding_1; +static gint hf_extended_uiuc_ie_aas_ul; +static gint hf_extended_uiuc_ie_cqich_alloc; +static gint hf_extended_uiuc_ie_ul_zone; +static gint hf_extended_uiuc_ie_phymod_ul; +static gint hf_extended_uiuc_ie_mimo_ul_basic; +static gint hf_extended_uiuc_ie_fast_tracking; +static gint hf_extended_uiuc_ie_ul_pusc_burst_allocation; +static gint hf_extended_uiuc_ie_fast_ranging; +static gint hf_extended_uiuc_ie_ul_allocation_start; +static gint hf_extended_uiuc_ie_unknown_uiuc; /* Compact UL-MAP IE Types (table 90) */ diff --git a/plugins/epan/wimax/wimax_fch_decoder.c b/plugins/epan/wimax/wimax_fch_decoder.c index 6ecacbc0db..69e2c1959c 100644 --- a/plugins/epan/wimax/wimax_fch_decoder.c +++ b/plugins/epan/wimax/wimax_fch_decoder.c @@ -25,8 +25,8 @@ extern gint proto_wimax; extern address bs_address; /* declared in packet-wmx.c */ -static int proto_wimax_fch_decoder = -1; -static gint ett_wimax_fch_decoder = -1; +static int proto_wimax_fch_decoder; +static gint ett_wimax_fch_decoder; #define FCH_BURST_LENGTH 3 /* FCH Burst bits */ @@ -42,17 +42,17 @@ static gint ett_wimax_fch_decoder = -1; #define DL_MAP_LENGTH 0x000FF0 #define FCH_RESERVED_2 0x00000F -static int hf_fch_used_subchannel_group0 = -1; -static int hf_fch_used_subchannel_group1 = -1; -static int hf_fch_used_subchannel_group2 = -1; -static int hf_fch_used_subchannel_group3 = -1; -static int hf_fch_used_subchannel_group4 = -1; -static int hf_fch_used_subchannel_group5 = -1; -static int hf_fch_reserved_1 = -1; -static int hf_fch_repetition_coding_indication = -1; -static int hf_fch_coding_indication = -1; -static int hf_fch_dlmap_length = -1; -static int hf_fch_reserved_2 = -1; +static int hf_fch_used_subchannel_group0; +static int hf_fch_used_subchannel_group1; +static int hf_fch_used_subchannel_group2; +static int hf_fch_used_subchannel_group3; +static int hf_fch_used_subchannel_group4; +static int hf_fch_used_subchannel_group5; +static int hf_fch_reserved_1; +static int hf_fch_repetition_coding_indication; +static int hf_fch_coding_indication; +static int hf_fch_dlmap_length; +static int hf_fch_reserved_2; static const value_string used_or_not_used[] = { @@ -229,7 +229,7 @@ void wimax_proto_register_wimax_fch(void) proto_register_field_array(proto_wimax_fch_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("wimax_fch_burst_handler", dissect_wimax_fch_decoder, -1); + register_dissector("wimax_fch_burst_handler", dissect_wimax_fch_decoder, proto_wimax_fch_decoder); } /* diff --git a/plugins/epan/wimax/wimax_ffb_decoder.c b/plugins/epan/wimax/wimax_ffb_decoder.c index 98ad719019..5b8b8f8b72 100644 --- a/plugins/epan/wimax/wimax_ffb_decoder.c +++ b/plugins/epan/wimax/wimax_ffb_decoder.c @@ -21,15 +21,15 @@ extern gint proto_wimax; -static gint proto_wimax_ffb_decoder = -1; -static gint ett_wimax_ffb_decoder = -1; +static gint proto_wimax_ffb_decoder; +static gint ett_wimax_ffb_decoder; -/* static gint hf_ffb_burst = -1; */ -static gint hf_ffb_num_of_ffbs = -1; -static gint hf_ffb_type = -1; -static gint hf_ffb_subchannel = -1; -static gint hf_ffb_symboloffset = -1; -static gint hf_ffb_value = -1; +/* static gint hf_ffb_burst; */ +static gint hf_ffb_num_of_ffbs; +static gint hf_ffb_type; +static gint hf_ffb_subchannel; +static gint hf_ffb_symboloffset; +static gint hf_ffb_value; static int dissect_wimax_ffb_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -112,7 +112,7 @@ void wimax_proto_register_wimax_ffb(void) proto_register_field_array(proto_wimax_ffb_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - register_dissector("wimax_ffb_burst_handler", dissect_wimax_ffb_decoder, -1); + register_dissector("wimax_ffb_burst_handler", dissect_wimax_ffb_decoder, proto_wimax_ffb_decoder); } /* diff --git a/plugins/epan/wimax/wimax_hack_decoder.c b/plugins/epan/wimax/wimax_hack_decoder.c index cb29ed636b..a1aaef93ef 100644 --- a/plugins/epan/wimax/wimax_hack_decoder.c +++ b/plugins/epan/wimax/wimax_hack_decoder.c @@ -21,8 +21,8 @@ extern gint proto_wimax; -static gint proto_wimax_hack_decoder = -1; -static gint ett_wimax_hack_decoder = -1; +static gint proto_wimax_hack_decoder; +static gint ett_wimax_hack_decoder; static const value_string vals_flags[] = { @@ -38,12 +38,12 @@ static const value_string vals_values[] = {0, NULL} }; -/* static gint hf_hack_burst = -1; */ -static gint hf_hack_num_of_hacks = -1; -static gint hf_hack_half_slot_flag = -1; -static gint hf_hack_subchannel = -1; -static gint hf_hack_symboloffset = -1; -static gint hf_hack_value = -1; +/* static gint hf_hack_burst; */ +static gint hf_hack_num_of_hacks; +static gint hf_hack_half_slot_flag; +static gint hf_hack_subchannel; +static gint hf_hack_symboloffset; +static gint hf_hack_value; static int dissect_wimax_hack_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) @@ -121,7 +121,7 @@ void wimax_proto_register_wimax_hack(void) proto_wimax_hack_decoder = proto_wimax; - register_dissector("wimax_hack_burst_handler", dissect_wimax_hack_decoder, -1); + register_dissector("wimax_hack_burst_handler", dissect_wimax_hack_decoder, proto_wimax_hack_decoder); proto_register_field_array(proto_wimax_hack_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/plugins/epan/wimax/wimax_harq_map_decoder.c b/plugins/epan/wimax/wimax_harq_map_decoder.c index ec99de002c..d0bb91cdad 100644 --- a/plugins/epan/wimax/wimax_harq_map_decoder.c +++ b/plugins/epan/wimax/wimax_harq_map_decoder.c @@ -25,8 +25,8 @@ extern gint proto_wimax; -static gint proto_wimax_harq_map_decoder = -1; -static gint ett_wimax_harq_map_decoder = -1; +static gint proto_wimax_harq_map_decoder; +static gint ett_wimax_harq_map_decoder; /* MASKs */ #define LSB_NIBBLE_MASK 0x0F @@ -41,15 +41,15 @@ static gint ett_wimax_harq_map_decoder = -1; #define WIMAX_HARQ_MAP_DL_IE_COUNT_SHIFT 4 /* HARQ MAP display indexies */ -static gint hf_harq_map_indicator = -1; -static gint hf_harq_ul_map_appended = -1; -static gint hf_harq_map_reserved = -1; -static gint hf_harq_map_msg_length = -1; -static gint hf_harq_dl_ie_count = -1; -static gint hf_harq_map_msg_crc = -1; -static gint hf_harq_map_msg_crc_status = -1; - -static expert_field ei_harq_map_msg_crc = EI_INIT; +static gint hf_harq_map_indicator; +static gint hf_harq_ul_map_appended; +static gint hf_harq_map_reserved; +static gint hf_harq_map_msg_length; +static gint hf_harq_dl_ie_count; +static gint hf_harq_map_msg_crc; +static gint hf_harq_map_msg_crc_status; + +static expert_field ei_harq_map_msg_crc; /* Copied and renamed from proto.c because global value_strings don't work for plugins */ diff --git a/plugins/epan/wimax/wimax_pdu_decoder.c b/plugins/epan/wimax/wimax_pdu_decoder.c index 1d22dbeefc..3b764a69db 100644 --- a/plugins/epan/wimax/wimax_pdu_decoder.c +++ b/plugins/epan/wimax/wimax_pdu_decoder.c @@ -47,10 +47,10 @@ static dissector_handle_t wimax_harq_map_handle = NULL; /* Global Variables. */ gboolean first_gmh; -static gint proto_wimax_pdu_decoder = -1; -static gint ett_wimax_pdu_decoder = -1; +static gint proto_wimax_pdu_decoder; +static gint ett_wimax_pdu_decoder; -static int hf_wimax_value_bytes = -1; +static int hf_wimax_value_bytes; static int dissect_wimax_pdu_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -227,7 +227,7 @@ void wimax_proto_register_wimax_pdu(void) proto_wimax_pdu_decoder = proto_wimax; - register_dissector("wimax_pdu_burst_handler", dissect_wimax_pdu_decoder, -1); + register_dissector("wimax_pdu_burst_handler", dissect_wimax_pdu_decoder, proto_wimax_pdu_decoder); proto_register_field_array(proto_wimax_pdu_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } diff --git a/plugins/epan/wimax/wimax_phy_attributes_decoder.c b/plugins/epan/wimax/wimax_phy_attributes_decoder.c index 3aa517ef38..daa691523c 100644 --- a/plugins/epan/wimax/wimax_phy_attributes_decoder.c +++ b/plugins/epan/wimax/wimax_phy_attributes_decoder.c @@ -21,8 +21,8 @@ extern gint proto_wimax; -static gint proto_wimax_phy_attributes_decoder = -1; -static gint ett_wimax_phy_attributes_decoder = -1; +static gint proto_wimax_phy_attributes_decoder; +static gint ett_wimax_phy_attributes_decoder; static const value_string vals_subchannel_types[] = { @@ -53,14 +53,14 @@ static const value_string vals_encoding_types[] = {0, NULL} }; -static gint hf_phy_attributes_subchannelization_type = -1; -static gint hf_phy_attributes_permbase = -1; -static gint hf_phy_attributes_modulation_rate = -1; -static gint hf_phy_attributes_encoding_type = -1; -static gint hf_phy_attributes_num_repeat = -1; -static gint hf_phy_attributes_symbol_offset = -1; -static gint hf_phy_attributes_num_of_slots = -1; -static gint hf_phy_attributes_subchannel = -1; +static gint hf_phy_attributes_subchannelization_type; +static gint hf_phy_attributes_permbase; +static gint hf_phy_attributes_modulation_rate; +static gint hf_phy_attributes_encoding_type; +static gint hf_phy_attributes_num_repeat; +static gint hf_phy_attributes_symbol_offset; +static gint hf_phy_attributes_num_of_slots; +static gint hf_phy_attributes_subchannel; @@ -158,7 +158,7 @@ void wimax_proto_register_wimax_phy_attributes(void) proto_wimax_phy_attributes_decoder = proto_wimax; - register_dissector("wimax_phy_attributes_burst_handler", dissect_wimax_phy_attributes_decoder, -1); + register_dissector("wimax_phy_attributes_burst_handler", dissect_wimax_phy_attributes_decoder, proto_wimax_phy_attributes_decoder); proto_register_field_array(proto_wimax_phy_attributes_decoder, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/plugins/epan/wimax/wimax_utils.c b/plugins/epan/wimax/wimax_utils.c index 405762ca44..e59bb2a561 100644 --- a/plugins/epan/wimax/wimax_utils.c +++ b/plugins/epan/wimax/wimax_utils.c @@ -32,22 +32,22 @@ extern gint proto_mac_mgmt_msg_reg_req_decoder; extern gint mac_sdu_length; /* declared in packet-wmx.c */ extern gboolean include_cor2_changes; -static gint proto_wimax_utility_decoders = -1; -static gint ett_wimax_service_flow_encodings = -1; -static gint ett_wimax_cst_encoding_rules = -1; -static gint ett_wimax_error_parameter_set = -1; -static gint ett_wimax_hmac_tuple = -1; -static gint ett_wimax_cmac_tuple = -1; -static gint ett_wimax_short_hmac_tuple = -1; -static gint ett_security_negotiation_parameters = -1; -static gint ett_pkm_tlv_encoded_attributes_decoder = -1; -static gint ett_sa_descriptor_decoder = -1; -static gint ett_cryptographic_suite_list_decoder = -1; -static gint ett_security_capabilities_decoder = -1; -static gint ett_vendor_specific_info_decoder = -1; -static gint ett_vendor_id_encoding_decoder = -1; -static gint ett_ul_service_flow_decoder = -1; -static gint ett_dl_service_flow_decoder = -1; +static gint proto_wimax_utility_decoders; +static gint ett_wimax_service_flow_encodings; +static gint ett_wimax_cst_encoding_rules; +static gint ett_wimax_error_parameter_set; +static gint ett_wimax_hmac_tuple; +static gint ett_wimax_cmac_tuple; +static gint ett_wimax_short_hmac_tuple; +static gint ett_security_negotiation_parameters; +static gint ett_pkm_tlv_encoded_attributes_decoder; +static gint ett_sa_descriptor_decoder; +static gint ett_cryptographic_suite_list_decoder; +static gint ett_security_capabilities_decoder; +static gint ett_vendor_specific_info_decoder; +static gint ett_vendor_id_encoding_decoder; +static gint ett_ul_service_flow_decoder; +static gint ett_dl_service_flow_decoder; static dissector_handle_t eap_handle = NULL; @@ -400,155 +400,155 @@ static const value_string vals_dcd_mac_version[] = }; /* fix fields */ -static gint hf_sfe_unknown_type = -1; -static gint hf_sfe_sf_id = -1; -static gint hf_sfe_cid = -1; -static gint hf_sfe_service_class_name = -1; -static gint hf_sfe_mbs_service = -1; -static gint hf_sfe_qos_params_set = -1; -static gint hf_sfe_set_provisioned = -1; -static gint hf_sfe_set_admitted = -1; -static gint hf_sfe_set_active = -1; -static gint hf_sfe_set_rsvd = -1; -static gint hf_sfe_traffic_priority = -1; -static gint hf_sfe_max_str = -1; -static gint hf_sfe_max_traffic_burst = -1; -static gint hf_sfe_min_rtr = -1; -static gint hf_sfe_reserved_10 = -1; -static gint hf_sfe_ul_grant_scheduling = -1; -static gint hf_sfe_req_tx_policy = -1; -static gint hf_sfe_policy_broadcast_bwr = -1; -static gint hf_sfe_policy_multicast_bwr = -1; -static gint hf_sfe_policy_piggyback = -1; -static gint hf_sfe_policy_fragment = -1; -static gint hf_sfe_policy_headers = -1; -static gint hf_sfe_policy_packing = -1; -static gint hf_sfe_policy_crc = -1; -static gint hf_sfe_policy_rsvd1 = -1; -static gint hf_sfe_jitter = -1; -static gint hf_sfe_max_latency = -1; -static gint hf_sfe_fixed_len_sdu = -1; -static gint hf_sfe_sdu_size = -1; -static gint hf_sfe_target_said = -1; -static gint hf_sfe_cs_specification = -1; -static gint hf_sfe_type_of_data_delivery_services = -1; -static gint hf_sfe_sdu_inter_arrival_interval = -1; -static gint hf_sfe_time_base = -1; -static gint hf_sfe_paging_preference = -1; -static gint hf_sfe_mbs_zone_identifier_assignment = -1; -static gint hf_sfe_sn_feedback_enabled = -1; -static gint hf_sfe_harq_service_flows = -1; -static gint hf_sfe_harq_channel_mapping_index = -1; -static gint hf_sfe_fsn_size = -1; -static gint hf_sfe_unsolicited_grant_interval = -1; -static gint hf_sfe_unsolicited_polling_interval = -1; -/* static gint hf_sfe_harq_channel_mapping = -1; */ -static gint hf_sfe_global_service_class_name = -1; -static gint hf_sfe_reserved_36 = -1; -static gint hf_sfe_reserved_34 = -1; - -static gint hf_sfe_arq_enable = -1; -static gint hf_sfe_arq_transmitter_delay = -1; -static gint hf_sfe_arq_receiver_delay = -1; -static gint hf_sfe_arq_block_lifetime = -1; -static gint hf_sfe_arq_sync_loss_timeout = -1; -static gint hf_sfe_arq_transmitter_delay_cor2 = -1; -static gint hf_sfe_arq_receiver_delay_cor2 = -1; -static gint hf_sfe_arq_block_lifetime_cor2 = -1; -static gint hf_sfe_arq_sync_loss_timeout_cor2 = -1; -static gint hf_sfe_arq_deliver_in_order = -1; -static gint hf_sfe_arq_rx_purge_timeout = -1; -static gint hf_sfe_arq_window_size = -1; -static gint hf_sfe_arq_block_size = -1; -static gint hf_sfe_arq_block_size_cor2 = -1; -static gint hf_sfe_arq_min_block_size = -1; -static gint hf_sfe_arq_max_block_size = -1; - -/* static gint hf_sfe_cid_alloc_for_active_bs = -1; */ -static gint hf_sfe_cid_alloc_for_active_bs_cid = -1; -static gint hf_sfe_pdu_sn_ext_subheader_reorder = -1; -static gint hf_sfe_mbs_contents_ids = -1; -static gint hf_sfe_mbs_contents_ids_id = -1; -static gint hf_sfe_authorization_token = -1; - -static gint hf_cst_classifier_dsc_action = -1; -static gint hf_cst_error_set_errored_param = -1; -static gint hf_cst_error_set_error_code = -1; -static gint hf_cst_error_set_error_msg = -1; - -static gint hf_cst_pkt_class_rule = -1; - -static gint hf_cst_pkt_class_rule_priority = -1; -static gint hf_cst_pkt_class_rule_range_mask = -1; -static gint hf_cst_pkt_class_rule_tos_low = -1; -static gint hf_cst_pkt_class_rule_tos_high = -1; -static gint hf_cst_pkt_class_rule_tos_mask = -1; -static gint hf_cst_pkt_class_rule_protocol = -1; -/*static gint hf_cst_pkt_class_rule_protocol_number = -1;*/ -static gint hf_cst_pkt_class_rule_ip_masked_src_address = -1; -static gint hf_cst_pkt_class_rule_ip_masked_dest_address = -1; -static gint hf_cst_pkt_class_rule_src_ipv4 = -1; -static gint hf_cst_pkt_class_rule_dest_ipv4 = -1; -static gint hf_cst_pkt_class_rule_mask_ipv4 = -1; -static gint hf_cst_pkt_class_rule_src_ipv6 = -1; -static gint hf_cst_pkt_class_rule_dest_ipv6 = -1; -static gint hf_cst_pkt_class_rule_mask_ipv6 = -1; -static gint hf_cst_pkt_class_rule_prot_src_port_range = -1; -static gint hf_cst_pkt_class_rule_src_port_low = -1; -static gint hf_cst_pkt_class_rule_src_port_high = -1; -static gint hf_cst_pkt_class_rule_prot_dest_port_range = -1; -static gint hf_cst_pkt_class_rule_dest_port_low = -1; -static gint hf_cst_pkt_class_rule_dest_port_high = -1; -static gint hf_cst_pkt_class_rule_dest_mac_address = -1; -static gint hf_cst_pkt_class_rule_dest_mac = -1; -static gint hf_cst_pkt_class_rule_src_mac_address = -1; -static gint hf_cst_pkt_class_rule_src_mac = -1; -static gint hf_cst_pkt_class_rule_mask_mac = -1; -static gint hf_cst_pkt_class_rule_ethertype = -1; -static gint hf_cst_pkt_class_rule_etype = -1; -static gint hf_cst_pkt_class_rule_eprot1 = -1; -static gint hf_cst_pkt_class_rule_eprot2 = -1; -static gint hf_cst_pkt_class_rule_user_priority = -1; -static gint hf_cst_pkt_class_rule_pri_low = -1; -static gint hf_cst_pkt_class_rule_pri_high = -1; -static gint hf_cst_pkt_class_rule_vlan_id = -1; -static gint hf_cst_pkt_class_rule_vlan_id1 = -1; -static gint hf_cst_pkt_class_rule_vlan_id2 = -1; -static gint hf_cst_pkt_class_rule_phsi = -1; -static gint hf_cst_pkt_class_rule_index = -1; -static gint hf_cst_pkt_class_rule_ipv6_flow_label = -1; -static gint hf_cst_pkt_class_rule_vendor_spec = -1; -static gint hf_cst_pkt_class_rule_classifier_action_rule = -1; -static gint hf_cst_pkt_class_rule_classifier_action_rule_bit0 = -1; -static gint hf_cst_pkt_class_rule_classifier_action_rule_bit1 = -1; - -static gint hf_cst_large_context_id = -1; -static gint hf_cst_short_format_context_id = -1; - -static gint hf_cst_phs_dsc_action = -1; -static gint hf_cst_phs_rule = -1; -static gint hf_cst_phs_phsi = -1; -static gint hf_cst_phs_phsf = -1; -static gint hf_cst_phs_phsm = -1; -static gint hf_cst_phs_phss = -1; -static gint hf_cst_phs_phsv = -1; -static gint hf_cst_phs_vendor_spec = -1; -static gint hf_cst_invalid_tlv = -1; - -static gint hf_csper_atm_switching_encoding = -1; -static gint hf_csper_atm_classifier = -1; -static gint hf_csper_atm_classifier_vpi = -1; -static gint hf_csper_atm_classifier_vci = -1; -static gint hf_csper_atm_classifier_id = -1; -/*static gint hf_csper_atm_classifier_dsc_action = -1;*/ -static gint hf_csper_unknown_type = -1; - -static gint hf_xmac_tuple_rsvd = -1; -static gint hf_xmac_tuple_key_seq_num = -1; -static gint hf_hmac_tuple_hmac_digest = -1; -static gint hf_packet_number_counter = -1; -static gint hf_cmac_tuple_cmac_value = -1; -static gint hf_cmac_tuple_bsid = -1; +static gint hf_sfe_unknown_type; +static gint hf_sfe_sf_id; +static gint hf_sfe_cid; +static gint hf_sfe_service_class_name; +static gint hf_sfe_mbs_service; +static gint hf_sfe_qos_params_set; +static gint hf_sfe_set_provisioned; +static gint hf_sfe_set_admitted; +static gint hf_sfe_set_active; +static gint hf_sfe_set_rsvd; +static gint hf_sfe_traffic_priority; +static gint hf_sfe_max_str; +static gint hf_sfe_max_traffic_burst; +static gint hf_sfe_min_rtr; +static gint hf_sfe_reserved_10; +static gint hf_sfe_ul_grant_scheduling; +static gint hf_sfe_req_tx_policy; +static gint hf_sfe_policy_broadcast_bwr; +static gint hf_sfe_policy_multicast_bwr; +static gint hf_sfe_policy_piggyback; +static gint hf_sfe_policy_fragment; +static gint hf_sfe_policy_headers; +static gint hf_sfe_policy_packing; +static gint hf_sfe_policy_crc; +static gint hf_sfe_policy_rsvd1; +static gint hf_sfe_jitter; +static gint hf_sfe_max_latency; +static gint hf_sfe_fixed_len_sdu; +static gint hf_sfe_sdu_size; +static gint hf_sfe_target_said; +static gint hf_sfe_cs_specification; +static gint hf_sfe_type_of_data_delivery_services; +static gint hf_sfe_sdu_inter_arrival_interval; +static gint hf_sfe_time_base; +static gint hf_sfe_paging_preference; +static gint hf_sfe_mbs_zone_identifier_assignment; +static gint hf_sfe_sn_feedback_enabled; +static gint hf_sfe_harq_service_flows; +static gint hf_sfe_harq_channel_mapping_index; +static gint hf_sfe_fsn_size; +static gint hf_sfe_unsolicited_grant_interval; +static gint hf_sfe_unsolicited_polling_interval; +/* static gint hf_sfe_harq_channel_mapping; */ +static gint hf_sfe_global_service_class_name; +static gint hf_sfe_reserved_36; +static gint hf_sfe_reserved_34; + +static gint hf_sfe_arq_enable; +static gint hf_sfe_arq_transmitter_delay; +static gint hf_sfe_arq_receiver_delay; +static gint hf_sfe_arq_block_lifetime; +static gint hf_sfe_arq_sync_loss_timeout; +static gint hf_sfe_arq_transmitter_delay_cor2; +static gint hf_sfe_arq_receiver_delay_cor2; +static gint hf_sfe_arq_block_lifetime_cor2; +static gint hf_sfe_arq_sync_loss_timeout_cor2; +static gint hf_sfe_arq_deliver_in_order; +static gint hf_sfe_arq_rx_purge_timeout; +static gint hf_sfe_arq_window_size; +static gint hf_sfe_arq_block_size; +static gint hf_sfe_arq_block_size_cor2; +static gint hf_sfe_arq_min_block_size; +static gint hf_sfe_arq_max_block_size; + +/* static gint hf_sfe_cid_alloc_for_active_bs; */ +static gint hf_sfe_cid_alloc_for_active_bs_cid; +static gint hf_sfe_pdu_sn_ext_subheader_reorder; +static gint hf_sfe_mbs_contents_ids; +static gint hf_sfe_mbs_contents_ids_id; +static gint hf_sfe_authorization_token; + +static gint hf_cst_classifier_dsc_action; +static gint hf_cst_error_set_errored_param; +static gint hf_cst_error_set_error_code; +static gint hf_cst_error_set_error_msg; + +static gint hf_cst_pkt_class_rule; + +static gint hf_cst_pkt_class_rule_priority; +static gint hf_cst_pkt_class_rule_range_mask; +static gint hf_cst_pkt_class_rule_tos_low; +static gint hf_cst_pkt_class_rule_tos_high; +static gint hf_cst_pkt_class_rule_tos_mask; +static gint hf_cst_pkt_class_rule_protocol; +/*static gint hf_cst_pkt_class_rule_protocol_number;*/ +static gint hf_cst_pkt_class_rule_ip_masked_src_address; +static gint hf_cst_pkt_class_rule_ip_masked_dest_address; +static gint hf_cst_pkt_class_rule_src_ipv4; +static gint hf_cst_pkt_class_rule_dest_ipv4; +static gint hf_cst_pkt_class_rule_mask_ipv4; +static gint hf_cst_pkt_class_rule_src_ipv6; +static gint hf_cst_pkt_class_rule_dest_ipv6; +static gint hf_cst_pkt_class_rule_mask_ipv6; +static gint hf_cst_pkt_class_rule_prot_src_port_range; +static gint hf_cst_pkt_class_rule_src_port_low; +static gint hf_cst_pkt_class_rule_src_port_high; +static gint hf_cst_pkt_class_rule_prot_dest_port_range; +static gint hf_cst_pkt_class_rule_dest_port_low; +static gint hf_cst_pkt_class_rule_dest_port_high; +static gint hf_cst_pkt_class_rule_dest_mac_address; +static gint hf_cst_pkt_class_rule_dest_mac; +static gint hf_cst_pkt_class_rule_src_mac_address; +static gint hf_cst_pkt_class_rule_src_mac; +static gint hf_cst_pkt_class_rule_mask_mac; +static gint hf_cst_pkt_class_rule_ethertype; +static gint hf_cst_pkt_class_rule_etype; +static gint hf_cst_pkt_class_rule_eprot1; +static gint hf_cst_pkt_class_rule_eprot2; +static gint hf_cst_pkt_class_rule_user_priority; +static gint hf_cst_pkt_class_rule_pri_low; +static gint hf_cst_pkt_class_rule_pri_high; +static gint hf_cst_pkt_class_rule_vlan_id; +static gint hf_cst_pkt_class_rule_vlan_id1; +static gint hf_cst_pkt_class_rule_vlan_id2; +static gint hf_cst_pkt_class_rule_phsi; +static gint hf_cst_pkt_class_rule_index; +static gint hf_cst_pkt_class_rule_ipv6_flow_label; +static gint hf_cst_pkt_class_rule_vendor_spec; +static gint hf_cst_pkt_class_rule_classifier_action_rule; +static gint hf_cst_pkt_class_rule_classifier_action_rule_bit0; +static gint hf_cst_pkt_class_rule_classifier_action_rule_bit1; + +static gint hf_cst_large_context_id; +static gint hf_cst_short_format_context_id; + +static gint hf_cst_phs_dsc_action; +static gint hf_cst_phs_rule; +static gint hf_cst_phs_phsi; +static gint hf_cst_phs_phsf; +static gint hf_cst_phs_phsm; +static gint hf_cst_phs_phss; +static gint hf_cst_phs_phsv; +static gint hf_cst_phs_vendor_spec; +static gint hf_cst_invalid_tlv; + +static gint hf_csper_atm_switching_encoding; +static gint hf_csper_atm_classifier; +static gint hf_csper_atm_classifier_vpi; +static gint hf_csper_atm_classifier_vci; +static gint hf_csper_atm_classifier_id; +/*static gint hf_csper_atm_classifier_dsc_action;*/ +static gint hf_csper_unknown_type; + +static gint hf_xmac_tuple_rsvd; +static gint hf_xmac_tuple_key_seq_num; +static gint hf_hmac_tuple_hmac_digest; +static gint hf_packet_number_counter; +static gint hf_cmac_tuple_cmac_value; +static gint hf_cmac_tuple_bsid; /* bit masks */ /* 11.13.4 */ @@ -577,33 +577,33 @@ static gint hf_cmac_tuple_bsid = -1; #define XMAC_TUPLE_KEY_SEQ_NUM 0x0F /* WiMax Security Negotiation Parameters display */ -static gint hf_snp_pkm_version_support = -1; -static gint hf_snp_pkm_version_support_bit0 = -1; -static gint hf_snp_pkm_version_support_bit1 = -1; -static gint hf_snp_pkm_version_support_reserved = -1; -static gint hf_snp_auth_policy_support = -1; -static gint hf_snp_auth_policy_support_bit0 = -1; -static gint hf_snp_auth_policy_support_bit1 = -1; -static gint hf_snp_auth_policy_support_bit2 = -1; -static gint hf_snp_auth_policy_support_bit3 = -1; -static gint hf_snp_auth_policy_support_bit4 = -1; -static gint hf_snp_auth_policy_support_bit5 = -1; -static gint hf_snp_auth_policy_support_bit6 = -1; -static gint hf_snp_auth_policy_support_bit7 = -1; -static gint hf_snp_mac_mode = -1; -static gint hf_snp_mac_mode_bit0 = -1; -static gint hf_snp_mac_mode_bit1 = -1; -static gint hf_snp_mac_mode_bit1_rsvd = -1; -static gint hf_snp_mac_mode_bit2 = -1; -static gint hf_snp_mac_mode_bit3 = -1; -static gint hf_snp_mac_mode_bit4 = -1; -static gint hf_snp_mac_mode_bit5 = -1; -static gint hf_snp_mac_mode_reserved = -1; -static gint hf_snp_mac_mode_reserved1 = -1; -static gint hf_snp_pn_window_size = -1; -static gint hf_snp_max_conc_transactions = -1; -static gint hf_snp_max_suppt_sec_assns = -1; -static gint hf_snp_unknown_type = -1; +static gint hf_snp_pkm_version_support; +static gint hf_snp_pkm_version_support_bit0; +static gint hf_snp_pkm_version_support_bit1; +static gint hf_snp_pkm_version_support_reserved; +static gint hf_snp_auth_policy_support; +static gint hf_snp_auth_policy_support_bit0; +static gint hf_snp_auth_policy_support_bit1; +static gint hf_snp_auth_policy_support_bit2; +static gint hf_snp_auth_policy_support_bit3; +static gint hf_snp_auth_policy_support_bit4; +static gint hf_snp_auth_policy_support_bit5; +static gint hf_snp_auth_policy_support_bit6; +static gint hf_snp_auth_policy_support_bit7; +static gint hf_snp_mac_mode; +static gint hf_snp_mac_mode_bit0; +static gint hf_snp_mac_mode_bit1; +static gint hf_snp_mac_mode_bit1_rsvd; +static gint hf_snp_mac_mode_bit2; +static gint hf_snp_mac_mode_bit3; +static gint hf_snp_mac_mode_bit4; +static gint hf_snp_mac_mode_bit5; +static gint hf_snp_mac_mode_reserved; +static gint hf_snp_mac_mode_reserved1; +static gint hf_snp_pn_window_size; +static gint hf_snp_max_conc_transactions; +static gint hf_snp_max_suppt_sec_assns; +static gint hf_snp_unknown_type; /* bit masks */ /* 11.8.4.1 */ @@ -630,65 +630,65 @@ static gint hf_snp_unknown_type = -1; #define SNP_MAC_MODE_RSV1 0xC0 /* PKM display */ -static gint hf_pkm_msg_unknown_type = -1; -static gint hf_pkm_msg_attr_display = -1; -static gint hf_pkm_config_settings_authorize_waitout = -1; -static gint hf_pkm_config_settings_reauthorize_waitout = -1; -static gint hf_pkm_config_settings_grace_time = -1; -static gint hf_pkm_config_settings_operational_waittime = -1; -static gint hf_pkm_msg_attr_auth_key = -1; -static gint hf_pkm_msg_attr_tek = -1; -static gint hf_pkm_msg_attr_key_life_time = -1; -static gint hf_pkm_msg_attr_key_seq_num = -1; -static gint hf_pkm_msg_attr_hmac_digest = -1; -static gint hf_pkm_msg_attr_said = -1; -static gint hf_pkm_msg_attr_cbc_iv = -1; -static gint hf_pkm_msg_attr_error_code = -1; -static gint hf_pkm_msg_attr_ca_certificate = -1; -static gint hf_pkm_msg_attr_ss_certificate = -1; -static gint hf_pkm_attr_auth_result_code = -1; -static gint hf_pkm_attr_sa_service_type = -1; -static gint hf_pkm_attr_frame_number = -1; -static gint hf_pkm_attr_ss_random = -1; -static gint hf_pkm_attr_bs_random = -1; -static gint hf_pkm_attr_pre_pak = -1; -static gint hf_pkm_attr_bs_certificate = -1; -static gint hf_pkm_attr_sig_bs = -1; -static gint hf_pkm_attr_ms_mac_address = -1; -static gint hf_pkm_attr_cmac_digest = -1; -static gint hf_pkm_attr_cmac_digest_pn = -1; -static gint hf_pkm_attr_cmac_digest_value = -1; -static gint hf_pkm_attr_eap_payload = -1; -static gint hf_pkm_attr_nonce = -1; -static gint hf_pkm_sa_type = -1; -static gint hf_pkm_msg_crypto_suite = -1; -static gint hf_pkm_msg_crypto_suite_msb = -1; -static gint hf_pkm_msg_crypto_suite_middle = -1; -static gint hf_pkm_msg_crypto_suite_lsb = -1; -/*static gint hf_pkm_msg_version = -1;*/ -static gint hf_pkm_attr_push_modes = -1; -static gint hf_pkm_attr_key_push_counter = -1; -static gint hf_pkm_attr_gkek = -1; -static gint hf_pkm_attr_sig_ss = -1; -static gint hf_pkm_attr_akid = -1; -static gint hf_pkm_config_settings_rekey_wait_timeout = -1; -static gint hf_pkm_config_settings_tek_grace_time = -1; -static gint hf_pkm_config_settings_authorize_reject_wait_timeout = -1; - -/* static gint hf_pkm_attr_pak_ak_seq_number = -1; */ -static gint hf_pkm_attr_associated_gkek_seq_number = -1; -/* static gint hf_pkm_attr_gkek_params = -1; */ - -/* static gint hf_common_tlv_unknown_type = -1; */ -static gint hf_common_tlv_mac_version = -1; -static gint hf_common_tlv_vendor_id = -1; -static gint hf_common_tlv_vendor_specific_type = -1; -static gint hf_common_tlv_vendor_specific_length = -1; -static gint hf_common_tlv_vendor_specific_length_size = -1; -static gint hf_common_tlv_vendor_specific_value = -1; -static gint hf_common_current_transmitted_power = -1; - -static expert_field ei_common_tlv_info = EI_INIT; +static gint hf_pkm_msg_unknown_type; +static gint hf_pkm_msg_attr_display; +static gint hf_pkm_config_settings_authorize_waitout; +static gint hf_pkm_config_settings_reauthorize_waitout; +static gint hf_pkm_config_settings_grace_time; +static gint hf_pkm_config_settings_operational_waittime; +static gint hf_pkm_msg_attr_auth_key; +static gint hf_pkm_msg_attr_tek; +static gint hf_pkm_msg_attr_key_life_time; +static gint hf_pkm_msg_attr_key_seq_num; +static gint hf_pkm_msg_attr_hmac_digest; +static gint hf_pkm_msg_attr_said; +static gint hf_pkm_msg_attr_cbc_iv; +static gint hf_pkm_msg_attr_error_code; +static gint hf_pkm_msg_attr_ca_certificate; +static gint hf_pkm_msg_attr_ss_certificate; +static gint hf_pkm_attr_auth_result_code; +static gint hf_pkm_attr_sa_service_type; +static gint hf_pkm_attr_frame_number; +static gint hf_pkm_attr_ss_random; +static gint hf_pkm_attr_bs_random; +static gint hf_pkm_attr_pre_pak; +static gint hf_pkm_attr_bs_certificate; +static gint hf_pkm_attr_sig_bs; +static gint hf_pkm_attr_ms_mac_address; +static gint hf_pkm_attr_cmac_digest; +static gint hf_pkm_attr_cmac_digest_pn; +static gint hf_pkm_attr_cmac_digest_value; +static gint hf_pkm_attr_eap_payload; +static gint hf_pkm_attr_nonce; +static gint hf_pkm_sa_type; +static gint hf_pkm_msg_crypto_suite; +static gint hf_pkm_msg_crypto_suite_msb; +static gint hf_pkm_msg_crypto_suite_middle; +static gint hf_pkm_msg_crypto_suite_lsb; +/*static gint hf_pkm_msg_version;*/ +static gint hf_pkm_attr_push_modes; +static gint hf_pkm_attr_key_push_counter; +static gint hf_pkm_attr_gkek; +static gint hf_pkm_attr_sig_ss; +static gint hf_pkm_attr_akid; +static gint hf_pkm_config_settings_rekey_wait_timeout; +static gint hf_pkm_config_settings_tek_grace_time; +static gint hf_pkm_config_settings_authorize_reject_wait_timeout; + +/* static gint hf_pkm_attr_pak_ak_seq_number; */ +static gint hf_pkm_attr_associated_gkek_seq_number; +/* static gint hf_pkm_attr_gkek_params; */ + +/* static gint hf_common_tlv_unknown_type; */ +static gint hf_common_tlv_mac_version; +static gint hf_common_tlv_vendor_id; +static gint hf_common_tlv_vendor_specific_type; +static gint hf_common_tlv_vendor_specific_length; +static gint hf_common_tlv_vendor_specific_length_size; +static gint hf_common_tlv_vendor_specific_value; +static gint hf_common_current_transmitted_power; + +static expert_field ei_common_tlv_info; /* Register WiMax Utility Routines */ void wimax_proto_register_wimax_utility_decoders(void) @@ -1033,10 +1033,6 @@ void wimax_proto_register_wimax_utility_decoders(void) {"Protocol", "wmx.cst.pkt_class_rule.protocol", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL} }, #if 0 /* Removed by the changes of 802.16E 2005 */ - { /* Protocol */ - &hf_cst_pkt_class_rule_protocol, - {"Protocol", "wmx.cst.pkt_class_rule.protocol", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} - }, { /* Protocol Number */ &hf_cst_pkt_class_rule_protocol_number, {"Protocol Number", "wmx.cst.pkt_class_rule.protocol.number", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL} @@ -1612,12 +1608,6 @@ void wimax_proto_register_wimax_utility_decoders(void) &hf_pkm_attr_sa_service_type, {"SA Service Type", "wmx.pkm_msg.pkm_attr.sa_service_type", FT_UINT8, BASE_DEC, VALS(vs_sa_service_type), 0x0, NULL, HFILL} }, -#if 0 /* same as 11.9.19 */ - { /* 11.9.36 - type 27 */ - &hf_pkm_attr_config_settings, - {"PKMv2 Configuration Settings", "wmx.pkm_msg.pkm_attr.config_settings", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL} - }, -#endif { /* 11.9.37 - type 32 */ &hf_pkm_attr_frame_number, {"Frame Number", "wmx.pkm_msg.pkm_attr.frame_number", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL} @@ -1689,7 +1679,7 @@ void wimax_proto_register_wimax_utility_decoders(void) expert_module_t* expert_wimax_utility; - if(proto_wimax_utility_decoders == -1) + if(proto_wimax_utility_decoders <= 0) { proto_wimax_utility_decoders = proto_register_protocol ( "WiMax Sub-TLV Messages", diff --git a/plugins/epan/wimaxasncp/CMakeLists.txt b/plugins/epan/wimaxasncp/CMakeLists.txt index 39aa634dbf..9bfe3f5ebf 100644 --- a/plugins/epan/wimaxasncp/CMakeLists.txt +++ b/plugins/epan/wimaxasncp/CMakeLists.txt @@ -26,17 +26,18 @@ add_lex_files(LEX_FILES PLUGIN_FILES ) set_source_files_properties( - ${PLUGIN_FILES} + ${DISSECTOR_SRC} PROPERTIES COMPILE_FLAGS "${WERROR_COMMON_FLAGS}" ) register_plugin_files(plugin.c plugin + "WiMAX ASN Control Plane dissection" ${DISSECTOR_SRC} ) -add_plugin_library(wimaxasncp epan) +add_wireshark_epan_plugin_library(wimaxasncp) target_link_libraries(wimaxasncp epan) diff --git a/plugins/epan/wimaxasncp/packet-wimaxasncp.c b/plugins/epan/wimaxasncp/packet-wimaxasncp.c index e0e1bfc282..ced1ceb520 100644 --- a/plugins/epan/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/epan/wimaxasncp/packet-wimaxasncp.c @@ -37,37 +37,37 @@ void proto_register_wimaxasncp(void); void proto_reg_handoff_wimaxasncp(void); /* Initialize the protocol and registered fields */ -static int proto_wimaxasncp = -1; -static int hf_wimaxasncp_version = -1; -static int hf_wimaxasncp_flags = -1; -static int hf_wimaxasncp_function_type = -1; -static int hf_wimaxasncp_op_id = -1; -/* static int hf_wimaxasncp_message_type = -1; */ -/* static int hf_wimaxasncp_qos_msg = -1; */ -/* static int hf_wimaxasncp_ho_control_msg = -1; */ -/* static int hf_wimaxasncp_data_path_control_msg = -1; */ -/* static int hf_wimaxasncp_context_delivery_msg = -1; */ -/* static int hf_wimaxasncp_r3_mobility_msg = -1; */ -/* static int hf_wimaxasncp_paging_msg = -1; */ -/* static int hf_wimaxasncp_rrm_msg = -1; */ -/* static int hf_wimaxasncp_authentication_msg = -1; */ -/* static int hf_wimaxasncp_ms_state_msg = -1; */ -/* static int hf_wimaxasncp_reauthentication_msg = -1; */ -/* static int hf_wimaxasncp_session_msg = -1; */ -static int hf_wimaxasncp_length = -1; -static int hf_wimaxasncp_msid = -1; -static int hf_wimaxasncp_reserved1 = -1; -static int hf_wimaxasncp_transaction_id = -1; -static int hf_wimaxasncp_reserved2 = -1; -/* static int hf_wimaxasncp_tlv = -1; */ -static int hf_wimaxasncp_tlv_type = -1; -static int hf_wimaxasncp_tlv_length = -1; -static int hf_wimaxasncp_tlv_value_bytes = -1; -static int hf_wimaxasncp_tlv_value_bitflags8 = -1; -static int hf_wimaxasncp_tlv_value_bitflags16 = -1; -static int hf_wimaxasncp_tlv_value_bitflags32 = -1; -/* static int hf_wimaxasncp_tlv_value_protocol = -1; */ -/* static int hf_wimaxasncp_tlv_value_vendor_id = -1; */ +static int proto_wimaxasncp; +static int hf_wimaxasncp_version; +static int hf_wimaxasncp_flags; +static int hf_wimaxasncp_function_type; +static int hf_wimaxasncp_op_id; +static int hf_wimaxasncp_message_type; +/* static int hf_wimaxasncp_qos_msg; */ +/* static int hf_wimaxasncp_ho_control_msg; */ +/* static int hf_wimaxasncp_data_path_control_msg; */ +/* static int hf_wimaxasncp_context_delivery_msg; */ +/* static int hf_wimaxasncp_r3_mobility_msg; */ +/* static int hf_wimaxasncp_paging_msg; */ +/* static int hf_wimaxasncp_rrm_msg; */ +/* static int hf_wimaxasncp_authentication_msg; */ +/* static int hf_wimaxasncp_ms_state_msg; */ +/* static int hf_wimaxasncp_reauthentication_msg; */ +/* static int hf_wimaxasncp_session_msg; */ +static int hf_wimaxasncp_length; +static int hf_wimaxasncp_msid; +static int hf_wimaxasncp_reserved1; +static int hf_wimaxasncp_transaction_id; +static int hf_wimaxasncp_reserved2; +/* static int hf_wimaxasncp_tlv; */ +static int hf_wimaxasncp_tlv_type; +static int hf_wimaxasncp_tlv_length; +static int hf_wimaxasncp_tlv_value_bytes; +static int hf_wimaxasncp_tlv_value_bitflags8; +static int hf_wimaxasncp_tlv_value_bitflags16; +static int hf_wimaxasncp_tlv_value_bitflags32; +/* static int hf_wimaxasncp_tlv_value_protocol; */ +/* static int hf_wimaxasncp_tlv_value_vendor_id; */ /* Preferences */ static gboolean show_transaction_id_d_bit = FALSE; @@ -78,29 +78,30 @@ static gboolean debug_enabled = FALSE; /* Initialize the subtree pointers */ -static gint ett_wimaxasncp = -1; -static gint ett_wimaxasncp_flags = -1; -static gint ett_wimaxasncp_tlv = -1; -static gint ett_wimaxasncp_tlv_value_bitflags8 = -1; -static gint ett_wimaxasncp_tlv_value_bitflags16 = -1; -static gint ett_wimaxasncp_tlv_value_bitflags32 = -1; -static gint ett_wimaxasncp_tlv_protocol_list = -1; -static gint ett_wimaxasncp_tlv_port_range_list = -1; -static gint ett_wimaxasncp_tlv_ip_address_mask_list = -1; -static gint ett_wimaxasncp_tlv_ip_address_mask = -1; -static gint ett_wimaxasncp_tlv_eap = -1; -static gint ett_wimaxasncp_tlv_vendor_specific_information_field = -1; -static gint ett_wimaxasncp_port_range = -1; - -static expert_field ei_wimaxasncp_tlv_type = EI_INIT; -static expert_field ei_wimaxasncp_function_type = EI_INIT; -static expert_field ei_wimaxasncp_op_id = EI_INIT; -static expert_field ei_wimaxasncp_length_bad = EI_INIT; +static gint ett_wimaxasncp; +static gint ett_wimaxasncp_flags; +static gint ett_wimaxasncp_tlv; +static gint ett_wimaxasncp_tlv_value_bitflags8; +static gint ett_wimaxasncp_tlv_value_bitflags16; +static gint ett_wimaxasncp_tlv_value_bitflags32; +static gint ett_wimaxasncp_tlv_protocol_list; +static gint ett_wimaxasncp_tlv_port_range_list; +static gint ett_wimaxasncp_tlv_ip_address_mask_list; +static gint ett_wimaxasncp_tlv_ip_address_mask; +static gint ett_wimaxasncp_tlv_eap; +static gint ett_wimaxasncp_tlv_vendor_specific_information_field; +static gint ett_wimaxasncp_port_range; + +static expert_field ei_wimaxasncp_tlv_type; +static expert_field ei_wimaxasncp_function_type; +static expert_field ei_wimaxasncp_op_id; +static expert_field ei_wimaxasncp_message_type; +static expert_field ei_wimaxasncp_length_bad; /* Header size, up to, but not including, the TLV fields. */ #define WIMAXASNCP_HEADER_SIZE 20 -/* Offset to end of the length field in the headder. */ +/* Offset to end of the length field in the header. */ #define WIMAXASNCP_HEADER_LENGTH_END 6 #define WIMAXASNCP_BIT32(n) (1U << (31 - (n))) @@ -401,7 +402,7 @@ static const ver_value_string wimaxasncp_ms_state_msg_vals[] = /* ------------------------------------------------------------------------- */ -/* note - function type 10-im_operation, was once used for re-authrntication */ +/* note - function type 10-im_operation, was once used for re-authentication */ static const ver_value_string wimaxasncp_im_operations_msg_vals[] = { {0, { 1, "AR_EAP_Start"}}, @@ -519,7 +520,7 @@ static const gchar *wimaxasncp_get_enum_name( { if (tlv_info->enum_vs) { - return val_to_str(code, tlv_info->enum_vs, "Unknown"); + return val_to_str_const(code, tlv_info->enum_vs, "Unknown"); } else { @@ -574,7 +575,7 @@ static void wimaxasncp_proto_tree_add_tlv_ipv4_value( guint32 ip; const gchar *addr_res; - if (tlv_info->hf_ipv4 != -1) + if (tlv_info->hf_ipv4 > 0) { hf_value = tlv_info->hf_ipv4; } @@ -609,7 +610,7 @@ static void wimaxasncp_proto_tree_add_tlv_ipv6_value( ws_in6_addr ip; const gchar *addr_res; - if (tlv_info->hf_ipv4 != -1) + if (tlv_info->hf_ipv4 > 0) { hf_value = tlv_info->hf_ipv6; } @@ -645,7 +646,7 @@ static void wimaxasncp_proto_tree_add_ether_value( const guint8 *p; const gchar *ether_name; - if (tlv_info->hf_bsid != -1) + if (tlv_info->hf_bsid > 0) { hf_value = tlv_info->hf_bsid; } @@ -1043,29 +1044,28 @@ static void wimaxasncp_dissect_tlv_value( { if (tree) { - const gchar *format1; - const gchar *format2; - const guint8 *p = tvb_get_ptr(tvb, offset, length); - const gchar *s = bytes_to_str_punct(pinfo->pool, p, MIN(length, max_show_bytes), 0); - - if (length <= max_show_bytes) - { - format1 = "Value: %s"; - format2 = " - %s"; - } - else - { - format1 = "Value: %s..."; - format2 = " - %s..."; - } - - proto_tree_add_bytes_format( + proto_tree_add_item( tree, tlv_info->hf_value, - tvb, offset, length, p, - format1, s); + tvb, offset, length, ENC_NA); - proto_item_append_text( - tlv_item, format2, s); + if (length) { + const gchar* format; + if (length <= max_show_bytes) + { + format = " - %s"; + } + else + { + format = " - %s..."; + } + const gchar* s = tvb_bytes_to_str_punct( + pinfo->pool, tvb, offset, MIN(length, max_show_bytes), 0); + + proto_item_append_text( + tlv_item, format, s); + } else { + proto_item_append_text(tlv_item, " - <MISSING>"); + } } return; @@ -1224,23 +1224,26 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - const gchar *format; - const guint8 *p = tvb_get_ptr(tvb, offset, length); - const gchar *s = bytes_to_str_punct(pinfo->pool, p, MIN(length, max_show_bytes), 0); + if (length) { + const char *format; + const char *s = tvb_bytes_to_str_punct( + pinfo->pool, tvb, offset, length, 0); - if (length <= max_show_bytes) - { - format = "Value: %s %s"; - } - else - { - format = "Value: %s %s..."; - } + if (length <= max_show_bytes) { + format = "%s %s"; + } else { + format = "%s %s..."; + } - proto_tree_add_bytes_format( - tree, tlv_info->hf_value, - tvb, offset, length, p, - format, hex_note, s); + proto_tree_add_bytes_format_value( + tree, tlv_info->hf_value, + tvb, offset, length, NULL, format, hex_note, s); + + } else { + proto_tree_add_bytes_format_value( + tree, tlv_info->hf_value, + tvb, offset, length, NULL, "%s", "<MISSING>"); + } proto_item_append_text(tlv_item, " - TBD"); } @@ -1711,30 +1714,37 @@ static void wimaxasncp_dissect_tlv_value( { if (tree) { - const gchar *format1; - const gchar *format2; - const guint8 *p = tvb_get_ptr(tvb, offset, length); - const gchar *s = - bytes_to_str_punct(pinfo->pool, p, MIN(length, max_show_bytes), 0); + const char* s; + if (length) { + const char* format1; + const char* format2; + if (length <= max_show_bytes) + { + format1 = "%s %s"; + format2 = " - %s %s"; + } + else + { + format1 = "%s %s..."; + format2 = " - %s %s..."; + } + s = tvb_bytes_to_str_punct( + pinfo->pool, tvb, offset, MIN(length, max_show_bytes), 0); - if (length <= max_show_bytes) - { - format1 = "Value: %s %s"; - format2 = " - %s %s"; - } - else - { - format1 = "Value: %s %s..."; - format2 = " - %s %s..."; - } + proto_tree_add_bytes_format_value( + tree, tlv_info->hf_value, + tvb, offset, length, NULL, format1, hex_note, s); - proto_tree_add_bytes_format( - tree, tlv_info->hf_value, - tvb, offset, length, p, - format1, hex_note, s); + proto_item_append_text( + tlv_item, format2, hex_note, s); + } + else { + proto_tree_add_bytes_format_value( + tree, tlv_info->hf_value, + tvb, offset, length, NULL, "%s", "<MISSING>"); - proto_item_append_text( - tlv_item, format2, hex_note, s); + proto_item_append_text(tlv_item, " - <MISSING>"); + } } @@ -1753,23 +1763,27 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - const gchar *format; - const guint8 *p = tvb_get_ptr(tvb, offset, length); - const gchar *s = bytes_to_str_punct(pinfo->pool, p, MIN(length, max_show_bytes), 0); + if (length) { + const char* format; + const char *s = tvb_bytes_to_str_punct( + pinfo->pool, tvb, offset, MIN(length, max_show_bytes), 0); - if (length <= max_show_bytes) - { - format = "Value: %s %s"; - } - else - { - format = "Value: %s %s..."; - } + if (length <= max_show_bytes) { + format = "%s %s"; + } else { + format = "%s %s..."; + } - proto_tree_add_bytes_format( - tree, hf_wimaxasncp_tlv_value_bytes, - tvb, offset, length, p, - format, hex_note, s); + proto_tree_add_bytes_format_value( + tree, hf_wimaxasncp_tlv_value_bytes, + tvb, offset, length, NULL, + format, hex_note, s); + } else { + proto_tree_add_bytes_format_value( + tree, hf_wimaxasncp_tlv_value_bytes, + tvb, offset, length, NULL, + "%s", "<MISSING>"); + } } } @@ -2146,7 +2160,7 @@ dissect_wimaxasncp( offset = 0; /* Register protocol fields, etc if haven't done yet. */ - if (hf_wimaxasncp_version == -1) + if (hf_wimaxasncp_version <= 0) { proto_registrar_get_byname("wimaxasncp.version"); } @@ -2322,7 +2336,7 @@ dissect_wimaxasncp( } item = proto_tree_add_uint_format( - wimaxasncp_tree, hf_wimaxasncp_op_id, + wimaxasncp_tree, hf_wimaxasncp_message_type, tvb, offset, 1, ui8, "Message Type: %s", message_name); @@ -2331,8 +2345,8 @@ dissect_wimaxasncp( /* Add expert item if not matched */ if (strcmp(message_name, unknown) == 0) { - expert_add_info_format(pinfo, item, &ei_wimaxasncp_op_id, - "Unknown message op (%u)", + expert_add_info_format(pinfo, item, &ei_wimaxasncp_message_type, + "Unknown message type (%u)", 0x1f & ui8); } @@ -2823,7 +2837,6 @@ register_wimaxasncp_fields(const char* unused _U_) HFILL } }, -#if 0 { &hf_wimaxasncp_message_type, { @@ -2837,7 +2850,6 @@ register_wimaxasncp_fields(const char* unused _U_) HFILL } }, -#endif #if 0 { &hf_wimaxasncp_qos_msg, @@ -3218,6 +3230,7 @@ register_wimaxasncp_fields(const char* unused _U_) { &ei_wimaxasncp_tlv_type, { "wimaxasncp.tlv.type.unknown", PI_UNDECODED, PI_WARN, "Unknown tlv", EXPFILL }}, { &ei_wimaxasncp_function_type, { "wimaxasncp.function_type.unknown", PI_UNDECODED, PI_WARN, "Unknown function type", EXPFILL }}, { &ei_wimaxasncp_op_id, { "wimaxasncp.opid.unknown", PI_UNDECODED, PI_WARN, "Unknown message op", EXPFILL }}, + { &ei_wimaxasncp_message_type, { "wimaxasncp.message_type.unknown", PI_UNDECODED, PI_WARN, "Unknown message type", EXPFILL }}, { &ei_wimaxasncp_length_bad, { "wimaxasncp.length.bad", PI_MALFORMED, PI_ERROR, "Bad length", EXPFILL }}, }; @@ -3231,7 +3244,7 @@ register_wimaxasncp_fields(const char* unused _U_) debug_parser = getenv("WIRESHARK_DEBUG_WIMAXASNCP_DICT_PARSER") != NULL; dump_dict = getenv("WIRESHARK_DUMP_WIMAXASNCP_DICT") != NULL; - dir = g_strdup_printf( + dir = ws_strdup_printf( "%s" G_DIR_SEPARATOR_S "wimaxasncp", get_datafile_dir()); diff --git a/plugins/epan/wimaxasncp/wimaxasncp_dict.l b/plugins/epan/wimaxasncp/wimaxasncp_dict.l index 68caa80b1f..6108ccb51e 100644 --- a/plugins/epan/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/epan/wimaxasncp/wimaxasncp_dict.l @@ -1,6 +1,7 @@ %top { /* Include this before everything else, for various large-file definitions */ #include "config.h" +#include <wireshark.h> } /* @@ -103,7 +104,7 @@ /* * Disable diagnostics in the code generated by Flex. */ -DIAG_OFF_FLEX +DIAG_OFF_FLEX() typedef struct entity_t { gchar *name; @@ -345,7 +346,7 @@ since_attr since=\042 } if (!e) { - temp_str = g_strdup_printf( + temp_str = ws_strdup_printf( "cannot find entity: '%s'\n", yytext); yyextra->dict_error = g_string_append(yyextra->dict_error, temp_str); g_free(temp_str); @@ -448,18 +449,6 @@ since_attr since=\042 D(("tlv_start\n")); yyextra->tlv = wmem_new0(wmem_epan_scope(), wimaxasncp_dict_tlv_t); - yyextra->tlv->hf_root = -1; - yyextra->tlv->hf_value = -1; - yyextra->tlv->hf_ipv4 = -1; - yyextra->tlv->hf_ipv6 = -1; - yyextra->tlv->hf_bsid = -1; - yyextra->tlv->hf_protocol = -1; - yyextra->tlv->hf_port_low = -1; - yyextra->tlv->hf_port_high = -1; - yyextra->tlv->hf_ipv4_mask = -1; - yyextra->tlv->hf_ipv6_mask = -1; - yyextra->tlv->hf_vendor_id = -1; - yyextra->tlv->hf_vendor_rest_of_info = -1; if (! yyextra->dict->tlvs ) yyextra->last_tlv = yyextra->dict->tlvs = yyextra->tlv; @@ -516,7 +505,7 @@ since_attr since=\042 /* * Turn diagnostics back on, so we check the code that we've written. */ -DIAG_ON_FLEX +DIAG_ON_FLEX() static int debugging = 0; @@ -641,7 +630,7 @@ static FILE *wimaxasncp_dict_open( gchar *fname; if (system_directory) { - fname = g_strdup_printf("%s%s%s", + fname = ws_strdup_printf("%s%s%s", system_directory, G_DIR_SEPARATOR_S,filename); } else diff --git a/plugins/epan/wimaxmacphy/CMakeLists.txt b/plugins/epan/wimaxmacphy/CMakeLists.txt index 12e940892a..ef29c28de5 100644 --- a/plugins/epan/wimaxmacphy/CMakeLists.txt +++ b/plugins/epan/wimaxmacphy/CMakeLists.txt @@ -29,10 +29,11 @@ set_source_files_properties( register_plugin_files(plugin.c plugin + "WiMAX MAC PHY over Ethernet dissection" ${DISSECTOR_SRC} ) -add_plugin_library(wimaxmacphy epan) +add_wireshark_epan_plugin_library(wimaxmacphy) target_link_libraries(wimaxmacphy epan) diff --git a/plugins/epan/wimaxmacphy/packet-wimaxmacphy.c b/plugins/epan/wimaxmacphy/packet-wimaxmacphy.c index 2084d64e3a..d2015941e9 100644 --- a/plugins/epan/wimaxmacphy/packet-wimaxmacphy.c +++ b/plugins/epan/wimaxmacphy/packet-wimaxmacphy.c @@ -20,274 +20,275 @@ /* Initialize the protocol and registered fields */ -static int proto_wimaxmacphy = -1; -static int hf_wimaxmacphy_hdr_phy_entity_id = -1; -static int hf_wimaxmacphy_hdr_message_segmentation = -1; -static int hf_wimaxmacphy_hdr_message_type = -1; -static int hf_wimaxmacphy_unknown = -1; -static int hf_wimaxmacphy_prim_length_of_txvector = -1; -static int hf_wimaxmacphy_prim_length_of_rxvector = -1; -static int hf_wimaxmacphy_prim_status = -1; -static int hf_wimaxmacphy_prim_txstart_indication_status = -1; -static int hf_wimaxmacphy_prim_reserved1 = -1; -static int hf_wimaxmacphy_prim_reserved2 = -1; -static int hf_wimaxmacphy_prim_reserved3 = -1; -static int hf_wimaxmacphy_prim_reserved4 = -1; -static int hf_wimaxmacphy_prim_reserved5 = -1; -static int hf_wimaxmacphy_prim_next_frame_number = -1; -static int hf_wimaxmacphy_prim_extended_frame_number = -1; -static int hf_wimaxmacphy_prim_current_frame_number_lsn = -1; -static int hf_wimaxmacphy_prim_initial_frame_number = -1; -static int hf_wimaxmacphy_prim_dl_zone_number = -1; -static int hf_wimaxmacphy_prim_sub_burst_burst_split_point = -1; -static int hf_wimaxmacphy_prim_dl_sub_burst_burst_number = -1; -static int hf_wimaxmacphy_prim_phy_sdu = -1; -static int hf_wimaxmacphy_prim_phy_request = -1; -static int hf_wimaxmacphy_prim_requested_aas_calibration_zone_size = -1; -static int hf_wimaxmacphy_prim_requested_aas_calibration_zone_alloc = -1; -static int hf_wimaxmacphy_prim_number_of_consecutive_frames_with_aas = -1; -static int hf_wimaxmacphy_prim_frame_number = -1; -static int hf_wimaxmacphy_prim_issid = -1; -static int hf_wimaxmacphy_prim_integrity = -1; -static int hf_wimaxmacphy_prim_number_of_bytes_received = -1; -static int hf_wimaxmacphy_prim_rssi_per_subcarrier_level = -1; -static int hf_wimaxmacphy_prim_cinr = -1; -static int hf_wimaxmacphy_prim_power_offset = -1; -static int hf_wimaxmacphy_prim_current_frame_number_msn = -1; -static int hf_wimaxmacphy_prim_acid_for_harq_data_bursts = -1; -static int hf_wimaxmacphy_prim_indication_type = -1; -static int hf_wimaxmacphy_prim_zone_permutation_type = -1; -static int hf_wimaxmacphy_prim_update_aas_handle_in_mac = -1; -static int hf_wimaxmacphy_prim_aas_handle = -1; -static int hf_wimaxmacphy_prim_time_deviation = -1; -static int hf_wimaxmacphy_prim_frequency_deviation = -1; -static int hf_wimaxmacphy_prim_phy_aas_report_present = -1; -static int hf_wimaxmacphy_prim_number_of_affected_ss = -1; -static int hf_wimaxmacphy_prim_zonexid = -1; -static int hf_wimaxmacphy_prim_cdma_code = -1; -static int hf_wimaxmacphy_prim_cdma_symbol = -1; -static int hf_wimaxmacphy_prim_cdma_subchannel = -1; -static int hf_wimaxmacphy_prim_harq_ack_issid = -1; -static int hf_wimaxmacphy_prim_harq_ack_acid = -1; -static int hf_wimaxmacphy_prim_harq_ack_reserved1 = -1; -static int hf_wimaxmacphy_prim_harq_ack_ack_valid = -1; -static int hf_wimaxmacphy_prim_harq_ack_unnamed = -1; -static int hf_wimaxmacphy_prim_harq_ack_reserved2 = -1; -static int hf_wimaxmacphy_prim_fast_issid = -1; -static int hf_wimaxmacphy_prim_fast_cqich_id = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit0 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit1 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit2 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit3 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit4 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit5 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit6 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit7 = -1; -static int hf_wimaxmacphy_prim_fast_feedback_valid = -1; -static int hf_wimaxmacphy_prim_fast_feedback_sub_type = -1; -static int hf_wimaxmacphy_prim_fast_reserved = -1; -static int hf_wimaxmacphy_prim_fast_feedback_value = -1; -static int hf_wimaxmacphy_subframe_subframe_type = -1; -static int hf_wimaxmacphy_subframe_frame_number = -1; -static int hf_wimaxmacphy_subframe_downlink_reserved1 = -1; -static int hf_wimaxmacphy_subframe_phy_sap_version_number = -1; -static int hf_wimaxmacphy_subframe_downlink_reserved2 = -1; -static int hf_wimaxmacphy_subframe_allocation_start_time = -1; -static int hf_wimaxmacphy_number_of_zone_descriptors = -1; -static int hf_wimaxmacphy_zone_padding = -1; -static int hf_wimaxmacphy_dl_zone_type = -1; -static int hf_wimaxmacphy_ul_zone_type = -1; -static int hf_wimaxmacphy_zone_number = -1; -static int hf_wimaxmacphy_zone_start_symbol_offset = -1; -static int hf_wimaxmacphy_zone_end_symbol_offset = -1; -static int hf_wimaxmacphy_dl_zone_permutation_type = -1; -static int hf_wimaxmacphy_ul_zone_permutation_type = -1; -static int hf_wimaxmacphy_dl_zone_use_all_subchannels_indicator = -1; -static int hf_wimaxmacphy_ul_zone_use_all_subchannels_indicator = -1; -static int hf_wimaxmacphy_ul_zone_disable_pusc_subchannel_rotation = -1; -static int hf_wimaxmacphy_zone_dl_perm_base = -1; -static int hf_wimaxmacphy_zone_ul_perm_base = -1; -static int hf_wimaxmacphy_zone_prbs_id = -1; -static int hf_wimaxmacphy_zone_agc_range_extension = -1; -static int hf_wimaxmacphy_zone_dedicated_pilots = -1; -static int hf_wimaxmacphy_zone_reserved = -1; -static int hf_wimaxmacphy_zone_stc_type = -1; -static int hf_wimaxmacphy_zone_matrix_indicator = -1; -static int hf_wimaxmacphy_zone_midamble_presence = -1; -static int hf_wimaxmacphy_zone_midamble_boosting = -1; -static int hf_wimaxmacphy_zone_preamble_configuration = -1; -static int hf_wimaxmacphy_zone_sdma_supported_indication = -1; -static int hf_wimaxmacphy_zone_preamble_type = -1; -static int hf_wimaxmacphy_dl_zone_aas_reserved = -1; -static int hf_wimaxmacphy_ul_zone_aas_reserved = -1; -static int hf_wimaxmacphy_number_of_burst_descriptors = -1; -static int hf_wimaxmacphy_burst_padding = -1; -static int hf_wimaxmacphy_dl_burst_type = -1; -static int hf_wimaxmacphy_ul_burst_type = -1; -static int hf_wimaxmacphy_burst_type_extension = -1; -static int hf_wimaxmacphy_burst_number = -1; -static int hf_wimaxmacphy_burst_modulation_fec_code_type = -1; -static int hf_wimaxmacphy_burst_data_length = -1; -static int hf_wimaxmacphy_burst_ofdma_symbol_offset = -1; -static int hf_wimaxmacphy_burst_subchannel_offset = -1; -static int hf_wimaxmacphy_burst_boosting = -1; -static int hf_wimaxmacphy_burst_reserved = -1; -static int hf_wimaxmacphy_burst_repetition_coding_indication = -1; -static int hf_wimaxmacphy_burst_issid = -1; -static int hf_wimaxmacphy_burst_aas_handle = -1; -static int hf_wimaxmacphy_dl_burst_map_number_of_slots = -1; -static int hf_wimaxmacphy_dl_burst_map_reserved = -1; -static int hf_wimaxmacphy_dl_burst_normal_number_of_symbols = -1; -static int hf_wimaxmacphy_dl_burst_normal_number_of_subchannels = -1; -static int hf_wimaxmacphy_dl_burst_normal_aas_handle = -1; -static int hf_wimaxmacphy_ul_burst_normal_number_of_slots = -1; -static int hf_wimaxmacphy_ul_burst_normal_reserved = -1; -static int hf_wimaxmacphy_burst_papr_number_of_symbols = -1; -static int hf_wimaxmacphy_burst_papr_number_of_subchannels = -1; -static int hf_wimaxmacphy_burst_papr_reserved = -1; -static int hf_wimaxmacphy_ul_burst_papr_unnamed = -1; -static int hf_wimaxmacphy_ul_burst_harq_ack_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_harq_ack_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_harq_ack_reserved = -1; -static int hf_wimaxmacphy_ul_burst_fast_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_fast_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_fast_reserved = -1; -static int hf_wimaxmacphy_ul_burst_initial_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_initial_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_initial_ranging_method = -1; -static int hf_wimaxmacphy_ul_burst_initial_reserved1 = -1; -static int hf_wimaxmacphy_ul_burst_initial_zone_xid = -1; -static int hf_wimaxmacphy_ul_burst_initial_reserved2 = -1; -static int hf_wimaxmacphy_ul_burst_periodic_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_periodic_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_periodic_ranging_method = -1; -static int hf_wimaxmacphy_ul_burst_periodic_reserved1 = -1; -static int hf_wimaxmacphy_ul_burst_periodic_zone_xid = -1; -static int hf_wimaxmacphy_ul_burst_periodic_reserved2 = -1; -static int hf_wimaxmacphy_ul_burst_sounding_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_sounding_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_sounding_type = -1; -static int hf_wimaxmacphy_ul_burst_sounding_separability_type = -1; -static int hf_wimaxmacphy_ul_burst_sounding_max_cyclic_shift_indx = -1; -static int hf_wimaxmacphy_ul_burst_sounding_decimation_value = -1; -static int hf_wimaxmacphy_ul_burst_sounding_decimation_offset_rand = -1; -static int hf_wimaxmacphy_ul_burst_sounding_reserved = -1; -static int hf_wimaxmacphy_ul_burst_noise_number_of_symbols = -1; -static int hf_wimaxmacphy_ul_burst_noise_number_of_subchannels = -1; -static int hf_wimaxmacphy_ul_burst_noise_reserved = -1; -static int hf_wimaxmacphy_burst_opt_aas_preamble_modifier_type = -1; -static int hf_wimaxmacphy_burst_opt_aas_preamble_shift_index = -1; -static int hf_wimaxmacphy_burst_opt_aas_reserved = -1; -static int hf_wimaxmacphy_burst_opt_mimo_matrix_indicator = -1; -static int hf_wimaxmacphy_burst_opt_mimo_layer_index = -1; -static int hf_wimaxmacphy_dl_burst_opt_mimo_reserved = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_matrix_indicator = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit0 = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit1 = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit2 = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit3 = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_collaborative = -1; -static int hf_wimaxmacphy_ul_burst_opt_mimo_antenna_unnamed = -1; -static int hf_wimaxmacphy_number_of_sub_burst_descriptors = -1; -static int hf_wimaxmacphy_sub_burst_padding = -1; -static int hf_wimaxmacphy_dl_sub_burst_type = -1; -static int hf_wimaxmacphy_ul_sub_burst_type = -1; -static int hf_wimaxmacphy_sub_burst_number = -1; -static int hf_wimaxmacphy_sub_burst_symbol_offset = -1; -static int hf_wimaxmacphy_sub_burst_subchannel_offset = -1; -static int hf_wimaxmacphy_sub_burst_number_of_slots = -1; -static int hf_wimaxmacphy_sub_burst_reserved1 = -1; -static int hf_wimaxmacphy_sub_burst_reserved2 = -1; -static int hf_wimaxmacphy_sub_burst_modulation_fec_code_type = -1; -static int hf_wimaxmacphy_sub_burst_issid = -1; -static int hf_wimaxmacphy_sub_burst_aas_handle = -1; -static int hf_wimaxmacphy_sub_burst_boosting = -1; -static int hf_wimaxmacphy_sub_burst_repetition_coding_indication = -1; -static int hf_wimaxmacphy_sub_burst_data_length = -1; -static int hf_wimaxmacphy_sub_burst_harq_chase_harq_channel_id = -1; -static int hf_wimaxmacphy_sub_burst_harq_chase_harq_sequence_number = -1; -static int hf_wimaxmacphy_sub_burst_harq_chase_flush_unnamed = -1; -static int hf_wimaxmacphy_sub_burst_harq_chase_reserved = -1; -static int hf_wimaxmacphy_sub_burst_mimo_chase_harq_channel_id = -1; -static int hf_wimaxmacphy_sub_burst_mimo_chase_harq_sequence_number = -1; -static int hf_wimaxmacphy_sub_burst_mimo_chase_flush_unnamed = -1; -static int hf_wimaxmacphy_sub_burst_mimo_chase_layer_index = -1; -static int hf_wimaxmacphy_ul_sub_burst_ctype = -1; -static int hf_wimaxmacphy_ul_sub_burst_mini_subchannel_index = -1; -static int hf_wimaxmacphy_ul_sub_burst_mini_reserved = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit0 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit1 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit2 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit3 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit4 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit5 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit6 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit7 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_reserved1 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_sub_type = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_cqich_id = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_reserved2 = -1; -static int hf_wimaxmacphy_ul_sub_burst_feedback_slot_offset = -1; -static int hf_wimaxmacphy_ul_sub_burst_harq_ack_acid = -1; -static int hf_wimaxmacphy_ul_sub_burst_harq_ack_reserved = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_symbol_index = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_power_assignment = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_power_boost = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_allocation_mode = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_start_freq_band = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_num_freq_bands = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_band_bit_map = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_cyclic_time_shift = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_decimation_offset = -1; -static int hf_wimaxmacphy_ul_sub_burst_sounding_reserved = -1; -static int hf_wimaxmacphy_ul_sub_burst_mimo_chase_matrix = -1; +static dissector_handle_t wimaxmacphy_handle; +static int proto_wimaxmacphy; +static int hf_wimaxmacphy_hdr_phy_entity_id; +static int hf_wimaxmacphy_hdr_message_segmentation; +static int hf_wimaxmacphy_hdr_message_type; +static int hf_wimaxmacphy_unknown; +static int hf_wimaxmacphy_prim_length_of_txvector; +static int hf_wimaxmacphy_prim_length_of_rxvector; +static int hf_wimaxmacphy_prim_status; +static int hf_wimaxmacphy_prim_txstart_indication_status; +static int hf_wimaxmacphy_prim_reserved1; +static int hf_wimaxmacphy_prim_reserved2; +static int hf_wimaxmacphy_prim_reserved3; +static int hf_wimaxmacphy_prim_reserved4; +static int hf_wimaxmacphy_prim_reserved5; +static int hf_wimaxmacphy_prim_next_frame_number; +static int hf_wimaxmacphy_prim_extended_frame_number; +static int hf_wimaxmacphy_prim_current_frame_number_lsn; +static int hf_wimaxmacphy_prim_initial_frame_number; +static int hf_wimaxmacphy_prim_dl_zone_number; +static int hf_wimaxmacphy_prim_sub_burst_burst_split_point; +static int hf_wimaxmacphy_prim_dl_sub_burst_burst_number; +static int hf_wimaxmacphy_prim_phy_sdu; +static int hf_wimaxmacphy_prim_phy_request; +static int hf_wimaxmacphy_prim_requested_aas_calibration_zone_size; +static int hf_wimaxmacphy_prim_requested_aas_calibration_zone_alloc; +static int hf_wimaxmacphy_prim_number_of_consecutive_frames_with_aas; +static int hf_wimaxmacphy_prim_frame_number; +static int hf_wimaxmacphy_prim_issid; +static int hf_wimaxmacphy_prim_integrity; +static int hf_wimaxmacphy_prim_number_of_bytes_received; +static int hf_wimaxmacphy_prim_rssi_per_subcarrier_level; +static int hf_wimaxmacphy_prim_cinr; +static int hf_wimaxmacphy_prim_power_offset; +static int hf_wimaxmacphy_prim_current_frame_number_msn; +static int hf_wimaxmacphy_prim_acid_for_harq_data_bursts; +static int hf_wimaxmacphy_prim_indication_type; +static int hf_wimaxmacphy_prim_zone_permutation_type; +static int hf_wimaxmacphy_prim_update_aas_handle_in_mac; +static int hf_wimaxmacphy_prim_aas_handle; +static int hf_wimaxmacphy_prim_time_deviation; +static int hf_wimaxmacphy_prim_frequency_deviation; +static int hf_wimaxmacphy_prim_phy_aas_report_present; +static int hf_wimaxmacphy_prim_number_of_affected_ss; +static int hf_wimaxmacphy_prim_zonexid; +static int hf_wimaxmacphy_prim_cdma_code; +static int hf_wimaxmacphy_prim_cdma_symbol; +static int hf_wimaxmacphy_prim_cdma_subchannel; +static int hf_wimaxmacphy_prim_harq_ack_issid; +static int hf_wimaxmacphy_prim_harq_ack_acid; +static int hf_wimaxmacphy_prim_harq_ack_reserved1; +static int hf_wimaxmacphy_prim_harq_ack_ack_valid; +static int hf_wimaxmacphy_prim_harq_ack_unnamed; +static int hf_wimaxmacphy_prim_harq_ack_reserved2; +static int hf_wimaxmacphy_prim_fast_issid; +static int hf_wimaxmacphy_prim_fast_cqich_id; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit0; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit1; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit2; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit3; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit4; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit5; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit6; +static int hf_wimaxmacphy_prim_fast_feedback_type_coding_bit7; +static int hf_wimaxmacphy_prim_fast_feedback_valid; +static int hf_wimaxmacphy_prim_fast_feedback_sub_type; +static int hf_wimaxmacphy_prim_fast_reserved; +static int hf_wimaxmacphy_prim_fast_feedback_value; +static int hf_wimaxmacphy_subframe_subframe_type; +static int hf_wimaxmacphy_subframe_frame_number; +static int hf_wimaxmacphy_subframe_downlink_reserved1; +static int hf_wimaxmacphy_subframe_phy_sap_version_number; +static int hf_wimaxmacphy_subframe_downlink_reserved2; +static int hf_wimaxmacphy_subframe_allocation_start_time; +static int hf_wimaxmacphy_number_of_zone_descriptors; +static int hf_wimaxmacphy_zone_padding; +static int hf_wimaxmacphy_dl_zone_type; +static int hf_wimaxmacphy_ul_zone_type; +static int hf_wimaxmacphy_zone_number; +static int hf_wimaxmacphy_zone_start_symbol_offset; +static int hf_wimaxmacphy_zone_end_symbol_offset; +static int hf_wimaxmacphy_dl_zone_permutation_type; +static int hf_wimaxmacphy_ul_zone_permutation_type; +static int hf_wimaxmacphy_dl_zone_use_all_subchannels_indicator; +static int hf_wimaxmacphy_ul_zone_use_all_subchannels_indicator; +static int hf_wimaxmacphy_ul_zone_disable_pusc_subchannel_rotation; +static int hf_wimaxmacphy_zone_dl_perm_base; +static int hf_wimaxmacphy_zone_ul_perm_base; +static int hf_wimaxmacphy_zone_prbs_id; +static int hf_wimaxmacphy_zone_agc_range_extension; +static int hf_wimaxmacphy_zone_dedicated_pilots; +static int hf_wimaxmacphy_zone_reserved; +static int hf_wimaxmacphy_zone_stc_type; +static int hf_wimaxmacphy_zone_matrix_indicator; +static int hf_wimaxmacphy_zone_midamble_presence; +static int hf_wimaxmacphy_zone_midamble_boosting; +static int hf_wimaxmacphy_zone_preamble_configuration; +static int hf_wimaxmacphy_zone_sdma_supported_indication; +static int hf_wimaxmacphy_zone_preamble_type; +static int hf_wimaxmacphy_dl_zone_aas_reserved; +static int hf_wimaxmacphy_ul_zone_aas_reserved; +static int hf_wimaxmacphy_number_of_burst_descriptors; +static int hf_wimaxmacphy_burst_padding; +static int hf_wimaxmacphy_dl_burst_type; +static int hf_wimaxmacphy_ul_burst_type; +static int hf_wimaxmacphy_burst_type_extension; +static int hf_wimaxmacphy_burst_number; +static int hf_wimaxmacphy_burst_modulation_fec_code_type; +static int hf_wimaxmacphy_burst_data_length; +static int hf_wimaxmacphy_burst_ofdma_symbol_offset; +static int hf_wimaxmacphy_burst_subchannel_offset; +static int hf_wimaxmacphy_burst_boosting; +static int hf_wimaxmacphy_burst_reserved; +static int hf_wimaxmacphy_burst_repetition_coding_indication; +static int hf_wimaxmacphy_burst_issid; +static int hf_wimaxmacphy_burst_aas_handle; +static int hf_wimaxmacphy_dl_burst_map_number_of_slots; +static int hf_wimaxmacphy_dl_burst_map_reserved; +static int hf_wimaxmacphy_dl_burst_normal_number_of_symbols; +static int hf_wimaxmacphy_dl_burst_normal_number_of_subchannels; +static int hf_wimaxmacphy_dl_burst_normal_aas_handle; +static int hf_wimaxmacphy_ul_burst_normal_number_of_slots; +static int hf_wimaxmacphy_ul_burst_normal_reserved; +static int hf_wimaxmacphy_burst_papr_number_of_symbols; +static int hf_wimaxmacphy_burst_papr_number_of_subchannels; +static int hf_wimaxmacphy_burst_papr_reserved; +static int hf_wimaxmacphy_ul_burst_papr_unnamed; +static int hf_wimaxmacphy_ul_burst_harq_ack_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_harq_ack_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_harq_ack_reserved; +static int hf_wimaxmacphy_ul_burst_fast_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_fast_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_fast_reserved; +static int hf_wimaxmacphy_ul_burst_initial_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_initial_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_initial_ranging_method; +static int hf_wimaxmacphy_ul_burst_initial_reserved1; +static int hf_wimaxmacphy_ul_burst_initial_zone_xid; +static int hf_wimaxmacphy_ul_burst_initial_reserved2; +static int hf_wimaxmacphy_ul_burst_periodic_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_periodic_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_periodic_ranging_method; +static int hf_wimaxmacphy_ul_burst_periodic_reserved1; +static int hf_wimaxmacphy_ul_burst_periodic_zone_xid; +static int hf_wimaxmacphy_ul_burst_periodic_reserved2; +static int hf_wimaxmacphy_ul_burst_sounding_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_sounding_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_sounding_type; +static int hf_wimaxmacphy_ul_burst_sounding_separability_type; +static int hf_wimaxmacphy_ul_burst_sounding_max_cyclic_shift_indx; +static int hf_wimaxmacphy_ul_burst_sounding_decimation_value; +static int hf_wimaxmacphy_ul_burst_sounding_decimation_offset_rand; +static int hf_wimaxmacphy_ul_burst_sounding_reserved; +static int hf_wimaxmacphy_ul_burst_noise_number_of_symbols; +static int hf_wimaxmacphy_ul_burst_noise_number_of_subchannels; +static int hf_wimaxmacphy_ul_burst_noise_reserved; +static int hf_wimaxmacphy_burst_opt_aas_preamble_modifier_type; +static int hf_wimaxmacphy_burst_opt_aas_preamble_shift_index; +static int hf_wimaxmacphy_burst_opt_aas_reserved; +static int hf_wimaxmacphy_burst_opt_mimo_matrix_indicator; +static int hf_wimaxmacphy_burst_opt_mimo_layer_index; +static int hf_wimaxmacphy_dl_burst_opt_mimo_reserved; +static int hf_wimaxmacphy_ul_burst_opt_mimo_matrix_indicator; +static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns; +static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit0; +static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit1; +static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit2; +static int hf_wimaxmacphy_ul_burst_opt_mimo_pilot_patterns_bit3; +static int hf_wimaxmacphy_ul_burst_opt_mimo_collaborative; +static int hf_wimaxmacphy_ul_burst_opt_mimo_antenna_unnamed; +static int hf_wimaxmacphy_number_of_sub_burst_descriptors; +static int hf_wimaxmacphy_sub_burst_padding; +static int hf_wimaxmacphy_dl_sub_burst_type; +static int hf_wimaxmacphy_ul_sub_burst_type; +static int hf_wimaxmacphy_sub_burst_number; +static int hf_wimaxmacphy_sub_burst_symbol_offset; +static int hf_wimaxmacphy_sub_burst_subchannel_offset; +static int hf_wimaxmacphy_sub_burst_number_of_slots; +static int hf_wimaxmacphy_sub_burst_reserved1; +static int hf_wimaxmacphy_sub_burst_reserved2; +static int hf_wimaxmacphy_sub_burst_modulation_fec_code_type; +static int hf_wimaxmacphy_sub_burst_issid; +static int hf_wimaxmacphy_sub_burst_aas_handle; +static int hf_wimaxmacphy_sub_burst_boosting; +static int hf_wimaxmacphy_sub_burst_repetition_coding_indication; +static int hf_wimaxmacphy_sub_burst_data_length; +static int hf_wimaxmacphy_sub_burst_harq_chase_harq_channel_id; +static int hf_wimaxmacphy_sub_burst_harq_chase_harq_sequence_number; +static int hf_wimaxmacphy_sub_burst_harq_chase_flush_unnamed; +static int hf_wimaxmacphy_sub_burst_harq_chase_reserved; +static int hf_wimaxmacphy_sub_burst_mimo_chase_harq_channel_id; +static int hf_wimaxmacphy_sub_burst_mimo_chase_harq_sequence_number; +static int hf_wimaxmacphy_sub_burst_mimo_chase_flush_unnamed; +static int hf_wimaxmacphy_sub_burst_mimo_chase_layer_index; +static int hf_wimaxmacphy_ul_sub_burst_ctype; +static int hf_wimaxmacphy_ul_sub_burst_mini_subchannel_index; +static int hf_wimaxmacphy_ul_sub_burst_mini_reserved; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit0; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit1; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit2; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit3; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit4; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit5; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit6; +static int hf_wimaxmacphy_ul_sub_burst_feedback_type_coding_bit7; +static int hf_wimaxmacphy_ul_sub_burst_feedback_reserved1; +static int hf_wimaxmacphy_ul_sub_burst_feedback_sub_type; +static int hf_wimaxmacphy_ul_sub_burst_feedback_cqich_id; +static int hf_wimaxmacphy_ul_sub_burst_feedback_reserved2; +static int hf_wimaxmacphy_ul_sub_burst_feedback_slot_offset; +static int hf_wimaxmacphy_ul_sub_burst_harq_ack_acid; +static int hf_wimaxmacphy_ul_sub_burst_harq_ack_reserved; +static int hf_wimaxmacphy_ul_sub_burst_sounding_symbol_index; +static int hf_wimaxmacphy_ul_sub_burst_sounding_power_assignment; +static int hf_wimaxmacphy_ul_sub_burst_sounding_power_boost; +static int hf_wimaxmacphy_ul_sub_burst_sounding_allocation_mode; +static int hf_wimaxmacphy_ul_sub_burst_sounding_start_freq_band; +static int hf_wimaxmacphy_ul_sub_burst_sounding_num_freq_bands; +static int hf_wimaxmacphy_ul_sub_burst_sounding_band_bit_map; +static int hf_wimaxmacphy_ul_sub_burst_sounding_cyclic_time_shift; +static int hf_wimaxmacphy_ul_sub_burst_sounding_decimation_offset; +static int hf_wimaxmacphy_ul_sub_burst_sounding_reserved; +static int hf_wimaxmacphy_ul_sub_burst_mimo_chase_matrix; /* Initialize the subtree pointers */ -static gint ett_wimaxmacphy = -1; -static gint ett_wimaxmacphy_primitive = -1; -static gint ett_wimaxmacphy_prim_harq_ack = -1; -static gint ett_wimaxmacphy_prim_fast_feedback = -1; -static gint ett_wimaxmacphy_prim_fast_feedback_type_coding = -1; -static gint ett_wimaxmacphy_dl_zone_descriptor = -1; -static gint ett_wimaxmacphy_dl_zone_stc = -1; -static gint ett_wimaxmacphy_dl_zone_aas = -1; -static gint ett_wimaxmacphy_dl_burst_descriptor = -1; -static gint ett_wimaxmacphy_dl_burst_map = -1; -static gint ett_wimaxmacphy_dl_burst_normal = -1; -static gint ett_wimaxmacphy_dl_burst_papr = -1; -static gint ett_wimaxmacphy_dl_sub_burst_descriptor = -1; -static gint ett_wimaxmacphy_dl_sub_burst_harq_chase = -1; -static gint ett_wimaxmacphy_dl_sub_burst_mimo_chase = -1; -static gint ett_wimaxmacphy_dl_burst_opt_aas = -1; -static gint ett_wimaxmacphy_dl_burst_opt_mimo = -1; -static gint ett_wimaxmacphy_ul_zone_descriptor = -1; -static gint ett_wimaxmacphy_ul_zone_aas = -1; -static gint ett_wimaxmacphy_ul_burst_descriptor = -1; -static gint ett_wimaxmacphy_ul_burst_harq_ack = -1; -static gint ett_wimaxmacphy_ul_burst_fast_feedback = -1; -static gint ett_wimaxmacphy_ul_burst_initial_ranging = -1; -static gint ett_wimaxmacphy_ul_burst_periodic_ranging = -1; -static gint ett_wimaxmacphy_ul_burst_papr_safety_zone = -1; -static gint ett_wimaxmacphy_ul_burst_sounding_zone = -1; -static gint ett_wimaxmacphy_ul_burst_noise_floor = -1; -static gint ett_wimaxmacphy_ul_burst_normal_data = -1; -static gint ett_wimaxmacphy_ul_burst_opt_aas = -1; -static gint ett_wimaxmacphy_ul_burst_opt_mimo = -1; -static gint ett_wimaxmacphy_ul_sub_burst_descriptor = -1; -static gint ett_wimaxmacphy_ul_pilot_patterns = -1; -static gint ett_wimaxmacphy_ul_feedback_type_coding = -1; -static gint ett_wimaxmacphy_ul_sub_burst_mini_subchannel = -1; -static gint ett_wimaxmacphy_ul_sub_burst_fast_feedback = -1; -static gint ett_wimaxmacphy_ul_sub_burst_harq_ack = -1; -static gint ett_wimaxmacphy_ul_sub_burst_sounding_signal = -1; -static gint ett_wimaxmacphy_ul_sub_burst_harq_chase = -1; -static gint ett_wimaxmacphy_ul_sub_burst_mimo_chase = -1; -static gint ett_wimaxmacphy_ul_sub_burst_sub_allocation_specific = -1; - -static expert_field ei_wimaxmacphy_unknown = EI_INIT; +static gint ett_wimaxmacphy; +static gint ett_wimaxmacphy_primitive; +static gint ett_wimaxmacphy_prim_harq_ack; +static gint ett_wimaxmacphy_prim_fast_feedback; +static gint ett_wimaxmacphy_prim_fast_feedback_type_coding; +static gint ett_wimaxmacphy_dl_zone_descriptor; +static gint ett_wimaxmacphy_dl_zone_stc; +static gint ett_wimaxmacphy_dl_zone_aas; +static gint ett_wimaxmacphy_dl_burst_descriptor; +static gint ett_wimaxmacphy_dl_burst_map; +static gint ett_wimaxmacphy_dl_burst_normal; +static gint ett_wimaxmacphy_dl_burst_papr; +static gint ett_wimaxmacphy_dl_sub_burst_descriptor; +static gint ett_wimaxmacphy_dl_sub_burst_harq_chase; +static gint ett_wimaxmacphy_dl_sub_burst_mimo_chase; +static gint ett_wimaxmacphy_dl_burst_opt_aas; +static gint ett_wimaxmacphy_dl_burst_opt_mimo; +static gint ett_wimaxmacphy_ul_zone_descriptor; +static gint ett_wimaxmacphy_ul_zone_aas; +static gint ett_wimaxmacphy_ul_burst_descriptor; +static gint ett_wimaxmacphy_ul_burst_harq_ack; +static gint ett_wimaxmacphy_ul_burst_fast_feedback; +static gint ett_wimaxmacphy_ul_burst_initial_ranging; +static gint ett_wimaxmacphy_ul_burst_periodic_ranging; +static gint ett_wimaxmacphy_ul_burst_papr_safety_zone; +static gint ett_wimaxmacphy_ul_burst_sounding_zone; +static gint ett_wimaxmacphy_ul_burst_noise_floor; +static gint ett_wimaxmacphy_ul_burst_normal_data; +static gint ett_wimaxmacphy_ul_burst_opt_aas; +static gint ett_wimaxmacphy_ul_burst_opt_mimo; +static gint ett_wimaxmacphy_ul_sub_burst_descriptor; +static gint ett_wimaxmacphy_ul_pilot_patterns; +static gint ett_wimaxmacphy_ul_feedback_type_coding; +static gint ett_wimaxmacphy_ul_sub_burst_mini_subchannel; +static gint ett_wimaxmacphy_ul_sub_burst_fast_feedback; +static gint ett_wimaxmacphy_ul_sub_burst_harq_ack; +static gint ett_wimaxmacphy_ul_sub_burst_sounding_signal; +static gint ett_wimaxmacphy_ul_sub_burst_harq_chase; +static gint ett_wimaxmacphy_ul_sub_burst_mimo_chase; +static gint ett_wimaxmacphy_ul_sub_burst_sub_allocation_specific; + +static expert_field ei_wimaxmacphy_unknown; /* PHY SAP message header size */ #define WIMAXMACPHY_HEADER_SIZE 2 @@ -2659,7 +2660,7 @@ proto_register_wimaxmacphy(void) { "Initial Frame Number (from PHY)", "wimaxmacphy.prim_initial_frame_number", - FT_UINT8, + FT_UINT24, BASE_DEC, NULL, 0x0, @@ -2761,8 +2762,7 @@ proto_register_wimaxmacphy(void) { &hf_wimaxmacphy_prim_number_of_consecutive_frames_with_aas, { - "Number of consecutive frames with AAS Calibration Zone" - " allocation", + "Number of consecutive frames with AAS Calibration Zone allocation", "wimaxmacphy.prim_number_of_consecutive_frames_with_aas", FT_UINT8, BASE_DEC, @@ -2868,10 +2868,10 @@ proto_register_wimaxmacphy(void) { "Current Frame Number (lsb)", "wimaxmacphy.prim_current_frame_number", - FT_UINT8, + FT_UINT16, BASE_DEC, NULL, - 0xf0, + 0x00f0, NULL, HFILL } @@ -2881,10 +2881,10 @@ proto_register_wimaxmacphy(void) { "ACID for HARQ data bursts", "wimaxmacphy.prim_acid_for_harq_data_bursts", - FT_UINT8, + FT_UINT16, BASE_DEC, NULL, - 0x0f, + 0x000f, NULL, HFILL } @@ -3206,10 +3206,9 @@ proto_register_wimaxmacphy(void) { "Feedback sub-type", "wimaxmacphy.prim_fast_feedback_sub_type", - FT_UINT8, + FT_UINT16, BASE_DEC, - VALS( - wimaxmacphy_prim_fast_feedback_sub_type_vals), + VALS(wimaxmacphy_prim_fast_feedback_sub_type_vals), 0x7000, NULL, HFILL @@ -3402,7 +3401,7 @@ proto_register_wimaxmacphy(void) { "Number of Zone Descriptors", "wimaxmacphy.number_of_zone_descriptors", - FT_UINT8, + FT_UINT24, BASE_DEC, NULL, 0x0, @@ -3547,8 +3546,7 @@ proto_register_wimaxmacphy(void) "wimaxmacphy.zone_disable_pusc_subchannel_rotation", FT_UINT8, BASE_DEC, - VALS( - wimaxmacphy_ul_zone_disable_pusc_subchannel_rotation_vals), + VALS(wimaxmacphy_ul_zone_disable_pusc_subchannel_rotation_vals), 0x0f, NULL, HFILL @@ -3951,8 +3949,7 @@ proto_register_wimaxmacphy(void) { &hf_wimaxmacphy_dl_burst_map_number_of_slots, { - "Number of slots (duration) after repetition code is" - " applied", + "Number of slots (duration) after repetition code is applied", "wimaxmacphy.burst_map_number_of_slots", FT_UINT16, BASE_DEC, @@ -4424,8 +4421,7 @@ proto_register_wimaxmacphy(void) "wimaxmacphy.burst_sounding_max_cyclic_shift_indx", FT_UINT8, BASE_DEC, - VALS( - wimaxmacphy_ul_burst_sounding_max_cyclic_shift_indx_vals), + VALS(wimaxmacphy_ul_burst_sounding_max_cyclic_shift_indx_vals), 0x0, NULL, HFILL @@ -4451,8 +4447,7 @@ proto_register_wimaxmacphy(void) "wimaxmacphy.burst_sounding_decimation_offset_rand", FT_UINT8, BASE_DEC, - VALS( - wimaxmacphy_ul_burst_sounding_decimation_offset_rand_vals), + VALS(wimaxmacphy_ul_burst_sounding_decimation_offset_rand_vals), 0x0, NULL, HFILL @@ -4864,7 +4859,7 @@ proto_register_wimaxmacphy(void) { &hf_wimaxmacphy_sub_burst_harq_chase_harq_channel_id, { - "HARQ channeld id (ACID)", + "HARQ channel id (ACID)", "wimaxmacphy.sub_burst_harq_chase_harq_channel_id", FT_UINT8, BASE_DEC, @@ -5191,10 +5186,10 @@ proto_register_wimaxmacphy(void) { "ACID", "wimaxmacphy.sub_burst_harq_ack_acid", - FT_UINT8, + FT_UINT32, BASE_DEC, NULL, - 0xf0, + 0x000000f0, NULL, HFILL } @@ -5207,7 +5202,7 @@ proto_register_wimaxmacphy(void) FT_UINT32, BASE_HEX, NULL, - 0x0fff, + 0x00000fff, NULL, HFILL } @@ -5232,8 +5227,7 @@ proto_register_wimaxmacphy(void) "wimaxmacphy.sub_burst_sounding_power_assignment_method", FT_UINT8, BASE_HEX, - VALS( - wimaxmacphy_ul_sub_burst_sounding_power_assignment_vals), + VALS(wimaxmacphy_ul_sub_burst_sounding_power_assignment_vals), 0x0, NULL, HFILL @@ -5259,8 +5253,7 @@ proto_register_wimaxmacphy(void) "wimaxmacphy.sub_burst_sounding_allocation_mode", FT_UINT8, BASE_DEC, - VALS( - wimaxmacphy_ul_sub_burst_sounding_allocation_mode_vals), + VALS(wimaxmacphy_ul_sub_burst_sounding_allocation_mode_vals), 0x0, NULL, HFILL @@ -5410,10 +5403,8 @@ proto_register_wimaxmacphy(void) expert_module_t* expert_wimaxmacphy; /* Register the protocol name and description */ - proto_wimaxmacphy = proto_register_protocol( - "WiMAX MAC-PHY over Ethernet", - "WiMAX MAC-PHY", - "wimaxmacphy"); + proto_wimaxmacphy = proto_register_protocol("WiMAX MAC-PHY over Ethernet", "WiMAX MAC-PHY", "wimaxmacphy"); + wimaxmacphy_handle = register_dissector("wimaxmacphy", dissect_wimaxmacphy, proto_wimaxmacphy); /* Required function calls to register the header fields and subtrees * used */ @@ -5426,9 +5417,6 @@ proto_register_wimaxmacphy(void) void proto_reg_handoff_wimaxmacphy(void) { - dissector_handle_t wimaxmacphy_handle; - - wimaxmacphy_handle = create_dissector_handle(dissect_wimaxmacphy, proto_wimaxmacphy); dissector_add_for_decode_as_with_preference("udp.port", wimaxmacphy_handle); } |