diff options
author | Michael Mann <mmann78@netscape.net> | 2014-07-31 12:39:40 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-08-03 16:29:16 +0000 |
commit | 3fa5625ea074908d5617111a7edfcf6d95e6108a (patch) | |
tree | 05c5b6f0995c239b28a05ae3f61f3fdf9ff40583 /epan/dissectors | |
parent | 7a7a72e15508d5927ced7189e50d17a16a016dad (diff) |
Eliminate proto_tree_add_text from some dissectors.
Change-Id: Ib6024307e85d6c23decf40e9759f549c19ffe136
Reviewed-on: https://code.wireshark.org/review/3318
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-9p.c | 79 | ||||
-rw-r--r-- | epan/dissectors/packet-a21.c | 33 | ||||
-rw-r--r-- | epan/dissectors/packet-acap.c | 43 | ||||
-rw-r--r-- | epan/dissectors/packet-actrace.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-alcap.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-amqp.c | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-aodv.c | 57 | ||||
-rw-r--r-- | epan/dissectors/packet-ar_drone.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-arcnet.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-artnet.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-aruba-papi.c | 87 | ||||
-rw-r--r-- | epan/dissectors/packet-atm.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-auto_rp.c | 28 |
13 files changed, 260 insertions, 197 deletions
diff --git a/epan/dissectors/packet-9p.c b/epan/dissectors/packet-9p.c index b21e7d32b5..12729eeffd 100644 --- a/epan/dissectors/packet-9p.c +++ b/epan/dissectors/packet-9p.c @@ -33,13 +33,12 @@ #include <epan/packet.h> #include <epan/strutil.h> #include <epan/conversation.h> +#include <epan/expert.h> #include <epan/wmem/wmem.h> #include "packet-tcp.h" -#define FIRSTPASS(pinfo) (pinfo->fd->flags.visited == 0) - /** * enum _9p_msg_t - 9P message types * @_9P_TLERROR: not used @@ -870,7 +869,7 @@ static int hf_9P_uname = -1; static int hf_9P_aname = -1; static int hf_9P_ename = -1; static int hf_9P_enum = -1; -static int hf_9P_name = -1; +/* static int hf_9P_name = -1; */ static int hf_9P_filename = -1; static int hf_9P_sdlen = -1; static int hf_9P_user = -1; @@ -972,6 +971,9 @@ static gint ett_9P_getattr_flags = -1; static gint ett_9P_setattr_flags = -1; static gint ett_9P_lflags = -1; +static expert_field ei_9P_first_250 = EI_INIT; +static expert_field ei_9P_msgtype = EI_INIT; + static GHashTable *_9p_hashtable = NULL; static void dissect_9P_mode(tvbuff_t *tvb, proto_item *tree, int offset); @@ -1124,7 +1126,7 @@ static void conv_set_fid_nocopy(packet_info *pinfo, guint32 fid, const char *pat { struct _9p_hashval *val; - if (!FIRSTPASS(pinfo) || fid == _9P_NOFID) + if (pinfo->fd->flags.visited || fid == _9P_NOFID) return; /* get or create&insert fid tree */ @@ -1144,7 +1146,7 @@ static void conv_set_fid(packet_info *pinfo, guint32 fid, const gchar *path, gsi { char *str; - if (!FIRSTPASS(pinfo) || fid == _9P_NOFID || len == 0) + if (pinfo->fd->flags.visited || fid == _9P_NOFID || len == 0) return; str = (char*)wmem_alloc(wmem_file_scope(), len); @@ -1178,7 +1180,7 @@ static void conv_set_tag(packet_info *pinfo, guint16 tag, enum _9p_msg_t msgtype struct _9p_hashval *val; struct _9p_taginfo *taginfo; - if (!FIRSTPASS(pinfo) || tag == _9P_NOTAG) + if (pinfo->fd->flags.visited || tag == _9P_NOTAG) return; val = _9p_hash_new_val(sizeof(struct _9p_taginfo)); @@ -1201,7 +1203,7 @@ static inline struct _9p_taginfo *conv_get_tag(packet_info *pinfo, guint16 tag) struct _9p_hashval *val; /* get tag only makes sense on first pass, as tree isn't built like fid */ - if (!FIRSTPASS(pinfo) || tag == _9P_NOTAG) + if (pinfo->fd->flags.visited || tag == _9P_NOTAG) return NULL; /* check that length matches? */ @@ -1212,7 +1214,7 @@ static inline struct _9p_taginfo *conv_get_tag(packet_info *pinfo, guint16 tag) static inline void conv_free_tag(packet_info *pinfo, guint16 tag) { - if (!FIRSTPASS(pinfo) || tag == _9P_NOTAG) + if (pinfo->fd->flags.visited || tag == _9P_NOTAG) return; _9p_hash_free(pinfo, tag, _9P_NOFID); @@ -1247,12 +1249,11 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre wmem_strbuf_t *tmppath = NULL; gint len, reportedlen; tvbuff_t *next_tvb; - proto_item *ti; - proto_tree *ninep_tree, *sub_tree; + proto_item *ti, *msg_item; + proto_tree *ninep_tree; struct _9p_taginfo *taginfo; nstime_t tv; int _9p_version; - const int firstpass = FIRSTPASS(pinfo); _9p_version = conv_get_version(pinfo); col_set_str(pinfo->cinfo, COL_PROTOCOL, val_to_str_ext_const(_9p_version, &ninep_version_ext, "9P")); @@ -1277,7 +1278,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree_add_item(ninep_tree, hf_9P_msgsz, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset+= 4; - proto_tree_add_item(ninep_tree, hf_9P_msgtype, tvb, offset, 1, ENC_LITTLE_ENDIAN); + msg_item = proto_tree_add_item(ninep_tree, hf_9P_msgtype, tvb, offset, 1, ENC_LITTLE_ENDIAN); ++offset; proto_tree_add_item(ninep_tree, hf_9P_tag, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -1288,7 +1289,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree_add_item(ninep_tree, hf_9P_maxsize, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - if (firstpass) { + if (!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tvb_s = tvb_get_string_enc(NULL, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA); @@ -1330,7 +1331,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item_append_text(ti, " (%s)", g_strerror(u32)); offset += 4; } else { - offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_enum, ett_9P_ename); + offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_ename, ett_9P_ename); } /* conv_get_tag checks we're in first pass */ @@ -1359,7 +1360,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += _9p_dissect_string(tvb, ninep_tree, offset, hf_9P_uname, ett_9P_uname); - if(firstpass) { + if(!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tvb_s = tvb_get_string_enc(NULL, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA); conv_set_fid(pinfo, fid, tvb_s, _9p_len+1); @@ -1380,7 +1381,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre ti = proto_tree_add_item(ninep_tree, hf_9P_fid, tvb, offset, 4, ENC_LITTLE_ENDIAN); fid_path = conv_get_fid(pinfo, fid); proto_item_append_text(ti, " (%s)", fid_path); - if (firstpass) { + if (!pinfo->fd->flags.visited) { tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN); wmem_strbuf_append(tmppath, fid_path); } @@ -1393,15 +1394,9 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre u16 = tvb_get_letohs(tvb, offset); proto_tree_add_item(ninep_tree, hf_9P_nwalk, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - /* I can't imagine anyone having a directory depth more than 25, - Limit to 10 times that to be sure, 2^16 is too much */ - if(u16 > 250) { - sub_tree = proto_tree_add_text(ninep_tree, tvb, 0, 0, "Only first 250 items shown"); - PROTO_ITEM_SET_GENERATED(sub_tree); - } for(i = 0 ; i < u16; i++) { - if (firstpass) { + if (!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tvb_s = tvb_get_string_enc(NULL, tvb, offset+2, _9p_len, ENC_UTF_8|ENC_NA); wmem_strbuf_append_c(tmppath, '/'); @@ -1414,7 +1409,13 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } } - if (firstpass) { + /* I can't imagine anyone having a directory depth more than 25, + Limit to 10 times that to be sure, 2^16 is too much */ + if(u16 > 250) { + expert_add_info(pinfo, ti, &ei_9P_first_250); + } + + if (!pinfo->fd->flags.visited) { conv_set_fid(pinfo, fid, wmem_strbuf_get_str(tmppath), wmem_strbuf_get_len(tmppath)+1); } @@ -1423,14 +1424,12 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre case _9P_RWALK: u16 = tvb_get_letohs(tvb, offset); - proto_tree_add_item(ninep_tree, hf_9P_nqid, tvb, offset, 2, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(ninep_tree, hf_9P_nqid, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* I can't imagine anyone having a directory depth more than 25, Limit to 10 times that to be sure, 2^16 is too much */ if(u16 > 250) { u16 = 250; - sub_tree = proto_tree_add_text(ninep_tree, tvb, 0, 0, "Only first 250 items shown"); - PROTO_ITEM_SET_GENERATED(sub_tree); } for(i = 0; i < u16; i++) { @@ -1438,6 +1437,10 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += 13; } + if (i >= 250) { + expert_add_info(pinfo, ti, &ei_9P_first_250); + } + conv_free_tag(pinfo, tag); break; case _9P_TLOPEN: @@ -1472,7 +1475,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item_append_text(ti, " (%s)", fid_path); offset += 4; - if (firstpass) { + if (!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN); wmem_strbuf_append(tmppath, fid_path); @@ -1493,7 +1496,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if (_9p_version == _9P2000_u) { _9p_len = tvb_get_letohs(tvb, offset); - proto_tree_add_item(ninep_tree, hf_9P_extension, tvb, offset+2, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(ninep_tree, hf_9P_extension, tvb, offset+2, 4, ENC_ASCII|ENC_NA); offset += 2 + _9p_len; } @@ -1507,7 +1510,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item_append_text(ti, " (%s)", fid_path); offset += 4; - if (firstpass) { + if (!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN); wmem_strbuf_append(tmppath, fid_path); @@ -1873,7 +1876,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_item_append_text(ti, " (%s)", fid_path); offset += 4; - if (firstpass) { + if (!pinfo->fd->flags.visited) { _9p_len = tvb_get_letohs(tvb, offset); tmppath = wmem_strbuf_sized_new(wmem_packet_scope(), 0, MAXPATHLEN); wmem_strbuf_append(tmppath, conv_get_fid(pinfo, dfid)); @@ -2142,7 +2145,7 @@ static int dissect_9P_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre case _9P_TLERROR: case _9P_TERROR: default: - proto_tree_add_text(ninep_tree, tvb, 0, 0, "This message type should not happen"); + expert_add_info(pinfo, msg_item, &ei_9P_msgtype); break; } DISSECTOR_ASSERT(tvb_captured_length(tvb) == offset); @@ -2487,9 +2490,11 @@ void proto_register_9P(void) {&hf_9P_enum, {"Enum", "9p.enum", FT_UINT32, BASE_DEC, NULL, 0x0, "Error", HFILL}}, +#if 0 {&hf_9P_name, {"Name", "9p.name", FT_STRING, BASE_NONE, NULL, 0x0, "Name of file", HFILL}}, +#endif {&hf_9P_sdlen, {"Stat data length", "9p.sdlen", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, @@ -2747,11 +2752,19 @@ void proto_register_9P(void) &ett_9P_lflags, }; + expert_module_t* expert_9P; + + static ei_register_info ei[] = { + { &ei_9P_first_250, { "9p.first_250", PI_PROTOCOL, PI_NOTE, "Only first 250 items shown", EXPFILL }}, + { &ei_9P_msgtype, { "9p.msgtype.unknown", PI_PROTOCOL, PI_WARN, "This message type should not happen", EXPFILL }}, + }; + proto_9P = proto_register_protocol("Plan 9", "9P", "9p"); proto_register_field_array(proto_9P, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); + expert_9P = expert_register_protocol(proto_9P); + expert_register_field_array(expert_9P, ei, array_length(ei)); register_init_routine(_9p_hash_init); } diff --git a/epan/dissectors/packet-a21.c b/epan/dissectors/packet-a21.c index 038c94a7ba..77b1fc7cc6 100644 --- a/epan/dissectors/packet-a21.c +++ b/epan/dissectors/packet-a21.c @@ -154,6 +154,14 @@ dissect_a21_correlation_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr } +static const value_string a21_mn_id_type_of_identity_vals[] = { + { 0, "No Identity Code" }, + { 1, "MEID" }, + { 5, "ESN" }, + { 6, "IMSI" }, + { 0, NULL } +}; + /* 5.2.4.8 Mobile Identity (MN ID) */ static void dissect_a21_mobile_identity(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_) @@ -193,9 +201,6 @@ dissect_a21_mobile_identity(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t proto_item_append_text(item, "%s", imsi_str); break; - default: - proto_tree_add_text(tree, tvb, offset, -1, "Type of Identity Reserved"); - break; } @@ -246,10 +251,11 @@ dissect_a21_pilot_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } } -static const value_string a21_random_number_type_vals[] = { - {0x01, "RAND"}, - /* All other values reserved */ - {0, NULL} +static const range_string a21_random_number_type_rvals[] = { + {0x00, 0x00, "Reserved"}, + {0x01, 0x01, "RAND"}, + {0x02, 0x0F, "Reserved"}, + {0, 0, NULL} }; static void @@ -268,9 +274,6 @@ dissect_a21_authentication_challenge_parameter(tvbuff_t *tvb, packet_info *pinfo proto_tree_add_item(tree, hf_a21_auth_chall_para_rand_value, tvb, offset, 4, ENC_BIG_ENDIAN); /*offset +=4;*/ break; - default: - proto_tree_add_text(tree, tvb, offset, -1, "Random Number Type Reserved"); - break; } } @@ -525,12 +528,6 @@ dissect_a21_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gi proto_tree *ie_tree; proto_item *ti; -/* - gint len; - len = tvb_reported_length_remaining(tvb, offset); - proto_tree_add_text(tree, tvb, offset, -1, "offset = %d", offset); - proto_tree_add_text(tree, tvb, offset, -1,"tvb reported length remaining = %d",len); -*/ while(offset < (gint)tvb_reported_length(tvb)){ ie_type = tvb_get_guint8(tvb, offset); if(ie_type == A21_IEI_GCSNA_PDU){ @@ -711,7 +708,7 @@ void proto_register_a21(void) }, { &hf_a21_mn_id_type_of_identity, {"Type of Identity", "a21.mn_id_type_of_identity", - FT_UINT8, BASE_DEC, NULL, 0x07, + FT_UINT8, BASE_DEC, VALS(a21_mn_id_type_of_identity_vals), 0x07, NULL, HFILL } }, {&hf_a21_imsi, @@ -868,7 +865,7 @@ void proto_register_a21(void) */ { &hf_a21_auth_chall_para_rand_num_type, {"Random Number Type", "a21.auth_chall_para_rand_num_type", - FT_UINT8, BASE_DEC, VALS(a21_random_number_type_vals), 0x0f, + FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(a21_random_number_type_rvals), 0x0f, NULL, HFILL } }, { &hf_a21_auth_chall_para_rand_value, diff --git a/epan/dissectors/packet-acap.c b/epan/dissectors/packet-acap.c index 07f4ff7937..8442f272de 100644 --- a/epan/dissectors/packet-acap.c +++ b/epan/dissectors/packet-acap.c @@ -52,6 +52,25 @@ static header_field_info hfi_acap_request HFI_ACAP = FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if ACAP request", HFILL }; +static header_field_info hfi_acap_request_tag HFI_ACAP = + { "Request Tag", "acap.request_tag", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }; + +static header_field_info hfi_acap_response_tag HFI_ACAP = + { "Response Tag", "acap.response_tag", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }; + +static header_field_info hfi_acap_request_data HFI_ACAP = + { "Request", "acap.request_data", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }; + +static header_field_info hfi_acap_response_data HFI_ACAP = + { "Response", "acap.response_data", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }; static gint ett_acap = -1; static gint ett_acap_reqresp = -1; @@ -128,13 +147,11 @@ dissect_acap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tokenlen = get_token_len(line, line + linelen, &next_token); if (tokenlen != 0) { if (is_request) { - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Request Tag: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, &hfi_acap_request_tag, tvb, offset, + tokenlen, format_text(line, tokenlen)); } else { - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Response Tag: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, &hfi_acap_response_tag, tvb, offset, + tokenlen, format_text(line, tokenlen)); } offset += (int)(next_token - line); linelen -= (int)(next_token - line); @@ -146,13 +163,11 @@ dissect_acap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (linelen != 0) { if (is_request) { - proto_tree_add_text(reqresp_tree, tvb, offset, - linelen, "Request: %s", - format_text(line, linelen)); + proto_tree_add_string(reqresp_tree, &hfi_acap_request_data, tvb, offset, + linelen, format_text(line, linelen)); } else { - proto_tree_add_text(reqresp_tree, tvb, offset, - linelen, "Response: %s", - format_text(line, linelen)); + proto_tree_add_string(reqresp_tree, &hfi_acap_response_data, tvb, offset, + linelen, format_text(line, linelen)); } } @@ -174,6 +189,10 @@ proto_register_acap(void) static header_field_info *hfi[] = { &hfi_acap_response, &hfi_acap_request, + &hfi_acap_request_tag, + &hfi_acap_response_tag, + &hfi_acap_request_data, + &hfi_acap_response_data, }; #endif diff --git a/epan/dissectors/packet-actrace.c b/epan/dissectors/packet-actrace.c index ecfb860bda..e77132f123 100644 --- a/epan/dissectors/packet-actrace.c +++ b/epan/dissectors/packet-actrace.c @@ -539,24 +539,21 @@ static void dissect_actrace_cas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *a switch (function) { case SEND_EVENT: - proto_tree_add_text(actrace_tree, tvb, offset, 4, - "Parameter 0: %s", val_to_str_ext(par0, - &actrace_cas_pstn_event_vals_ext, "Unknown (%d)")); + proto_tree_add_int_format_value(actrace_tree, hf_actrace_cas_par0, tvb, offset, 4, + par0, "%s", val_to_str_ext(par0, &actrace_cas_pstn_event_vals_ext, "Unknown (%d)")); col_append_fstr(pinfo->cinfo, COL_INFO, "%s|", val_to_str_ext(par0, &actrace_cas_pstn_event_vals_ext, "%d")); break; case CHANGE_COLLECT_TYPE: - proto_tree_add_text(actrace_tree, tvb, offset, 4, - "Parameter 0: %s", val_to_str(par0, - actrace_cas_collect_type_vals, "Unknown (%d)")); + proto_tree_add_int_format_value(actrace_tree, hf_actrace_cas_par0, tvb, offset, 4, + par0, "%s", val_to_str(par0, actrace_cas_collect_type_vals, "Unknown (%d)")); col_append_fstr(pinfo->cinfo, COL_INFO, "%s|", val_to_str(par0, actrace_cas_collect_type_vals, "%d")); break; case SEND_MF: case SEND_DEST_NUM: - proto_tree_add_text(actrace_tree, tvb, offset, 4, - "Parameter 0: %s", val_to_str(par0, - actrace_cas_send_type_vals, "Unknown (%d)")); + proto_tree_add_int_format_value(actrace_tree, hf_actrace_cas_par0, tvb, offset, 4, + par0, "%s", val_to_str(par0, actrace_cas_send_type_vals, "Unknown (%d)")); col_append_fstr(pinfo->cinfo, COL_INFO, "%s|", val_to_str(par0, actrace_cas_send_type_vals, "%d")); break; @@ -568,8 +565,8 @@ static void dissect_actrace_cas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *a par1 = tvb_get_ntohl(tvb, offset); if (function == SEND_EVENT) { - proto_tree_add_text(actrace_tree, tvb, offset, 4, - "Parameter 1: %s", val_to_str_ext(par1, &actrace_cas_cause_vals_ext, "Unknown (%d)")); + proto_tree_add_int_format_value(actrace_tree, hf_actrace_cas_par1, tvb, offset, 4, + par1, "%s", val_to_str_ext(par1, &actrace_cas_cause_vals_ext, "Unknown (%d)")); col_append_fstr(pinfo->cinfo, COL_INFO, "%s|", val_to_str_ext(par1, &actrace_cas_cause_vals_ext, "%d")); } else { diff --git a/epan/dissectors/packet-alcap.c b/epan/dissectors/packet-alcap.c index 0b37169ebb..0beaa34f2c 100644 --- a/epan/dissectors/packet-alcap.c +++ b/epan/dissectors/packet-alcap.c @@ -779,7 +779,7 @@ static const gchar* dissect_fields_ssim(packet_info* pinfo _U_, tvbuff_t *tvb, p return NULL; } -static const gchar* dissect_fields_ssisa(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) { +static const gchar* dissect_fields_ssisa(packet_info* pinfo, tvbuff_t *tvb, proto_tree *tree, int offset, int len, alcap_message_info_t* msg_info _U_) { /* * Q.2630.1 -> 7.3.11 Service specific information (SAR-assured) * @@ -797,7 +797,7 @@ static const gchar* dissect_fields_ssisa(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree_add_item(tree,hf_alcap_ssisa_max_sscop_uu_fw,tvb,offset+10,2,ENC_BIG_ENDIAN); proto_tree_add_item(tree,hf_alcap_ssisa_max_sscop_uu_bw,tvb,offset+12,2,ENC_BIG_ENDIAN); - proto_tree_add_text(tree,tvb,offset,14,"Not yet decoded: Q.2630.1 7.4.8"); + proto_tree_add_expert_format(tree,pinfo,&ei_alcap_undecoded,tvb,offset,14,"Not yet decoded: Q.2630.1 7.4.8"); return NULL; } @@ -816,7 +816,7 @@ static const gchar* dissect_fields_ssisu(packet_info* pinfo _U_, tvbuff_t *tvb, proto_tree_add_item(tree,hf_alcap_ssisu_max_sssar_fw,tvb,offset,3,ENC_BIG_ENDIAN); proto_tree_add_item(tree,hf_alcap_ssisu_max_sssar_bw,tvb,offset+3,3,ENC_BIG_ENDIAN); proto_tree_add_item(tree,hf_alcap_ssisu_ted,tvb,offset+6,1,ENC_BIG_ENDIAN); - proto_tree_add_text(tree,tvb,offset,7,"Not yet decoded: Q.2630.1 7.4.9"); + proto_tree_add_expert_format(tree,pinfo,&ei_alcap_undecoded,tvb,offset,7,"Not yet decoded: Q.2630.1 7.4.9"); return NULL; } @@ -1247,33 +1247,10 @@ static alcap_param_info_t param_infos[] = { #define GET_PARAM_INFO(id) ( array_length(param_infos) <= id ? &(param_infos[0]) : &(param_infos[id]) ) -typedef struct _alcap_msg_type_info_t { - const gchar* abbr; - int severity; /* XXX - not used */ -} alcap_msg_type_info_t; - -static const alcap_msg_type_info_t msg_types[] = { - { "Unknown Message ", PI_ERROR }, - { "BLC ", PI_NOTE }, - { "BLO ", PI_NOTE }, - { "CFN ", PI_WARN }, - { "ECF ", PI_CHAT }, - { "ERQ ", PI_CHAT }, - { "RLC ", PI_CHAT }, - { "REL ", PI_CHAT }, - { "RSC ", PI_NOTE }, - { "RES ", PI_NOTE }, - { "UBC ", PI_NOTE }, - { "UBL ", PI_NOTE }, - { "MOA ", PI_CHAT }, - { "MOR ", PI_CHAT }, - { "MOD ", PI_CHAT }, -}; - static void alcap_leg_tree(proto_tree* tree, tvbuff_t* tvb, packet_info *pinfo, const alcap_leg_info_t* leg) { - proto_item* pi = proto_tree_add_text(tree,tvb,0,0,"[ALCAP Leg Info]"); + proto_item* pi; - tree = proto_item_add_subtree(pi,ett_leg); + tree = proto_tree_add_subtree(tree,tvb,0,0,ett_leg,NULL,"[ALCAP Leg Info]"); if (leg->dsaid) { pi = proto_tree_add_uint(tree,hf_alcap_leg_dsaid,tvb,0,0,leg->dsaid); @@ -1352,7 +1329,6 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset; proto_item* pi; proto_tree* compat_tree; - const alcap_msg_type_info_t* msg_type; col_set_str(pinfo->cinfo, COL_PROTOCOL, alcap_proto_name_short); @@ -1367,11 +1343,9 @@ static void dissect_alcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { msg_info->dsaid = tvb_get_ntohl(tvb, 0); msg_info->msg_type = tvb_get_guint8(tvb, 4); - msg_type = GET_MSG_TYPE(msg_info->msg_type); - expert_add_info(pinfo, pi, &ei_alcap_response); - col_set_str(pinfo->cinfo, COL_INFO, msg_type->abbr); + col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(msg_info->msg_type, msg_type_strings, "Unknown Message")); pi = proto_tree_add_item(alcap_tree,hf_alcap_compat,tvb,5,1,ENC_NA); compat_tree = proto_item_add_subtree(pi,ett_compat); diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c index 7b1ab63984..188622eedd 100644 --- a/epan/dissectors/packet-amqp.c +++ b/epan/dissectors/packet-amqp.c @@ -1654,6 +1654,7 @@ static int hf_amqp_0_10_queue_method = -1; static int hf_amqp_0_10_file_method = -1; static int hf_amqp_0_10_stream_method = -1; static int hf_amqp_0_10_argument_packing_flags = -1; +static int hf_amqp_0_10_session_header = -1; static int hf_amqp_0_10_session_header_sync = -1; static int hf_amqp_0_10_undissected_struct32 = -1; static int hf_amqp_0_10_message_body = -1; @@ -3922,8 +3923,9 @@ dissect_amqp_0_10_execution(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -4108,8 +4110,9 @@ dissect_amqp_0_10_message(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -4440,6 +4443,7 @@ dissect_amqp_0_10_tx(tvbuff_t *tvb, guint8 method; guint8 flag1, flag2; const gchar *method_name; + proto_item *ti; method = tvb_get_guint8(tvb, offset+1); method_name = val_to_str_const(method, amqp_0_10_tx_methods, @@ -4457,8 +4461,9 @@ dissect_amqp_0_10_tx(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -4498,8 +4503,9 @@ dissect_amqp_0_10_dtx(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -4696,8 +4702,9 @@ dissect_amqp_0_10_exchange(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -4962,8 +4969,9 @@ dissect_amqp_0_10_queue(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -5120,8 +5128,9 @@ dissect_amqp_0_10_file(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -5458,8 +5467,9 @@ dissect_amqp_0_10_stream(tvbuff_t *tvb, */ flag1 = tvb_get_guint8(tvb, offset); flag2 = tvb_get_guint8(tvb, offset+1); + ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN); if ((flag1 != 1) || ((flag2 & 0xfe) != 0)) - proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header"); + proto_item_append_text(ti, " (Invalid)"); else proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync, tvb, offset + 1, 1, ENC_BIG_ENDIAN); @@ -11967,6 +11977,10 @@ proto_register_amqp(void) "Packing Flags", "amqp.struct.packing", FT_UINT16, BASE_HEX, NULL, 0xffff, "Argument Struct Packing Flags", HFILL}}, + {&hf_amqp_0_10_session_header, { + "Session header", "amqp.session.header", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL}}, {&hf_amqp_0_10_session_header_sync, { "Sync", "amqp.session.header.sync", FT_BOOLEAN, 8, TFS(&amqp_0_10_session_header_sync), 0x01, diff --git a/epan/dissectors/packet-aodv.c b/epan/dissectors/packet-aodv.c index d2d9de4f69..bce1a12ccd 100644 --- a/epan/dissectors/packet-aodv.c +++ b/epan/dissectors/packet-aodv.c @@ -31,6 +31,7 @@ #include <epan/packet.h> #include <epan/to_str.h> +#include <epan/expert.h> #ifndef offsetof #define offsetof(type, member) ((size_t)(&((type *)0)->member)) @@ -132,8 +133,8 @@ static int hf_aodv_flags_rreq_unknown = -1; static int hf_aodv_flags_rrep_repair = -1; static int hf_aodv_flags_rrep_ack = -1; static int hf_aodv_flags_rerr_nodelete = -1; -/* static int hf_aodv_ext_type = -1; */ -/* static int hf_aodv_ext_length = -1; */ +static int hf_aodv_ext_type = -1; +static int hf_aodv_ext_length = -1; static int hf_aodv_ext_interval = -1; static int hf_aodv_ext_timestamp = -1; @@ -143,17 +144,18 @@ static gint ett_aodv_flags = -1; static gint ett_aodv_unreach_dest = -1; static gint ett_aodv_extensions = -1; +static expert_field ei_aodv_ext_length = EI_INIT; +static expert_field ei_aodv_type = EI_INIT; + /* Code to actually dissect the packets */ static void -dissect_aodv_ext(tvbuff_t * tvb, int offset, proto_tree * tree) +dissect_aodv_ext(tvbuff_t * tvb, packet_info *pinfo, int offset, proto_tree * tree) { proto_tree *ext_tree; + proto_item *len_item; guint8 type, len; - if (!tree) - return; - again: if ((int) tvb_reported_length(tvb) <= offset) return; /* No more options left */ @@ -163,17 +165,14 @@ dissect_aodv_ext(tvbuff_t * tvb, int offset, proto_tree * tree) ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2 + len, ett_aodv_extensions, NULL, "Extensions"); - proto_tree_add_text(ext_tree, tvb, offset, 1, - "Type: %u (%s)", type, - val_to_str_const(type, exttype_vals, "Unknown")); + proto_tree_add_item(ext_tree, hf_aodv_ext_type, tvb, offset, 1, ENC_NA); + len_item = proto_tree_add_uint_format_value(ext_tree, hf_aodv_ext_length, tvb, offset + 1, 1, + len, "%u bytes", len); if (len == 0) { - proto_tree_add_text(ext_tree, tvb, offset + 1, 1, - "Invalid option length: %u", len); + expert_add_info(pinfo, len_item, &ei_aodv_ext_length); return; /* we must not try to decode this */ } - proto_tree_add_text(ext_tree, tvb, offset + 1, 1, - "Length: %u bytes", len); offset += 2; @@ -320,7 +319,7 @@ dissect_aodv_rreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, if (aodv_tree) { extlen = tvb_reported_length_remaining(tvb, offset); if (extlen > 0) - dissect_aodv_ext(tvb, offset, aodv_tree); + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } } @@ -439,7 +438,7 @@ dissect_aodv_rrep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, if (aodv_tree) { extlen = tvb_reported_length_remaining(tvb, offset); if (extlen > 0) - dissect_aodv_ext(tvb, offset, aodv_tree); + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } } @@ -598,7 +597,7 @@ dissect_aodv_draft_01_v6_rreq(tvbuff_t *tvb, packet_info *pinfo, if (aodv_tree) { extlen = tvb_reported_length_remaining(tvb, offset); if (extlen > 0) - dissect_aodv_ext(tvb, offset, aodv_tree); + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } } @@ -690,7 +689,7 @@ dissect_aodv_draft_01_v6_rrep(tvbuff_t *tvb, packet_info *pinfo, if (aodv_tree) { extlen = tvb_reported_length_remaining(tvb, offset); if (extlen > 0) - dissect_aodv_ext(tvb, offset, aodv_tree); + dissect_aodv_ext(tvb, pinfo, offset, aodv_tree); } } @@ -743,8 +742,8 @@ dissect_aodv_draft_01_v6_rerr(tvbuff_t *tvb, packet_info *pinfo, static int dissect_aodv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - proto_item *ti = NULL; - proto_tree *aodv_tree = NULL; + proto_item *ti, *type_item; + proto_tree *aodv_tree; gboolean is_ipv6; guint8 type; @@ -769,14 +768,12 @@ dissect_aodv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(type, type_vals, "Unknown AODV Packet Type (%u)")); - if (tree) { ti = proto_tree_add_protocol_format(tree, proto_aodv, tvb, 0, -1, "Ad hoc On-demand Distance Vector Routing Protocol, %s", val_to_str(type, type_vals, "Unknown AODV Packet Type (%u)")); aodv_tree = proto_item_add_subtree(ti, ett_aodv); - proto_tree_add_uint(aodv_tree, hf_aodv_type, tvb, 0, 1, type); - } + type_item = proto_tree_add_uint(aodv_tree, hf_aodv_type, tvb, 0, 1, type); switch (type) { case RREQ: @@ -802,8 +799,7 @@ dissect_aodv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ case DRAFT_01_V6_RREP_ACK: break; default: - proto_tree_add_text(aodv_tree, tvb, 0, -1, - "Unknown AODV Packet Type (%u)", type); + expert_add_info(pinfo, type_item, &ei_aodv_type); } return tvb_length(tvb); @@ -938,9 +934,10 @@ proto_register_aodv(void) FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, +#endif { &hf_aodv_ext_type, { "Extension Type", "aodv.ext_type", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC, VALS(exttype_vals), 0x0, "Extension Format Type", HFILL} }, { &hf_aodv_ext_length, @@ -948,7 +945,6 @@ proto_register_aodv(void) FT_UINT8, BASE_DEC, NULL, 0x0, "Extension Data Length", HFILL} }, -#endif { &hf_aodv_ext_interval, { "Hello Interval", "aodv.hello_interval", FT_UINT32, BASE_DEC, NULL, 0x0, @@ -969,12 +965,21 @@ proto_register_aodv(void) &ett_aodv_extensions, }; + static ei_register_info ei[] = { + { &ei_aodv_ext_length, { "aodv.ext_length.invalid", PI_MALFORMED, PI_ERROR, "Invalid option length", EXPFILL }}, + { &ei_aodv_type, { "aodv.ext_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown AODV Packet Type", EXPFILL }}, + }; + + expert_module_t* expert_aodv; + /* Register the protocol name and description */ proto_aodv = proto_register_protocol("Ad hoc On-demand Distance Vector Routing Protocol", "AODV", "aodv"); /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_aodv, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_aodv = expert_register_protocol(proto_aodv); + expert_register_field_array(expert_aodv, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-ar_drone.c b/epan/dissectors/packet-ar_drone.c index c7e2d975fd..d6949a1e73 100644 --- a/epan/dissectors/packet-ar_drone.c +++ b/epan/dissectors/packet-ar_drone.c @@ -423,7 +423,7 @@ dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data expert_add_info(pinfo, sub_item, &ei_NO_CR); return offset; } - proto_tree_add_text(sub_tree, tvb, master_offset, length, "(Sets the reference for the horizontal plane)"); + proto_item_append_text(sub_item, " (Sets the reference for the horizontal plane)"); proto_tree_add_item(sub_tree, hf_FTRIM_seq, tvb, offset, length, ENC_ASCII|ENC_NA); offset += (length + 1); } else if (!strncmp(command, "AT*CONFIG", 9)) diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c index 597befe9da..0297a1ee9c 100644 --- a/epan/dissectors/packet-arcnet.c +++ b/epan/dissectors/packet-arcnet.c @@ -43,6 +43,7 @@ static int hf_arcnet_protID = -1; static int hf_arcnet_exception_flag = -1; static int hf_arcnet_split_flag = -1; static int hf_arcnet_sequence = -1; +static int hf_arcnet_padding = -1; /* Initialize the subtree pointers */ static gint ett_arcnet = -1; @@ -213,7 +214,7 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, split_flag); offset++; - proto_tree_add_text (arcnet_tree, tvb, offset, 2, "Padding"); + proto_tree_add_item(arcnet_tree, hf_arcnet_padding, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* Another copy of the packet type appears after the padding. */ @@ -331,6 +332,11 @@ proto_register_arcnet (void) FT_UINT16, BASE_DEC, NULL, 0, "Sequence number", HFILL} }, + {&hf_arcnet_padding, + {"Padding", "arcnet.padding", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL} + }, }; /* Setup protocol subtree array */ diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c index f67ccd6463..d5a7b175ba 100644 --- a/epan/dissectors/packet-artnet.c +++ b/epan/dissectors/packet-artnet.c @@ -1111,6 +1111,7 @@ static int proto_artnet = -1; /* general */ static int hf_artnet_filler = -1; static int hf_artnet_spare = -1; +static int hf_artnet_data = -1; static int hf_artnet_excess_bytes = -1; /* Header */ @@ -3114,16 +3115,15 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { default: - if (tree && tvb_reported_length_remaining(tvb, offset) > 0) { - proto_tree_add_text(artnet_tree, tvb, offset, -1, - "Data (%d bytes)", tvb_reported_length_remaining(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) > 0) { + proto_tree_add_item(artnet_tree, hf_artnet_data, tvb, offset, -1, ENC_NA); } return; } - if (tree && tvb_reported_length_remaining(tvb, offset) > 0) { + if (tvb_reported_length_remaining(tvb, offset) > 0) { proto_tree_add_item(artnet_tree, hf_artnet_excess_bytes, tvb, - offset, tvb_reported_length_remaining(tvb, offset), ENC_NA); + offset, -1, ENC_NA); } } @@ -3159,6 +3159,12 @@ proto_register_artnet(void) { FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_artnet_data, + { "Data", + "artnet.data", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_artnet_filler, { "filler", "artnet.filler", diff --git a/epan/dissectors/packet-aruba-papi.c b/epan/dissectors/packet-aruba-papi.c index 921b53c0bc..4dcb2d886b 100644 --- a/epan/dissectors/packet-aruba-papi.c +++ b/epan/dissectors/packet-aruba-papi.c @@ -35,6 +35,7 @@ #include <epan/packet.h> #include <epan/prefs.h> +#include <epan/expert.h> /* This is not IANA assigned nor registered */ #define UDP_PORT_PAPI 8211 @@ -66,6 +67,8 @@ static int hf_papi_debug_64bits = -1; static int hf_papi_debug_bytes = -1; static int hf_papi_debug_bytes_length = -1; +static expert_field ei_papi_debug_unknown = EI_INIT; + /* Global PAPI Debug Preference */ static gboolean g_papi_debug = FALSE; @@ -76,7 +79,7 @@ static gint ett_papi = -1; /* PAPI Debug loop ! */ static int -dissect_papi_debug(tvbuff_t *tvb, guint offset, proto_tree *tree) +dissect_papi_debug(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree) { proto_item *ti; proto_tree *debug_tree, *debug_sub_tree; @@ -128,7 +131,7 @@ dissect_papi_debug(tvbuff_t *tvb, guint offset, proto_tree *tree) offset += 9; break; default: - proto_tree_add_text(debug_tree, tvb, offset, 1, "Unknown (%d)", tvb_get_guint8(tvb, offset)); + proto_tree_add_expert_format(debug_tree, pinfo, &ei_papi_debug_unknown, tvb, offset, 1, "Unknown (%d)", tvb_get_guint8(tvb, offset)); offset +=1; } } @@ -152,60 +155,56 @@ dissect_papi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PAPI"); col_set_str(pinfo->cinfo, COL_INFO, "PAPI - Aruba AP Control Protocol"); - if (tree) { - - ti = proto_tree_add_item(tree, proto_papi, tvb, 0, -1, ENC_NA); - - papi_tree = proto_item_add_subtree(ti, ett_papi); - - proto_tree_add_item(papi_tree, hf_papi_hdr_id, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + ti = proto_tree_add_item(tree, proto_papi, tvb, 0, -1, ENC_NA); + papi_tree = proto_item_add_subtree(ti, ett_papi); - proto_tree_add_item(papi_tree, hf_papi_hdr_version, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_id, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_ip_destination, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(papi_tree, hf_papi_hdr_version, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_ip_source, tvb, offset, 4, ENC_BIG_ENDIAN); - offset += 4; + proto_tree_add_item(papi_tree, hf_papi_hdr_ip_destination, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_ip_source, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; - proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_port_source, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_port_destination, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_port_source, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_port_destination, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_sequence, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + proto_tree_add_item(papi_tree, hf_papi_hdr_sequence, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - proto_tree_add_item(papi_tree, hf_papi_hdr_checksum, tvb, offset, 16, ENC_NA); - offset += 16; + proto_tree_add_item(papi_tree, hf_papi_hdr_unknown, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; - if(g_papi_debug) - { - offset = dissect_papi_debug(tvb, offset, papi_tree); - } + proto_tree_add_item(papi_tree, hf_papi_hdr_checksum, tvb, offset, 16, ENC_NA); + offset += 16; - next_tvb = tvb_new_subset_remaining(tvb, offset); - call_dissector(data_handle,next_tvb, pinfo, tree); + if(g_papi_debug) + { + offset = dissect_papi_debug(tvb, pinfo, offset, papi_tree); } + next_tvb = tvb_new_subset_remaining(tvb, offset); + call_dissector(data_handle,next_tvb, pinfo, tree); + return(TRUE); } @@ -323,10 +322,18 @@ proto_register_papi(void) &ett_papi }; + static ei_register_info ei[] = { + { &ei_papi_debug_unknown, { "papi.debug.unknown", PI_PROTOCOL, PI_WARN, "Unknown", EXPFILL }}, + }; + + expert_module_t* expert_papi; + proto_papi = proto_register_protocol("Aruba PAPI", "PAPI", "papi"); proto_register_field_array(proto_papi, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_papi = expert_register_protocol(proto_papi); + expert_register_field_array(expert_papi, ei, array_length(ei)); papi_module = prefs_register_protocol(proto_papi, NULL); diff --git a/epan/dissectors/packet-atm.c b/epan/dissectors/packet-atm.c index e4ca478f70..96e4b8674b 100644 --- a/epan/dissectors/packet-atm.c +++ b/epan/dissectors/packet-atm.c @@ -43,6 +43,7 @@ void proto_reg_handoff_atm(void); static int proto_atm = -1; static int hf_atm_aal = -1; +static int hf_atm_gfc = -1; static int hf_atm_vpi = -1; static int hf_atm_vci = -1; static int hf_atm_cid = -1; @@ -116,6 +117,7 @@ static int hf_atm_aal_oamcell_type_ad = -1; static int hf_atm_aal_oamcell_type_ft = -1; static int hf_atm_aal_oamcell_func_spec = -1; static int hf_atm_aal_oamcell_crc = -1; +static int hf_atm_padding = -1; static gint ett_atm = -1; static gint ett_atm_lane = -1; @@ -1079,8 +1081,7 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *ti; if (pad_length > 0) { - proto_tree_add_text(atm_tree, tvb, aal5_length, pad_length, - "Padding"); + proto_tree_add_item(atm_tree, hf_atm_padding, tvb, aal5_length, pad_length, ENC_NA); } proto_tree_add_item(atm_tree, hf_atm_aal5_uu, tvb, length - 8, 1, ENC_BIG_ENDIAN); @@ -1167,7 +1168,7 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, else if (pntoh16(octet) == 0x00) { /* assume vc muxed bridged ethernet */ - proto_tree_add_text(tree, tvb, 0, 2, "Pad: 0x0000"); + proto_tree_add_item(tree, hf_atm_padding, tvb, 0, 2, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, 2); call_dissector(eth_handle, next_tvb, pinfo, tree); } @@ -1622,7 +1623,7 @@ dissect_atm_cell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * +-+-+-+-+-+-+-+-+ */ octet = tvb_get_guint8(tvb, 0); - proto_tree_add_text(atm_tree, tvb, 0, 1, "GFC: 0x%x", octet >> 4); + proto_tree_add_item(atm_tree, hf_atm_gfc, tvb, 0, 1, ENC_NA); vpi = (octet & 0xF) << 4; octet = tvb_get_guint8(tvb, 1); vpi |= octet >> 4; @@ -1934,7 +1935,9 @@ proto_register_atm(void) { &hf_atm_aal, { "AAL", "atm.aal", FT_UINT8, BASE_DEC, VALS(aal_vals), 0x0, NULL, HFILL }}, - + { &hf_atm_gfc, + { "GFC", "atm.GFC", FT_UINT8, BASE_DEC, NULL, 0xF0, + NULL, HFILL }}, { &hf_atm_vpi, { "VPI", "atm.vpi", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -2139,6 +2142,10 @@ proto_register_atm(void) { &hf_atm_aal_oamcell_crc, { "CRC-10", "atm.aal_oamcell.crc", FT_UINT16, BASE_HEX, NULL, 0x3FF, NULL, HFILL }}, + { &hf_atm_padding, + { "Padding", "atm.padding", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + }; static gint *ett[] = { diff --git a/epan/dissectors/packet-auto_rp.c b/epan/dissectors/packet-auto_rp.c index b2a7f158ba..2fe644ee7c 100644 --- a/epan/dissectors/packet-auto_rp.c +++ b/epan/dissectors/packet-auto_rp.c @@ -47,6 +47,9 @@ static gint hf_auto_rp_rp_addr = -1; static gint hf_auto_rp_prefix_sgn = -1; static gint hf_auto_rp_mask_len = -1; static gint hf_auto_rp_group_prefix = -1; +static gint hf_auto_rp_reserved = -1; +static gint hf_auto_rp_trailing_junk = -1; +static gint hf_auto_rp_group_num = -1; #define UDP_PORT_PIM_RP_DISC 496 @@ -149,14 +152,14 @@ static void dissect_auto_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "%u second%s", holdtime, plurality(holdtime, "", "s")); offset+=2; - proto_tree_add_text(auto_rp_tree, tvb, offset, 4, "Reserved: 0x%x", tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(auto_rp_tree, hf_auto_rp_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; for (i = 0; i < rp_count; i++) offset = do_auto_rp_map(tvb, offset, auto_rp_tree); - if (tvb_offset_exists(tvb, offset)) - proto_tree_add_text(tree, tvb, offset, -1, "Trailing junk"); + if (tvb_reported_length_remaining(tvb, offset) > 0) + proto_tree_add_item(tree, hf_auto_rp_trailing_junk, tvb, offset, -1, ENC_NA); } return; @@ -183,7 +186,7 @@ static int do_auto_rp_map(tvbuff_t *tvb, int offset, proto_tree *auto_rp_tree) offset += 4; proto_tree_add_item(map_tree, hf_auto_rp_pim_ver, tvb, offset, 1, ENC_NA); offset++; - proto_tree_add_text(map_tree, tvb, offset, 1, "Number of groups this RP maps to: %u", group_count); + proto_tree_add_uint(map_tree, hf_auto_rp_group_num, tvb, offset, 1, group_count); offset++; for (i = 0; i < group_count; i++) { @@ -227,6 +230,11 @@ void proto_register_auto_rp(void) FT_UINT8, BASE_DEC, NULL, 0, "The number of RP addresses contained in this message", HFILL }}, + { &hf_auto_rp_group_num, + {"Number of groups this RP maps to", "auto_rp.group_num", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_auto_rp_holdtime, {"Holdtime", "auto_rp.holdtime", FT_UINT16, BASE_DEC, NULL, 0, @@ -255,7 +263,17 @@ void proto_register_auto_rp(void) { &hf_auto_rp_group_prefix, {"Prefix", "auto_rp.group_prefix", FT_IPv4, BASE_NONE, NULL, 0, - "Group prefix", HFILL }} + "Group prefix", HFILL }}, + + { &hf_auto_rp_reserved, + {"Reserved", "auto_rp.reserved", + FT_UINT32, BASE_HEX, NULL, 0, + NULL, HFILL }}, + + { &hf_auto_rp_trailing_junk, + {"Trailing junk", "auto_rp.trailing_junk", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, }; static gint *ett[] = { |