From d68d0e88b4924a610b5cd2fd3a748b00c9bbab1a Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 13 Aug 2014 08:56:22 -0400 Subject: Eliminate proto_tree_add_text from some dissectors. Other minor cleanup while in the neighborhood. Change-Id: If73a029f564219782c313d4154c24c7ce7458b52 Reviewed-on: https://code.wireshark.org/review/3574 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-k12.c | 14 ++---- epan/dissectors/packet-kafka.c | 18 +++++-- epan/dissectors/packet-kingfisher.c | 12 ++--- epan/dissectors/packet-knet.c | 2 +- epan/dissectors/packet-lanforge.c | 6 --- epan/dissectors/packet-lapdm.c | 9 ++-- epan/dissectors/packet-lapsat.c | 8 ++- epan/dissectors/packet-lbmc.c | 10 ++-- epan/dissectors/packet-ldss.c | 19 +++++--- epan/dissectors/packet-lg8979.c | 32 ++++++------ epan/dissectors/packet-lge_monitor.c | 26 ++++++---- epan/dissectors/packet-llc.c | 75 ++++++++++++----------------- epan/dissectors/packet-lldp.c | 37 ++++++++------ epan/dissectors/packet-lon.c | 2 +- epan/dissectors/packet-loop.c | 33 +++++++------ epan/dissectors/packet-lpd.c | 83 ++++++++++++++++++-------------- epan/dissectors/packet-lwres.c | 33 ++++++++----- epan/dissectors/packet-m2pa.c | 12 +++-- epan/dissectors/packet-m2ua.c | 4 +- epan/dissectors/packet-m3ua.c | 9 ++-- epan/dissectors/packet-mac-lte.c | 7 ++- epan/dissectors/packet-mbtcp.c | 38 +++++++++++---- epan/dissectors/packet-mdshdr.c | 6 ++- epan/dissectors/packet-media.c | 16 ++++-- epan/dissectors/packet-mip.c | 13 ++++- epan/dissectors/packet-mmse.c | 35 ++++++++++---- epan/dissectors/packet-mp2t.c | 10 +++- epan/dissectors/packet-mp4ves.c | 36 +++++++++++--- epan/dissectors/packet-mpeg-descriptor.c | 13 +++-- epan/dissectors/packet-mrp-msrp.c | 13 ++++- epan/dissectors/packet-msdp.c | 41 +++++++++++----- epan/dissectors/packet-mtp2.c | 13 +++-- epan/dissectors/packet-mtp3.c | 10 ++-- epan/dissectors/packet-mtp3mg.c | 70 ++++++++++++++++----------- epan/dissectors/packet-roofnet.c | 2 +- 35 files changed, 473 insertions(+), 294 deletions(-) diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 6ea80c26a5..3e4ba9b45a 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -63,9 +63,9 @@ static int hf_k12_ts = -1; static gint ett_k12 = -1; static gint ett_port = -1; -static gint ett_stack_item = -1; static expert_field ei_k12_unmatched_stk_file = EI_INIT; +static expert_field ei_k12_unmatched_info = EI_INIT; static dissector_handle_t k12_handle; static dissector_handle_t data_handle; @@ -261,14 +261,8 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree) } if (handles == data_handles) { - proto_tree* stack_tree = proto_item_add_subtree(stack_item, ett_stack_item); - proto_item* item; - expert_add_info(pinfo, stack_item, &ei_k12_unmatched_stk_file); - - item = proto_tree_add_text(stack_tree,tvb,0,0, - "Info: You can edit the 'K12 Protocols' table from Preferences->Protocols->k12xx"); - PROTO_ITEM_SET_GENERATED(item); + expert_add_info(pinfo, stack_item, &ei_k12_unmatched_info); call_dissector(data_handle, tvb, pinfo, tree); return; @@ -432,12 +426,12 @@ proto_register_k12(void) static gint *ett[] = { &ett_k12, - &ett_port, - &ett_stack_item + &ett_port }; static ei_register_info ei[] = { { &ei_k12_unmatched_stk_file, { "k12.unmatched_stk_file", PI_UNDECODED, PI_WARN, "Warning: stk file not matched in the 'K12 Protocols' table", EXPFILL }}, + { &ei_k12_unmatched_info, { "k12.unmatched_info", PI_PROTOCOL, PI_NOTE, "You can edit the 'K12 Protocols' table from Preferences->Protocols->k12xx", EXPFILL }}, }; static uat_field_t uat_k12_flds[] = { diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c index 016582c12c..4e03cac2d3 100644 --- a/epan/dissectors/packet-kafka.c +++ b/epan/dissectors/packet-kafka.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -88,6 +89,8 @@ static gint ett_kafka_request_partition = -1; static gint ett_kafka_response_topic = -1; static gint ett_kafka_response_partition = -1; +static expert_field ei_kafka_message_decompress = EI_INIT; + static guint kafka_port = 0; #define KAFKA_PRODUCE 0 @@ -245,7 +248,7 @@ kafka_get_bytes(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int off static int dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int start_offset) { - proto_item *ti; + proto_item *ti, *decrypt_item; proto_tree *subtree; tvbuff_t *raw, *payload; int offset = start_offset; @@ -277,9 +280,8 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int s add_new_data_source(pinfo, payload, "Uncompressed Message"); dissect_kafka_message_set(payload, pinfo, subtree, 0, FALSE); } else { - /* TODO make this an expert item */ - proto_tree_add_text(subtree, tvb, 0, tvb_length(raw), "[Failed to decompress message!]"); - proto_tree_add_item(subtree, hf_kafka_message_value, raw, 0, -1, ENC_NA); + decrypt_item = proto_tree_add_item(subtree, hf_kafka_message_value, raw, 0, -1, ENC_NA); + expert_add_info(pinfo, decrypt_item, &ei_kafka_message_decompress); } offset += tvb_length(raw); } @@ -1228,11 +1230,19 @@ proto_register_kafka(void) &ett_kafka_response_partition }; + static ei_register_info ei[] = { + { &ei_kafka_message_decompress, { "kafka.decompress_failed", PI_UNDECODED, PI_WARN, "Failed to decompress message", EXPFILL }}, + }; + + expert_module_t* expert_kafka; + proto_kafka = proto_register_protocol("Kafka", "Kafka", "kafka"); proto_register_field_array(proto_kafka, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_kafka = expert_register_protocol(proto_kafka); + expert_register_field_array(expert_kafka, ei, array_length(ei)); kafka_module = prefs_register_protocol(proto_kafka, proto_reg_handoff_kafka); diff --git a/epan/dissectors/packet-kingfisher.c b/epan/dissectors/packet-kingfisher.c index 2235bf9cd3..80d3b3bc35 100644 --- a/epan/dissectors/packet-kingfisher.c +++ b/epan/dissectors/packet-kingfisher.c @@ -51,6 +51,7 @@ static int hf_kingfisher_via = -1; static int hf_kingfisher_message = -1; static int hf_kingfisher_function = -1; static int hf_kingfisher_checksum = -1; +static int hf_kingfisher_message_data = -1; static dissector_handle_t kingfisher_conv_handle; @@ -183,7 +184,7 @@ static gboolean dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_conv_dissector) { kingfisher_packet_t kfp; - proto_tree *kingfisher_tree=NULL; + proto_tree *kingfisher_tree; proto_item *item=NULL; const char *func_string = NULL; unsigned short checksum; @@ -269,10 +270,8 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean message = (kfp.message & 0x0f) | ((kfp.message & 0xf0) >> 4); - if(tree){ - item = proto_tree_add_protocol_format(tree, proto_kingfisher, tvb, 0, -1, "Kingfisher Protocol, From RTU: %d, Target RTU: %d", kfp.from, kfp.target ); - kingfisher_tree = proto_item_add_subtree( item, ett_kingfisher ); - } + item = proto_tree_add_protocol_format(tree, proto_kingfisher, tvb, 0, -1, "Kingfisher Protocol, From RTU: %d, Target RTU: %d", kfp.from, kfp.target ); + kingfisher_tree = proto_item_add_subtree( item, ett_kingfisher ); /* version */ proto_tree_add_uint(kingfisher_tree, hf_kingfisher_version, tvb, 6, 1, kfp.version); @@ -300,7 +299,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean /* message data */ if(kfp.length > ((kfp.version==3)?11:8)){ - proto_tree_add_text(kingfisher_tree, tvb, ((kfp.version==3)?10:7), kfp.length - ((kfp.version==3)?11:8), "Message Data"); + proto_tree_add_item(kingfisher_tree, hf_kingfisher_message_data, tvb, ((kfp.version==3)?10:7), kfp.length - ((kfp.version==3)?11:8), ENC_NA); } /* checksum */ @@ -355,6 +354,7 @@ proto_register_kingfisher( void ) { &hf_kingfisher_message, { "Message Number", "kingfisher.message", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_kingfisher_function, { "Function Code", "kingfisher.function", FT_UINT8, BASE_DEC, VALS( function_code_vals ), 0x0, NULL, HFILL } }, { &hf_kingfisher_checksum, { "Checksum", "kingfisher.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_kingfisher_message_data, { "Message Data", "kingfisher.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-knet.c b/epan/dissectors/packet-knet.c index 1081fd59e1..bff29425cc 100644 --- a/epan/dissectors/packet-knet.c +++ b/epan/dissectors/packet-knet.c @@ -438,7 +438,7 @@ dissect_payload(tvbuff_t *buffer, int offset, int messageid, proto_tree *tree, i break; case DISCONNECT: /*No payload*/ case DISCONNECTACK: /*No payload*/ - proto_tree_add_text(payload_tree, buffer, offset, 0, "No Payload"); + proto_tree_add_bytes_format(payload_tree, hf_knet_payload, buffer, offset, 0, NULL, "No Payload"); break; case CONNECTSYN: /*TODO: Not yet implemented, implement when available*/ case CONNECTSYNACK: /*TODO: Not yet implemented, implement when available*/ diff --git a/epan/dissectors/packet-lanforge.c b/epan/dissectors/packet-lanforge.c index f214081e6e..cb7a22e4ac 100644 --- a/epan/dissectors/packet-lanforge.c +++ b/epan/dissectors/packet-lanforge.c @@ -149,15 +149,9 @@ static gboolean dissect_lanforge(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_tree_add_time(lanforge_tree, hf_lanforge_timestamp, tvb, offset - 8, 8, &tstamp); -#if 0 - if(tvb_reported_length_remaining(tvb, offset) > 0) /* random data */ - proto_tree_add_text(lanforge_tree, tvb, offset, -1, "Data (%u bytes)", - tvb_length_remaining(tvb, offset)); -#else if(tvb_reported_length_remaining(tvb, offset) > 0) /* random data */ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, lanforge_tree); -#endif } return TRUE; diff --git a/epan/dissectors/packet-lapdm.c b/epan/dissectors/packet-lapdm.c index 7a5692d808..9f84d03d3e 100644 --- a/epan/dissectors/packet-lapdm.c +++ b/epan/dissectors/packet-lapdm.c @@ -86,6 +86,7 @@ static int hf_lapdm_len = -1; /* * LAPDm fragment handling */ +static int hf_lapdm_fragment_data = -1; static int hf_lapdm_fragments = -1; static int hf_lapdm_fragment = -1; static int hf_lapdm_fragment_overlap = -1; @@ -322,9 +323,7 @@ dissect_lapdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { col_append_str(pinfo->cinfo, COL_INFO, " (Fragment)"); - if (tree) { - proto_tree_add_text(lapdm_tree, payload, 0, -1, "Fragment Data"); - } + proto_tree_add_item(lapdm_tree, hf_lapdm_fragment_data, payload, 0, -1, ENC_NA); } /* Now reset fragmentation information in pinfo @@ -425,6 +424,10 @@ proto_register_lapdm(void) /* Fragment reassembly */ + { &hf_lapdm_fragment_data, + { "Fragment Data", "lapdm.fragment_data", FT_NONE, BASE_NONE, + NULL, 0x00, NULL, HFILL }}, + { &hf_lapdm_fragments, { "Message fragments", "lapdm.fragments", FT_NONE, BASE_NONE, NULL, 0x00, "LAPDm Message fragments", HFILL }}, diff --git a/epan/dissectors/packet-lapsat.c b/epan/dissectors/packet-lapsat.c index acf36b5753..62830abd5b 100644 --- a/epan/dissectors/packet-lapsat.c +++ b/epan/dissectors/packet-lapsat.c @@ -79,6 +79,7 @@ static int hf_lapsat_payload_last_nibble = -1; static int hf_lapsat_len = -1; +static int hf_lapsat_fragment_data = -1; static int hf_lapsat_fragments = -1; static int hf_lapsat_fragment = -1; static int hf_lapsat_fragment_overlap = -1; @@ -558,7 +559,7 @@ dissect_lapsat(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else { /* No, just add infos */ col_append_str(pinfo->cinfo, COL_INFO, " (Fragment)"); - proto_tree_add_text(lapsat_tree, payload, 0, -1, "Fragment Data"); + proto_tree_add_item(lapsat_tree, hf_lapsat_fragment_data, payload, 0, -1, ENC_NA); } /* Now reset fragmentation information in pinfo */ @@ -687,6 +688,11 @@ proto_register_lapsat(void) }, /* Fragment reassembly */ + { &hf_lapsat_fragment_data, + { "Fragment Data", "lapsat.fragment_data", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL } + }, { &hf_lapsat_fragments, { "Message fragments", "lapsat.fragments", FT_NONE, BASE_NONE, NULL, 0x00, diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c index 0d023cc36e..56efbf140c 100644 --- a/epan/dissectors/packet-lbmc.c +++ b/epan/dissectors/packet-lbmc.c @@ -11546,19 +11546,17 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr } else { - proto_item * pi = NULL; + proto_item * pi; if (msg->reassembled_frame == 0) { - expert_add_info(pinfo, NULL, &ei_lbmc_analysis_missing_reassembly_frame); - pi = proto_tree_add_text(subtree, data_tvb, 0, tvb_reported_length_remaining(data_tvb, 0), - "Message not reassembled - reassembly data missing from capture"); + proto_tree_add_expert(subtree, pinfo, &ei_lbmc_analysis_missing_reassembly_frame, data_tvb, 0, -1); } else { pi = proto_tree_add_uint(subtree, hf_reassembly_frame, data_tvb, 0, tvb_reported_length_remaining(data_tvb, 0), msg->reassembled_frame); + PROTO_ITEM_SET_GENERATED(pi); } - PROTO_ITEM_SET_GENERATED(pi); } } @@ -14316,7 +14314,7 @@ void proto_register_lbmc(void) { &ei_lbmc_analysis_invalid_value, { "lbmc.analysis.invalid_value", PI_MALFORMED, PI_ERROR, "Invalid value", EXPFILL } }, { &ei_lbmc_analysis_no_reassembly, { "lbmc.analysis.no_reassembly", PI_PROTOCOL, PI_ERROR, "Reassembly not in progress but fragment_offset not zero", EXPFILL } }, { &ei_lbmc_analysis_invalid_offset, { "lbmc.analysis.invalid_offset", PI_MALFORMED, PI_ERROR, "Message property offset exceeds data length", EXPFILL } }, - { &ei_lbmc_analysis_missing_reassembly_frame, { "lbmc.analysis.missing_reassembly_frame", PI_UNDECODED, PI_WARN, "Reassembly frame not found - perhaps missing packets?", EXPFILL } }, + { &ei_lbmc_analysis_missing_reassembly_frame, { "lbmc.analysis.missing_reassembly_frame", PI_UNDECODED, PI_WARN, "Message not reassembled - reassembly data missing from capture", EXPFILL } }, { &ei_lbmc_analysis_invalid_fragment, { "lbmc.analysis.invalid_fragment", PI_MALFORMED, PI_ERROR, "Invalid fragment", EXPFILL } }, }; module_t * lbmc_module = NULL; diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c index b96a0599f9..8b5ba4d1cb 100644 --- a/epan/dissectors/packet-ldss.c +++ b/epan/dissectors/packet-ldss.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -204,6 +205,9 @@ static int ett_ldss_broadcast = -1; static int ett_ldss_transfer = -1; static int ett_ldss_transfer_req = -1; +static expert_field ei_ldss_unrecognized_line = EI_INIT; + + static dissector_handle_t ldss_udp_handle; static dissector_handle_t ldss_tcp_handle; @@ -458,7 +462,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void conversation_t *transfer_conv; ldss_transfer_info_t *transfer_info; struct tcpinfo *transfer_tcpinfo; - proto_tree *ti, *line_tree = NULL, *ldss_tree = NULL; + proto_tree *ti, *line_tree = NULL, *ldss_tree = NULL; nstime_t broadcast_response_time; /* Reject the packet if data is NULL */ @@ -587,11 +591,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void } } else { - if (tree) { - ti = proto_tree_add_text(line_tree, tvb, offset, linelen, - "Unrecognized line ignored"); - PROTO_ITEM_SET_GENERATED(ti); - } + proto_tree_add_expert(line_tree, pinfo, &ei_ldss_unrecognized_line, tvb, offset, linelen); } if (is_digest_line) { @@ -970,11 +970,18 @@ proto_register_ldss (void) { static gint *ett[] = { &ett_ldss_broadcast, &ett_ldss_transfer, &ett_ldss_transfer_req }; + static ei_register_info ei[] = { + { &ei_ldss_unrecognized_line, { "ldss.unrecognized_line", PI_PROTOCOL, PI_WARN, "Unrecognized line ignored", EXPFILL }}, + }; + module_t *ldss_module; + expert_module_t* expert_ldss; proto_ldss = proto_register_protocol("Local Download Sharing Service", "LDSS", "ldss"); proto_register_field_array(proto_ldss, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ldss = expert_register_protocol(proto_ldss); + expert_register_field_array(expert_ldss, ei, array_length(ei)); ldss_module = prefs_register_protocol( proto_ldss, proto_reg_handoff_ldss); prefs_register_uint_preference( ldss_module, "udp_port", diff --git a/epan/dissectors/packet-lg8979.c b/epan/dissectors/packet-lg8979.c index 255de063ac..5c3d228317 100644 --- a/epan/dissectors/packet-lg8979.c +++ b/epan/dissectors/packet-lg8979.c @@ -140,6 +140,7 @@ static int hf_lg8979_timebias_proctime = -1; static int hf_lg8979_firmware_ver = -1; static int hf_lg8979_exprpt_code = -1; static int hf_lg8979_exprpt_parm = -1; +static int hf_lg8979_disallowed_func = -1; static int hf_lg8979_crc16 = -1; /* Initialize the subtree pointers */ @@ -497,11 +498,11 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ { /* Set up structures needed to add the protocol subtree and manage it */ proto_item *lg8979_item, *lg8979_flags_item = NULL, *lg8979_point_item = NULL; - proto_item *lg8979_ts_item = NULL, *lg8979_slot_item = NULL, *lg8979_expparm_item = NULL; + proto_item *lg8979_slot_item = NULL; proto_tree *lg8979_tree, *lg8979_flags_tree = NULL, *lg8979_fc_tree = NULL; proto_tree *lg8979_point_tree = NULL, *lg8979_ts_tree = NULL; int offset = 0; - guint8 rtu_addr, func, packet_type, data_len, ptnum8, tripclose, rl, exp_code, exp_parm; + guint8 rtu_addr, func, packet_type, data_len, ptnum8, tripclose, rl, exp_code; guint8 ts_mon, ts_day, ts_hr, ts_min, ts_sec; guint16 ptnum, ptval, ana12_val; guint16 ts_ms; @@ -677,10 +678,9 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ ts_sec = tvb_get_guint8(tvb, offset+4); ts_ms = tvb_get_letohs(tvb, offset+5); - lg8979_ts_item = proto_tree_add_text(lg8979_tree, tvb, offset, 7, - "Time-Sync Value: %02d/%02d %02d:%02d:%02d.%03d", - ts_mon, ts_day, ts_hr, ts_min, ts_sec, ts_ms); - lg8979_ts_tree = proto_item_add_subtree(lg8979_ts_item, ett_lg8979_ts); + lg8979_ts_tree = proto_tree_add_subtree_format(lg8979_tree, tvb, offset, 7, ett_lg8979_ts, NULL, + "Time-Sync Value: %02d/%02d %02d:%02d:%02d.%03d", + ts_mon, ts_day, ts_hr, ts_min, ts_sec, ts_ms); proto_tree_add_item(lg8979_ts_tree, hf_lg8979_timesync_mon, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(lg8979_ts_tree, hf_lg8979_timesync_day, tvb, offset+1, 1, ENC_LITTLE_ENDIAN); @@ -1114,10 +1114,8 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ ts_sec = tvb_get_guint8(tvb, offset+4); ts_ms = tvb_get_letohs(tvb, offset+5); - lg8979_ts_item = proto_tree_add_text(lg8979_point_tree, tvb, offset, 7, - "SOE Time Stamp: [%02d/%02d %02d:%02d:%02d.%03d]", - ts_mon, ts_day, ts_hr, ts_min, ts_sec, ts_ms); - lg8979_ts_tree = proto_item_add_subtree(lg8979_ts_item, ett_lg8979_ts); + lg8979_ts_tree = proto_tree_add_subtree_format(lg8979_point_tree, tvb, offset, 7, ett_lg8979_ts, NULL, + "SOE Time Stamp: [%02d/%02d %02d:%02d:%02d.%03d]", ts_mon, ts_day, ts_hr, ts_min, ts_sec, ts_ms); proto_tree_add_item(lg8979_ts_tree, hf_lg8979_soe_logchg_mon, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(lg8979_ts_tree, hf_lg8979_soe_logchg_day, tvb, offset+1, 1, ENC_LITTLE_ENDIAN); @@ -1170,17 +1168,13 @@ dissect_lg8979(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ case LG8979_FC_EXP_RPT: exp_code = tvb_get_guint8(tvb, offset); - exp_parm = tvb_get_guint8(tvb, offset+1); proto_tree_add_item(lg8979_tree, hf_lg8979_exprpt_code, tvb, offset, 1, ENC_LITTLE_ENDIAN); - lg8979_expparm_item = proto_tree_add_item(lg8979_tree, hf_lg8979_exprpt_parm, tvb, offset+1, 1, ENC_LITTLE_ENDIAN); - proto_item_prepend_text(lg8979_expparm_item, "Parameter: %s, ", - val_to_str_const(exp_code, lg8979_exprpt_parm_vals, "Unknown Parameters")); + proto_tree_add_item(lg8979_tree, hf_lg8979_exprpt_parm, tvb, offset+1, 1, ENC_LITTLE_ENDIAN); /* Function code lookup, if required */ if (exp_code == 14) { - proto_item *lg8979_dfc_item=NULL; - lg8979_dfc_item = proto_tree_add_text(lg8979_tree, tvb, offset+1, 1, "Disallowed Function Code: %s", - val_to_str_const(exp_parm, lg8979_funccode_vals, "Unknown Function Code")); + proto_item *lg8979_dfc_item; + lg8979_dfc_item = proto_tree_add_item(lg8979_tree, hf_lg8979_disallowed_func, tvb, offset+1, 1, ENC_NA); PROTO_ITEM_SET_GENERATED(lg8979_dfc_item); } @@ -1483,7 +1477,9 @@ proto_register_lg8979(void) { &hf_lg8979_exprpt_code, { "Exception Report Code", "lg8979.exprpt_code", FT_UINT8, BASE_DEC, VALS(lg8979_exprpt_code_vals), 0x0, NULL, HFILL }}, { &hf_lg8979_exprpt_parm, - { "Value", "lg8979.exprpt_parm", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { "Value", "lg8979.exprpt_parm", FT_UINT8, BASE_DEC, VALS(lg8979_exprpt_parm_vals), 0x0, NULL, HFILL }}, + { &hf_lg8979_disallowed_func, + { "Disallowed Function Code", "lg8979.disallowed_func", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &lg8979_funccode_vals_ext, 0x0, NULL, HFILL }}, { &hf_lg8979_crc16, { "CRC-16", "lg8979.crc16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-lge_monitor.c b/epan/dissectors/packet-lge_monitor.c index 67f40aae3a..418a7a9356 100644 --- a/epan/dissectors/packet-lge_monitor.c +++ b/epan/dissectors/packet-lge_monitor.c @@ -39,10 +39,11 @@ static int proto_lge_monitor = -1; static int hf_lge_monitor_dir = -1; static int hf_lge_monitor_prot = -1; static int hf_lge_monitor_length = -1; +static int hf_lge_monitor_data = -1; /* Initialize the subtree pointers */ static int ett_lge_monitor = -1; - +static int ett_lge_header = -1; static guint LGEMonitorUDPPort = 0; static dissector_handle_t mtp3_handle, m3ua_handle, sccp_handle, sctp_handle; @@ -70,6 +71,7 @@ dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int offset = 0; guint32 lge_monitor_proto_id; tvbuff_t* next_tvb = NULL; + proto_tree* header_tree; /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; @@ -81,14 +83,14 @@ dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(tree, proto_lge_monitor, tvb, 0, LGEMON_PROTO_HEADER_LENGTH, ENC_NA); lge_monitor_tree = proto_item_add_subtree(ti, ett_lge_monitor); - proto_tree_add_text(lge_monitor_tree, tvb, offset, LGEMON_PROTO_HEADER_LENGTH, "LGE Monitor PDU"); - proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_dir, tvb, offset, 4, ENC_BIG_ENDIAN); - offset = offset +4; + header_tree = proto_tree_add_subtree(lge_monitor_tree, tvb, offset, LGEMON_PROTO_HEADER_LENGTH, ett_lge_header, NULL, "LGE Monitor PDU"); + proto_tree_add_item(header_tree, hf_lge_monitor_dir, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; lge_monitor_proto_id = tvb_get_ntohl(tvb,offset); - proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_prot, tvb, offset, 4, ENC_BIG_ENDIAN); - offset = offset +4; - proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_length, tvb, offset, 4, ENC_BIG_ENDIAN); - offset = offset +4; + proto_tree_add_item(header_tree, hf_lge_monitor_prot, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; + proto_tree_add_item(header_tree, hf_lge_monitor_length, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; next_tvb = tvb_new_subset_remaining(tvb, offset); @@ -106,7 +108,7 @@ dissect_lge_monitor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) call_dissector(m3ua_handle, next_tvb, pinfo, tree); return; default: - proto_tree_add_text(lge_monitor_tree, tvb, offset, -1, "LGE Monitor data"); + proto_tree_add_item(lge_monitor_tree, hf_lge_monitor_data, tvb, offset, -1, ENC_NA); break; } return; @@ -164,11 +166,17 @@ proto_register_lge_monitor(void) FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_lge_monitor_data, + { "LGE Monitor data", "lge_monitor.monitor_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; /* Setup protocol subtree array */ static gint *ett[] = { &ett_lge_monitor, + &ett_lge_header }; /* Register the protocol name and description */ diff --git a/epan/dissectors/packet-llc.c b/epan/dissectors/packet-llc.c index 225f0d15ec..dac0ec26b9 100644 --- a/epan/dissectors/packet-llc.c +++ b/epan/dissectors/packet-llc.c @@ -60,7 +60,9 @@ void proto_reg_handoff_llc(void); static int proto_llc = -1; static int hf_llc_dsap = -1; static int hf_llc_ssap = -1; +static int hf_llc_dsap_sap = -1; static int hf_llc_dsap_ig = -1; +static int hf_llc_ssap_sap = -1; static int hf_llc_ssap_cr = -1; static int hf_llc_ctrl = -1; static int hf_llc_n_r = -1; @@ -216,25 +218,15 @@ static GHashTable *oui_info_table = NULL; * proto_tree_add_... function to display the topmost 7 bits of the SAP * value as a bitfield produces incorrect results (while the bitfield is * displayed correctly, Wireshark uses the bitshifted value to display the - * associated name and for filtering purposes). This function calls the - * Wireshark routine to decode the SAP value as a bitfield into a given - * string without performing any bitshift of the original value. - * - * The string passed to this function must be of ITEM_LABEL_LENGTH size. - * The SAP value passed to this function must be complete (not masked). - * + * associated name and for filtering purposes). This function calls a + * BASE_CUSTOM routine to decode the SAP value as a bitfield + * counter-balancing the bitshift of the original value. */ -static gchar * -decode_sap_value_as_bitfield(gchar *buffer, guint32 sap) -{ - char *p; - - memset (buffer, '\0', ITEM_LABEL_LENGTH); - p = decode_bitfield_value (buffer, sap, SAP_MASK, 8); - g_snprintf(p, (gulong)(ITEM_LABEL_LENGTH-strlen(buffer)-1), "SAP: %s", - val_to_str_const(sap, sap_vals, "Unknown")); - return buffer; +static void +llc_sap_value( gchar *result, guint32 sap ) +{ + g_snprintf( result, ITEM_LABEL_LENGTH, "%s", val_to_str_const(sap<<1, sap_vals, "Unknown")); } /* @@ -440,9 +432,9 @@ dissect_basicxid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *llc_tree = NULL; - proto_tree *field_tree = NULL; - proto_item *ti = NULL; + proto_tree *llc_tree; + proto_tree *field_tree; + proto_item *ti, *sap_item; int is_snap; guint16 control; int llc_header_len; @@ -453,32 +445,19 @@ dissect_llc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); dsap = tvb_get_guint8(tvb, 0); - if (tree) { - proto_item *dsap_item; - gchar label[ITEM_LABEL_LENGTH]; - - ti = proto_tree_add_item(tree, proto_llc, tvb, 0, -1, ENC_NA); - llc_tree = proto_item_add_subtree(ti, ett_llc); - dsap_item = proto_tree_add_item(llc_tree, hf_llc_dsap, tvb, 0, 1, ENC_NA); - field_tree = proto_item_add_subtree(dsap_item, ett_llc_dsap); - proto_tree_add_text(field_tree, tvb, 0, 1, "%s", - decode_sap_value_as_bitfield(label, dsap)); - proto_tree_add_item(field_tree, hf_llc_dsap_ig, tvb, 0, 1, ENC_NA); - } else - llc_tree = NULL; + + ti = proto_tree_add_item(tree, proto_llc, tvb, 0, -1, ENC_NA); + llc_tree = proto_item_add_subtree(ti, ett_llc); + sap_item = proto_tree_add_item(llc_tree, hf_llc_dsap, tvb, 0, 1, ENC_NA); + field_tree = proto_item_add_subtree(sap_item, ett_llc_dsap); + proto_tree_add_item(field_tree, hf_llc_dsap_sap, tvb, 0, 1, ENC_NA); + proto_tree_add_item(field_tree, hf_llc_dsap_ig, tvb, 0, 1, ENC_NA); ssap = tvb_get_guint8(tvb, 1); - if (tree) { - proto_item *ssap_item; - gchar label[ITEM_LABEL_LENGTH]; - - ssap_item = proto_tree_add_item(llc_tree, hf_llc_ssap, tvb, 1, 1, ENC_NA); - field_tree = proto_item_add_subtree(ssap_item, ett_llc_ssap); - proto_tree_add_text(field_tree, tvb, 1, 1, "%s", - decode_sap_value_as_bitfield(label, ssap)); - proto_tree_add_item(field_tree, hf_llc_ssap_cr, tvb, 1, 1, ENC_NA); - } else - llc_tree = NULL; + sap_item = proto_tree_add_item(llc_tree, hf_llc_ssap, tvb, 1, 1, ENC_NA); + field_tree = proto_item_add_subtree(sap_item, ett_llc_ssap); + proto_tree_add_item(field_tree, hf_llc_ssap_sap, tvb, 1, 1, ENC_NA); + proto_tree_add_item(field_tree, hf_llc_ssap_cr, tvb, 1, 1, ENC_NA); is_snap = (dsap == SAP_SNAP) && (ssap == SAP_SNAP); llc_header_len = 2; /* DSAP + SSAP */ @@ -783,6 +762,10 @@ proto_register_llc(void) { "DSAP", "llc.dsap", FT_UINT8, BASE_HEX, VALS(sap_vals), 0x0, "Destination Service Access Point", HFILL }}, + { &hf_llc_dsap_sap, + { "SAP", "llc.dsap.sap", FT_UINT8, BASE_CUSTOM, + llc_sap_value, 0xFE, "Service Access Point", HFILL }}, + { &hf_llc_dsap_ig, { "IG Bit", "llc.dsap.ig", FT_BOOLEAN, 8, TFS(&ig_bit), DSAP_GI_BIT, "Individual/Group", HFILL }}, @@ -791,6 +774,10 @@ proto_register_llc(void) { "SSAP", "llc.ssap", FT_UINT8, BASE_HEX, VALS(sap_vals), 0x0, "Source Service Access Point", HFILL }}, + { &hf_llc_ssap_sap, + { "SAP", "llc.ssap.sap", FT_UINT8, BASE_CUSTOM, + llc_sap_value, 0xFE, "Service Access Point", HFILL }}, + { &hf_llc_ssap_cr, { "CR Bit", "llc.ssap.cr", FT_BOOLEAN, 8, TFS(&cr_bit), SSAP_CR_BIT, "Command/Response", HFILL }}, diff --git a/epan/dissectors/packet-lldp.c b/epan/dissectors/packet-lldp.c index c1fd099157..be87323c86 100644 --- a/epan/dissectors/packet-lldp.c +++ b/epan/dissectors/packet-lldp.c @@ -101,6 +101,7 @@ static int hf_dcbx_feature_flag_enabled = -1; static int hf_dcbx_feature_flag_error = -1; static int hf_dcbx_feature_flag_willing = -1; static int hf_dcbx_feature_subtype = -1; +static int hf_dcbx_feature_pgid_reserved = -1; static int hf_dcbx_feature_pgid_prio_0 = -1; static int hf_dcbx_feature_pgid_prio_1 = -1; static int hf_dcbx_feature_pgid_prio_2 = -1; @@ -172,6 +173,7 @@ static int hf_ieee_8021az_tsa_class6 = -1; static int hf_ieee_8021az_tsa_class7 = -1; static int hf_ieee_8021az_feature_flag_mbc = -1; static int hf_ieee_8021az_pfc_numtcs = -1; +static int hf_ieee_8021az_app_reserved = -1; static int hf_ieee_8021az_app_prio = -1; static int hf_ieee_8021az_app_selector = -1; static int hf_ieee_802_3_subtype = -1; @@ -1544,7 +1546,6 @@ dissect_dcbx_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint3 proto_tree *subtlv_tree = NULL; proto_tree *apptlv_tree = NULL; - proto_item *tf = NULL; proto_tree_add_item(tree, hf_dcbx_type, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1560,25 +1561,27 @@ dissect_dcbx_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint3 dataLen = TLV_INFO_LEN(tempShort); /* Write out common header fields first */ - tf = proto_tree_add_text(tree, tvb, offset, dataLen + 2, "%s TLV", - val_to_str_const(subType, dcbx_subtypes, "Unknown")); - switch (subType) { case 0x1: /* Control */ - subtlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cee_1); + subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2, + ett_org_spc_dcbx_cee_1, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown")); break; case 0x2: /* Priority Groups */ - subtlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cee_2); + subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2, + ett_org_spc_dcbx_cee_2, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown")); break; case 0x3: /* PFC */ - subtlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cee_3); + subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2, + ett_org_spc_dcbx_cee_3, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown")); break; case 0x4: /* Application */ - subtlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cee_4); + subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2, + ett_org_spc_dcbx_cee_4, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown")); break; case 0x6: /* Logical Link Down */ - subtlv_tree = proto_item_add_subtree(tf, ett_org_spc_dcbx_cin_6); + subtlv_tree = proto_tree_add_subtree_format(tree, tvb, offset, dataLen + 2, + ett_org_spc_dcbx_cin_6, NULL, "%s TLV", val_to_str_const(subType, dcbx_subtypes, "Unknown")); break; } proto_tree_add_item(subtlv_tree, hf_dcbx_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -1948,9 +1951,7 @@ dissect_ieee_802_1_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } case 0xA: /* ETS Recommendation */ { - tempByte = tvb_get_guint8(tvb, offset); - - proto_tree_add_text(tree, tvb, offset, 1, "Reserved 0x%X", tempByte); + proto_tree_add_item(tree, hf_dcbx_feature_pgid_reserved, tvb, offset, 1, ENC_NA); offset++; @@ -2060,9 +2061,7 @@ dissect_ieee_802_1_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } case 0xC: /* Application Priority */ { - tempByte = tvb_get_guint8(tvb, offset); - - proto_tree_add_text(tree, tvb, offset, 1, "Reserved 0x%X", tempByte); + proto_tree_add_item(tree, hf_ieee_8021az_app_reserved, tvb, offset, 1, ENC_NA); offset++; @@ -3491,6 +3490,10 @@ proto_register_lldp(void) { "Subtype", "lldp.dcbx.feature.subtype", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } }, + { &hf_dcbx_feature_pgid_reserved, + { "Reserved", "lldp.dcbx.feature.pg.reserved", FT_UINT8, BASE_HEX, + NULL, 0xF000, 0, HFILL } + }, { &hf_dcbx_feature_pgid_prio_0, { "PGID for Prio 0", "lldp.dcbx.feature.pg.pgid_prio0", FT_UINT16, BASE_DEC, NULL, 0xF000, 0, HFILL } @@ -3775,6 +3778,10 @@ proto_register_lldp(void) { "Max PFC Enabled Traffic Classes", "lldp.dcbx.ieee.pfc.numtcs", FT_UINT8, BASE_DEC, NULL, 0xF, NULL, HFILL } }, + { &hf_ieee_8021az_app_reserved, + { "Reserved", "lldp.dcbx.ieee.app.reserved", FT_UINT8, BASE_HEX, + NULL, 0x0, NULL, HFILL } + }, { &hf_ieee_8021az_app_prio, { "Application Priority", "lldp.dcbx.ieee.app.prio", FT_UINT8, BASE_DEC, NULL, 0xE0, NULL, HFILL } diff --git a/epan/dissectors/packet-lon.c b/epan/dissectors/packet-lon.c index 7182fc5664..2e6262fb63 100644 --- a/epan/dissectors/packet-lon.c +++ b/epan/dissectors/packet-lon.c @@ -298,7 +298,7 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) switch(dom_len) { case 0: /* Domain-wide */ - proto_tree_add_text(lon_tree, tvb, offset, 0, "Domain wide addressing"); + proto_tree_add_bytes_format(lon_tree, hf_lon_domain, tvb, offset, 0, NULL, "Domain wide addressing"); break; case 1: proto_tree_add_item(lon_tree, hf_lon_domain, tvb, offset, 1, ENC_NA); diff --git a/epan/dissectors/packet-loop.c b/epan/dissectors/packet-loop.c index 19a953120d..f78ba68cd4 100644 --- a/epan/dissectors/packet-loop.c +++ b/epan/dissectors/packet-loop.c @@ -36,6 +36,7 @@ void proto_reg_handoff_loop(void); static int proto_loop = -1; static int hf_loop_skipcount = -1; static int hf_loop_function = -1; +static int hf_loop_relevant_function = -1; static int hf_loop_receipt_number = -1; static int hf_loop_forwarding_address = -1; @@ -82,25 +83,22 @@ dissect_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(function, function_vals, "Unknown function (%u)")); - proto_tree_add_text(loop_tree, tvb, offset, 2, "Relevant function:"); + proto_tree_add_uint(loop_tree, hf_loop_relevant_function, tvb, offset, 2, function); set_info = FALSE; } - if (tree) - proto_tree_add_uint(loop_tree, hf_loop_function, tvb, offset, 2, function); + proto_tree_add_uint(loop_tree, hf_loop_function, tvb, offset, 2, function); offset += 2; switch (function) { case FUNC_REPLY: - if (tree) - proto_tree_add_item(loop_tree, hf_loop_receipt_number, tvb, offset, 2, + proto_tree_add_item(loop_tree, hf_loop_receipt_number, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; more_function = FALSE; break; case FUNC_FORWARD_DATA: - if (tree) - proto_tree_add_item(loop_tree, hf_loop_forwarding_address, tvb, offset, + proto_tree_add_item(loop_tree, hf_loop_forwarding_address, tvb, offset, 6, ENC_NA); offset += 6; more_function = TRUE; @@ -129,23 +127,28 @@ proto_register_loop(void) static hf_register_info hf[] = { { &hf_loop_skipcount, { "skipCount", "loop.skipcount", - FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, { &hf_loop_function, { "Function", "loop.function", - FT_UINT16, BASE_DEC, VALS(function_vals), 0x0, - NULL, HFILL }}, + FT_UINT16, BASE_DEC, VALS(function_vals), 0x0, + NULL, HFILL }}, + + { &hf_loop_relevant_function, + { "Relevant function", "loop.relevant_function", + FT_UINT16, BASE_DEC, VALS(function_vals), 0x0, + NULL, HFILL }}, { &hf_loop_receipt_number, { "Receipt number", "loop.receipt_number", - FT_UINT16, BASE_DEC, NULL, 0x0, - NULL, HFILL }}, + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, { &hf_loop_forwarding_address, { "Forwarding address", "loop.forwarding_address", - FT_ETHER, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + FT_ETHER, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_loop, diff --git a/epan/dissectors/packet-lpd.c b/epan/dissectors/packet-lpd.c index f9a5c4e1a4..ea338667e9 100644 --- a/epan/dissectors/packet-lpd.c +++ b/epan/dissectors/packet-lpd.c @@ -34,6 +34,9 @@ void proto_reg_handoff_lpd(void); static int proto_lpd = -1; static int hf_lpd_response = -1; static int hf_lpd_request = -1; +static int hf_lpd_client_code = -1; +static int hf_lpd_printer_option = -1; +static int hf_lpd_response_code = -1; static gint ett_lpd = -1; @@ -43,6 +46,28 @@ static gint find_printer_string(tvbuff_t *tvb, int offset); static dissector_handle_t data_handle; +/* This information comes from the LPRng HOWTO, which also describes + RFC 1179. http://www.astart.com/lprng/LPRng-HOWTO.html */ +static const value_string lpd_client_code[] = { + { 1, "LPC: start print / jobcmd: abort" }, + { 2, "LPR: transfer a printer job / jobcmd: receive control file" }, + { 3, "LPQ: print short form of queue status / jobcmd: receive data file" }, + { 4, "LPQ: print long form of queue status" }, + { 5, "LPRM: remove jobs" }, + { 6, "LPRng lpc: do control operation" }, + { 7, "LPRng lpr: transfer a block format print job" }, + { 8, "LPRng lpc: secure command transfer" }, + { 9, "LPRng lpq: verbose status information" }, + { 0, NULL } +}; +static const value_string lpd_server_code[] = { + { 0, "Success: accepted, proceed" }, + { 1, "Queue not accepting jobs" }, + { 2, "Queue temporarily full, retry later" }, + { 3, "Bad job format, do not retry" }, + { 0, NULL } +}; + static void dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -52,28 +77,6 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 code; gint printer_len; - /* This information comes from the LPRng HOWTO, which also describes - RFC 1179. http://www.astart.com/lprng/LPRng-HOWTO.html */ - static const value_string lpd_client_code[] = { - { 1, "LPC: start print / jobcmd: abort" }, - { 2, "LPR: transfer a printer job / jobcmd: receive control file" }, - { 3, "LPQ: print short form of queue status / jobcmd: receive data file" }, - { 4, "LPQ: print long form of queue status" }, - { 5, "LPRM: remove jobs" }, - { 6, "LPRng lpc: do control operation" }, - { 7, "LPRng lpr: transfer a block format print job" }, - { 8, "LPRng lpc: secure command transfer" }, - { 9, "LPRng lpq: verbose status information" }, - { 0, NULL } - }; - static const value_string lpd_server_code[] = { - { 0, "Success: accepted, proceed" }, - { 1, "Queue not accepting jobs" }, - { 2, "Queue temporarily full, retry later" }, - { 3, "Bad job format, do not retry" }, - { 0, NULL } - }; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "LPD"); col_clear(pinfo->cinfo, COL_INFO); @@ -99,7 +102,6 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_INFO, "LPD continuation"); } - if (tree) { ti = proto_tree_add_item(tree, proto_lpd, tvb, 0, -1, ENC_NA); lpd_tree = proto_item_add_subtree(ti, ett_lpd); @@ -116,11 +118,9 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) printer_len = find_printer_string(tvb, 1); if (code <= 9 && printer_len != -1) { - proto_tree_add_text(lpd_tree, tvb, 0, 1, "%s", - val_to_str(code, lpd_client_code, "Unknown client code: %u")); - proto_tree_add_text(lpd_tree, tvb, 1, printer_len, - "Printer/options: %s", - tvb_format_text(tvb, 1, printer_len)); + proto_tree_add_uint_format(lpd_tree, hf_lpd_client_code, tvb, 0, 1, code, + "%s", val_to_str(code, lpd_client_code, "Unknown client code: %u")); + proto_tree_add_item(lpd_tree, hf_lpd_printer_option, tvb, 1, printer_len, ENC_ASCII|ENC_NA); } else { call_dissector(data_handle,tvb, pinfo, lpd_tree); @@ -128,8 +128,7 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if (lpr_packet_type == response) { if (code <= 3) { - proto_tree_add_text(lpd_tree, tvb, 0, 1, - "Response: %s", val_to_str(code, lpd_server_code, "Unknown server code: %u")); + proto_tree_add_item(lpd_tree, hf_lpd_response_code, tvb, 0, 1, ENC_NA); } else { call_dissector(data_handle,tvb, pinfo, lpd_tree); @@ -138,7 +137,6 @@ dissect_lpd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { call_dissector(data_handle,tvb, pinfo, lpd_tree); } - } } @@ -163,13 +161,28 @@ proto_register_lpd(void) static hf_register_info hf[] = { { &hf_lpd_response, { "Response", "lpd.response", - FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "TRUE if LPD response", HFILL }}, + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "TRUE if LPD response", HFILL }}, { &hf_lpd_request, { "Request", "lpd.request", - FT_BOOLEAN, BASE_NONE, NULL, 0x0, - "TRUE if LPD request", HFILL }} + FT_BOOLEAN, BASE_NONE, NULL, 0x0, + "TRUE if LPD request", HFILL }}, + + { &hf_lpd_client_code, + { "Client code", "lpd.client_code", + FT_UINT8, BASE_DEC, VALS(lpd_client_code), 0x0, + NULL, HFILL }}, + + { &hf_lpd_printer_option, + { "Printer/options", "lpd.printer_option", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_lpd_response_code, + { "Response", "lpd.response_code", + FT_UINT8, BASE_DEC, VALS(lpd_server_code), 0x0, + NULL, HFILL }}, }; static gint *ett[] = { &ett_lpd, diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index 6a37802751..dee7675976 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -137,11 +137,12 @@ static int hf_realnamelen = -1; static int hf_realname = -1; -/* static int hf_a_record = -1; */ +static int hf_a_record = -1; static int hf_a_rec_len = -1; static int hf_srv_prio = -1; static int hf_srv_weight = -1; static int hf_srv_port = -1; +static int hf_srv_dname = -1; static int hf_adn_flags = -1; static int hf_adn_addrtype = -1; @@ -157,6 +158,7 @@ static int hf_adn_family = -1; static int hf_adn_addr_len = -1; static int hf_adn_addr_addr = -1; +static int hf_ns_dname = -1; static int ett_lwres = -1; static int ett_rdata_req = -1; @@ -470,9 +472,7 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o proto_tree_add_item(addr_tree, hf_a_rec_len, tvb, curr, sizeof(guint16), ENC_BIG_ENDIAN); - proto_tree_add_text(addr_tree, tvb, curr + 2, 4, "Addr: %s", - addrs); - + proto_tree_add_item(addr_tree, hf_a_record, tvb, curr + 2, 4, ENC_BIG_ENDIAN); } } @@ -529,11 +529,12 @@ static void dissect_srv_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int port); - proto_tree_add_text(rec_tree, + proto_tree_add_string(rec_tree, + hf_srv_dname, tvb, curr + 8, dlen, - "DNAME: %s", dname); + dname); curr+=(int)((sizeof(short)*4) + dlen); @@ -576,11 +577,12 @@ static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in 2, ENC_BIG_ENDIAN); - proto_tree_add_text(rec_tree, + proto_tree_add_string(rec_tree, + hf_srv_dname, tvb, curr + 4, dlen, - "name: %s", dname); + dname); curr+=(int)((sizeof(short)*2) + dlen); @@ -613,11 +615,12 @@ static void dissect_ns_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in rec_tree = proto_tree_add_subtree_format(ns_rec_tree, tvb, curr,4, ett_ns_rec_item, NULL, "NS record: dname=%s",dname); - proto_tree_add_text(rec_tree, + proto_tree_add_string(rec_tree, + hf_ns_dname, tvb, curr + 2, dlen, - "Name: %s", dname); + dname); curr+=(int)(sizeof(short) + dlen); } @@ -1032,11 +1035,9 @@ proto_register_lwres(void) { "Real doname name", "lwres.realname", FT_STRING, BASE_NONE, NULL, 0x0, "lwres realname", HFILL }}, -#if 0 { &hf_a_record, { "IPv4 Address", "lwres.arecord", FT_UINT32, BASE_DEC, NULL, 0x0, "lwres arecord", HFILL }}, -#endif { &hf_a_rec_len, { "Length", "lwres.areclen", FT_UINT16, BASE_DEC, NULL, 0x0, @@ -1054,6 +1055,10 @@ proto_register_lwres(void) { "Port" , "lwres.srv.port", FT_UINT16, BASE_DEC, NULL, 0x0, "lwres srv port", HFILL }}, + { &hf_srv_dname, + { "DNAME" , "lwres.srv.dname", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_adn_flags, { "Flags", "lwres.adn.flags", FT_UINT32, BASE_HEX, NULL, 0x0, "lwres adn flags", HFILL }}, @@ -1098,6 +1103,10 @@ proto_register_lwres(void) { "IP Address", "lwres.adn.addr.addr", FT_STRING, BASE_NONE, NULL, 0x0, "lwres adn addr addr", HFILL }}, + { &hf_ns_dname, + { "Name" , "lwres.ns.dname", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + /* Add more fields here */ }; diff --git a/epan/dissectors/packet-m2pa.c b/epan/dissectors/packet-m2pa.c index 120b1f3259..74bfc90c9e 100644 --- a/epan/dissectors/packet-m2pa.c +++ b/epan/dissectors/packet-m2pa.c @@ -75,6 +75,7 @@ static gint ett_m2pa = -1; static gint ett_m2pa_li = -1; static expert_field ei_undecode_data = EI_INIT; +static expert_field ei_length = EI_INIT; static dissector_handle_t mtp3_handle; @@ -386,9 +387,10 @@ dissect_v2_message_data(tvbuff_t *message_tvb, packet_info *pinfo, proto_item *m message_data_length = (gint) tvb_get_ntohl(message_tvb, V2_LENGTH_OFFSET); if ((gint) message_data_length < 1) { - if (m2pa_tree) - proto_tree_add_text(m2pa_tree, message_tvb, V2_LENGTH_OFFSET, 4, + proto_tree_add_expert_format(m2pa_tree, pinfo, &ei_length, message_tvb, V2_LENGTH_OFFSET, 4, "Invalid message data length: %u", message_data_length); + /* XXX - is this really necessary? Can we just return since the expert info can + still find the "malformed" packet? */ THROW(ReportedBoundsError); } @@ -418,9 +420,10 @@ dissect_v8_message_data(tvbuff_t *message_tvb, packet_info *pinfo, proto_item *m message_data_length = tvb_get_ntohl(message_tvb, V8_LENGTH_OFFSET) - V8_HEADER_LENGTH; if ((gint) message_data_length < 1) { - if (m2pa_tree) - proto_tree_add_text(m2pa_tree, message_tvb, V8_LENGTH_OFFSET, 4, + proto_tree_add_expert_format(m2pa_tree, pinfo, &ei_length, message_tvb, V8_LENGTH_OFFSET, 4, "Invalid message data length: %u", message_data_length); + /* XXX - is this really necessary? Can we just return since the expert info can + still find the "malformed" packet? */ THROW(ReportedBoundsError); } message_data_tvb = tvb_new_subset_length(message_tvb, V8_MESSAGE_DATA_OFFSET, message_data_length); @@ -575,6 +578,7 @@ proto_register_m2pa(void) static ei_register_info ei[] = { { &ei_undecode_data, { "m2pa.undecoded_data.expert", PI_MALFORMED, PI_WARN, "There are bytes of data which is greater than M2PA's length parameter", EXPFILL }}, + { &ei_length, { "m2pa.length.invalid", PI_MALFORMED, PI_ERROR, "Invalid message data length", EXPFILL }}, }; expert_module_t* expert_m2pa; diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c index 719f42f0b7..a488e4a8bd 100644 --- a/epan/dissectors/packet-m2ua.c +++ b/epan/dissectors/packet-m2ua.c @@ -899,8 +899,8 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, PROTO_ITEM_SET_HIDDEN(hidden_item); /* add tag and length to the m2ua tree */ - proto_tree_add_text(parameter_tree, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, - "Parameter Tag: Protocol data 1 (0x000e)"); + proto_tree_add_uint_format_value(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, + tag, "Protocol data 1 (0x000e)"); proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN); tag = PROTOCOL_DATA_1_PARAMETER_TAG; diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c index f9485a6953..1582561349 100644 --- a/epan/dissectors/packet-m3ua.c +++ b/epan/dissectors/packet-m3ua.c @@ -300,7 +300,7 @@ static int hf_registration_result_context = -1; static int hf_v6_deregistration_result_status = -1; static int hf_v6_deregistration_result_context = -1; static int hf_li = -1; - +static int hf_heuristic_standard = -1; static int m3ua_tap = -1; @@ -1177,9 +1177,11 @@ dissect_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pro if (mtp3_heuristic_standard) { heuristic_standard = m3ua_heur_mtp3_standard(payload_tvb, pinfo, opc, dpc, si); if (heuristic_standard == HEURISTIC_FAILED_STANDARD) { - gen_item = proto_tree_add_text(tree, parameter_tvb, 0, 0, "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); + gen_item = proto_tree_add_uint_format(tree, hf_heuristic_standard, parameter_tvb, 0, 0, heuristic_standard, + "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); } else { - gen_item = proto_tree_add_text(tree, parameter_tvb, 0, 0, "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); + gen_item = proto_tree_add_uint_format(tree, hf_heuristic_standard, parameter_tvb, 0, 0, heuristic_standard, + "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); mtp3_standard = heuristic_standard; @@ -2109,6 +2111,7 @@ proto_register_m3ua(void) { &hf_registration_result_context, { "Routing context", "m3ua.registration_result_routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_v6_deregistration_result_status, { "De-Registration status", "m3ua.deregistration_results_status", FT_UINT32, BASE_DEC, VALS(v6_deregistration_result_status_values), 0x0, NULL, HFILL } }, { &hf_v6_deregistration_result_context, { "Routing context", "m3ua.deregistration_result_routing_context", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_heuristic_standard, { "Heuristic standard", "m3ua.heuristic_standard", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c index 51f306dc78..62ea587e68 100644 --- a/epan/dissectors/packet-mac-lte.c +++ b/epan/dissectors/packet-mac-lte.c @@ -312,6 +312,7 @@ static expert_field ei_mac_lte_rar_timing_advance_not_zero_warn = EI_INIT; static expert_field ei_mac_lte_dlsch_lcid = EI_INIT; static expert_field ei_mac_lte_padding_data_before_control_subheader = EI_INIT; static expert_field ei_mac_lte_rach_preamble_sent_warn = EI_INIT; +static expert_field ei_mac_lte_no_per_frame_data = EI_INIT; /* Constants and value strings */ @@ -5266,10 +5267,7 @@ int dissect_mac_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d /* Can't dissect anything without it... */ if (p_mac_lte_info == NULL) { - proto_item *tii = - proto_tree_add_text(mac_lte_tree, tvb, offset, -1, - "Can't dissect LTE MAC frame because no per-frame info was attached!"); - PROTO_ITEM_SET_GENERATED(tii); + proto_tree_add_expert(mac_lte_tree, pinfo, &ei_mac_lte_no_per_frame_data, tvb, offset, -1); return 0; } @@ -7138,6 +7136,7 @@ void proto_register_mac_lte(void) { &ei_mac_lte_context_rnti_type, { "mac-lte.rnti-type.invalid", PI_MALFORMED, PI_ERROR, "RNTI indicated, but value is not correct", EXPFILL }}, { &ei_mac_lte_ul_mac_frame_retx, { "mac-lte.ul-mac-frame-retx", PI_SEQUENCE, PI_WARN, "UL MAC frame ReTX", EXPFILL }}, { &ei_mac_lte_context_crc_status, { "mac-lte.crc-status.error", PI_MALFORMED, PI_ERROR, "Frame has CRC error problem", EXPFILL }}, + { &ei_mac_lte_no_per_frame_data, { "mac-lte.no_per_frame_data", PI_UNDECODED, PI_WARN, "Can't dissect LTE MAC frame because no per-frame info was attached!", EXPFILL }}, }; static const enum_val_t show_info_col_vals[] = { diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c index 3da2f63a04..a1a79c9960 100644 --- a/epan/dissectors/packet-mbtcp.c +++ b/epan/dissectors/packet-mbtcp.c @@ -95,6 +95,7 @@ static int hf_mbtcp_len = -1; static int hf_mbtcp_unitid = -1; static int hf_mbtcp_functioncode = -1; static int hf_modbus_reference = -1; +static int hf_modbus_padding = -1; static int hf_modbus_lreference = -1; static int hf_modbus_reftype = -1; static int hf_modbus_readref = -1; @@ -121,6 +122,7 @@ static int hf_modbus_diag_return_slave_nak_count = -1; static int hf_modbus_diag_return_slave_busy_count = -1; static int hf_modbus_diag_return_bus_char_overrun_count = -1; static int hf_modbus_status = -1; +static int hf_modbus_event = -1; static int hf_modbus_event_count = -1; static int hf_modbus_message_count = -1; static int hf_modbus_event_recv_comm_err = -1; @@ -145,6 +147,7 @@ static int hf_modbus_conformity_level = -1; static int hf_modbus_more_follows = -1; static int hf_modbus_next_object_id = -1; static int hf_modbus_object_str_value = -1; +static int hf_modbus_object_value = -1; static int hf_modbus_reg_uint16 = -1; static int hf_modbus_reg_uint32 = -1; static int hf_modbus_reg_ieee_float = -1; @@ -936,12 +939,12 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ if (packet_type == QUERY_PACKET) { proto_tree_add_item(modbus_tree, hf_modbus_reference, tvb, payload_start, 2, ENC_BIG_ENDIAN); dissect_modbus_data(tvb, pinfo, modbus_tree, function_code, payload_start + 2, 1, register_format); - proto_tree_add_text(modbus_tree, tvb, payload_start + 3, 1, "Padding"); + proto_tree_add_item(modbus_tree, hf_modbus_padding, tvb, payload_start + 3, 1, ENC_NA); } else if (packet_type == RESPONSE_PACKET) { proto_tree_add_item(modbus_tree, hf_modbus_reference, tvb, payload_start, 2, ENC_BIG_ENDIAN); dissect_modbus_data(tvb, pinfo, modbus_tree, function_code, payload_start + 2, 1, register_format); - proto_tree_add_text(modbus_tree, tvb, payload_start + 3, 1, "Padding"); + proto_tree_add_item(modbus_tree, hf_modbus_padding, tvb, payload_start + 3, 1, ENC_NA); } break; @@ -1096,13 +1099,14 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ while (byte_cnt > 0) { event_code = tvb_get_guint8(tvb, payload_start+7+event_index); if (event_code == 0) { - proto_tree_add_text(event_tree, tvb, payload_start+7+event_index, 1, "Initiated Communication Restart"); + proto_tree_add_uint_format(event_tree, hf_modbus_event, tvb, payload_start+7+event_index, 1, event_code, "Initiated Communication Restart"); } else if (event_code == 4) { - proto_tree_add_text(event_tree, tvb, payload_start+7+event_index, 1, "Entered Listen Only Mode"); + proto_tree_add_uint_format(event_tree, hf_modbus_event, tvb, payload_start+7+event_index, 1, event_code, "Entered Listen Only Mode"); } else if (event_code & REMOTE_DEVICE_RECV_EVENT_MASK) { - mei = proto_tree_add_text(event_tree, tvb, payload_start+7+event_index, 1, "Receive Event: 0x%02X", event_code); + mei = proto_tree_add_uint_format(event_tree, hf_modbus_event, tvb, payload_start+7+event_index, 1, + event_code, "Receive Event: 0x%02X", event_code); event_item_tree = proto_item_add_subtree(mei, ett_events_recv); /* add subtrees to describe each event bit */ @@ -1116,7 +1120,8 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ tvb, payload_start+7+event_index, 1, ENC_LITTLE_ENDIAN ); } else if ((event_code & REMOTE_DEVICE_SEND_EVENT_MASK) == REMOTE_DEVICE_SEND_EVENT_VALUE) { - mei = proto_tree_add_text(event_tree, tvb, payload_start+7+event_index, 1, "Send Event: 0x%02X", event_code); + mei = proto_tree_add_uint_format(event_tree, hf_modbus_event, tvb, payload_start+7+event_index, 1, + event_code, "Send Event: 0x%02X", event_code); event_item_tree = proto_item_add_subtree(mei, ett_events_send); /* add subtrees to describe each event bit */ @@ -1134,7 +1139,7 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ tvb, payload_start+7+event_index, 1, ENC_LITTLE_ENDIAN ); } else { - proto_tree_add_text(event_tree, tvb, payload_start+7+event_index, 1, "Unknown Event"); + proto_tree_add_uint_format(event_tree, hf_modbus_event, tvb, payload_start+7+event_index, 1, event_code, "Unknown Event"); } byte_cnt--; @@ -1338,7 +1343,7 @@ dissect_modbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ else { if (object_len > 0) - proto_tree_add_text(device_objects_item_tree, tvb, payload_start+6+object_index, object_len, "Object Value"); + proto_tree_add_item(device_objects_item_tree, hf_modbus_object_value, tvb, payload_start+6+object_index, object_len, ENC_NA); } object_index += object_len; } @@ -1424,6 +1429,11 @@ proto_register_modbus(void) FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_modbus_padding, + { "Padding", "modbus.padding", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, { &hf_modbus_lreference, { "Reference Number (32 bit)", "modbus.reference_num_32", FT_UINT32, BASE_DEC, NULL, 0x0, @@ -1554,8 +1564,13 @@ proto_register_modbus(void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_modbus_event, + { "Event", "modbus.event", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_modbus_event_count, - { "Event Vount", "modbus.ev_count", + { "Event Count", "modbus.ev_count", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, @@ -1673,6 +1688,11 @@ proto_register_modbus(void) FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_modbus_object_value, + { "Object Value", "modbus.object_value", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_modbus_reg_uint16, { "Register (UINT16)", "modbus.register.uint16", FT_UINT16, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c index a3515c1912..a1de187a8a 100644 --- a/epan/dissectors/packet-mdshdr.c +++ b/epan/dissectors/packet-mdshdr.c @@ -90,6 +90,7 @@ static int hf_mdshdr_dstidx = -1; static int hf_mdshdr_srcidx = -1; static int hf_mdshdr_vsan = -1; static int hf_mdshdr_eof = -1; +static int hf_mdshdr_no_trailer = -1; static int hf_mdshdr_span = -1; static int hf_mdshdr_fccrc = -1; @@ -224,7 +225,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) trailer_start+2, MDSHDR_SIZE_INT32, ENC_BIG_ENDIAN); } else { - proto_tree_add_text(mdshdr_tree_main, tvb, 0, 0, "MDS Trailer: Not Found"); + proto_tree_add_item(mdshdr_tree_main, hf_mdshdr_no_trailer, tvb, 0, 0, ENC_NA); } } @@ -271,6 +272,9 @@ proto_register_mdshdr(void) { &hf_mdshdr_eof, {"EOF", "mdshdr.eof", FT_UINT8, BASE_DEC, VALS(eof_vals), 0x0, NULL, HFILL}}, + { &hf_mdshdr_no_trailer, + {"MDS Trailer: Not Found", "mdshdr.no_trailer", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}}, + { &hf_mdshdr_span, {"SPAN Frame", "mdshdr.span", FT_UINT16, BASE_DEC, NULL, 0xF000, NULL, HFILL}}, diff --git a/epan/dissectors/packet-media.c b/epan/dissectors/packet-media.c index 01a295a1e1..6d4efefbc0 100644 --- a/epan/dissectors/packet-media.c +++ b/epan/dissectors/packet-media.c @@ -37,6 +37,7 @@ void proto_register_media(void); * print routines */ int proto_media = -1; +static gint hf_media_type = -1; static gint ett_media = -1; static heur_dissector_list_t heur_subdissector_list; @@ -63,14 +64,14 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) if (pinfo->private_data) { /* The media type has parameters */ - proto_tree_add_text(media_tree, tvb, 0, bytes, - "Media Type: %s; %s (%d byte%s)", + proto_tree_add_bytes_format_value(media_tree, hf_media_type, tvb, 0, bytes, + NULL, "%s; %s (%d byte%s)", pinfo->match_string, (char *)pinfo->private_data, bytes, plurality(bytes, "", "s")); } else { /* The media type has no parameters */ - proto_tree_add_text(media_tree, tvb, 0, bytes, - "Media Type: %s (%d byte%s)", + proto_tree_add_bytes_format_value(media_tree, hf_media_type, tvb, 0, bytes, + NULL, "%s (%d byte%s)", pinfo->match_string ? pinfo->match_string : "", bytes, plurality(bytes, "", "s")); } @@ -83,6 +84,12 @@ dissect_media(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, void* data) void proto_register_media(void) { + static hf_register_info hf[] = { + { &hf_media_type, + { "Media type", "media.type", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + }; static gint *ett[] = { &ett_media }; @@ -94,6 +101,7 @@ proto_register_media(void) ); new_register_dissector("media", dissect_media, proto_media); register_heur_dissector_list("media", &heur_subdissector_list); + proto_register_field_array(proto_media, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); /* diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index 98ba689845..38df585303 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -132,6 +133,8 @@ static gint ett_mip_ext = -1; static gint ett_mip_exts = -1; static gint ett_mip_pmipv4_ext = -1; +static expert_field ei_mip_data_not_dissected = EI_INIT; + /* Port used for Mobile IP */ #define UDP_PORT_MIP 434 @@ -487,7 +490,7 @@ dissect_mip_priv_ext_3gpp2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr proto_tree_add_item(tree, hf_mip_nvse_3gpp2_type17_sec_dns, tvb, offset, 4, ENC_BIG_ENDIAN); break; default: - proto_tree_add_text(tree, tvb, offset, -1, " Data not dissected yet"); + proto_tree_add_expert(tree, pinfo, &ei_mip_data_not_dissected, tvb, offset, -1); break; } @@ -1444,6 +1447,12 @@ void proto_register_mip(void) &ett_mip_pmipv4_ext, }; + static ei_register_info ei[] = { + { &ei_mip_data_not_dissected, { "mip.data_not_dissected", PI_UNDECODED, PI_WARN, "Data not dissected yet", EXPFILL }}, + }; + + expert_module_t* expert_mip; + /* Register the protocol name and description */ proto_mip = proto_register_protocol("Mobile IP", "Mobile IP", "mip"); @@ -1453,6 +1462,8 @@ void proto_register_mip(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_mip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mip = expert_register_protocol(proto_mip); + expert_register_field_array(expert_mip, ei, array_length(ei)); mip_nvse_ext_dissector_table = register_dissector_table("mip.nvse_ext", "MIP Normal Vendor/Organization Specific Extension", FT_UINT32, BASE_DEC); diff --git a/epan/dissectors/packet-mmse.c b/epan/dissectors/packet-mmse.c index eef33948ae..306c5078c1 100644 --- a/epan/dissectors/packet-mmse.c +++ b/epan/dissectors/packet-mmse.c @@ -242,6 +242,9 @@ static int hf_mmse_prev_sent_by_address = -1; static int hf_mmse_prev_sent_date = -1; static int hf_mmse_prev_sent_date_fwd_count = -1; static int hf_mmse_prev_sent_date_date = -1; +static int hf_mmse_header_uint = -1; +static int hf_mmse_header_string = -1; +static int hf_mmse_header_bytes = -1; /* * Initialize the subtree pointers @@ -1228,14 +1231,15 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, guint8 peek = tvb_get_guint8(tvb, offset); const char *hdr_name = val_to_str(field, vals_mm_header_names, "Unknown field (0x%02x)"); + const char *str; DebugLog(("\t\tUndecoded well-known header: %s\n", hdr_name)); if (peek & 0x80) { /* Well-known value */ length = 1; if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, + proto_tree_add_uint_format(mmse_tree, hf_mmse_header_uint, tvb, offset - 1, + length + 1, peek, "%s: " " (not decoded)", hdr_name, peek); @@ -1243,10 +1247,9 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, } else if ((peek == 0) || (peek >= 0x20)) { /* Text */ length = get_text_string(tvb, offset, &strval); if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, "%s: %s (Not decoded)", - hdr_name, - format_text(strval, strlen(strval))); + str = format_text(strval, strlen(strval)); + proto_tree_add_string_format(mmse_tree, hf_mmse_header_string, tvb, offset - 1, + length + 1, str, "%s: %s (Not decoded)", hdr_name, str); } } else { /* General form with length */ if (peek == 0x1F) { /* Value length in guintvar */ @@ -1258,8 +1261,8 @@ dissect_mmse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdut, length = 1 + tvb_get_guint8(tvb, offset); } if (tree) { - proto_tree_add_text(mmse_tree, tvb, offset - 1, - length + 1, "%s: " + proto_tree_add_bytes_format(mmse_tree, hf_mmse_header_bytes, tvb, offset - 1, + length + 1, NULL, "%s: " " (not decoded)", hdr_name); } @@ -1633,7 +1636,21 @@ proto_register_mmse(void) HFILL } }, - + { &hf_mmse_header_uint, + { "Header Uint Value", "mmse.previously_sent_date.date", + FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL + } + }, + { &hf_mmse_header_string, + { "Header String Value", "mmse.header.string", + FT_STRING, BASE_NONE, NULL, 0x00, NULL, HFILL + } + }, + { &hf_mmse_header_bytes, + { "Header Byte array", "mmse.header.bytes", + FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL + } + }, }; diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c index df1112e750..7a17ddc6df 100644 --- a/epan/dissectors/packet-mp2t.c +++ b/epan/dissectors/packet-mp2t.c @@ -225,6 +225,8 @@ static int hf_msg_fragment_count = -1; static int hf_msg_reassembled_in = -1; static int hf_msg_reassembled_length = -1; +static int hf_msg_ts_packet_reassembled = -1; + static expert_field ei_mp2t_pointer = EI_INIT; static expert_field ei_mp2t_cc_drop = EI_INIT; @@ -546,7 +548,7 @@ mp2t_fragment_handle(tvbuff_t *tvb, guint offset, packet_info *pinfo, NULL, tree); if (new_tvb) { - /* ti = */ proto_tree_add_text(tree, tvb, 0, 0, "MPEG TS Packet (reassembled)"); + /* ti = */ proto_tree_add_item(tree, hf_msg_ts_packet_reassembled, tvb, 0, 0, ENC_NA); mp2t_dissect_packet(new_tvb, pload_type, pinfo, tree); } @@ -1501,7 +1503,11 @@ proto_register_mp2t(void) { &hf_msg_reassembled_length, { "Reassembled MP2T length", "mp2t.msg.reassembled.length", FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL - } } + } }, + { &hf_msg_ts_packet_reassembled, { + "MPEG TS Packet (reassembled)", "mp2t.ts_packet_reassembled", + FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL + } }, }; static gint *ett[] = diff --git a/epan/dissectors/packet-mp4ves.c b/epan/dissectors/packet-mp4ves.c index 3ea5d00c80..b3cd058d7d 100644 --- a/epan/dissectors/packet-mp4ves.c +++ b/epan/dissectors/packet-mp4ves.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -59,11 +60,16 @@ static int hf_mp4ves_is_object_layer_identifier = -1; static int hf_mp4ves_aspect_ratio_info = -1; static int hf_mp4ves_vol_control_parameters = -1; static int hf_mp4ves_video_object_layer_shape = -1; +static int hf_mp4ves_user_data = -1; +static int hf_mp4ves_data = -1; /* Initialize the subtree pointers */ static int ett_mp4ves = -1; static int ett_mp4ves_config = -1; +static expert_field ei_mp4ves_config_too_short = EI_INIT; +static expert_field ei_mp4ves_not_dissected_bits = EI_INIT; + /* The dynamic payload type which will be dissected as MP4V-ES */ static guint global_dynamic_payload_type = 0; @@ -272,7 +278,7 @@ dissect_mp4ves_user_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree bit_offset+=8; /* user_data 8 bits */ } - proto_tree_add_text(tree, tvb, start_bit_offset>>3, (bit_offset - start_bit_offset)>>2, "User data"); + proto_tree_add_item(tree, hf_mp4ves_user_data, tvb, start_bit_offset>>3, (bit_offset - start_bit_offset)>>2, ENC_NA); return bit_offset; } @@ -481,7 +487,7 @@ dissect_mp4ves_VideoObjectLayer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre } } if(bit_offset-current_bit_offset > 0) - proto_tree_add_text(tree, tvb, current_bit_offset>>3, (bit_offset+7)>>3, "Not dissected bits"); + proto_tree_add_expert(tree, pinfo, &ei_mp4ves_not_dissected_bits, tvb, current_bit_offset>>3, (bit_offset+7)>>3); /* video_object_layer_shape 2 uimsbf */ video_object_layer_shape = tvb_get_bits8(tvb,bit_offset, 2); proto_tree_add_bits_item(tree, hf_mp4ves_video_object_layer_shape, tvb, bit_offset, 2, ENC_BIG_ENDIAN); @@ -542,7 +548,6 @@ VisualObject() { static int dissect_mp4ves_VisualObject(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int bit_offset) { - proto_item *item; guint8 is_visual_object_identifier, visual_object_type; guint32 dword; guint8 octet; @@ -595,8 +600,7 @@ dissect_mp4ves_VisualObject(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_bits_item(tree, hf_mp4ves_start_code, tvb, bit_offset, 8, ENC_BIG_ENDIAN); bit_offset+= 8; if(tvb_length_remaining(tvb,(bit_offset>>3))<=0){ - item = proto_tree_add_text(tree, tvb, 0, -1, "Config string too short"); - PROTO_ITEM_SET_GENERATED(item); + proto_tree_add_expert(tree, pinfo, &ei_mp4ves_config_too_short, tvb, 0, -1); return -1; } /* @@ -744,13 +748,13 @@ dissect_mp4ves(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (tvb_length(tvb)< 4){ /* To short to be a start code */ - proto_tree_add_text(mp4ves_tree, tvb, bit_offset>>3, -1, "Data"); + proto_tree_add_item(mp4ves_tree, hf_mp4ves_data, tvb, bit_offset>>3, -1, ENC_NA); return; } dword = tvb_get_bits32(tvb,bit_offset, 24, ENC_BIG_ENDIAN); if (dword != 1){ /* if it's not 23 zeros followed by 1 it isn't a start code */ - proto_tree_add_text(mp4ves_tree, tvb, bit_offset>>3, -1, "Data"); + proto_tree_add_item(mp4ves_tree, hf_mp4ves_data, tvb, bit_offset>>3, -1, ENC_NA); return; } dword = tvb_get_bits8(tvb,24, 8); @@ -978,6 +982,16 @@ proto_register_mp4ves(void) FT_UINT8, BASE_DEC, VALS(mp4ves_video_object_layer_shape_vals), 0x0, NULL, HFILL } }, + { &hf_mp4ves_user_data, + { "User data", "mp4ves.user_data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_mp4ves_data, + { "Data", "mp4ves.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, }; /* Setup protocol subtree array */ @@ -986,7 +1000,13 @@ proto_register_mp4ves(void) &ett_mp4ves_config, }; + static ei_register_info ei[] = { + { &ei_mp4ves_config_too_short, { "mp4ves.config_too_short", PI_MALFORMED, PI_ERROR, "Config string too short", EXPFILL }}, + { &ei_mp4ves_not_dissected_bits, { "mp4ves.not_dissected_bits", PI_UNDECODED, PI_WARN, "Not dissected bits", EXPFILL }}, + }; + module_t *mp4ves_module; + expert_module_t* expert_mp4ves; /* Register the protocol name and description */ proto_mp4ves = proto_register_protocol("MP4V-ES","MP4V-ES", "mp4v-es"); @@ -994,6 +1014,8 @@ proto_register_mp4ves(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_mp4ves, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mp4ves = expert_register_protocol(proto_mp4ves); + expert_register_field_array(expert_mp4ves, ei, array_length(ei)); /* Register a configuration option for port */ register_dissector("mp4ves", dissect_mp4ves, proto_mp4ves); diff --git a/epan/dissectors/packet-mpeg-descriptor.c b/epan/dissectors/packet-mpeg-descriptor.c index ef03a71db1..44f08748b3 100644 --- a/epan/dissectors/packet-mpeg-descriptor.c +++ b/epan/dissectors/packet-mpeg-descriptor.c @@ -1750,7 +1750,7 @@ proto_mpeg_descriptor_dissect_local_time_offset(tvbuff_t *tvb, guint offset, gui if (packet_mpeg_sect_mjd_to_utc_time(tvb, offset, &time_of_change) < 0) { - proto_tree_add_text(tree, tvb, offset, 5, "Time of Change : Unparseable time"); + proto_tree_add_time_format_value(tree, hf_mpeg_descr_local_time_offset_time_of_change, tvb, offset, 5, &time_of_change, "Unparseable time"); } else { proto_tree_add_time(tree, hf_mpeg_descr_local_time_offset_time_of_change, tvb, offset, 5, &time_of_change); } @@ -2309,6 +2309,8 @@ static int hf_mpeg_descr_extension_supp_audio_ed_cla = -1; static int hf_mpeg_descr_extension_supp_audio_lang_code_present = -1; static int hf_mpeg_descr_extension_supp_audio_lang_code = -1; +static int hf_mpeg_descr_private_data = -1; + #define EXT_TAG_IMG_ICON 0x00 #define EXT_TAG_CPCM_DLV 0x01 #define EXT_TAG_CP 0x02 @@ -2383,7 +2385,7 @@ proto_mpeg_descriptor_dissect_extension(tvbuff_t *tvb, guint offset, guint len, } already_dissected = offset-offset_start; if (already_dissected 0) { - proto_tree_add_text(descriptor_tree, tvb, offset, remaining, "Private data bytes"); + proto_tree_add_item(descriptor_tree, hf_mpeg_descr_private_data, tvb, offset, remaining, ENC_NA); offset += remaining; } } @@ -4080,6 +4082,11 @@ proto_register_mpeg_descriptor(void) FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, + { &hf_mpeg_descr_private_data, { + "Private data", "mpeg_descr.private_data", + FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL + } }, + /* 0xA2 Logon Initialize Descriptor */ { &hf_mpeg_descr_logon_initialize_group_id, { "Group ID", "mpeg_descr.logon_init.group_id", diff --git a/epan/dissectors/packet-mrp-msrp.c b/epan/dissectors/packet-mrp-msrp.c index 06c59995bb..bbca2788a1 100644 --- a/epan/dissectors/packet-mrp-msrp.c +++ b/epan/dissectors/packet-mrp-msrp.c @@ -33,6 +33,7 @@ #include #include +#include #include void proto_register_mrp_msrp(void); @@ -273,7 +274,7 @@ static gint ett_attr_list = -1; static gint ett_vect_attr = -1; static gint ett_first_value = -1; - +static expert_field ei_msrp_attribute_type = EI_INIT; /**********************************************************/ /* Dissector starts here */ @@ -616,7 +617,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) number_of_values); break; default: - proto_tree_add_text(first_value_tree, tvb, msg_offset + vect_offset, vect_attr_len, "Unknown Attribute"); + proto_tree_add_expert(first_value_tree, pinfo, &ei_msrp_attribute_type, tvb, msg_offset + vect_offset, vect_attr_len); break; } } @@ -766,6 +767,12 @@ proto_register_mrp_msrp(void) &ett_priority_and_rank }; + static ei_register_info ei[] = { + { &ei_msrp_attribute_type, { "mrp-msrp.attribute_type.unknown", PI_PROTOCOL, PI_WARN, "Malformed TCP/IP Status", EXPFILL }}, + }; + + expert_module_t* expert_msrp; + /* Register the protocol name and description */ proto_msrp = proto_register_protocol("Multiple Stream Reservation Protocol", "MRP-MSRP", "mrp-msrp"); @@ -773,6 +780,8 @@ proto_register_mrp_msrp(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_msrp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_msrp = expert_register_protocol(proto_msrp); + expert_register_field_array(expert_msrp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c index 13726929e5..8c842bcd8f 100644 --- a/epan/dissectors/packet-msdp.c +++ b/epan/dissectors/packet-msdp.c @@ -156,6 +156,10 @@ static int hf_msdp_not_res = -1; static int hf_msdp_not_entry_count = -1; static int hf_msdp_not_sprefix_len = -1; +static int hf_msdp_tlv_contents = -1; +static int hf_msdp_trailing_junk = -1; +static int hf_msdp_unknown_encap = -1; +static int hf_msdp_unknown_data = -1; static gint ett_msdp = -1; static gint ett_msdp_sa_entry = -1; @@ -219,15 +223,14 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: if (length > 0) - proto_tree_add_text(msdp_tree, tvb, offset, length, "TLV contents"); + proto_tree_add_item(msdp_tree, hf_msdp_tlv_contents, tvb, offset, length, ENC_NA); offset += length; break; } } if (tvb_length_remaining(tvb, offset) > 0) - proto_tree_add_text(msdp_tree, tvb, offset, - -1, "Trailing junk"); + proto_tree_add_item(msdp_tree, hf_msdp_trailing_junk, tvb, offset, -1, ENC_NA); return; } @@ -409,15 +412,11 @@ static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_t } else if (error_sub == 6) { /* No break, causes fall through to next label */ } else if (error_sub == 7) { - proto_tree_add_text(tree, tvb, *offset, tlv_len - 5, - "Packet with unknown encapsulation: %u bytes", - tlv_len - 5); + proto_tree_add_item(tree, hf_msdp_unknown_encap, tvb, *offset, tlv_len - 5, ENC_NA); *offset += tlv_len - 5; break; } else { - proto_tree_add_text(tree, tvb, *offset, tlv_len - 5, - ": %u bytes", - tlv_len -5); + proto_tree_add_item(tree, hf_msdp_unknown_data, tvb, *offset, tlv_len - 5, ENC_NA); *offset += tlv_len - 5; break; } @@ -439,9 +438,7 @@ static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_t break; default: if (tlv_len - 5 > 0) - proto_tree_add_text(tree, tvb, *offset, tlv_len - 5, - ": %u bytes", - tlv_len -5); + proto_tree_add_item(tree, hf_msdp_unknown_data, tvb, *offset, tlv_len - 5, ENC_NA); *offset += tlv_len - 5; break; } @@ -548,6 +545,26 @@ proto_register_msdp(void) FT_UINT8, BASE_DEC, NULL, 0, "Source prefix length in Notification messages", HFILL } }, + { &hf_msdp_tlv_contents, + { "TLV contents", "msdp.tlv_contents", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_msdp_trailing_junk, + { "Trailing junk", "msdp.trailing_junk", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_msdp_unknown_encap, + { "Packet with unknown encapsulation", "msdp.unknown_encap", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, + { &hf_msdp_unknown_data, + { "Unknown data", "msdp.unknown_data", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL } + }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index 3b9c5c5e1d..15a883cb3e 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -58,6 +58,7 @@ static int hf_mtp2_spare = -1; static int hf_mtp2_ext_spare = -1; static int hf_mtp2_sf = -1; static int hf_mtp2_sf_extra = -1; +static int hf_mtp2_fcs_16 = -1; static expert_field ei_mtp2_checksum_error = EI_INIT; @@ -196,15 +197,12 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo) rx_fcs_offset = proto_offset + len; rx_fcs_exp = mtp2_fcs16(tvb); rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset); + cause=proto_tree_add_item(fh_tree, hf_mtp2_fcs_16, tvb, rx_fcs_offset, 2, ENC_LITTLE_ENDIAN); if (rx_fcs_got != rx_fcs_exp) { - cause=proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, - "FCS 16: 0x%04x [incorrect, should be 0x%04x]", - rx_fcs_got, rx_fcs_exp); + proto_item_append_text(cause, " [incorrect, should be 0x%04x]", rx_fcs_exp); expert_add_info(pinfo, cause, &ei_mtp2_checksum_error); } else { - proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, - "FCS 16: 0x%04x [correct]", - rx_fcs_got); + proto_item_append_text(cause, " [correct]"); } } return next_tvb; @@ -385,7 +383,8 @@ proto_register_mtp2(void) { &hf_mtp2_spare, { "Spare", "mtp2.spare", FT_UINT8, BASE_DEC, NULL, SPARE_MASK, NULL, HFILL } }, { &hf_mtp2_ext_spare, { "Spare", "mtp2.spare", FT_UINT16, BASE_DEC, NULL, EXTENDED_SPARE_MASK, NULL, HFILL } }, { &hf_mtp2_sf, { "Status field", "mtp2.sf", FT_UINT8, BASE_DEC, VALS(status_field_vals), 0x0, NULL, HFILL } }, - { &hf_mtp2_sf_extra, { "Status field extra octet", "mtp2.sf_extra", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } } + { &hf_mtp2_sf_extra, { "Status field extra octet", "mtp2.sf_extra", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_mtp2_fcs_16, { "FCS 16", "mtp2.fcs_16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index ba2f6e2c7e..7621b0ee34 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -94,6 +94,7 @@ static int hf_mtp3_japan_4_bit_sls = -1; static int hf_mtp3_japan_4_bit_sls_spare = -1; static int hf_mtp3_japan_5_bit_sls = -1; static int hf_mtp3_japan_5_bit_sls_spare = -1; +static int hf_mtp3_heuristic_standard = -1; /* Initialize the subtree pointers */ static gint ett_mtp3 = -1; @@ -711,9 +712,11 @@ dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (mtp3_heuristic_standard) { heuristic_standard = heur_mtp3_standard(tvb, pinfo, si); if (heuristic_standard == HEURISTIC_FAILED_STANDARD) { - gen_item = proto_tree_add_text(tree, tvb, 0, 0, "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); + gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, mtp3_standard, + "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); } else { - gen_item = proto_tree_add_text(tree, tvb, 0, 0, "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); + gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, heuristic_standard, + "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); mtp3_standard = heuristic_standard; /* Register a frame-end routine to ensure mtp3_standard is set @@ -805,7 +808,8 @@ proto_register_mtp3(void) { &hf_mtp3_japan_5_bit_sls_spare, { "SLS Spare", "mtp3.sls_spare", FT_UINT8, BASE_HEX, NULL, JAPAN_5_BIT_SLS_SPARE_MASK, NULL, HFILL }}, { &hf_mtp3_ansi_5_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, ANSI_5BIT_SLS_MASK, NULL, HFILL }}, { &hf_mtp3_ansi_8_bit_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, ANSI_8BIT_SLS_MASK, NULL, HFILL }}, - { &hf_mtp3_chinese_itu_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, CHINESE_ITU_SLS_MASK, NULL, HFILL }} + { &hf_mtp3_chinese_itu_sls, { "Signalling Link Selector", "mtp3.sls", FT_UINT8, BASE_DEC, NULL, CHINESE_ITU_SLS_MASK, NULL, HFILL }}, + { &hf_mtp3_heuristic_standard, { "Heuristic standard", "mtp3.heuristic_standard",FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c index 11cafb6130..6e160e33d5 100644 --- a/epan/dissectors/packet-mtp3mg.c +++ b/epan/dissectors/packet-mtp3mg.c @@ -40,6 +40,7 @@ #include #include +#include #include @@ -416,6 +417,7 @@ static int hf_mtp3mg_japan_test = -1; static int hf_mtp3mg_japan_test_spare = -1; static int hf_mtp3mg_japan_test_pattern = -1; static int hf_mtp3mg_japan_spare = -1; +static int hf_mtp3mg_test_pattern = -1; /* Initialize the subtree pointers */ static gint ett_mtp3mg = -1; @@ -424,13 +426,15 @@ static gint ett_mtp3mg_tfm_apc = -1; static gint ett_mtp3mg_rsm_apc = -1; static gint ett_mtp3mg_upu_apc = -1; +static expert_field ei_mtp3mg_unknown_message = EI_INIT; + static void -dissect_mtp3mg_unknown_message(tvbuff_t *tvb, proto_tree *tree) +dissect_mtp3mg_unknown_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 message_length; message_length = tvb_length(tvb); - proto_tree_add_text(tree, tvb, 0, message_length, + proto_tree_add_expert_format(tree, pinfo, &ei_mtp3mg_unknown_message, tvb, 0, message_length, "Unknown message (%u byte%s)", message_length, plurality(message_length, "", "s")); } @@ -490,7 +494,7 @@ dissect_mtp3mg_chm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -515,7 +519,7 @@ dissect_mtp3mg_ecm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -603,7 +607,7 @@ dissect_mtp3mg_fcm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -637,7 +641,7 @@ dissect_mtp3mg_tfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (h1 == TFM_H1_TCP || h1 == TFM_H1_TCR || h1 == TFM_H1_TCA || h1 == TFM_H1_TFR) - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); proto_tree_add_item(tree, hf_mtp3mg_tfm_japan_count, tvb, JAPAN_TFM_COUNT_OFFSET, @@ -665,7 +669,7 @@ dissect_mtp3mg_tfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else /* ITU_STANDARD and CHINESE_ITU_STANDARD */ { if (h1 == TFM_H1_TCP || h1 == TFM_H1_TCR || h1 == TFM_H1_TCA) - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); else if (mtp3_standard == ITU_STANDARD) { apc_item = proto_tree_add_item(tree, hf_mtp3mg_itu_apc, @@ -688,7 +692,7 @@ dissect_mtp3mg_tfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -745,7 +749,7 @@ dissect_mtp3mg_rsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += JAPAN_PC_LENGTH; } } else - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } else /* ITU_STANDARD and CHINESE_ITU_STANDARD */ { @@ -768,12 +772,12 @@ dissect_mtp3mg_rsm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hf_mtp3mg_apc_cluster, hf_mtp3mg_apc_member, 0, 0); } else - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -803,7 +807,7 @@ dissect_mtp3mg_mim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -821,12 +825,12 @@ dissect_mtp3mg_trm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; case TRM_H1_TRW: if (mtp3_standard != ANSI_STANDARD) - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); /* else: nothing to dissect */ break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -858,7 +862,7 @@ dissect_mtp3mg_dlm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -927,7 +931,7 @@ dissect_mtp3mg_ufc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -954,13 +958,11 @@ dissect_mtp3mg_test(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ENC_NA); length = tvb_get_guint8(tvb, 0) >> TEST_LENGTH_SHIFT; - proto_tree_add_text(tree, tvb, TEST_PATTERN_OFFSET, length, - "Test pattern (%u byte%s)", length, - plurality(length, "", "s")); + proto_tree_add_item(tree, hf_mtp3mg_test_pattern, tvb, TEST_PATTERN_OFFSET, length, ENC_NA); break; default: - dissect_mtp3mg_unknown_message(tvb, tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, tree); } } @@ -1040,7 +1042,7 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; default: - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); } } else { /* not JAPAN */ @@ -1063,7 +1065,7 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default: col_set_str(pinfo->cinfo, COL_INFO, "Unknown "); - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); } /* switch */ } @@ -1123,7 +1125,7 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) H0H1_LENGTH, ENC_NA); dissect_mtp3mg_mim(payload_tvb, pinfo, mtp3mg_tree, h1); } else - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); break; case H0_TRM: if (mtp3_standard != JAPAN_STANDARD) @@ -1132,7 +1134,7 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) H0H1_LENGTH, ENC_NA); dissect_mtp3mg_trm(payload_tvb, pinfo, mtp3mg_tree, h1); } else - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); break; case H0_DLM: if (mtp3_standard != JAPAN_STANDARD) @@ -1141,7 +1143,7 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) H0H1_LENGTH, ENC_NA); dissect_mtp3mg_dlm(payload_tvb, pinfo, mtp3mg_tree, h1); } else - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); break; case H0_UFC: if (mtp3_standard != JAPAN_STANDARD) @@ -1150,13 +1152,13 @@ dissect_mtp3mg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) H0H1_LENGTH, ENC_NA); dissect_mtp3mg_ufc(payload_tvb, pinfo, mtp3mg_tree, h1); } else - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); break; default: col_set_str(pinfo->cinfo, COL_INFO, "Unknown "); - dissect_mtp3mg_unknown_message(tvb, mtp3mg_tree); + dissect_mtp3mg_unknown_message(tvb, pinfo, mtp3mg_tree); } /* switch */ } /* else */ @@ -1371,7 +1373,11 @@ proto_register_mtp3mg(void) { &hf_mtp3mg_test_ansi_slc, { "Signalling Link Code", "mtp3mg.slc", FT_UINT8, BASE_DEC, NULL, ANSI_TEST_SLC_MASK, - "SLC of affected link", HFILL }} + "SLC of affected link", HFILL }}, + { &hf_mtp3mg_test_pattern, + { "Test pattern", "mtp3mg.test_pattern", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; /* Setup protocol subtree array */ @@ -1383,6 +1389,12 @@ proto_register_mtp3mg(void) &ett_mtp3mg_upu_apc }; + static ei_register_info ei[] = { + { &ei_mtp3mg_unknown_message, { "mtp3mg.unknown_message", PI_PROTOCOL, PI_WARN, "Unknown message", EXPFILL }}, + }; + + expert_module_t* expert_mtp3mg; + /* Register the protocol name and description */ proto_mtp3mg = proto_register_protocol("Message Transfer Part Level 3 Management", "MTP3MG", "mtp3mg"); @@ -1391,6 +1403,8 @@ proto_register_mtp3mg(void) /* Required calls to register the header fields and subtrees used */ proto_register_field_array(proto_mtp3mg, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mtp3mg = expert_register_protocol(proto_mtp3mg); + expert_register_field_array(expert_mtp3mg, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c index f8ac520b5a..91bbf2667d 100644 --- a/epan/dissectors/packet-roofnet.c +++ b/epan/dissectors/packet-roofnet.c @@ -219,7 +219,7 @@ static void dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) roofnet_nlinks= tvb_get_guint8(tvb, ROOFNET_OFFSET_NLINKS); /* Check that we do not have a malformed roofnet packet */ if ((roofnet_nlinks*6*4)+ROOFNET_HEADER_LENGTH > ROOFNET_MAX_LENGTH) { - expert_add_info_format(pinfo, it, &ei_roofnet_too_many_links, "Too many links (%u)\n", roofnet_nlinks); + expert_add_info_format(pinfo, it, &ei_roofnet_too_many_links, "Too many links (%u)", roofnet_nlinks); return; } -- cgit v1.2.1