/* * Function for AVP flags dissector. */ static void dissect_pana_avp_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset, guint16 flags) { static const int * flag_fields[] = { &hf_pana_avp_flag_v, NULL, }; proto_tree_add_bitmask_value_with_flags(parent_tree, tvb, offset, hf_pana_avp_flags, ett_pana_avp_flags, flag_fields, flags, BMT_NO_TFS|BMT_NO_FALSE); }
static void dissect_sita(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; guchar flags, signals, errors1, errors2, proto; const gchar *errors1_string, *errors2_string, *flags_string; proto_tree *sita_tree = NULL; proto_tree *sita_flags_tree = NULL; proto_tree *sita_errors1_tree = NULL; proto_tree *sita_errors2_tree = NULL; static const gchar *rx_errors1_str[] = {"Framing", "Parity", "Collision", "Long-frame", "Short-frame", "", "", "" }; static const gchar *rx_errors2_str[] = {"Non-Aligned", "Abort", "CD-lost", "DPLL", "Overrun", "Length", "CRC", "Break" }; #if 0 static const gchar *tx_errors1_str[] = {"", "", "", "", "", "", "", "" }; #endif static const gchar *tx_errors2_str[] = {"Underrun", "CTS-lost", "UART", "ReTx-limit", "", "", "", "" }; static const gchar *flags_str[] = {"", "", "", "", "", "", "", "No-buffers" }; static const int * signal_flags[] = { &hf_dcd, &hf_rts, &hf_cts, &hf_dtr, &hf_dsr, NULL }; col_clear(pinfo->cinfo, COL_PROTOCOL); /* erase the protocol */ col_clear(pinfo->cinfo, COL_INFO); /* and info columns so that the next decoder can fill them in */ flags = pinfo->pseudo_header->sita.sita_flags; signals = pinfo->pseudo_header->sita.sita_signals; errors1 = pinfo->pseudo_header->sita.sita_errors1; errors2 = pinfo->pseudo_header->sita.sita_errors2; proto = pinfo->pseudo_header->sita.sita_proto; if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) { col_set_str(pinfo->cinfo, COL_DEF_SRC, IOP); /* set the source (direction) column accordingly */ } else { col_set_str(pinfo->cinfo, COL_DEF_SRC, REMOTE); } col_set_str(pinfo->cinfo, COL_INFO, ""); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_sita, tvb, 0, 0, "Link Layer"); sita_tree = proto_item_add_subtree(ti, ett_sita); proto_tree_add_uint(sita_tree, hf_proto, tvb, 0, 0, proto); flags_string = format_flags_string(flags, flags_str); sita_flags_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_flags, NULL, "Flags: 0x%02x (From %s)%s%s", flags, ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_TXED) ? IOP : REMOTE, strlen(flags_string) ? ", " : "", flags_string); proto_tree_add_boolean(sita_flags_tree, hf_droppedframe, tvb, 0, 0, flags); proto_tree_add_boolean(sita_flags_tree, hf_dir, tvb, 0, 0, flags); proto_tree_add_bitmask_value_with_flags(sita_tree, tvb, 0, hf_signals, ett_sita_signals, signal_flags, signals, BMT_NO_FALSE|BMT_NO_TFS); if ((flags & SITA_FRAME_DIR) == SITA_FRAME_DIR_RXED) { errors1_string = format_flags_string(errors1, rx_errors1_str); sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors1, NULL, "Receive Status: 0x%02x %s", errors1, errors1_string); proto_tree_add_boolean(sita_errors1_tree, hf_shortframe, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_longframe, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_collision, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_parity, tvb, 0, 0, errors1); proto_tree_add_boolean(sita_errors1_tree, hf_framing, tvb, 0, 0, errors1); errors2_string = format_flags_string(errors2, rx_errors2_str); sita_errors2_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors2, NULL, "Receive Status: 0x%02x %s", errors2, errors2_string); proto_tree_add_boolean(sita_errors2_tree, hf_break, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_crc, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_length, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_overrun, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_rxdpll, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_lostcd, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_abort, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors2_tree, hf_nonaligned, tvb, 0, 0, errors2); } else { errors2_string = format_flags_string(errors2, tx_errors2_str); sita_errors1_tree = proto_tree_add_subtree_format(sita_tree, tvb, 0, 0, ett_sita_errors1, NULL, "Transmit Status: 0x%02x %s", errors2, errors2_string); proto_tree_add_boolean(sita_errors1_tree, hf_rtxlimit, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors1_tree, hf_uarterror, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors1_tree, hf_lostcts, tvb, 0, 0, errors2); proto_tree_add_boolean(sita_errors1_tree, hf_underrun, tvb, 0, 0, errors2); } } /* try to find and run an applicable dissector */ if (!dissector_try_uint(sita_dissector_table, pinfo->pseudo_header->sita.sita_proto, tvb, pinfo, tree)) { /* if one can't be found... tell them we don't know how to decode this protocol and give them the details then */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); col_add_fstr(pinfo->cinfo, COL_INFO, "IOP protocol number: %u", pinfo->pseudo_header->sita.sita_proto); call_dissector(data_handle, tvb, pinfo, tree); /* call the generic (hex display) decoder instead */ } }