diff options
Diffstat (limited to 'epan/dissectors/packet-erf.c')
-rw-r--r-- | epan/dissectors/packet-erf.c | 1169 |
1 files changed, 619 insertions, 550 deletions
diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index a1834a9142..329ee95314 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -16,12 +16,14 @@ #include <epan/ipproto.h> #include <epan/to_str.h> #include <wsutil/str_util.h> +#include <wiretap/wtap.h> +#include <wiretap/erf_record.h> + #include "packet-erf.h" #include "packet-ptp.h" /* */ -#include "wiretap/erf_record.h" void proto_register_erf(void); void proto_reg_handoff_erf(void); @@ -45,223 +47,235 @@ static dissector_handle_t erf_handle; static dissector_table_t erf_dissector_table; /* Initialize the protocol and registered fields */ -static int proto_erf = -1; - -static int hf_erf_ts = -1; -static int hf_erf_rectype = -1; -static int hf_erf_type = -1; -static int hf_erf_ehdr = -1; -static int hf_erf_ehdr_t = -1; -static int hf_erf_flags = -1; -static int hf_erf_flags_cap = -1; -static int hf_erf_flags_vlen = -1; -static int hf_erf_flags_trunc = -1; -static int hf_erf_flags_rxe = -1; -static int hf_erf_flags_dse = -1; -static int hf_erf_flags_res = -1; - -static int hf_erf_rlen = -1; -static int hf_erf_lctr = -1; -static int hf_erf_color = -1; -static int hf_erf_wlen = -1; +static int proto_erf; + +static int hf_erf_ts; +static int hf_erf_rectype; +static int hf_erf_type; +static int hf_erf_ehdr; +static int hf_erf_ehdr_t; +static int hf_erf_flags; +static int hf_erf_flags_cap; +static int hf_erf_flags_if_raw; +static int hf_erf_flags_vlen; +static int hf_erf_flags_trunc; +static int hf_erf_flags_rxe; +static int hf_erf_flags_dse; +static int hf_erf_flags_res; + +static int hf_erf_rlen; +static int hf_erf_lctr; +static int hf_erf_color; +static int hf_erf_wlen; /* Classification extension header */ /* InterceptID extension header */ -static int hf_erf_ehdr_int_res1 = -1; -static int hf_erf_ehdr_int_id = -1; -static int hf_erf_ehdr_int_res2 = -1; +static int hf_erf_ehdr_int_res1; +static int hf_erf_ehdr_int_id; +static int hf_erf_ehdr_int_res2; /* Raw Link extension header */ -static int hf_erf_ehdr_raw_link_res = -1; -static int hf_erf_ehdr_raw_link_seqnum = -1; -static int hf_erf_ehdr_raw_link_rate = -1; -static int hf_erf_ehdr_raw_link_type = -1; +static int hf_erf_ehdr_raw_link_res; +static int hf_erf_ehdr_raw_link_seqnum; +static int hf_erf_ehdr_raw_link_rate; +static int hf_erf_ehdr_raw_link_type; /* Classification extension header */ -static int hf_erf_ehdr_class_flags = -1; -static int hf_erf_ehdr_class_flags_sh = -1; -static int hf_erf_ehdr_class_flags_shm = -1; -static int hf_erf_ehdr_class_flags_res1 = -1; -static int hf_erf_ehdr_class_flags_user = -1; -static int hf_erf_ehdr_class_flags_res2 = -1; -static int hf_erf_ehdr_class_flags_drop = -1; -static int hf_erf_ehdr_class_flags_str = -1; -static int hf_erf_ehdr_class_seqnum = -1; +static int hf_erf_ehdr_class_flags; +static int hf_erf_ehdr_class_flags_sh; +static int hf_erf_ehdr_class_flags_shm; +static int hf_erf_ehdr_class_flags_res1; +static int hf_erf_ehdr_class_flags_user; +static int hf_erf_ehdr_class_flags_res2; +static int hf_erf_ehdr_class_flags_drop; +static int hf_erf_ehdr_class_flags_str; +static int hf_erf_ehdr_class_seqnum; /* BFS extension header */ -static int hf_erf_ehdr_bfs_hash = -1; -static int hf_erf_ehdr_bfs_color = -1; -static int hf_erf_ehdr_bfs_raw_hash = -1; +static int hf_erf_ehdr_bfs_hash; +static int hf_erf_ehdr_bfs_color; +static int hf_erf_ehdr_bfs_raw_hash; /* Channelised extension header */ -static int hf_erf_ehdr_chan_morebits = -1; -static int hf_erf_ehdr_chan_morefrag = -1; -static int hf_erf_ehdr_chan_seqnum = -1; -static int hf_erf_ehdr_chan_res = -1; -static int hf_erf_ehdr_chan_virt_container_id = -1; -static int hf_erf_ehdr_chan_assoc_virt_container_size = -1; -static int hf_erf_ehdr_chan_rate = -1; -static int hf_erf_ehdr_chan_type = -1; +static int hf_erf_ehdr_chan_morebits; +static int hf_erf_ehdr_chan_morefrag; +static int hf_erf_ehdr_chan_seqnum; +static int hf_erf_ehdr_chan_res; +static int hf_erf_ehdr_chan_virt_container_id; +static int hf_erf_ehdr_chan_assoc_virt_container_size; +static int hf_erf_ehdr_chan_rate; +static int hf_erf_ehdr_chan_type; /* Filter Hash extension header */ -static int hf_erf_ehdr_signature_payload_hash = -1; -static int hf_erf_ehdr_signature_color = -1; -static int hf_erf_ehdr_signature_flow_hash = -1; +static int hf_erf_ehdr_signature_payload_hash; +static int hf_erf_ehdr_signature_color; +static int hf_erf_ehdr_signature_flow_hash; /* Flow ID extension header */ -static int hf_erf_ehdr_flow_id_source_id = -1; -static int hf_erf_ehdr_flow_id_hash_type = -1; -static int hf_erf_ehdr_flow_id_stack_type = -1; -static int hf_erf_ehdr_flow_id_flow_hash = -1; +static int hf_erf_ehdr_flow_id_source_id; +static int hf_erf_ehdr_flow_id_hash_type; +static int hf_erf_ehdr_flow_id_hash_type_type; +static int hf_erf_ehdr_flow_id_hash_type_inner; +static int hf_erf_ehdr_flow_id_stack_type; +static int hf_erf_ehdr_flow_id_flow_hash; /* Host ID extension header */ -static int hf_erf_ehdr_host_id_sourceid = -1; -static int hf_erf_ehdr_host_id_hostid = -1; +static int hf_erf_ehdr_host_id_sourceid; +static int hf_erf_ehdr_host_id_hostid; /* Anchor ID extension header */ -static int hf_erf_ehdr_anchor_id_definition = -1; -static int hf_erf_ehdr_anchor_id_reserved = -1; -static int hf_erf_ehdr_anchor_id_anchorid = -1; -static int hf_erf_ehdr_anchor_id_flags = -1; +static int hf_erf_ehdr_anchor_id_definition; +static int hf_erf_ehdr_anchor_id_reserved; +static int hf_erf_ehdr_anchor_id_anchorid; +static int hf_erf_ehdr_anchor_id_flags; -static int hf_erf_anchor_linked = -1; -static int hf_erf_anchor_anchorid = -1; -static int hf_erf_anchor_hostid = -1; +static int hf_erf_anchor_linked; +static int hf_erf_anchor_anchorid; +static int hf_erf_anchor_hostid; /* Generated Host ID/Source ID */ -static int hf_erf_sourceid = -1; -static int hf_erf_hostid = -1; -static int hf_erf_source_current = -1; -static int hf_erf_source_next = -1; -static int hf_erf_source_prev = -1; +static int hf_erf_sourceid; +static int hf_erf_hostid; +static int hf_erf_source_current; +static int hf_erf_source_next; +static int hf_erf_source_prev; /* Entropy extension header */ -static int hf_erf_ehdr_entropy_entropy = -1; -static int hf_erf_ehdr_entropy_entropy_raw = -1; -static int hf_erf_ehdr_entropy_reserved = -1; +static int hf_erf_ehdr_entropy_entropy; +static int hf_erf_ehdr_entropy_entropy_raw; +static int hf_erf_ehdr_entropy_reserved; /* Unknown extension header */ -static int hf_erf_ehdr_unk = -1; +static int hf_erf_ehdr_unk; /* MC HDLC Header */ -static int hf_erf_mc_hdlc = -1; -static int hf_erf_mc_hdlc_cn = -1; -static int hf_erf_mc_hdlc_res1 = -1; -static int hf_erf_mc_hdlc_res2 = -1; -static int hf_erf_mc_hdlc_fcse = -1; -static int hf_erf_mc_hdlc_sre = -1; -static int hf_erf_mc_hdlc_lre = -1; -static int hf_erf_mc_hdlc_afe = -1; -static int hf_erf_mc_hdlc_oe = -1; -static int hf_erf_mc_hdlc_lbe = -1; -static int hf_erf_mc_hdlc_first = -1; -static int hf_erf_mc_hdlc_res3 = -1; +static int hf_erf_mc_hdlc; +static int hf_erf_mc_hdlc_cn; +static int hf_erf_mc_hdlc_res1; +static int hf_erf_mc_hdlc_res2; +static int hf_erf_mc_hdlc_fcse; +static int hf_erf_mc_hdlc_sre; +static int hf_erf_mc_hdlc_lre; +static int hf_erf_mc_hdlc_afe; +static int hf_erf_mc_hdlc_oe; +static int hf_erf_mc_hdlc_lbe; +static int hf_erf_mc_hdlc_first; +static int hf_erf_mc_hdlc_res3; /* MC RAW Header */ -static int hf_erf_mc_raw = -1; -static int hf_erf_mc_raw_int = -1; -static int hf_erf_mc_raw_res1 = -1; -static int hf_erf_mc_raw_sre = -1; -static int hf_erf_mc_raw_lre = -1; -static int hf_erf_mc_raw_res2 = -1; -static int hf_erf_mc_raw_lbe = -1; -static int hf_erf_mc_raw_first = -1; -static int hf_erf_mc_raw_res3 = -1; +static int hf_erf_mc_raw; +static int hf_erf_mc_raw_int; +static int hf_erf_mc_raw_res1; +static int hf_erf_mc_raw_sre; +static int hf_erf_mc_raw_lre; +static int hf_erf_mc_raw_res2; +static int hf_erf_mc_raw_lbe; +static int hf_erf_mc_raw_first; +static int hf_erf_mc_raw_res3; /* MC ATM Header */ -static int hf_erf_mc_atm = -1; -static int hf_erf_mc_atm_cn = -1; -static int hf_erf_mc_atm_res1 = -1; -static int hf_erf_mc_atm_mul = -1; -static int hf_erf_mc_atm_port = -1; -static int hf_erf_mc_atm_res2 = -1; -static int hf_erf_mc_atm_lbe = -1; -static int hf_erf_mc_atm_hec = -1; -static int hf_erf_mc_atm_crc10 = -1; -static int hf_erf_mc_atm_oamcell = -1; -static int hf_erf_mc_atm_first = -1; -static int hf_erf_mc_atm_res3 = -1; +static int hf_erf_mc_atm; +static int hf_erf_mc_atm_cn; +static int hf_erf_mc_atm_res1; +static int hf_erf_mc_atm_mul; +static int hf_erf_mc_atm_port; +static int hf_erf_mc_atm_res2; +static int hf_erf_mc_atm_lbe; +static int hf_erf_mc_atm_hec; +static int hf_erf_mc_atm_crc10; +static int hf_erf_mc_atm_oamcell; +static int hf_erf_mc_atm_first; +static int hf_erf_mc_atm_res3; /* MC Raw link Header */ -static int hf_erf_mc_rawl = -1; -static int hf_erf_mc_rawl_cn = -1; -static int hf_erf_mc_rawl_res1 = -1; -static int hf_erf_mc_rawl_lbe = -1; -static int hf_erf_mc_rawl_first = -1; -static int hf_erf_mc_rawl_res2 = -1; +static int hf_erf_mc_rawl; +static int hf_erf_mc_rawl_cn; +static int hf_erf_mc_rawl_res1; +static int hf_erf_mc_rawl_lbe; +static int hf_erf_mc_rawl_first; +static int hf_erf_mc_rawl_res2; /* MC AAL5 Header */ -static int hf_erf_mc_aal5 = -1; -static int hf_erf_mc_aal5_cn = -1; -static int hf_erf_mc_aal5_res1 = -1; -static int hf_erf_mc_aal5_port = -1; -static int hf_erf_mc_aal5_crcck = -1; -static int hf_erf_mc_aal5_crce = -1; -static int hf_erf_mc_aal5_lenck = -1; -static int hf_erf_mc_aal5_lene = -1; -static int hf_erf_mc_aal5_res2 = -1; -static int hf_erf_mc_aal5_first = -1; -static int hf_erf_mc_aal5_res3 = -1; +static int hf_erf_mc_aal5; +static int hf_erf_mc_aal5_cn; +static int hf_erf_mc_aal5_res1; +static int hf_erf_mc_aal5_port; +static int hf_erf_mc_aal5_crcck; +static int hf_erf_mc_aal5_crce; +static int hf_erf_mc_aal5_lenck; +static int hf_erf_mc_aal5_lene; +static int hf_erf_mc_aal5_res2; +static int hf_erf_mc_aal5_first; +static int hf_erf_mc_aal5_res3; /* MC AAL2 Header */ -static int hf_erf_mc_aal2 = -1; -static int hf_erf_mc_aal2_cn = -1; -static int hf_erf_mc_aal2_res1 = -1; -static int hf_erf_mc_aal2_res2 = -1; -static int hf_erf_mc_aal2_port = -1; -static int hf_erf_mc_aal2_res3 = -1; -static int hf_erf_mc_aal2_first = -1; -static int hf_erf_mc_aal2_maale = -1; -static int hf_erf_mc_aal2_lene = -1; -static int hf_erf_mc_aal2_cid = -1; +static int hf_erf_mc_aal2; +static int hf_erf_mc_aal2_cn; +static int hf_erf_mc_aal2_res1; +static int hf_erf_mc_aal2_res2; +static int hf_erf_mc_aal2_port; +static int hf_erf_mc_aal2_res3; +static int hf_erf_mc_aal2_first; +static int hf_erf_mc_aal2_maale; +static int hf_erf_mc_aal2_lene; +static int hf_erf_mc_aal2_cid; /* AAL2 Header */ -static int hf_erf_aal2 = -1; -static int hf_erf_aal2_cid = -1; -static int hf_erf_aal2_maale = -1; -static int hf_erf_aal2_maalei = -1; -static int hf_erf_aal2_first = -1; -static int hf_erf_aal2_res1 = -1; +static int hf_erf_aal2; +static int hf_erf_aal2_cid; +static int hf_erf_aal2_maale; +static int hf_erf_aal2_maalei; +static int hf_erf_aal2_first; +static int hf_erf_aal2_res1; /* ERF Ethernet header/pad */ -static int hf_erf_eth = -1; -static int hf_erf_eth_off = -1; -static int hf_erf_eth_pad = -1; +static int hf_erf_eth; +static int hf_erf_eth_off; +static int hf_erf_eth_pad; /* ERF Meta record tag */ -static int hf_erf_meta_tag_type = -1; -static int hf_erf_meta_tag_len = -1; -static int hf_erf_meta_tag_unknown = -1; +static int hf_erf_meta_tag_type; +static int hf_erf_meta_tag_len; +static int hf_erf_meta_tag_unknown; /* Initialize the subtree pointers */ -static gint ett_erf = -1; -static gint ett_erf_pseudo_hdr = -1; -static gint ett_erf_rectype = -1; -static gint ett_erf_flags = -1; -static gint ett_erf_mc_hdlc = -1; -static gint ett_erf_mc_raw = -1; -static gint ett_erf_mc_atm = -1; -static gint ett_erf_mc_rawlink = -1; -static gint ett_erf_mc_aal5 = -1; -static gint ett_erf_mc_aal2 = -1; -static gint ett_erf_aal2 = -1; -static gint ett_erf_eth = -1; -static gint ett_erf_meta = -1; -static gint ett_erf_meta_tag = -1; -static gint ett_erf_source = -1; -static gint ett_erf_anchor = -1; -static gint ett_erf_anchor_flags = -1; -static gint ett_erf_entropy_value = -1; - -static expert_field ei_erf_extension_headers_not_shown = EI_INIT; -static expert_field ei_erf_packet_loss = EI_INIT; -static expert_field ei_erf_checksum_error = EI_INIT; -static expert_field ei_erf_meta_section_len_error = EI_INIT; -static expert_field ei_erf_meta_truncated_record = EI_INIT; -static expert_field ei_erf_meta_truncated_tag = EI_INIT; -static expert_field ei_erf_meta_zero_len_tag = EI_INIT; -static expert_field ei_erf_meta_reset = EI_INIT; +static gint ett_erf; +static gint ett_erf_pseudo_hdr; +static gint ett_erf_rectype; +static gint ett_erf_hash_type; +static gint ett_erf_flags; +static gint ett_erf_mc_hdlc; +static gint ett_erf_mc_raw; +static gint ett_erf_mc_atm; +static gint ett_erf_mc_rawlink; +static gint ett_erf_mc_aal5; +static gint ett_erf_mc_aal2; +static gint ett_erf_aal2; +static gint ett_erf_eth; +static gint ett_erf_meta; +static gint ett_erf_meta_tag; +static gint ett_erf_source; +static gint ett_erf_anchor; +static gint ett_erf_anchor_flags; +static gint ett_erf_entropy_value; + +static expert_field ei_erf_extension_headers_not_shown; +static expert_field ei_erf_packet_loss; +static expert_field ei_erf_mc_hdlc_checksum_error; +static expert_field ei_erf_mc_hdlc_short_error; +static expert_field ei_erf_mc_hdlc_long_error; +static expert_field ei_erf_mc_hdlc_abort_error; +static expert_field ei_erf_mc_hdlc_octet_error; +static expert_field ei_erf_mc_hdlc_lost_byte_error; +static expert_field ei_erf_rx_error; +static expert_field ei_erf_ds_error; +static expert_field ei_erf_truncation_error; +static expert_field ei_erf_meta_section_len_error; +static expert_field ei_erf_meta_truncated_record; +static expert_field ei_erf_meta_truncated_tag; +static expert_field ei_erf_meta_zero_len_tag; +static expert_field ei_erf_meta_reset; typedef enum { ERF_HDLC_CHDLC = 0, @@ -288,16 +302,9 @@ static dissector_handle_t atm_untruncated_handle; static dissector_handle_t sdh_handle; -/* ERF Header */ -#define ERF_HDR_TYPE_MASK 0x7f -#define ERF_HDR_EHDR_MASK 0x80 -#define ERF_HDR_FLAGS_MASK 0xff -#define ERF_HDR_CAP_MASK 0x03 -#define ERF_HDR_VLEN_MASK 0x04 -#define ERF_HDR_TRUNC_MASK 0x08 -#define ERF_HDR_RXE_MASK 0x10 -#define ERF_HDR_DSE_MASK 0x20 -#define ERF_HDR_RES_MASK 0xC0 +/* ERF Extension Header */ +#define ERF_EHDR_FLOW_ID_HASH_TYPE_TYPE_MASK 0x7f +#define ERF_EHDR_FLOW_ID_HASH_TYPE_INNER_MASK 0x80 /* Classification */ #define EHDR_CLASS_FLAGS_MASK 0x00ffffff @@ -448,7 +455,7 @@ static const value_string ehdr_type_vals[] = { { 0, NULL } }; -/* Used for Provenance ext_hdrs_added/remvoed, should match the field abbreviation */ +/* Used for Provenance ext_hdrs_added/removed, should match the field abbreviation */ static const value_string ehdr_type_vals_short[] = { { ERF_EXT_HDR_TYPE_CLASSIFICATION , "class"}, { ERF_EXT_HDR_TYPE_INTERCEPTID , "int"}, @@ -765,7 +772,7 @@ static erf_state_t erf_state; /* * XXX: These header_field_info are used as templates for dynamically building - * per-section fields for each tag, as well as appropiate value_string arrays. + * per-section fields for each tag, as well as appropriate value_string arrays. * We abuse the abbrev field to store the short name of the tags. */ static const erf_meta_hf_template_t erf_meta_tags[] = { @@ -832,6 +839,8 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_relative_snaplen, { "Relative Snap Length", "relative_snaplen", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_temperature, { "Temperature", "temperature", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_degree_celsius, 0x0, NULL, HFILL } }, { ERF_META_TAG_power, { "Power Consumption", "power", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_watt, 0x0, NULL, HFILL } }, + { ERF_META_TAG_vendor, { "Vendor", "vendor", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_cpu_threads, { "CPU Threads", "cpu_threads", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_if_num, { "Interface Number", "if_num", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_if_vc, { "Interface Virtual Circuit", "if_vc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, @@ -895,8 +904,32 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_dpi_application, { "DPI Application", "dpi_application", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_dpi_confidence, { "DPI Confidence", "dpi_confidence", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_dpi_state, { "DPI State", "dpi_state", FT_UINT32, BASE_NONE, VALS(erf_dpi_state), 0x0, NULL, HFILL } }, - { ERF_META_TAG_dpi_protocol_stack, { "DPI Protocol Stack", "dpi_protocol_stack", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_dpi_protocol_stack, { "DPI Protocol Stack", "dpi_protocol_stack", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_flow_state, { "Flow State", "flow_state", FT_UINT32, BASE_NONE, VALS(erf_flow_state), 0x0, NULL, HFILL } }, + { ERF_META_TAG_vlan_id, { "VLAN ID", "vlan_id", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_mpls_label, { "MPLS Label", "mpls_label", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_vlan_pcp, { "VLAN PCP", "vlan_pcp", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_mpls_tc, { "MPLS_TC", "mpls_tc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_dscp, { "DSCP", "dscp", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_mpls_label, { "Initiator MPLS Label", "initiator_mpls_label", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_mpls_label, { "Responder MPLS Label", "responder_mpls_label", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_mpls_tc, { "Initiator MPLS TC", "initiator_mpls_tc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_mpls_tc, { "Responder MPLS TC", "responder_mpls_tc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_ipv4, { "Initiator IPv4", "initiator_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_ipv4, { "Responder IPv4", "responder_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_ipv6, { "Initiator IPv6", "initiator_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_ipv6, { "Responder IPv6", "responder_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_mac, { "Initiator MAC Address", "initiator_mac", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_mac, { "Responder MAC Address", "responder_mac", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_port, { "Initiator Port", "initiator_port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_port, { "Responder Port", "responder_port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_retx, { "Initiator Retransmissions", "initiator_retx", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_retx, { "Responder Retransmissions", "responder_retx", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_zwin, { "Initiator Zero Window Count", "initiator_zwin", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_zwin, { "Responder Zero Window Count", "responder_zwin", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_initiator_tcp_flags, { "Initiator TCP Flags", "initiator_flags", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_responder_tcp_flags, { "Responder TCP Flags", "responder_flags", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_tcp_irtt, { "TCP Initial Round Trip Time", "tcp_irtt", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_start_time, { "Start Time", "start_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_end_time, { "End Time", "end_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0, NULL, HFILL } }, @@ -923,6 +956,27 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_stat_buf_drop, { "Buffer Drop", "stat_buf_drop", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_stream_drop, { "Stream Drop", "stream_drop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_stream_buf_drop, { "Stream Buffer Drop", "stream_buf_drop", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_pkt_drop, { "Packet Drop", "packet_drop", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_record_drop, { "Record Drop", "record_drop", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_bandwidth, { "Bandwidth", "bandwidth", FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0x0, NULL, HFILL } }, + { ERF_META_TAG_duration, { "Duration", "duration", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_top_index, { "Top N Index", "top_index", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_concurrent_flows, { "Concurrent Flows", "concurrent_flows", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_active_flows, { "Active Flows", "active_flows", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_created_flows, { "Created Flows", "created_flows", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_deleted_flows, { "Deleted Flows", "deleted_flows", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_active_endpoints, { "Active Endpoints", "active_endpoints", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_tx_pkts, { "Transmitted Packets", "tx_packets", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_tx_bytes, { "Transmitted Bytes", "tx_bytes", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_rx_bandwidth, { "Receive Bandwidth", "rx_bandwidth", FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0x0, NULL, HFILL } }, + { ERF_META_TAG_tx_bandwidth, { "Transmit Bandwidth", "tx_bandwidth", FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0x0, NULL, HFILL } }, + { ERF_META_TAG_records, { "Records", "records", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_record_bytes, { "Record Bytes", "record_bytes", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_pkt_drop_bytes, { "Packet Drop Bytes", "packet_drop_bytes", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_record_drop_bytes, { "Record Drop Bytes", "record_drop_bytes", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_drop_bandwidth, { "Drop Bandwidth", "drop_bandwidth", FT_UINT64, BASE_DEC|BASE_UNIT_STRING, &units_bit_sec, 0x0, NULL, HFILL } }, + { ERF_META_TAG_retx_pkts, { "Retransmitted Packets", "retx_packets", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_zwin_pkts, { "Zero-Window Packets", "zwin_packets", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ns_host_ipv4, { "IPv4 Name", "ns_host_ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ns_host_ipv6, { "IPv6 Name", "ns_host_ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL } }, @@ -938,6 +992,7 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_exthdr, { "ERF Extension Header", "exthdr", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_pcap_ng_block, { "Pcapng Block", "pcap_ng_block", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_asn1, { "ASN.1", "asn1", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_section_ref, { "Section Reference", "section_ref", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_clk_source, { "Clock Source", "clk_source", FT_UINT32, BASE_DEC, VALS(erf_clk_source), 0x0, NULL, HFILL } }, { ERF_META_TAG_clk_state, { "Clock State", "clk_state", FT_UINT32, BASE_DEC, VALS(erf_clk_state), 0x0, NULL, HFILL } }, @@ -962,15 +1017,15 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_ptp_domain_num, { "PTP Domain Number", "ptp_domain_num", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_steps_removed, { "PTP Steps Removed", "ptp_steps_removed", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, /* PTP TimeInterval scaled nanoseconds, using FT_RELATIVE_TIME so can compare with clk_threshold */ - { ERF_META_TAG_ptp_offset_from_master, { "PTP Offset From Master", "ptp_offset_from_master", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, - { ERF_META_TAG_ptp_mean_path_delay, { "PTP Mean Path Delay", "ptp_mean_path_delay", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ptp_offset_from_master, { "PTP Offset From Master", "ptp_offset_from_master", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ptp_mean_path_delay, { "PTP Mean Path Delay", "ptp_mean_path_delay", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_parent_identity, { "PTP Parent Clock Identity", "ptp_parent_identity", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_parent_port_num, { "PTP Parent Port Number", "ptp_parent_port_num", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_gm_identity, { "PTP Grandmaster Identity", "ptp_gm_identity", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* PTP ClockQuality combined field, see erf_ptp_clock_quality */ { ERF_META_TAG_ptp_gm_clock_quality, { "PTP Grandmaster Clock Quality", "ptp_gm_clock_quality", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, /* Integer seconds, using FT_RELATIVE_TIME so can compare with clk_phc_offset */ - { ERF_META_TAG_ptp_current_utc_offset, { "PTP Current UTC Offset", "ptp_current_utc_offset", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ptp_current_utc_offset, { "PTP Current UTC Offset", "ptp_current_utc_offset", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* PTP TIME_PROPERTIES_DATA_SET flags, see erf_ptp_time_properties_flags */ { ERF_META_TAG_ptp_time_properties, { "PTP Time Properties", "ptp_time_properties", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_time_source, { "PTP Time Source", "ptp_time_source", FT_UINT32, BASE_DEC | BASE_EXT_STRING, &ptp_v2_timeSource_vals_ext, 0x0, NULL, HFILL } }, @@ -979,10 +1034,20 @@ static const erf_meta_hf_template_t erf_meta_tags[] = { { ERF_META_TAG_ptp_port_state, { "PTP Port State", "ptp_port_state", FT_UINT32, BASE_DEC | BASE_EXT_STRING, &ptp_v2_portState_vals_ext, 0x0, NULL, HFILL } }, { ERF_META_TAG_ptp_delay_mechanism, { "PTP Delay Mechanism", "ptp_delay_mechanism", FT_UINT32, BASE_DEC, VALS(ptp_v2_delayMechanism_vals), 0x0, NULL, HFILL } }, - { ERF_META_TAG_clk_port_proto, { "Clock Input Port Protocol", "clk_port_proto", FT_UINT32, BASE_DEC, VALS(erf_clk_port_proto), 0x0, NULL, HFILL } } + { ERF_META_TAG_clk_port_proto, { "Clock Input Port Protocol", "clk_port_proto", FT_UINT32, BASE_DEC, VALS(erf_clk_port_proto), 0x0, NULL, HFILL } }, + + { ERF_META_TAG_ntp_status, { "NTP Status", "ntp_status", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_stratum, { "NTP Stratum", "ntp_stratum", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_rootdelay, { "NTP Root Delay", "ntp_root_delay", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_rootdisp, { "NTP Root Dispersion", "ntp_root_dispersion", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_offset, { "NTP Offset", "ntp_offset", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_frequency, { "NTP Frequency", "ntp_frequency", FT_INT32, BASE_DEC|BASE_UNIT_STRING, &units_hz, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_sys_jitter, { "NTP System Jitter", "ntp_sys_jitter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_peer_remote, { "NTP Peer Remote", "ntp_peer_remote", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_TAG_ntp_peer_refid, { "NTP Peer Refid", "ntp_peer_refid", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } } }; -/* Sections are also tags, but enumerate them seperately to make logic simpler */ +/* Sections are also tags, but enumerate them separately to make logic simpler */ static const erf_meta_hf_template_t erf_meta_sections[] = { /* * Some tags (such as generation time) can appear before the first section, @@ -1002,7 +1067,11 @@ static const erf_meta_hf_template_t erf_meta_sections[] = { { ERF_META_SECTION_STREAM, { "Stream Section", "section_stream", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_SECTION_TRANSFORM, { "Transform Section", "section_transform", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { ERF_META_SECTION_DNS, { "DNS Section", "section_dns", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, - { ERF_META_SECTION_SOURCE, { "Source Section", "section_source", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } } + { ERF_META_SECTION_SOURCE, { "Source Section", "section_source", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_SECTION_NETWORK, { "Network Section", "section_network", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_SECTION_ENDPOINT, { "Endpoint Section", "section_endpoint", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_SECTION_INPUT, { "Input Section", "section_input", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { ERF_META_SECTION_OUTPUT, { "Output Section", "section_output", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } } }; static int erf_type_has_color(unsigned int type) { @@ -1532,62 +1601,54 @@ erf_atm_guess_traffic_type(tvbuff_t *tvb, int offset, guint len, static void dissect_classification_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if (tree) { - proto_item *flags_item; - proto_tree *flags_tree; - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - guint32 value = ((guint32)(hdr >> 32)) & EHDR_CLASS_FLAGS_MASK; - - flags_item = proto_tree_add_uint(tree, hf_erf_ehdr_class_flags, tvb, 0, 0, value); - flags_tree = proto_item_add_subtree(flags_item, ett_erf_flags); - - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_sh, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_shm, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_res1, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_user, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_res2, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_drop, tvb, 0, 0, value); - proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_str, tvb, 0, 0, value); - - proto_tree_add_uint(tree, hf_erf_ehdr_class_seqnum, tvb, 0, 0, (guint32)hdr); - } + proto_item *flags_item; + proto_tree *flags_tree; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint32 value = ((guint32)(hdr >> 32)) & EHDR_CLASS_FLAGS_MASK; + + flags_item = proto_tree_add_uint(tree, hf_erf_ehdr_class_flags, tvb, 0, 0, value); + flags_tree = proto_item_add_subtree(flags_item, ett_erf_flags); + + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_sh, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_shm, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_res1, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_user, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_res2, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_drop, tvb, 0, 0, value); + proto_tree_add_uint(flags_tree, hf_erf_ehdr_class_flags_str, tvb, 0, 0, value); + + proto_tree_add_uint(tree, hf_erf_ehdr_class_seqnum, tvb, 0, 0, (guint32)hdr); } static void dissect_intercept_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if (tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint(tree, hf_erf_ehdr_int_res1, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_int_id, tvb, 0, 0, (guint16)((hdr >> 32 ) & 0xFFFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_int_res2, tvb, 0, 0, (guint32)hdr); - } + proto_tree_add_uint(tree, hf_erf_ehdr_int_res1, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_int_id, tvb, 0, 0, (guint16)((hdr >> 32 ) & 0xFFFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_int_res2, tvb, 0, 0, (guint32)hdr); } static void dissect_raw_link_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if (tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_res , tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFFFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_seqnum , tvb, 0, 0, (guint32)((hdr >> 16) & 0xffff)); - proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_rate, tvb, 0, 0, (guint32)((hdr >> 8) & 0x00ff)); - proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_type, tvb, 0, 0, (guint32)(hdr & 0x00ff)); - } + proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_res , tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFFFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_seqnum , tvb, 0, 0, (guint32)((hdr >> 16) & 0xffff)); + proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_rate, tvb, 0, 0, (guint32)((hdr >> 8) & 0x00ff)); + proto_tree_add_uint(tree, hf_erf_ehdr_raw_link_type, tvb, 0, 0, (guint32)(hdr & 0x00ff)); } static void dissect_bfs_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if (tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint(tree, hf_erf_ehdr_bfs_hash, tvb, 0, 0, (guint32)((hdr >> 48) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_bfs_color, tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_bfs_raw_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFFFF)); - } + proto_tree_add_uint(tree, hf_erf_ehdr_bfs_hash, tvb, 0, 0, (guint32)((hdr >> 48) & 0xFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_bfs_color, tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_bfs_raw_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFFFF)); } static int @@ -1704,45 +1765,39 @@ dissect_channelised_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 vc_size = (guint8)((hdr >> 16) & 0xFF); guint8 line_rate = (guint8)((hdr >> 8) & 0xFF); sdh_g707_format_t g707_format; - wmem_strbuf_t *vc_id_string = wmem_strbuf_new_label(pinfo->pool); + wmem_strbuf_t *vc_id_string = wmem_strbuf_create(pinfo->pool); channelised_fill_sdh_g707_format(&g707_format, vc_id, vc_size, line_rate); channelised_fill_vc_id_string(vc_id_string, &g707_format); - if (tree) { - proto_tree_add_boolean(tree, hf_erf_ehdr_chan_morebits, tvb, 0, 0, (guint8)((hdr >> 63) & 0x1)); - proto_tree_add_boolean(tree, hf_erf_ehdr_chan_morefrag, tvb, 0, 0, (guint8)((hdr >> 55) & 0x1)); - proto_tree_add_uint(tree, hf_erf_ehdr_chan_seqnum, tvb, 0, 0, (guint16)((hdr >> 40) & 0x7FFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_chan_res, tvb, 0, 0, (guint8)((hdr >> 32) & 0xFF)); - proto_tree_add_uint_format_value(tree, hf_erf_ehdr_chan_virt_container_id, tvb, 0, 0, vc_id, - "0x%.2x (g.707: %s)", vc_id, wmem_strbuf_get_str(vc_id_string)); - proto_tree_add_uint(tree, hf_erf_ehdr_chan_assoc_virt_container_size, tvb, 0, 0, vc_size); - proto_tree_add_uint(tree, hf_erf_ehdr_chan_rate, tvb, 0, 0, line_rate); - proto_tree_add_uint(tree, hf_erf_ehdr_chan_type, tvb, 0, 0, (guint8)((hdr >> 0) & 0xFF)); - } + proto_tree_add_boolean(tree, hf_erf_ehdr_chan_morebits, tvb, 0, 0, (guint8)((hdr >> 63) & 0x1)); + proto_tree_add_boolean(tree, hf_erf_ehdr_chan_morefrag, tvb, 0, 0, (guint8)((hdr >> 55) & 0x1)); + proto_tree_add_uint(tree, hf_erf_ehdr_chan_seqnum, tvb, 0, 0, (guint16)((hdr >> 40) & 0x7FFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_chan_res, tvb, 0, 0, (guint8)((hdr >> 32) & 0xFF)); + proto_tree_add_uint_format_value(tree, hf_erf_ehdr_chan_virt_container_id, tvb, 0, 0, vc_id, + "0x%.2x (g.707: %s)", vc_id, wmem_strbuf_get_str(vc_id_string)); + proto_tree_add_uint(tree, hf_erf_ehdr_chan_assoc_virt_container_size, tvb, 0, 0, vc_size); + proto_tree_add_uint(tree, hf_erf_ehdr_chan_rate, tvb, 0, 0, line_rate); + proto_tree_add_uint(tree, hf_erf_ehdr_chan_type, tvb, 0, 0, (guint8)((hdr >> 0) & 0xFF)); } static void dissect_signature_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if(tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint(tree, hf_erf_ehdr_signature_payload_hash, tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFFFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_signature_color, tvb, 0, 0, (guint8)((hdr >> 24) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_signature_flow_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFF)); - } + proto_tree_add_uint(tree, hf_erf_ehdr_signature_payload_hash, tvb, 0, 0, (guint32)((hdr >> 32) & 0xFFFFFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_signature_color, tvb, 0, 0, (guint8)((hdr >> 24) & 0xFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_signature_flow_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFF)); } static void dissect_host_id_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if(tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint(tree, hf_erf_ehdr_host_id_sourceid, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); - proto_tree_add_uint64(tree, hf_erf_ehdr_host_id_hostid, tvb, 0, 0, (hdr & ERF_EHDR_HOST_ID_MASK)); - } + proto_tree_add_uint(tree, hf_erf_ehdr_host_id_sourceid, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); + proto_tree_add_uint64(tree, hf_erf_ehdr_host_id_hostid, tvb, 0, 0, (hdr & ERF_EHDR_HOST_ID_MASK)); } static void @@ -1755,26 +1810,38 @@ dissect_anchor_id_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, NULL }; - if(tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_bitmask_value(tree, tvb, 0, hf_erf_ehdr_anchor_id_flags, ett_erf_anchor_flags, anchor_flags, (guint8)(hdr >> 48) & 0xff); - proto_tree_add_uint64(tree, hf_erf_ehdr_anchor_id_anchorid, tvb, 0, 0, (hdr & ERF_EHDR_ANCHOR_ID_MASK)); - } + proto_tree_add_bitmask_value(tree, tvb, 0, hf_erf_ehdr_anchor_id_flags, ett_erf_anchor_flags, anchor_flags, (guint8)(hdr >> 48) & 0xff); + proto_tree_add_uint64(tree, hf_erf_ehdr_anchor_id_anchorid, tvb, 0, 0, (hdr & ERF_EHDR_ANCHOR_ID_MASK)); } static void dissect_flow_id_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if(tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint8 hash_type = (guint8)((hdr >> 40) & 0xFF); + proto_item *hash_type_item; + proto_tree *hash_type_tree; - proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_source_id, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_hash_type, tvb, 0, 0, (guint8)((hdr >> 40) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_stack_type, tvb, 0, 0, (guint8)((hdr >> 32) & 0xFF)); - proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_flow_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFFFF)); - } + proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_source_id, tvb, 0, 0, (guint8)((hdr >> 48) & 0xFF)); + + hash_type_item = proto_tree_add_uint_format_value(tree, hf_erf_ehdr_flow_id_hash_type, tvb, 0, 0, hash_type, + "0x%02x (%s%s)", + hash_type, + (hash_type & ERF_EHDR_FLOW_ID_HASH_TYPE_INNER_MASK) ? "Inner " : "", + val_to_str_const( + (hash_type & ERF_EHDR_FLOW_ID_HASH_TYPE_TYPE_MASK), + erf_hash_type, + "Unknown Type")); + + hash_type_tree = proto_item_add_subtree(hash_type_item, ett_erf_hash_type); + proto_tree_add_uint(hash_type_tree, hf_erf_ehdr_flow_id_hash_type_type, tvb, 0, 0, hash_type); + proto_tree_add_uint(hash_type_tree, hf_erf_ehdr_flow_id_hash_type_inner, tvb, 0, 0, hash_type); + + proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_stack_type, tvb, 0, 0, (guint8)((hdr >> 32) & 0xFF)); + proto_tree_add_uint(tree, hf_erf_ehdr_flow_id_flow_hash, tvb, 0, 0, (guint32)(hdr & 0xFFFFFFFF)); } static float @@ -1790,22 +1857,20 @@ entropy_from_entropy_header_value(guint8 entropy_hdr_value) static void dissect_entropy_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if(tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - guint8 entropy_hdr_value = (guint8)((hdr >> 48) & 0xFF); - float entropy; - proto_item *pi; - proto_tree *entropy_value_tree; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint8 entropy_hdr_value = (guint8)((hdr >> 48) & 0xFF); + float entropy; + proto_item *pi; + proto_tree *entropy_value_tree; - entropy = entropy_from_entropy_header_value(entropy_hdr_value); + entropy = entropy_from_entropy_header_value(entropy_hdr_value); - pi = proto_tree_add_float_format_value(tree, hf_erf_ehdr_entropy_entropy, tvb, 0, 0, entropy, - "%.2f %s", (double) entropy, entropy == 0.0f ? "(not calculated)":"bits"); - entropy_value_tree = proto_item_add_subtree(pi, ett_erf_entropy_value); - proto_tree_add_uint(entropy_value_tree, hf_erf_ehdr_entropy_entropy_raw, tvb, 0, 0, entropy_hdr_value); + pi = proto_tree_add_float_format_value(tree, hf_erf_ehdr_entropy_entropy, tvb, 0, 0, entropy, + "%.2f %s", (double) entropy, entropy == 0.0f ? "(not calculated)":"bits"); + entropy_value_tree = proto_item_add_subtree(pi, ett_erf_entropy_value); + proto_tree_add_uint(entropy_value_tree, hf_erf_ehdr_entropy_entropy_raw, tvb, 0, 0, entropy_hdr_value); - proto_tree_add_uint64(tree, hf_erf_ehdr_entropy_reserved, tvb, 0, 0, (hdr & 0xFFFFFFFFFFFF)); - } + proto_tree_add_uint64(tree, hf_erf_ehdr_entropy_reserved, tvb, 0, 0, (hdr & 0xFFFFFFFFFFFF)); } static guint64 @@ -1843,323 +1908,301 @@ find_host_id(packet_info *pinfo, gboolean *has_anchor_definition) { static void dissect_host_anchor_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint64 host_id, guint64 anchor_id, guint8 anchor _U_) { - if(tree) { - erf_anchor_key_t key = {host_id, anchor_id}; - erf_host_anchor_info_t *anchor_info; - erf_anchored_info_t *anchored_info; - wmem_list_frame_t *frame; - wmem_list_t *frame_list; - proto_item *pi = NULL; - proto_tree *subtree; - - /* TODO: top level linking to most recent frame like we have for Host ID? */ - subtree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_erf_anchor, &pi, "Host ID: 0x%012" G_GINT64_MODIFIER "x, Anchor ID: 0x%012" G_GINT64_MODIFIER "x", host_id & ERF_EHDR_HOST_ID_MASK, anchor_id & ERF_EHDR_ANCHOR_ID_MASK); - proto_item_set_generated(pi); + erf_anchor_key_t key = {host_id, anchor_id}; + erf_host_anchor_info_t *anchor_info; + erf_anchored_info_t *anchored_info; + wmem_list_frame_t *frame; + wmem_list_t *frame_list; + proto_item *pi = NULL; + proto_tree *subtree; - pi = proto_tree_add_uint64(subtree, hf_erf_anchor_hostid, tvb, 0, 0, host_id & ERF_EHDR_HOST_ID_MASK); - proto_item_set_generated(pi); - pi = proto_tree_add_uint64(subtree, hf_erf_anchor_anchorid, tvb, 0, 0, anchor_id & ERF_EHDR_ANCHOR_ID_MASK); - proto_item_set_generated(pi); + /* TODO: top level linking to most recent frame like we have for Host ID? */ + subtree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_erf_anchor, &pi, "Host ID: 0x%012" PRIx64 ", Anchor ID: 0x%012" PRIx64, host_id & ERF_EHDR_HOST_ID_MASK, anchor_id & ERF_EHDR_ANCHOR_ID_MASK); + proto_item_set_generated(pi); - anchor_info = (erf_host_anchor_info_t*)wmem_map_lookup(erf_state.host_anchor_map, &key); + pi = proto_tree_add_uint64(subtree, hf_erf_anchor_hostid, tvb, 0, 0, host_id & ERF_EHDR_HOST_ID_MASK); + proto_item_set_generated(pi); + pi = proto_tree_add_uint64(subtree, hf_erf_anchor_anchorid, tvb, 0, 0, anchor_id & ERF_EHDR_ANCHOR_ID_MASK); + proto_item_set_generated(pi); - if(!anchor_info) { - return; - } + anchor_info = (erf_host_anchor_info_t*)wmem_map_lookup(erf_state.host_anchor_map, &key); - frame_list = anchor_info->anchored_list; - - /* Try to link frames */ - frame = wmem_list_head(frame_list); - while(frame != NULL) { - anchored_info = (erf_anchored_info_t*)wmem_list_frame_data(frame); - if(pinfo->num != anchored_info->frame_num) { - /* Don't list the frame itself */ - pi = proto_tree_add_uint(subtree, hf_erf_anchor_linked, tvb, 0, 0, anchored_info->frame_num); - proto_item_set_generated(pi); - /* XXX: Need to do this each time because pinfo is discarded. Filtering does not reset visited as it does not do a full redissect. - We also might not catch all frames in the first pass (e.g. comment after record). */ - mark_frame_as_depended_upon(pinfo, anchored_info->frame_num); - } - frame = wmem_list_frame_next(frame); + if(!anchor_info) { + return; + } + + frame_list = anchor_info->anchored_list; + + /* Try to link frames */ + frame = wmem_list_head(frame_list); + while(frame != NULL) { + anchored_info = (erf_anchored_info_t*)wmem_list_frame_data(frame); + if(pinfo->num != anchored_info->frame_num) { + /* Don't list the frame itself */ + pi = proto_tree_add_uint(subtree, hf_erf_anchor_linked, tvb, 0, 0, anchored_info->frame_num); + proto_item_set_generated(pi); + /* XXX: Need to do this each time because pinfo is discarded. Filtering does not reset visited as it does not do a full redissect. + We also might not catch all frames in the first pass (e.g. comment after record). */ + mark_frame_as_depended_upon(pinfo->fd, anchored_info->frame_num); } + frame = wmem_list_frame_next(frame); } } static void dissect_host_id_source_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint64 host_id, guint8 source_id) { - if (tree) { - proto_tree *hostid_tree; - proto_item *pi = NULL; - guint32 fnum_current = G_MAXUINT32; - guint32 fnum = G_MAXUINT32; - guint32 fnum_next = G_MAXUINT32; + proto_tree *hostid_tree; + proto_item *pi = NULL; + guint32 fnum_current = G_MAXUINT32; + guint32 fnum = G_MAXUINT32; + guint32 fnum_next = G_MAXUINT32; - fnum = erf_source_find_closest(host_id, source_id, pinfo->num, &fnum_next); + fnum = erf_source_find_closest(host_id, source_id, pinfo->num, &fnum_next); - if (fnum != G_MAXUINT32) { - fnum_current = fnum; - } else { - /* XXX: Possibly undesireable side effect: first metadata record links to next */ - fnum_current = fnum_next; - } + if (fnum != G_MAXUINT32) { + fnum_current = fnum; + } else { + /* XXX: Possibly undesirable side effect: first metadata record links to next */ + fnum_current = fnum_next; + } - if (fnum_current != G_MAXUINT32) { - pi = proto_tree_add_uint_format(tree, hf_erf_source_current, tvb, 0, 0, fnum_current, - "Host ID: 0x%012" G_GINT64_MODIFIER "x, Source ID: %u", host_id, source_id&0xFF); - hostid_tree = proto_item_add_subtree(pi, ett_erf_source); - } else { - /* If we have no frame number to link against, just add a static subtree */ - hostid_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_erf_source, &pi, - "Host ID: 0x%012" G_GINT64_MODIFIER "x, Source ID: %u", host_id, source_id&0xFF); - } - proto_item_set_generated(pi); + if (fnum_current != G_MAXUINT32) { + pi = proto_tree_add_uint_format(tree, hf_erf_source_current, tvb, 0, 0, fnum_current, + "Host ID: 0x%012" PRIx64 ", Source ID: %u", host_id, source_id&0xFF); + hostid_tree = proto_item_add_subtree(pi, ett_erf_source); + } else { + /* If we have no frame number to link against, just add a static subtree */ + hostid_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_erf_source, &pi, + "Host ID: 0x%012" PRIx64 ", Source ID: %u", host_id, source_id&0xFF); + } + proto_item_set_generated(pi); - pi = proto_tree_add_uint64(hostid_tree, hf_erf_hostid, tvb, 0, 0, host_id); + pi = proto_tree_add_uint64(hostid_tree, hf_erf_hostid, tvb, 0, 0, host_id); + proto_item_set_generated(pi); + pi = proto_tree_add_uint(hostid_tree, hf_erf_sourceid, tvb, 0, 0, source_id); + proto_item_set_generated(pi); + + if (fnum_next != G_MAXUINT32) { + pi = proto_tree_add_uint(hostid_tree, hf_erf_source_next, tvb, 0, 0, fnum_next); proto_item_set_generated(pi); - pi = proto_tree_add_uint(hostid_tree, hf_erf_sourceid, tvb, 0, 0, source_id); + /* XXX: Save the surrounding nearest periodic records when we do a filtered save so we keep native ERF metadata */ + mark_frame_as_depended_upon(pinfo->fd, fnum_next); + } + if (fnum != G_MAXUINT32) { + pi = proto_tree_add_uint(hostid_tree, hf_erf_source_prev, tvb, 0, 0, fnum); proto_item_set_generated(pi); - - if (fnum_next != G_MAXUINT32) { - pi = proto_tree_add_uint(hostid_tree, hf_erf_source_next, tvb, 0, 0, fnum_next); - proto_item_set_generated(pi); - /* XXX: Save the surrounding nearest periodic records when we do a filtered save so we keep native ERF metadata */ - mark_frame_as_depended_upon(pinfo, fnum_next); - } - if (fnum != G_MAXUINT32) { - pi = proto_tree_add_uint(hostid_tree, hf_erf_source_prev, tvb, 0, 0, fnum); - proto_item_set_generated(pi); - mark_frame_as_depended_upon(pinfo, fnum); - } + mark_frame_as_depended_upon(pinfo->fd, fnum); } } static void dissect_unknown_ex_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int idx) { - if (tree) { - guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; + guint64 hdr = pinfo->pseudo_header->erf.ehdr_list[idx].ehdr; - proto_tree_add_uint64(tree, hf_erf_ehdr_unk, tvb, 0, 0, hdr); - } + proto_tree_add_uint64(tree, hf_erf_ehdr_unk, tvb, 0, 0, hdr); } static void dissect_mc_hdlc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_hdlc_item; - proto_tree *mc_hdlc_tree; - guint32 mc_hdlc; - proto_item *pi; - - /* Multi Channel HDLC Header */ - mc_hdlc_item = proto_tree_add_uint(tree, hf_erf_mc_hdlc, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_hdlc_tree = proto_item_add_subtree(mc_hdlc_item, ett_erf_mc_hdlc); - mc_hdlc = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_cn, tvb, 0, 0, mc_hdlc); - proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res1, tvb, 0, 0, mc_hdlc); - proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res2, tvb, 0, 0, mc_hdlc); - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_fcse, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_FCSE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC FCS Error"); - - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_sre, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_SRE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC Short Record Error, <5 bytes"); - - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_lre, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_LRE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC Long Record Error, >2047 bytes"); - - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_afe, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_AFE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC Aborted Frame Error"); - - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_oe, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_OE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC Octet Error, the closing flag was not octet aligned after bit unstuffing"); - - pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_lbe, tvb, 0, 0, mc_hdlc); - if (mc_hdlc & MC_HDLC_LBE_MASK) - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF MC Lost Byte Error"); - - proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_first, tvb, 0, 0, mc_hdlc); - proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res3, tvb, 0, 0, mc_hdlc); - } + proto_item *mc_hdlc_item; + proto_tree *mc_hdlc_tree; + guint32 mc_hdlc; + proto_item *pi; + + /* Multi Channel HDLC Header */ + mc_hdlc_item = proto_tree_add_uint(tree, hf_erf_mc_hdlc, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_hdlc_tree = proto_item_add_subtree(mc_hdlc_item, ett_erf_mc_hdlc); + mc_hdlc = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_cn, tvb, 0, 0, mc_hdlc); + proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res1, tvb, 0, 0, mc_hdlc); + proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res2, tvb, 0, 0, mc_hdlc); + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_fcse, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_FCSE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_checksum_error); + + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_sre, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_SRE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_short_error); + + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_lre, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_LRE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_long_error); + + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_afe, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_AFE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_abort_error); + + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_oe, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_OE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_octet_error); + + pi=proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_lbe, tvb, 0, 0, mc_hdlc); + if (mc_hdlc & MC_HDLC_LBE_MASK) + expert_add_info(pinfo, pi, &ei_erf_mc_hdlc_lost_byte_error); + + proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_first, tvb, 0, 0, mc_hdlc); + proto_tree_add_uint(mc_hdlc_tree, hf_erf_mc_hdlc_res3, tvb, 0, 0, mc_hdlc); } static void dissect_mc_raw_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_raw_item; - proto_tree *mc_raw_tree; - guint32 mc_raw; - - /* Multi Channel RAW Header */ - mc_raw_item = proto_tree_add_uint(tree, hf_erf_mc_raw, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_raw_tree = proto_item_add_subtree(mc_raw_item, ett_erf_mc_raw); - mc_raw = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_int, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res1, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_sre, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_lre, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res2, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_lbe, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_first, tvb, 0, 0, mc_raw); - proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res3, tvb, 0, 0, mc_raw); - } + proto_item *mc_raw_item; + proto_tree *mc_raw_tree; + guint32 mc_raw; + + /* Multi Channel RAW Header */ + mc_raw_item = proto_tree_add_uint(tree, hf_erf_mc_raw, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_raw_tree = proto_item_add_subtree(mc_raw_item, ett_erf_mc_raw); + mc_raw = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_int, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res1, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_sre, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_lre, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res2, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_lbe, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_first, tvb, 0, 0, mc_raw); + proto_tree_add_uint(mc_raw_tree, hf_erf_mc_raw_res3, tvb, 0, 0, mc_raw); } static void dissect_mc_atm_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_atm_item; - proto_tree *mc_atm_tree; - guint32 mc_atm; - - /*"Multi Channel ATM Header"*/ - mc_atm_item = proto_tree_add_uint(tree, hf_erf_mc_atm, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_atm_tree = proto_item_add_subtree(mc_atm_item, ett_erf_mc_atm); - mc_atm = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_cn, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res1, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_mul, tvb, 0, 0, mc_atm); - - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_port, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res2, tvb, 0, 0, mc_atm); - - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_lbe, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_hec, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_crc10, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_oamcell, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_first, tvb, 0, 0, mc_atm); - proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res3, tvb, 0, 0, mc_atm); - } + proto_item *mc_atm_item; + proto_tree *mc_atm_tree; + guint32 mc_atm; + + /*"Multi Channel ATM Header"*/ + mc_atm_item = proto_tree_add_uint(tree, hf_erf_mc_atm, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_atm_tree = proto_item_add_subtree(mc_atm_item, ett_erf_mc_atm); + mc_atm = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_cn, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res1, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_mul, tvb, 0, 0, mc_atm); + + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_port, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res2, tvb, 0, 0, mc_atm); + + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_lbe, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_hec, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_crc10, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_oamcell, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_first, tvb, 0, 0, mc_atm); + proto_tree_add_uint(mc_atm_tree, hf_erf_mc_atm_res3, tvb, 0, 0, mc_atm); } static void dissect_mc_rawlink_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_rawl_item; - proto_tree *mc_rawl_tree; - guint32 mc_rawl; - - /* Multi Channel RAW Link Header */ - mc_rawl_item = proto_tree_add_uint(tree, hf_erf_mc_rawl, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_rawl_tree = proto_item_add_subtree(mc_rawl_item, ett_erf_mc_rawlink); - mc_rawl = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_cn, tvb, 0, 0, mc_rawl); - proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_res1, tvb, 0, 0, mc_rawl); - proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_lbe, tvb, 0, 0, mc_rawl); - proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_first, tvb, 0, 0, mc_rawl); - proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_res2, tvb, 0, 0, mc_rawl); - } + proto_item *mc_rawl_item; + proto_tree *mc_rawl_tree; + guint32 mc_rawl; + + /* Multi Channel RAW Link Header */ + mc_rawl_item = proto_tree_add_uint(tree, hf_erf_mc_rawl, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_rawl_tree = proto_item_add_subtree(mc_rawl_item, ett_erf_mc_rawlink); + mc_rawl = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_cn, tvb, 0, 0, mc_rawl); + proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_res1, tvb, 0, 0, mc_rawl); + proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_lbe, tvb, 0, 0, mc_rawl); + proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_first, tvb, 0, 0, mc_rawl); + proto_tree_add_uint(mc_rawl_tree, hf_erf_mc_rawl_res2, tvb, 0, 0, mc_rawl); } static void dissect_mc_aal5_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_aal5_item; - proto_tree *mc_aal5_tree; - guint32 mc_aal5; - - /* Multi Channel AAL5 Header */ - mc_aal5_item = proto_tree_add_uint(tree, hf_erf_mc_aal5, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_aal5_tree = proto_item_add_subtree(mc_aal5_item, ett_erf_mc_aal5); - mc_aal5 = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_cn, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res1, tvb, 0, 0, mc_aal5); - - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_port, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_crcck, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_crce, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_lenck, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_lene, tvb, 0, 0, mc_aal5); - - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res2, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_first, tvb, 0, 0, mc_aal5); - proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res3, tvb, 0, 0, mc_aal5); - } + proto_item *mc_aal5_item; + proto_tree *mc_aal5_tree; + guint32 mc_aal5; + + /* Multi Channel AAL5 Header */ + mc_aal5_item = proto_tree_add_uint(tree, hf_erf_mc_aal5, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_aal5_tree = proto_item_add_subtree(mc_aal5_item, ett_erf_mc_aal5); + mc_aal5 = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_cn, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res1, tvb, 0, 0, mc_aal5); + + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_port, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_crcck, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_crce, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_lenck, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_lene, tvb, 0, 0, mc_aal5); + + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res2, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_first, tvb, 0, 0, mc_aal5); + proto_tree_add_uint(mc_aal5_tree, hf_erf_mc_aal5_res3, tvb, 0, 0, mc_aal5); } static void dissect_mc_aal2_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *mc_aal2_item; - proto_tree *mc_aal2_tree; - guint32 mc_aal2; - - /* Multi Channel AAL2 Header */ - mc_aal2_item = proto_tree_add_uint(tree, hf_erf_mc_aal2, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - mc_aal2_tree = proto_item_add_subtree(mc_aal2_item, ett_erf_mc_aal2); - mc_aal2 = pinfo->pseudo_header->erf.subhdr.mc_hdr; - - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_cn, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res1, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res2, tvb, 0, 0, mc_aal2); - - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_port, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res3, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_first, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_maale, tvb, 0, 0, mc_aal2); - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_lene, tvb, 0, 0, mc_aal2); - - proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_cid, tvb, 0, 0, mc_aal2); - } + proto_item *mc_aal2_item; + proto_tree *mc_aal2_tree; + guint32 mc_aal2; + + /* Multi Channel AAL2 Header */ + mc_aal2_item = proto_tree_add_uint(tree, hf_erf_mc_aal2, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + mc_aal2_tree = proto_item_add_subtree(mc_aal2_item, ett_erf_mc_aal2); + mc_aal2 = pinfo->pseudo_header->erf.subhdr.mc_hdr; + + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_cn, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res1, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res2, tvb, 0, 0, mc_aal2); + + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_port, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_res3, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_first, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_maale, tvb, 0, 0, mc_aal2); + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_lene, tvb, 0, 0, mc_aal2); + + proto_tree_add_uint(mc_aal2_tree, hf_erf_mc_aal2_cid, tvb, 0, 0, mc_aal2); } static void dissect_aal2_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *aal2_item; - proto_tree *aal2_tree; - guint32 aal2; + proto_item *aal2_item; + proto_tree *aal2_tree; + guint32 aal2; - /* AAL2 Header */ - aal2_item = proto_tree_add_uint(tree, hf_erf_aal2, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); - aal2_tree = proto_item_add_subtree(aal2_item, ett_erf_aal2); - aal2 = pinfo->pseudo_header->erf.subhdr.aal2_hdr; + /* AAL2 Header */ + aal2_item = proto_tree_add_uint(tree, hf_erf_aal2, tvb, 0, 0, pinfo->pseudo_header->erf.subhdr.mc_hdr); + aal2_tree = proto_item_add_subtree(aal2_item, ett_erf_aal2); + aal2 = pinfo->pseudo_header->erf.subhdr.aal2_hdr; - proto_tree_add_uint(aal2_tree, hf_erf_aal2_cid, tvb, 0, 0, aal2); + proto_tree_add_uint(aal2_tree, hf_erf_aal2_cid, tvb, 0, 0, aal2); - proto_tree_add_uint(aal2_tree, hf_erf_aal2_maale, tvb, 0, 0, aal2); + proto_tree_add_uint(aal2_tree, hf_erf_aal2_maale, tvb, 0, 0, aal2); - proto_tree_add_uint(aal2_tree, hf_erf_aal2_maalei, tvb, 0, 0, aal2); - proto_tree_add_uint(aal2_tree, hf_erf_aal2_first, tvb, 0, 0, aal2); - proto_tree_add_uint(aal2_tree, hf_erf_aal2_res1, tvb, 0, 0, aal2); - } + proto_tree_add_uint(aal2_tree, hf_erf_aal2_maalei, tvb, 0, 0, aal2); + proto_tree_add_uint(aal2_tree, hf_erf_aal2_first, tvb, 0, 0, aal2); + proto_tree_add_uint(aal2_tree, hf_erf_aal2_res1, tvb, 0, 0, aal2); } static void dissect_eth_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - if (tree) { - proto_item *eth_item; - proto_tree *eth_tree; - guint8 eth_offset, eth_pad; + proto_item *eth_item; + proto_tree *eth_tree; + guint8 eth_offset, eth_pad; - eth_item = proto_tree_add_item(tree, hf_erf_eth, tvb, 0, 0, ENC_NA); + eth_item = proto_tree_add_item(tree, hf_erf_eth, tvb, 0, 0, ENC_NA); - eth_tree = proto_item_add_subtree(eth_item, ett_erf_eth); - eth_offset = pinfo->pseudo_header->erf.subhdr.eth_hdr.offset; - eth_pad = pinfo->pseudo_header->erf.subhdr.eth_hdr.pad; + eth_tree = proto_item_add_subtree(eth_item, ett_erf_eth); + eth_offset = pinfo->pseudo_header->erf.subhdr.eth_hdr.offset; + eth_pad = pinfo->pseudo_header->erf.subhdr.eth_hdr.pad; - proto_tree_add_uint(eth_tree, hf_erf_eth_off, tvb, 0, 0, eth_offset); - proto_tree_add_uint(eth_tree, hf_erf_eth_pad, tvb, 0, 0, eth_pad); - } + proto_tree_add_uint(eth_tree, hf_erf_eth_off, tvb, 0, 0, eth_offset); + proto_tree_add_uint(eth_tree, hf_erf_eth_pad, tvb, 0, 0, eth_pad); } static void @@ -2168,6 +2211,7 @@ dissect_erf_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *pi; proto_item *flags_item, *rectype_item; proto_tree *flags_tree, *rectype_tree; + gboolean has_flags = FALSE; proto_tree_add_uint64(tree, hf_erf_ts, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.ts); @@ -2187,31 +2231,37 @@ dissect_erf_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) flags_item=proto_tree_add_uint(tree, hf_erf_flags, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); flags_tree = proto_item_add_subtree(flags_item, ett_erf_flags); - proto_tree_add_uint(flags_tree, hf_erf_flags_cap, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); - proto_item_append_text(flags_item, " (Capture Interface: %d", pinfo->pseudo_header->erf.phdr.flags & ERF_HDR_CAP_MASK); + proto_tree_add_uint(flags_tree, hf_erf_flags_if_raw, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); proto_tree_add_uint(flags_tree, hf_erf_flags_vlen, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); pi=proto_tree_add_uint(flags_tree, hf_erf_flags_trunc, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); if (pinfo->pseudo_header->erf.phdr.flags & ERF_HDR_TRUNC_MASK) { - proto_item_append_text(flags_item, "; ERF Truncation Error"); - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF Truncation Error"); + proto_item_append_text(flags_item, "(ERF Truncation Error"); + expert_add_info(pinfo, pi, &ei_erf_truncation_error); + has_flags = TRUE; } pi=proto_tree_add_uint(flags_tree, hf_erf_flags_rxe, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); if (pinfo->pseudo_header->erf.phdr.flags & ERF_HDR_RXE_MASK) { - proto_item_append_text(flags_item, "; ERF Rx Error"); - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF Rx Error"); + proto_item_append_text(flags_item, "%sERF Rx Error", has_flags ? "; " : "("); + expert_add_info(pinfo, pi, &ei_erf_rx_error); + has_flags = TRUE; } pi=proto_tree_add_uint(flags_tree, hf_erf_flags_dse, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); if (pinfo->pseudo_header->erf.phdr.flags & ERF_HDR_DSE_MASK) { - proto_item_append_text(flags_item, "; ERF DS Error"); - expert_add_info_format(pinfo, pi, &ei_erf_checksum_error, "ERF DS Error"); + proto_item_append_text(flags_item, "%sERF DS Error", has_flags ? "; " : "("); + expert_add_info(pinfo, pi, &ei_erf_ds_error); + has_flags = TRUE; + } + if (has_flags) { + proto_item_append_text(flags_item, ")"); } - proto_item_append_text(flags_item, ")"); proto_tree_add_uint(flags_tree, hf_erf_flags_res, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.flags); + proto_tree_add_uint(tree, hf_erf_flags_cap, tvb, 0, 0, erf_interface_id_from_flags(pinfo->pseudo_header->erf.phdr.flags)); + proto_tree_add_uint(tree, hf_erf_rlen, tvb, 0, 0, pinfo->pseudo_header->erf.phdr.rlen); if (erf_type_has_color(pinfo->pseudo_header->erf.phdr.type)) { @@ -2437,7 +2487,7 @@ dissect_meta_tag_ext_hdrs(proto_item *section_tree, tvbuff_t *tvb, int offset, g int i; guint32 ext_hdrs[4] = {0, 0, 0, 0}; int int_offset = 0; - int int_avail = MIN(taglength / 4, 4);; + int int_avail = MIN(taglength / 4, 4); int bit_offset = 0; int ext_hdr_num = 0; gboolean first = TRUE; @@ -2583,7 +2633,7 @@ meta_tag_expected_length(erf_meta_tag_info_t *tag_info) { break; default: - expected_length = ftype_length(ftype); /* Returns 0 if unknown */ + expected_length = ftype_wire_size(ftype); /* Returns 0 if unknown */ break; } @@ -2648,7 +2698,7 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int captured_length = (int) tvb_captured_length(tvb); /* Set column heading title*/ - col_set_str(pinfo->cinfo, COL_INFO, "Provenance Metadata Record"); + col_set_str(pinfo->cinfo, COL_INFO, "Provenance Metadata"); /* Go through the sections and their tags */ /* Not using tvb_captured_length because want to check for overrun */ @@ -2720,6 +2770,7 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { DISSECTOR_ASSERT(tag_info->extra); tagvalstring = val_to_str(tagtype, erf_to_value_string(erf_meta_index.vs_list), "Unknown Section (0x%x)"); + col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "%s", tagvalstring); section_tree = proto_tree_add_subtree(tree, tvb, offset, 0, tag_info->extra->ett_value, §ion_pi, tagvalstring); tag_tree = proto_tree_add_subtree_format(section_tree, tvb, offset, MIN(taglength + 4, remaining_len), tag_info->ett, &tag_pi, "Provenance %s Header", tagvalstring); @@ -2775,8 +2826,8 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { case ERF_META_TAG_if_speed: case ERF_META_TAG_if_tx_speed: value64 = tvb_get_ntoh64(tvb, offset + 4); - tmp = format_size((gint64) value64, (format_size_flags_e)(format_size_unit_bits_s|format_size_prefix_si)); - tag_pi = proto_tree_add_uint64_format_value(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, value64, "%s (%" G_GINT64_MODIFIER "u bps)", tmp, value64); + tmp = format_size((int64_t)value64, FORMAT_SIZE_UNIT_BITS_S, FORMAT_SIZE_PREFIX_SI); + tag_pi = proto_tree_add_uint64_format_value(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, value64, "%s (%" PRIu64 " bps)", tmp, value64); g_free(tmp); break; @@ -2806,8 +2857,8 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { case ERF_META_TAG_mem: value64 = tvb_get_ntoh64(tvb, offset + 4); - tmp = format_size((gint64) value64, (format_size_flags_e)(format_size_unit_bytes|format_size_prefix_iec)); - tag_pi = proto_tree_add_uint64_format_value(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, value64, "%s (%" G_GINT64_MODIFIER"u bytes)", tmp, value64); + tmp = format_size((int64_t)value64, FORMAT_SIZE_UNIT_BYTES, FORMAT_SIZE_PREFIX_IEC); + tag_pi = proto_tree_add_uint64_format_value(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, value64, "%s (%" PRIu64" bytes)", tmp, value64); g_free(tmp); break; @@ -2822,7 +2873,7 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { val_to_str(value32, erf_to_value_string(erf_meta_index.vs_list), "Unknown Section (%u)"), tvb_get_ntohs(tvb, offset + 4 + 2)); proto_tree_add_uint_format_value(tag_tree, tag_info->extra->hf_values[0], tvb, offset + 4, MIN(2, taglength), value32, "%s (%u)", - val_to_str(value32, erf_to_value_string(erf_meta_index.vs_abbrev_list), "Unknown"), value32); + val_to_str_const(value32, erf_to_value_string(erf_meta_index.vs_abbrev_list), "Unknown"), value32); proto_tree_add_item(tag_tree, tag_info->extra->hf_values[1], tvb, offset + 6, MIN(2, taglength - 2), ENC_BIG_ENDIAN); break; @@ -2852,7 +2903,7 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { case ERF_META_TAG_ns_host_ib_lid: case ERF_META_TAG_ns_host_fc_id: { - int addr_len = ftype_length(tag_ft); + int addr_len = ftype_wire_size(tag_ft); DISSECTOR_ASSERT(tag_info->extra); @@ -2920,11 +2971,11 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* If not special case, dissect generically from template */ if (!dissected) { - if (IS_FT_INT(tag_ft) || IS_FT_UINT(tag_ft)) { + if (FT_IS_INT(tag_ft) || FT_IS_UINT(tag_ft)) { tag_pi = proto_tree_add_item(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, ENC_BIG_ENDIAN); - } else if (IS_FT_STRING(tag_ft)) { + } else if (FT_IS_STRING(tag_ft)) { tag_pi = proto_tree_add_item(section_tree, tag_info->hf_value, tvb, offset + 4, taglength, ENC_UTF_8); - } else if (IS_FT_TIME(tag_ft)) { + } else if (FT_IS_TIME(tag_ft)) { /* * ERF timestamps are conveniently the same as NTP/PTP timestamps but * little endian. @@ -2964,7 +3015,7 @@ dissect_meta_record_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { * XXX: Formatting value manually because don't have erf_meta_vs_list * populated at registration time. */ - proto_tree_add_uint_format_value(tag_tree, hf_erf_meta_tag_type, tvb, offset, 2, tagtype, "%s (%u)", val_to_str(tagtype, erf_to_value_string(erf_meta_index.vs_abbrev_list), "Unknown"), tagtype); + proto_tree_add_uint_format_value(tag_tree, hf_erf_meta_tag_type, tvb, offset, 2, tagtype, "%s (%u)", val_to_str_const(tagtype, erf_to_value_string(erf_meta_index.vs_abbrev_list), "Unknown"), tagtype); proto_tree_add_uint(tag_tree, hf_erf_meta_tag_len, tvb, offset + 2, 2, taglength); /* Add truncated expertinfo if needed */ @@ -3317,7 +3368,10 @@ proto_register_erf(void) FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_erf_flags_cap, { "Capture interface", "erf.flags.cap", - FT_UINT8, BASE_DEC, NULL, ERF_HDR_CAP_MASK, NULL, HFILL } }, + FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_erf_flags_if_raw, + { "Raw interface", "erf.flags.if_raw", + FT_UINT8, BASE_HEX, NULL, ERF_HDR_CAP_MASK, NULL, HFILL } }, { &hf_erf_flags_vlen, { "Varying record length", "erf.flags.vlen", FT_UINT8, BASE_DEC, NULL, ERF_HDR_VLEN_MASK, NULL, HFILL } }, @@ -3332,7 +3386,7 @@ proto_register_erf(void) FT_UINT8, BASE_DEC, NULL, ERF_HDR_DSE_MASK, NULL, HFILL } }, { &hf_erf_flags_res, { "Reserved", "erf.flags.res", - FT_UINT8, BASE_HEX, NULL, ERF_HDR_RES_MASK, NULL, HFILL } }, + FT_UINT8, BASE_DEC, NULL, ERF_HDR_RES_MASK, NULL, HFILL } }, { &hf_erf_rlen, { "Record length", "erf.rlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, @@ -3457,7 +3511,13 @@ proto_register_erf(void) FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, { &hf_erf_ehdr_flow_id_hash_type, { "Hash Type", "erf.ehdr.flowid.hashtype", - FT_UINT8, BASE_HEX, VALS(erf_hash_type), 0, NULL, HFILL } }, + FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } }, + { &hf_erf_ehdr_flow_id_hash_type_type, + { "Type", "erf.ehdr.flowid.hashtype.type", + FT_UINT8, BASE_DEC, VALS(erf_hash_type), ERF_EHDR_FLOW_ID_HASH_TYPE_TYPE_MASK, NULL, HFILL } }, + { &hf_erf_ehdr_flow_id_hash_type_inner, + { "Hash is for Tunnel Inner", "erf.ehdr.flowid.hashtype.inner", + FT_UINT8, BASE_DEC, NULL, ERF_EHDR_FLOW_ID_HASH_TYPE_INNER_MASK, NULL, HFILL } }, { &hf_erf_ehdr_flow_id_stack_type, { "Stack Type", "erf.ehdr.flowid.stacktype", FT_UINT8, BASE_HEX, VALS(erf_stack_type), 0, NULL, HFILL } }, @@ -3770,6 +3830,7 @@ proto_register_erf(void) &ett_erf, &ett_erf_pseudo_hdr, &ett_erf_rectype, + &ett_erf_hash_type, &ett_erf_flags, &ett_erf_mc_hdlc, &ett_erf_mc_raw, @@ -3804,9 +3865,17 @@ proto_register_erf(void) }; static ei_register_info ei[] = { - { &ei_erf_checksum_error, { "erf.checksum.error", PI_CHECKSUM, PI_ERROR, "ERF MC FCS Error", EXPFILL }}, - { &ei_erf_packet_loss, { "erf.packet_loss", PI_SEQUENCE, PI_WARN, "Packet loss occurred between previous and current packet", EXPFILL }}, - { &ei_erf_extension_headers_not_shown, { "erf.ehdr.more_not_shown", PI_SEQUENCE, PI_WARN, "More extension headers were present, not shown", EXPFILL }}, + { &ei_erf_mc_hdlc_checksum_error, { "erf.mchdlc.checksum.error", PI_CHECKSUM, PI_ERROR, "ERF MC HDLC FCS Error", EXPFILL }}, + { &ei_erf_mc_hdlc_short_error, { "erf.mchdlc.short.error", PI_RECEIVE, PI_ERROR, "ERF MC HDLC Short Record Error, <5 bytes", EXPFILL }}, + { &ei_erf_mc_hdlc_long_error, { "erf.mchdlc.long.error", PI_RECEIVE, PI_ERROR, "ERF MC HDLC Long Record Error, >2047 bytes", EXPFILL }}, + { &ei_erf_mc_hdlc_abort_error, { "erf.mchdlc.abort.error", PI_RECEIVE, PI_ERROR, "ERF MC HDLC Aborted Frame Error", EXPFILL }}, + { &ei_erf_mc_hdlc_octet_error, { "erf.mchdlc.octet.error", PI_RECEIVE, PI_ERROR, "ERF MC HDLC Octet Error, the closing flag was not octet aligned after bit unstuffing", EXPFILL }}, + { &ei_erf_mc_hdlc_lost_byte_error, { "erf.mchdlc.lost_byte.error", PI_RECEIVE, PI_ERROR, "ERF MC HDLC Lost Byte Error", EXPFILL }}, + { &ei_erf_rx_error, { "erf.rx.error", PI_INTERFACE, PI_ERROR, "ERF RX Error", EXPFILL }}, + { &ei_erf_ds_error, { "erf.ds.error", PI_INTERFACE, PI_ERROR, "ERF DS Error", EXPFILL }}, + { &ei_erf_truncation_error, { "erf.truncation.error", PI_INTERFACE, PI_ERROR, "ERF Truncation Error", EXPFILL }}, + { &ei_erf_packet_loss, { "erf.packet_loss", PI_INTERFACE, PI_WARN, "Packet loss occurred between previous and current packet", EXPFILL }}, + { &ei_erf_extension_headers_not_shown, { "erf.ehdr.more_not_shown", PI_INTERFACE, PI_WARN, "More extension headers were present, not shown", EXPFILL }}, { &ei_erf_meta_section_len_error, { "erf.meta.section_len.error", PI_PROTOCOL, PI_ERROR, "Provenance Section Length incorrect", EXPFILL }}, { &ei_erf_meta_truncated_record, { "erf.meta.truncated_record", PI_MALFORMED, PI_ERROR, "Provenance truncated record", EXPFILL }}, { &ei_erf_meta_truncated_tag, { "erf.meta.truncated_tag", PI_PROTOCOL, PI_ERROR, "Provenance truncated tag", EXPFILL }}, |