diff options
author | Michael Mann <mmann78@netscape.net> | 2014-09-26 19:28:01 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-09-27 15:44:53 +0000 |
commit | 6fad7d19e73be54c5426a6a5e97245c782e53b6c (patch) | |
tree | 41436d398cc6a6b73fc47050f0478ab7bb461173 | |
parent | 65437a7c526c0f11d164ecd32b99c13a4f9ec5e6 (diff) |
Eliminate proto_tree_add_text from some dissectors.
Some other related cleanup.
Change-Id: I45f54032aa8318858f4ee784945b6f2ed163b6ea
Reviewed-on: https://code.wireshark.org/review/4328
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | epan/dissectors/file-gif.c | 14 | ||||
-rw-r--r-- | epan/dissectors/file-mp4.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-afs.c | 74 | ||||
-rw-r--r-- | epan/dissectors/packet-dcc.c | 108 | ||||
-rw-r--r-- | epan/dissectors/packet-dtp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-extreme.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-fcdns.c | 50 | ||||
-rw-r--r-- | epan/dissectors/packet-fcswils.c | 237 | ||||
-rw-r--r-- | epan/dissectors/packet-hclnfsd.c | 65 | ||||
-rw-r--r-- | epan/dissectors/packet-igap.c | 41 | ||||
-rw-r--r-- | epan/dissectors/packet-juniper.c | 181 | ||||
-rw-r--r-- | epan/dissectors/packet-kink.c | 150 | ||||
-rw-r--r-- | epan/dissectors/packet-kismet.c | 82 | ||||
-rw-r--r-- | epan/dissectors/packet-mgcp.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-nlsp.c | 467 | ||||
-rw-r--r-- | epan/dissectors/packet-pdcp-lte.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-pnrp.c | 106 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-video.c | 2 |
18 files changed, 901 insertions, 761 deletions
diff --git a/epan/dissectors/file-gif.c b/epan/dissectors/file-gif.c index e8f9922089..2f00756a93 100644 --- a/epan/dissectors/file-gif.c +++ b/epan/dissectors/file-gif.c @@ -292,6 +292,12 @@ static header_field_info hfi_trailer GIF_HFI_INIT = HFILL }; +static header_field_info hfi_data_block GIF_HFI_INIT = + { "Data block", + IMG_GIF ".data_block", + FT_BYTES, BASE_NONE, NULL, 0x00, + NULL, HFILL }; + /* Initialize the subtree pointers */ static gint ett_gif = -1; @@ -496,8 +502,8 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) do { /* Read length of data block */ len = tvb_get_guint8(tvb, offset); - proto_tree_add_text(subtree, tvb, - offset, 1 + len, + proto_tree_add_bytes_format(subtree, hfi_data_block.id, tvb, + offset+1, len, NULL, "Data block (length = %u)", len); offset += (1 + len); item_len += (1 + len); @@ -575,8 +581,8 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) do { /* Read length of data block */ len = tvb_get_guint8(tvb, offset); - proto_tree_add_text(subtree, tvb, - offset, 1 + len, + proto_tree_add_bytes_format(subtree, hfi_data_block.id, tvb, + offset + 1, len, NULL, "Data block (length = %u)", len); offset += 1 + len; item_len += (1 + len); diff --git a/epan/dissectors/file-mp4.c b/epan/dissectors/file-mp4.c index c3e31c7518..4d5207ae86 100644 --- a/epan/dissectors/file-mp4.c +++ b/epan/dissectors/file-mp4.c @@ -54,6 +54,7 @@ static int hf_mp4_box_type_str = -1; static int hf_mp4_box_largesize = -1; static int hf_mp4_full_box_ver = -1; static int hf_mp4_full_box_flags = -1; +static int hf_mp4_full_box_flags_media_data_location = -1; static int hf_mp4_ftyp_brand = -1; static int hf_mp4_ftyp_ver = -1; static int hf_mp4_ftyp_add_brand = -1; @@ -364,25 +365,30 @@ static gint dissect_mp4_url_body(tvbuff_t *tvb, gint offset, gint len, packet_info *pinfo _U_, proto_tree *tree) { +#if 0 guint32 flags; +#endif proto_tree_add_item(tree, hf_mp4_full_box_ver, tvb, offset, 1, ENC_BIG_ENDIAN); /* XXX - put up an expert info if version!=0 */ offset += 1; +#if 0 flags = tvb_get_ntoh24(tvb, offset); +#endif proto_tree_add_item(tree, hf_mp4_full_box_flags, tvb, offset, 3, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_mp4_full_box_flags_media_data_location, tvb, offset, 3, ENC_BIG_ENDIAN); /*offset += 3;*/ +#if 0 if (flags&ENTRY_FLAG_MOVIE) { - proto_tree_add_text(tree, tvb, 0, 0, - "Media data location is defined in the movie box"); } else { /* XXX - dissect location string */ } +#endif return len; } @@ -598,6 +604,9 @@ proto_register_mp4(void) { &hf_mp4_full_box_flags, { "Flags", "mp4.full_box.flags", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL } }, + { &hf_mp4_full_box_flags_media_data_location, + { "Media data location is defined in the movie box", "mp4.full_box.flags.media_data_location", FT_BOOLEAN, 24, + NULL, ENTRY_FLAG_MOVIE, NULL, HFILL } }, { &hf_mp4_ftyp_brand, { "Brand", "mp4.ftyp.brand", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-afs.c b/epan/dissectors/packet-afs.c index 7be8558f85..1977bc0234 100644 --- a/epan/dissectors/packet-afs.c +++ b/epan/dissectors/packet-afs.c @@ -585,7 +585,7 @@ static const fragment_items afs_frag_items = { /* Output a fixed length vectorized string (each char is a 32 bit int) */ #define OUT_RXStringV(field, length) \ - { char tmp_orxsv[length+1]; \ + { char tmp_orxsv[length+1]; \ int i_orxsv,soff_orxsv; \ soff_orxsv = offset;\ for (i_orxsv=0; i_orxsv<length; i_orxsv++)\ @@ -600,10 +600,9 @@ static const fragment_items afs_frag_items = { /* Output a callback */ #define OUT_FS_AFSCallBack() \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 3*4, "Callback"); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_callback); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 3*4, ett_afs_callback, NULL, "Callback"); \ OUT_UINT(hf_afs_fs_callback_version); \ OUT_TIMESECS(hf_afs_fs_callback_expires); \ OUT_UINT(hf_afs_fs_callback_type); \ @@ -612,14 +611,13 @@ static const fragment_items afs_frag_items = { /* Output cache manager interfaces */ #define OUT_CM_INTERFACES() \ - { proto_tree *save, *ti; \ + { proto_tree *save; \ unsigned int i; \ unsigned int maxint, numint; \ maxint = 32; \ numint = tvb_get_ntohl(tvb, offset); \ - ti = proto_tree_add_text(tree, tvb, offset, 4+11*4+3*32*4, "Interfaces"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_cm_interfaces); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 4+11*4+3*32*4, ett_afs_cm_interfaces, NULL, "Interfaces"); \ OUT_UINT(hf_afs_cm_numint); \ OUT_UUID(hf_afs_cm_uuid); \ for ( i=0; i<numint; i++ ) { \ @@ -639,29 +637,25 @@ static const fragment_items afs_frag_items = { /* Output CM capabilities */ #define OUT_CM_CAPABILITIES() \ - { proto_tree *save, *ti; \ + { proto_tree *save; \ unsigned int numcap; \ - guint32 capabilities; \ numcap = tvb_get_ntohl(tvb, offset); \ - ti = proto_tree_add_text(tree, tvb, offset, 4+numcap*4, "Capabilities"); \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_cm_capabilities); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 4+numcap*4, ett_afs_cm_capabilities, NULL, "Capabilities"); \ OUT_UINT(hf_afs_cm_numcap); \ - capabilities = tvb_get_ntohl(tvb, offset); \ - ti = proto_tree_add_uint(tree, hf_afs_cm_capabilities, tvb, offset, \ - 4, capabilities); \ - proto_tree_add_boolean(tree, hf_afs_cm_cap_errortrans, \ - tvb,offset,4, capabilities); \ + proto_tree_add_item(tree, hf_afs_cm_capabilities, tvb, offset, \ + 4, ENC_BIG_ENDIAN); \ + proto_tree_add_item(tree, hf_afs_cm_cap_errortrans, \ + tvb,offset,4, ENC_BIG_ENDIAN); \ offset += 4; \ tree = save; \ } /* Output a callback */ #define OUT_CB_AFSCallBack() \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 3*4, "Callback"); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_callback); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 3*4, ett_afs_callback, NULL, "Callback"); \ OUT_UINT(hf_afs_cb_callback_version); \ OUT_TIMESECS(hf_afs_cb_callback_expires); \ OUT_UINT(hf_afs_cb_callback_type); \ @@ -670,11 +664,10 @@ static const fragment_items afs_frag_items = { /* Output a File ID */ #define OUT_FS_AFSFid(label) \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 3*4, \ - "FileID (%s)", label); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_fid); \ + tree = proto_tree_add_subtree_format(tree, tvb, offset, 3*4, \ + ett_afs_fid, NULL, "FileID (%s)", label); \ OUT_UINT(hf_afs_fs_fid_volume); \ OUT_UINT(hf_afs_fs_fid_vnode); \ OUT_UINT(hf_afs_fs_fid_uniqifier); \ @@ -731,11 +724,10 @@ static const fragment_items afs_frag_items = { /* Output a File ID */ #define OUT_CB_AFSFid(label) \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 3*4, \ - "FileID (%s)", label); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_fid); \ + tree = proto_tree_add_subtree_format(tree, tvb, offset, 3*4, \ + ett_afs_fid, NULL, "FileID (%s)", label); \ OUT_UINT(hf_afs_cb_fid_volume); \ OUT_UINT(hf_afs_cb_fid_vnode); \ OUT_UINT(hf_afs_cb_fid_uniqifier); \ @@ -744,11 +736,10 @@ static const fragment_items afs_frag_items = { /* Output a StoreStatus */ #define OUT_FS_AFSStoreStatus(label) \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 6*4, \ - label); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_status); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 6*4, \ + ett_afs_status, NULL, label); \ OUT_FS_STATUSMASK(); \ OUT_TIMESECS(hf_afs_fs_status_clientmodtime); \ OUT_UINT(hf_afs_fs_status_owner); \ @@ -760,11 +751,10 @@ static const fragment_items afs_frag_items = { /* Output a FetchStatus */ #define OUT_FS_AFSFetchStatus(label) \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 21*4, \ - label); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_status); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 21*4, \ + ett_afs_status, NULL, label); \ OUT_UINT(hf_afs_fs_status_interfaceversion); \ OUT_UINT(hf_afs_fs_status_filetype); \ OUT_UINT(hf_afs_fs_status_linkcount); \ @@ -791,11 +781,10 @@ static const fragment_items afs_frag_items = { /* Output a VolSync */ #define OUT_FS_AFSVolSync() \ - { proto_tree *save, *ti; \ - ti = proto_tree_add_text(tree, tvb, offset, 6*4, \ - "VolSync"); \ + { proto_tree *save; \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_volsync); \ + tree = proto_tree_add_subtree(tree, tvb, offset, 6*4, \ + ett_afs_volsync, NULL, "VolSync"); \ OUT_TIMESECS(hf_afs_fs_volsync_spare1); \ OUT_UINT(hf_afs_fs_volsync_spare2); \ OUT_UINT(hf_afs_fs_volsync_spare3); \ @@ -988,7 +977,7 @@ static const fragment_items afs_frag_items = { /* Output a UBIK version code */ #define OUT_UBIKVERSION(label) \ - { proto_tree *save, *ti; \ + { proto_tree *save; \ unsigned int epoch,counter; \ nstime_t ts; \ epoch = tvb_get_ntohl(tvb, offset); \ @@ -997,10 +986,9 @@ static const fragment_items afs_frag_items = { offset += 4; \ ts.secs = epoch; \ ts.nsecs = 0; \ - ti = proto_tree_add_text(tree, tvb, offset-8, 8, \ - "UBIK Version (%s): %u.%u", label, epoch, counter ); \ save = tree; \ - tree = proto_item_add_subtree(ti, ett_afs_ubikver); \ + tree = proto_tree_add_subtree_format(tree, tvb, offset-8, 8, \ + ett_afs_ubikver, NULL, "UBIK Version (%s): %u.%u", label, epoch, counter ); \ if ( epoch != 0 ) \ proto_tree_add_time(tree,hf_afs_ubik_version_epoch, tvb,offset-8, \ 4,&ts); \ diff --git a/epan/dissectors/packet-dcc.c b/epan/dissectors/packet-dcc.c index ca6a7f8212..866092ca62 100644 --- a/epan/dissectors/packet-dcc.c +++ b/epan/dissectors/packet-dcc.c @@ -29,6 +29,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <packet-dcc.h> @@ -57,6 +58,7 @@ static int hf_dcc_ck_sum = -1; static int hf_dcc_date = -1; static int hf_dcc_target = -1; +static int hf_dcc_response_text = -1; static int hf_dcc_adminop = -1; static int hf_dcc_adminval = -1; @@ -70,31 +72,39 @@ static int hf_dcc_trace_query = -1; static int hf_dcc_trace_ridc = -1; static int hf_dcc_trace_flood = -1; +static int hf_dcc_addr = -1; +static int hf_dcc_id = -1; +static int hf_dcc_last_used = -1; +static int hf_dcc_requests = -1; +static int hf_dcc_pad = -1; +static int hf_dcc_unused = -1; + static gint ett_dcc = -1; static gint ett_dcc_opnums = -1; static gint ett_dcc_op = -1; static gint ett_dcc_ck = -1; static gint ett_dcc_trace = -1; +static expert_field ei_dcc_len = EI_INIT; + /* Utility macros */ #define D_SIGNATURE() \ proto_tree_add_item(dcc_optree, hf_dcc_signature, tvb, \ offset, (int)sizeof(DCC_SIGNATURE), ENC_NA); \ offset += (int)sizeof(DCC_SIGNATURE); -#define D_LABEL(label,len) \ - proto_tree_add_text(dcc_optree, tvb, offset, len, label); \ +#define D_LABEL(hf_label, len, encoding) \ + proto_tree_add_item(dcc_optree, hf_label, tvb, offset, len, encoding); \ offset += len; -#define D_TEXT(label, endpad) { \ +#define D_TEXT(hf_label, endpad) { \ int next_offset,left; \ while (tvb_offset_exists(tvb, offset+endpad)) { \ left = tvb_length_remaining(tvb,offset) - endpad; \ tvb_find_line_end(tvb, offset, left, &next_offset, \ FALSE); \ - proto_tree_add_text(dcc_optree, tvb, offset, \ - next_offset - offset, "%s: %s", \ - label, tvb_format_text(tvb, offset, next_offset - offset)); \ + proto_tree_add_item(dcc_optree, hf_label, tvb, offset, \ + next_offset - offset, ENC_ASCII|ENC_NA); \ offset = next_offset; \ } \ } @@ -201,8 +211,9 @@ static const value_string dcc_floodop_vals[] = { static gboolean dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - proto_tree *dcc_tree, *dcc_optree, *dcc_opnumtree, *ti; + proto_tree *dcc_tree, *dcc_optree, *dcc_opnumtree, *ti; proto_tree *dcc_tracetree; + proto_item *len_item; int offset = 0; int client_is_le = 0; int op = 0; @@ -214,7 +225,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) } /* get at least a full packet structure */ - if ( tvb_length(tvb) < sizeof(DCC_HDR) ) { + if ( tvb_reported_length(tvb) < sizeof(DCC_HDR) ) { /* Doesn't have enough bytes to contain packet header. */ return FALSE; } @@ -228,23 +239,22 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) "%s: %s", is_response ? "Response" : "Request", val_to_str(tvb_get_guint8(tvb, offset+3), - dcc_op_vals, "Unknown Op: %u") - ); + dcc_op_vals, "Unknown Op: %u")); - if (tree) { - ti = proto_tree_add_item(tree, proto_dcc, tvb, offset, -1, - ENC_NA); - dcc_tree = proto_item_add_subtree(ti, ett_dcc); + ti = proto_tree_add_item(tree, proto_dcc, tvb, offset, -1, + ENC_NA); + dcc_tree = proto_item_add_subtree(ti, ett_dcc); - proto_tree_add_item(dcc_tree, hf_dcc_len, tvb, - offset, 2, ENC_BIG_ENDIAN); + len_item = proto_tree_add_item(dcc_tree, hf_dcc_len, tvb, + offset, 2, ENC_BIG_ENDIAN); - if ( tvb_length(tvb) < tvb_get_ntohs(tvb, offset)) { - /* Doesn't have number of bytes that header claims. */ - proto_tree_add_text(dcc_tree, tvb, offset, 2, "Error - packet is shorter than header claims!"); - } - offset += 2; + if ( tvb_reported_length(tvb) < tvb_get_ntohs(tvb, offset)) { + /* Doesn't have number of bytes that header claims. */ + expert_add_info(pinfo, len_item, &ei_dcc_len); + } + offset += 2; + if (tree) { proto_tree_add_item(dcc_tree, hf_dcc_pkt_vers, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -321,14 +331,14 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) (int)sizeof(DCC_SIGNATURE); if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) ) { - D_LABEL("Addr", 16); - D_LABEL("Id", (int)sizeof(DCC_CLNT_ID)); - D_LABEL("Last Used", 4); - D_LABEL("Requests", 4); + D_LABEL(hf_dcc_addr, 16, ENC_NA); + D_LABEL(hf_dcc_id, (int)sizeof(DCC_CLNT_ID), ENC_BIG_ENDIAN); + D_LABEL(hf_dcc_last_used, 4, ENC_BIG_ENDIAN); + D_LABEL(hf_dcc_requests, 4, ENC_BIG_ENDIAN); } else { - D_TEXT("Response Text", (int)sizeof(DCC_SIGNATURE)); + D_TEXT(hf_dcc_response_text, (int)sizeof(DCC_SIGNATURE)); } D_SIGNATURE(); } @@ -374,7 +384,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset += 4; offset += 1; /* admin op we did in reverse order */ - D_LABEL("Pad", 3); + D_LABEL(hf_dcc_pad, 3, ENC_NA); D_SIGNATURE(); } break; @@ -384,7 +394,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset, 1, ENC_BIG_ENDIAN); offset += 1; - D_LABEL("Unused", 1); + D_LABEL(hf_dcc_unused, 1, ENC_NA); proto_tree_add_item(dcc_optree, hf_dcc_qdelay_ms, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -474,6 +484,10 @@ proto_register_dcc(void) "Target", "dcc.target", FT_UINT32, BASE_HEX, VALS(dcc_target_vals), 0, NULL, HFILL }}, + { &hf_dcc_response_text, { + "Response Text", "dcc.response_text", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + { &hf_dcc_date, { "Date", "dcc.date", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }}, @@ -522,7 +536,31 @@ proto_register_dcc(void) "Flood Control Operation", "dcc.floodop", FT_UINT32, BASE_DEC, VALS(dcc_floodop_vals), 0, NULL, HFILL }}, - }; + { &hf_dcc_id, { + "Id", "dcc.id", FT_UINT32, BASE_DEC, + NULL, 0, NULL, HFILL }}, + + { &hf_dcc_last_used, { + "Last Used", "dcc.last_used", FT_UINT32, BASE_DEC, + NULL, 0, NULL, HFILL }}, + + { &hf_dcc_requests, { + "Requests", "dcc.requests", FT_UINT32, BASE_DEC, + NULL, 0, NULL, HFILL }}, + + { &hf_dcc_addr, { + "Addr", "dcc.addr", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_dcc_pad, { + "Pad", "dcc.pad", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_dcc_unused, { + "Unused", "dcc.unused", FT_BYTES, BASE_NONE, + NULL, 0, NULL, HFILL }}, + }; + static gint *ett[] = { &ett_dcc, &ett_dcc_op, @@ -531,12 +569,18 @@ proto_register_dcc(void) &ett_dcc_trace, }; - proto_dcc = proto_register_protocol("Distributed Checksum Clearinghouse protocol", - "DCC", "dcc"); + static ei_register_info ei[] = { + { &ei_dcc_len, { "dcc.len.short", PI_MALFORMED, PI_ERROR, "Error - packet is shorter than header claims!", EXPFILL }}, + }; + + expert_module_t* expert_dcc; - proto_register_field_array(proto_dcc, hf, array_length(hf)); + proto_dcc = proto_register_protocol("Distributed Checksum Clearinghouse protocol", "DCC", "dcc"); + proto_register_field_array(proto_dcc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dcc = expert_register_protocol(proto_dcc); + expert_register_field_array(expert_dcc, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-dtp.c b/epan/dissectors/packet-dtp.c index f13849f603..e1241d4566 100644 --- a/epan/dissectors/packet-dtp.c +++ b/epan/dissectors/packet-dtp.c @@ -56,6 +56,7 @@ static int hf_dtp_tot = -1; static int hf_dtp_tat = -1; static int hf_dtp_tos = -1; static int hf_dtp_tas = -1; +static int hf_dtp_data = -1; static gint ett_dtp = -1; static gint ett_dtp_tlv = -1; @@ -279,7 +280,7 @@ dissect_dtp_tlv(packet_info *pinfo, tvbuff_t *tvb, int offset, int length, break; default: - proto_tree_add_text(tree, tvb, offset, length, "Data"); + proto_tree_add_item(tree, hf_dtp_data, tvb, offset, length, ENC_NA); break; } } @@ -324,6 +325,9 @@ proto_register_dtp(void) { "Sender ID", "dtp.senderid", FT_ETHER, BASE_NONE, NULL, 0x0, "MAC Address of neighbor", HFILL }}, + { &hf_dtp_data, + { "Data", "dtp.data", FT_ETHER, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-extreme.c b/epan/dissectors/packet-extreme.c index 24db1e7305..43113aabb5 100644 --- a/epan/dissectors/packet-extreme.c +++ b/epan/dissectors/packet-extreme.c @@ -143,6 +143,7 @@ These are the structures you will see most often in EDP frames. #include <string.h> #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/to_str.h> #include <epan/strutil.h> #include <epan/in_cksum.h> @@ -254,6 +255,8 @@ static int hf_edp_unknown_data = -1; /* Null element */ static int hf_edp_null = -1; +static expert_field ei_edp_short_tlv = EI_INIT; + static gint ett_edp = -1; static gint ett_edp_checksum = -1; static gint ett_edp_tlv_header = -1; @@ -537,7 +540,6 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot proto_tree *flags_tree; proto_item *vlan_item; proto_tree *vlan_tree; - proto_item *too_short_item; guint16 vlan_id; guint8 *vlan_name; @@ -552,9 +554,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot /* Begin flags subtree */ if (length < 1) { - too_short_item = proto_tree_add_text(vlan_tree, tvb, 0, 0, - "TLV is too short"); - PROTO_ITEM_SET_GENERATED(too_short_item); + expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv); return offset; } flags_item = proto_tree_add_item(vlan_tree, hf_edp_vlan_flags, tvb, offset, 1, @@ -573,9 +573,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot /* End of flags subtree */ if (length < 1) { - too_short_item = proto_tree_add_text(vlan_tree, tvb, 0, 0, - "TLV is too short"); - PROTO_ITEM_SET_GENERATED(too_short_item); + expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv); return offset; } proto_tree_add_item(vlan_tree, hf_edp_vlan_reserved1, tvb, offset, 1, @@ -584,9 +582,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot length -= 1; if (length < 2) { - too_short_item = proto_tree_add_text(vlan_tree, tvb, 0, 0, - "TLV is too short"); - PROTO_ITEM_SET_GENERATED(too_short_item); + expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv); return offset; } vlan_id = tvb_get_ntohs(tvb, offset); @@ -598,9 +594,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot length -= 2; if (length < 4) { - too_short_item = proto_tree_add_text(vlan_tree, tvb, 0, 0, - "TLV is too short"); - PROTO_ITEM_SET_GENERATED(too_short_item); + expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv); return offset; } proto_tree_add_item(vlan_tree, hf_edp_vlan_reserved2, tvb, offset, 4, @@ -609,9 +603,7 @@ dissect_vlan_tlv(tvbuff_t *tvb, packet_info *pinfo, int offset, int length, prot length -= 4; if (length < 4) { - too_short_item = proto_tree_add_text(vlan_tree, tvb, 0, 0, - "TLV is too short"); - PROTO_ITEM_SET_GENERATED(too_short_item); + expert_add_info(pinfo, vlan_item, &ei_edp_short_tlv); return offset; } proto_tree_add_item(vlan_tree, hf_edp_vlan_ip, tvb, offset, 4, @@ -1050,17 +1042,17 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Decode the individual TLVs */ while (offset < data_length && !last) { if (data_length - offset < 4) { - proto_tree_add_text(edp_tree, tvb, offset, 4, - "Too few bytes left for TLV: %u (< 4)", - data_length - offset); + proto_tree_add_expert_format(edp_tree, pinfo, &ei_edp_short_tlv, tvb, offset, 4, + "Too few bytes left for TLV: %u (< 4)", + data_length - offset); break; } tlv_type = tvb_get_guint8(tvb, offset + 1); tlv_length = tvb_get_ntohs(tvb, offset + 2); if ((tlv_length < 4) || (tlv_length > (data_length - offset))) { - proto_tree_add_text(edp_tree, tvb, offset, 0, - "TLV with invalid length: %u", tlv_length); + proto_tree_add_expert_format(edp_tree, pinfo, &ei_edp_short_tlv, tvb, offset, 0, + "TLV with invalid length: %u", tlv_length); break; } if (tlv_type != EDP_TYPE_NULL) @@ -1477,10 +1469,17 @@ proto_register_edp(void) &ett_edp_null, }; - proto_edp = proto_register_protocol(PROTO_LONG_NAME, - PROTO_SHORT_NAME, "edp"); - proto_register_field_array(proto_edp, hf, array_length(hf)); + static ei_register_info ei[] = { + { &ei_edp_short_tlv, { "edp.short_tlv", PI_MALFORMED, PI_ERROR, "TLV is too short", EXPFILL }}, + }; + + expert_module_t* expert_edp; + + proto_edp = proto_register_protocol(PROTO_LONG_NAME, PROTO_SHORT_NAME, "edp"); + proto_register_field_array(proto_edp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_edp = expert_register_protocol(proto_edp); + expert_register_field_array(expert_edp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index d12e5bc819..5c468021cb 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -28,6 +28,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/to_str.h> #include <epan/wmem/wmem.h> #include <epan/conversation.h> @@ -214,6 +215,18 @@ static header_field_info hfi_fcdns_zone_mbrid FCDNS_HFI_INIT = {"Member Identifier", "fcdns.zone.mbrid", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}; +static header_field_info hfi_fcdns_id_length FCDNS_HFI_INIT = + {"Identifier Length", "fcdns.id_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, + HFILL}; + +static header_field_info hfi_fcdns_zone_flags FCDNS_HFI_INIT = + {"Flags", "fcdns.zone_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, + HFILL}; + +static header_field_info hfi_fcdns_zonelen FCDNS_HFI_INIT = + {"Name Length", "fcdns.zone_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, + HFILL}; + static header_field_info hfi_fcdns_zonenm FCDNS_HFI_INIT = {"Zone Name", "fcdns.zonename", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}; @@ -222,6 +235,10 @@ static header_field_info hfi_fcdns_portip FCDNS_HFI_INIT = {"Port IP Address", "fcdns.portip", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}; +static header_field_info hfi_fcdns_num_entries FCDNS_HFI_INIT = + {"Number of Entries", "fcdns.num_entries", FT_UINT32, BASE_HEX, + NULL, 0x0, NULL, HFILL}; + static header_field_info hfi_fcdns_sw2_objfmt FCDNS_HFI_INIT = {"Name Entry Object Format", "fcdns.entry.objfmt", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}; @@ -317,6 +334,8 @@ static gint ett_cos_flags = -1; static gint ett_fc4flags = -1; static gint ett_fc4features = -1; +static expert_field ei_fcdns_no_record_of_exchange = EI_INIT; + typedef struct _fcdns_conv_key { guint32 conv_idx; } fcdns_conv_key_t; @@ -1283,11 +1302,9 @@ dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) mbrtype = tvb_get_guint8 (tvb, offset); proto_tree_add_uint (zmbr_tree, &hfi_fcdns_zone_mbrtype, tvb, offset, 1, mbrtype); - proto_tree_add_text (zmbr_tree, tvb, offset+2, 1, "Flags: 0x%x", - tvb_get_guint8 (tvb, offset+2)); + proto_tree_add_item(zmbr_tree, &hfi_fcdns_zone_flags, tvb, offset+2, 1, ENC_NA); idlen = tvb_get_guint8 (tvb, offset+3); - proto_tree_add_text (zmbr_tree, tvb, offset+3, 1, - "Identifier Length: %d", idlen); + proto_tree_add_uint(zmbr_tree, &hfi_fcdns_id_length, tvb, offset+3, 1, idlen); switch (mbrtype) { case FC_SWILS_ZONEMBR_WWN: proto_tree_add_string (zmbr_tree, &hfi_fcdns_zone_mbrid, tvb, @@ -1323,11 +1340,9 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) int numrec, i, len; guint8 objfmt; - numrec = tvb_get_ntohl (tvb, offset); - if (tree) { - proto_tree_add_text (tree, tvb, offset, 4, "Number of Entries: %d", - numrec); + numrec = tvb_get_ntohl (tvb, offset); + proto_tree_add_uint(tree, &hfi_fcdns_num_entries, tvb, offset, 4, numrec); offset += 4; for (i = 0; i < numrec; i++) { @@ -1515,8 +1530,7 @@ dissect_fcdns_gezn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { if (req_tree) { str_len = tvb_get_guint8 (tvb, offset); - proto_tree_add_text (req_tree, tvb, offset, 1, "Name Length: %d", - str_len); + proto_tree_add_uint(req_tree, &hfi_fcdns_zonelen, tvb, offset, 1, str_len); proto_tree_add_item (req_tree, &hfi_fcdns_zonenm, tvb, offset+3, str_len, ENC_ASCII|ENC_NA); } @@ -1663,8 +1677,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) val_to_str (opcode, fc_dns_opcode_val, "0x%x")); /* No record of what this accept is for. Can't decode */ - proto_tree_add_text (fcdns_tree, tvb, 0, -1, - "No record of Exchg. Unable to decode MSG_ACC/RJT"); + proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1); return 0; } } @@ -1696,8 +1709,7 @@ dissect_fcdns (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) if (tree) { if ((cdata == NULL) && (opcode != FCCT_MSG_RJT)) { /* No record of what this accept is for. Can't decode */ - proto_tree_add_text (fcdns_tree, tvb, 0, -1, - "No record of Exchg. Unable to decode MSG_ACC/RJT"); + proto_tree_add_expert(fcdns_tree, pinfo, &ei_fcdns_no_record_of_exchange, tvb, 0, -1); return 0; } } @@ -1934,14 +1946,20 @@ proto_register_fcdns (void) &ett_fc4features, }; + static ei_register_info ei[] = { + { &ei_fcdns_no_record_of_exchange, { "fcdns.no_record_of_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode MSG_ACC/RJT", EXPFILL }}, + }; + + expert_module_t* expert_fcdns; int proto_fcdns; - proto_fcdns = proto_register_protocol("Fibre Channel Name Server", - "FC-dNS", "fcdns"); + proto_fcdns = proto_register_protocol("Fibre Channel Name Server", "FC-dNS", "fcdns"); hfi_fcdns = proto_registrar_get_nth(proto_fcdns); proto_register_fields(proto_fcdns, hfi, array_length(hfi)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcdns = expert_register_protocol(proto_fcdns); + expert_register_field_array(expert_fcdns, ei, array_length(ei)); register_init_routine (&fcdns_init_protocol); dns_handle = new_create_dissector_handle (dissect_fcdns, proto_fcdns); diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index d546d17a49..0b56b07763 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -26,6 +26,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/to_str.h> #include <epan/wmem/wmem.h> #include <epan/conversation.h> @@ -179,6 +180,33 @@ static int hf_swils_ess_fzs_defzone = -1; static int hf_swils_ess_cap_len = -1; static int hf_swils_mrra_vendorinfo = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_swils_lsrh_lsr_age = -1; +static int hf_swils_zone_full_zone_set_length = -1; +static int hf_swils_zone_num_zoning_objects = -1; +static int hf_swils_lsrec_number_of_links = -1; +static int hf_swils_sfc_zoneset_length = -1; +static int hf_swils_zone_vendor_unique = -1; +static int hf_swils_zone_num_members = -1; +static int hf_swils_zone_active_zoneset_length = -1; +static int hf_swils_lsack_num_of_lsr_headers = -1; +static int hf_swils_lsrh_lsr_length = -1; +static int hf_swils_esc_payload_length = -1; +static int hf_swils_lsupdate_num_of_lsrs = -1; +static int hf_swils_zone_mbr_identifier_length = -1; +static int hf_swils_zone_mbrflags = -1; +static int hf_swils_lsrh_options = -1; +static int hf_swils_domain_id_list_length = -1; +static int hf_swils_lsack_flags = -1; +static int hf_swils_rscn_num_entries = -1; +static int hf_swils_requested_domain_id = -1; +static int hf_swils_lsrh_checksum = -1; +static int hf_swils_granted_domain_id = -1; +static int hf_swils_lsupdate_flags = -1; + + +static expert_field ei_swils_efp_record_len = EI_INIT; +static expert_field ei_swils_no_exchange = EI_INIT; /* Initialize the subtree pointers */ static gint ett_fcswils = -1; @@ -420,7 +448,7 @@ typedef struct _fcswils_conv_data { static GHashTable *fcswils_req_hash = NULL; /* list of commands for each commandset */ -typedef void (*fcswils_dissector_t)(tvbuff_t *tvb, proto_tree *tree, guint8 isreq); +typedef void (*fcswils_dissector_t)(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint8 isreq); typedef struct _fcswils_func_table_t { fcswils_dissector_t func; @@ -685,7 +713,7 @@ dissect_swils_ess_capability_obj(tvbuff_t *tvb, proto_tree *tree, int offset) } static void -dissect_swils_nullpayload(tvbuff_t *tvb _U_, proto_tree *tree _U_, +dissect_swils_nullpayload(tvbuff_t *tvb _U_, packet_info* pinfo _U_, proto_tree *tree _U_, guint8 isreq _U_) { /* Common dissector for those ILSs without a payload */ @@ -693,7 +721,7 @@ dissect_swils_nullpayload(tvbuff_t *tvb _U_, proto_tree *tree _U_, } static void -dissect_swils_elp(tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) +dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ @@ -848,11 +876,12 @@ dissect_swils_elp(tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) } static void -dissect_swils_efp(tvbuff_t *tvb, proto_tree *efp_tree, guint8 isreq _U_) +dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ proto_tree *lrec_tree; + proto_item *rec_item; int num_listrec = 0; int offset = 0; fcswils_efp efp; @@ -860,37 +889,32 @@ dissect_swils_efp(tvbuff_t *tvb, proto_tree *efp_tree, guint8 isreq _U_) offset += 1; efp.reclen = tvb_get_guint8(tvb, offset); - if (efp_tree) - proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, efp.reclen); + rec_item = proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, efp.reclen); offset += 1; efp.payload_len = tvb_get_ntohs(tvb, offset); if (efp.payload_len < FC_SWILS_EFP_SIZE) { - if (efp_tree) - proto_tree_add_uint_format_value(efp_tree, hf_swils_efp_payload_len, + proto_tree_add_uint_format_value(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, efp.payload_len, "%u (bogus, must be >= %u)", efp.payload_len, FC_SWILS_EFP_SIZE); return; } - if (efp_tree) - proto_tree_add_item(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 5; /* skip 3 reserved bytes, too */ - if (efp_tree) - proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_pri, tvb, + proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_pri, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; tvb_memcpy(tvb, efp.pswitch_name, offset, 8); - if (efp_tree) - proto_tree_add_string(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, + proto_tree_add_string(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, 8, fcwwn_to_str(efp.pswitch_name)); offset += 8; + if (efp.reclen == 0) { + expert_add_info(pinfo, rec_item, &ei_swils_efp_record_len); + return; + } /* Add List Records now */ if (efp_tree) { - if (efp.reclen == 0) { - proto_tree_add_text(efp_tree, tvb, 0, 0, "Record length is zero"); - return; - } num_listrec = (efp.payload_len - FC_SWILS_EFP_SIZE)/efp.reclen; while (num_listrec-- > 0) { rec_type = tvb_get_guint8(tvb, offset); @@ -919,7 +943,7 @@ dissect_swils_efp(tvbuff_t *tvb, proto_tree *efp_tree, guint8 isreq _U_) } static void -dissect_swils_dia(tvbuff_t *tvb, proto_tree *dia_tree, guint8 isreq _U_) +dissect_swils_dia(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *dia_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -931,7 +955,7 @@ dissect_swils_dia(tvbuff_t *tvb, proto_tree *dia_tree, guint8 isreq _U_) } static void -dissect_swils_rdi(tvbuff_t *tvb, proto_tree *rdi_tree, guint8 isreq) +dissect_swils_rdi(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rdi_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -951,14 +975,10 @@ dissect_swils_rdi(tvbuff_t *tvb, proto_tree *rdi_tree, guint8 isreq) offset = 12; for (i = 0; i < numrec; i++) { if (isreq) { - proto_tree_add_text(rdi_tree, tvb, offset+3, 1, - "Requested Domain ID: %d", - tvb_get_guint8(tvb, offset+3)); + proto_tree_add_item(rdi_tree, hf_swils_requested_domain_id, tvb, offset+3, 1, ENC_NA); } else { - proto_tree_add_text(rdi_tree, tvb, offset+3, 1, - "Granted Domain ID: %d", - tvb_get_guint8(tvb, offset+3)); + proto_tree_add_item(rdi_tree, hf_swils_granted_domain_id, tvb, offset+3, 1, ENC_NA); } offset += 4; } @@ -991,17 +1011,14 @@ static void dissect_swils_fspf_lsrechdr(tvbuff_t *tvb, proto_tree *tree, int offset) { proto_tree_add_item(tree, hf_swils_lsrh_lsr_type, tvb, offset, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(tree, tvb, offset+2, 2, "LSR Age: %d secs", - tvb_get_ntohs(tvb, offset+2)); - proto_tree_add_text(tree, tvb, offset+4, 4, "Options : 0x%x", - tvb_get_ntohl(tvb, offset+4)); + proto_tree_add_uint_format_value(tree, hf_swils_lsrh_lsr_age, tvb, offset+2, 2, + tvb_get_ntohs(tvb, offset+2), "%d secs", tvb_get_ntohs(tvb, offset+2)); + proto_tree_add_item(tree, hf_swils_lsrh_options, tvb, offset+4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_lsid, tvb, offset+11, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_adv_domid, tvb, offset+15, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_swils_lsrh_ls_incid, tvb, offset+16, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(tree, tvb, offset+20, 2, "Checksum: 0x%x", - tvb_get_ntohs(tvb, offset+20)); - proto_tree_add_text(tree, tvb, offset+22, 2, "LSR Length: %d", - tvb_get_ntohs(tvb, offset+22)); + proto_tree_add_item(tree, hf_swils_lsrh_checksum, tvb, offset+20, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_swils_lsrh_lsr_length, tvb, offset+22, 2, ENC_BIG_ENDIAN); } static void @@ -1033,8 +1050,7 @@ dissect_swils_fspf_lsrec(tvbuff_t *tvb, proto_tree *tree, int offset, ett_fcswils_lsrechdr, NULL, "Link State Record Header"); dissect_swils_fspf_lsrechdr(tvb, lsrechdr_tree, offset); - proto_tree_add_text(tree, tvb, offset+26, 2, "Number of Links: %d", - num_ldrec); + proto_tree_add_item(tree, hf_swils_lsrec_number_of_links, tvb, offset+26, 2, ENC_BIG_ENDIAN); offset += 28; for (i = 0; i < num_ldrec; i++) { @@ -1050,7 +1066,7 @@ dissect_swils_fspf_lsrec(tvbuff_t *tvb, proto_tree *tree, int offset, } static void -dissect_swils_hello(tvbuff_t *tvb, proto_tree *hlo_tree, guint8 isreq _U_) +dissect_swils_hello(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *hlo_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1067,7 +1083,7 @@ dissect_swils_hello(tvbuff_t *tvb, proto_tree *hlo_tree, guint8 isreq _U_) } static void -dissect_swils_lsupdate(tvbuff_t *tvb, proto_tree *lsu_tree, guint8 isreq _U_) +dissect_swils_lsupdate(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *lsu_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1076,13 +1092,10 @@ dissect_swils_lsupdate(tvbuff_t *tvb, proto_tree *lsu_tree, guint8 isreq _U_) if (lsu_tree) { dissect_swils_fspf_hdr(tvb, lsu_tree, offset); - proto_tree_add_text(lsu_tree, tvb, offset+23, 1, "Flags : %s", - val_to_str(tvb_get_guint8(tvb, offset+23), - fc_swils_fspf_lsrflags_val, "0x%x")); + proto_tree_add_item(lsu_tree, hf_swils_lsupdate_flags, tvb, offset+23, 1, ENC_NA); num_lsrec = tvb_get_ntohl(tvb, offset+24); - proto_tree_add_text(lsu_tree, tvb, offset+24, 4, "Num of LSRs: %d", - num_lsrec); + proto_tree_add_item(lsu_tree, hf_swils_lsupdate_num_of_lsrs, tvb, offset+24, 4, ENC_BIG_ENDIAN); offset = 28; dissect_swils_fspf_lsrec(tvb, lsu_tree, offset, num_lsrec); @@ -1090,7 +1103,7 @@ dissect_swils_lsupdate(tvbuff_t *tvb, proto_tree *lsu_tree, guint8 isreq _U_) } static void -dissect_swils_lsack(tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_) +dissect_swils_lsack(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *lsa_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1100,13 +1113,10 @@ dissect_swils_lsack(tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_) if (lsa_tree) { dissect_swils_fspf_hdr(tvb, lsa_tree, offset); - proto_tree_add_text(lsa_tree, tvb, offset+23, 1, "Flags : %s", - val_to_str(tvb_get_guint8(tvb, offset+23), - fc_swils_fspf_lsrflags_val, "0x%x")); + proto_tree_add_item(lsa_tree, hf_swils_lsack_flags, tvb, offset+23, 1, ENC_NA); num_lsrechdr = tvb_get_ntohl(tvb, offset+24); - proto_tree_add_text(lsa_tree, tvb, offset+24, 4, "Num of LSR Headers: %d", - num_lsrechdr); + proto_tree_add_item(lsa_tree, hf_swils_lsack_num_of_lsr_headers, tvb, offset+24, 4, ENC_BIG_ENDIAN); offset = 28; @@ -1121,7 +1131,7 @@ dissect_swils_lsack(tvbuff_t *tvb, proto_tree *lsa_tree, guint8 isreq _U_) } static void -dissect_swils_rscn(tvbuff_t *tvb, proto_tree *rscn_tree, guint8 isreq) +dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1147,8 +1157,7 @@ dissect_swils_rscn(tvbuff_t *tvb, proto_tree *rscn_tree, guint8 isreq) return; } - proto_tree_add_text(rscn_tree, tvb, offset+12, 4, "Num Entries: %d", - numrec); + proto_tree_add_item(rscn_tree, hf_swils_rscn_num_entries, tvb, offset+12, 4, ENC_BIG_ENDIAN); offset = 16; for (i = 0; i < numrec; i++) { @@ -1192,11 +1201,9 @@ dissect_swils_zone_mbr(tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) mbrtype = tvb_get_guint8(tvb, offset); proto_tree_add_uint(zmbr_tree, hf_swils_zone_mbrtype, tvb, offset, 1, mbrtype); - proto_tree_add_text(zmbr_tree, tvb, offset+2, 1, "Flags: 0x%x", - tvb_get_guint8(tvb, offset+2)); + proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrflags, tvb, offset+2, 1, ENC_NA); idlen = tvb_get_guint8(tvb, offset+3); - proto_tree_add_text(zmbr_tree, tvb, offset+3, 1, - "Identifier Length: %u", idlen); + proto_tree_add_item(zmbr_tree, hf_swils_zone_mbr_identifier_length, tvb, offset+3, 1, ENC_NA); switch (mbrtype) { case FC_SWILS_ZONEMBR_WWN: proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb, @@ -1265,9 +1272,7 @@ dissect_swils_zone_obj(tvbuff_t *tvb, proto_tree *zobj_tree, int offset) offset+4, ZONENAME_LEN(tvb, offset+4), str); numrec = tvb_get_ntohl(tvb, offset+4+ZONENAME_LEN(tvb, offset+4)); - proto_tree_add_text(zobj_tree, tvb, - offset+4+ZONENAME_LEN(tvb, offset+4), 4, - "Number of Zone Members: %d", numrec); + proto_tree_add_item(zobj_tree, hf_swils_zone_num_members, tvb, offset+4+ZONENAME_LEN(tvb,offset+4), 4, ENC_BIG_ENDIAN); offset += 8 + ZONENAME_LEN(tvb, offset+4); for (i = 0; i < numrec; i++) { @@ -1286,7 +1291,7 @@ dissect_swils_zone_obj(tvbuff_t *tvb, proto_tree *zobj_tree, int offset) } static void -dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) +dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1298,8 +1303,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) if (isreq) { /* zonesetlen is the size of the zoneset including the zone name */ zonesetlen = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_text(mr_tree, tvb, offset+2, 2, - "Active ZoneSet Length: %u", zonesetlen); + proto_tree_add_item(mr_tree, hf_swils_zone_active_zoneset_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); if (zonesetlen) { str = zonenm_to_str(tvb, offset+4); @@ -1316,8 +1320,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) zobjlist_tree = proto_tree_add_subtree(mr_tree, tvb, offset, objlistlen, ett_fcswils_zoneobjlist, NULL, "Active Zone Set"); - proto_tree_add_text(zobjlist_tree, tvb, offset, 4, - "Number of zoning objects: %d", numrec); + proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; for (i = 0; i < numrec; i++) { @@ -1333,8 +1336,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) } zonesetlen = tvb_get_ntohl(tvb, offset); - proto_tree_add_text(mr_tree, tvb, offset, 4, - "Full Zone Set Length: %d", zonesetlen); + proto_tree_add_item(mr_tree, hf_swils_zone_full_zone_set_length, tvb, offset, 4, ENC_BIG_ENDIAN); if (zonesetlen) { objlistlen = zonesetlen; @@ -1345,8 +1347,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) zobjlist_tree = proto_tree_add_subtree(mr_tree, tvb, offset, objlistlen, ett_fcswils_zoneobjlist, NULL, "Full Zone Set"); - proto_tree_add_text(zobjlist_tree, tvb, offset, 4, - "Number of zoning objects: %d", numrec); + proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; for (i = 0; i < numrec; i++) { objlen = get_zoneobj_len(tvb, offset); @@ -1362,15 +1363,13 @@ dissect_swils_mergereq(tvbuff_t *tvb, proto_tree *mr_tree, guint8 isreq) offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(mr_tree, hf_swils_zone_reason, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(mr_tree, tvb, offset+7, 1, - "Vendor Unique: 0x%x", - tvb_get_guint8(tvb, offset+7)); + proto_tree_add_item(mr_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_NA); } } } static void -dissect_swils_aca(tvbuff_t *tvb, proto_tree *aca_tree, guint8 isreq) +dissect_swils_aca(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *aca_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1379,8 +1378,7 @@ dissect_swils_aca(tvbuff_t *tvb, proto_tree *aca_tree, guint8 isreq) if (aca_tree) { if (isreq) { plen = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_text(aca_tree, tvb, offset+2, 2, - "Domain ID List Length: %d", plen); + proto_tree_add_item(aca_tree, hf_swils_domain_id_list_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); numrec = plen/4; offset = 4; @@ -1398,15 +1396,13 @@ dissect_swils_aca(tvbuff_t *tvb, proto_tree *aca_tree, guint8 isreq) offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(aca_tree, hf_swils_zone_reason, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(aca_tree, tvb, offset+7, 1, - "Vendor Unique: 0x%x", - tvb_get_guint8(tvb, offset+7)); + proto_tree_add_item(aca_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_NA); } } } static void -dissect_swils_rca(tvbuff_t *tvb, proto_tree *rca_tree, guint8 isreq) +dissect_swils_rca(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rca_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1417,15 +1413,13 @@ dissect_swils_rca(tvbuff_t *tvb, proto_tree *rca_tree, guint8 isreq) offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(rca_tree, hf_swils_zone_reason, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(rca_tree, tvb, offset+7, 1, - "Vendor Unique: 0x%x", - tvb_get_guint8(tvb, offset+7)); + proto_tree_add_item(rca_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_NA); } } } static void -dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) +dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *sfc_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1438,8 +1432,7 @@ dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) proto_tree_add_item(sfc_tree, hf_swils_sfc_opcode, tvb, offset+1, 1, ENC_BIG_ENDIAN); zonesetlen = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_text(sfc_tree, tvb, offset+2, 2, - "ZoneSet Length: %d", zonesetlen); + proto_tree_add_item(sfc_tree, hf_swils_sfc_zoneset_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); if (zonesetlen) { str = zonenm_to_str(tvb, offset+4); @@ -1456,8 +1449,7 @@ dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) zobjlist_tree = proto_tree_add_subtree(sfc_tree, tvb, offset, objlistlen, ett_fcswils_zoneobjlist, NULL, "Zone Set"); - proto_tree_add_text(zobjlist_tree, tvb, offset, 4, - "Number of zoning objects: %d", numrec); + proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; for (i = 0; i < numrec; i++) { @@ -1473,8 +1465,7 @@ dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) } zonesetlen = tvb_get_ntohl(tvb, offset); - proto_tree_add_text(sfc_tree, tvb, offset, 4, - "Full Zone Set Length: %d", zonesetlen); + proto_tree_add_item(sfc_tree, hf_swils_zone_full_zone_set_length, tvb, offset, 4, ENC_BIG_ENDIAN); if (zonesetlen) { objlistlen = zonesetlen; @@ -1485,8 +1476,7 @@ dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) zobjlist_tree = proto_tree_add_subtree(sfc_tree, tvb, offset, objlistlen, ett_fcswils_zoneobjlist, NULL, "Full Zone Set"); - proto_tree_add_text(zobjlist_tree, tvb, offset, 4, - "Number of zoning objects: %d", numrec); + proto_tree_add_item(zobjlist_tree, hf_swils_zone_num_zoning_objects, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; for (i = 0; i < numrec; i++) { objlen = get_zoneobj_len(tvb, offset); @@ -1502,15 +1492,13 @@ dissect_swils_sfc(tvbuff_t *tvb, proto_tree *sfc_tree, guint8 isreq) offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sfc_tree, hf_swils_zone_reason, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(sfc_tree, tvb, offset+7, 1, - "Vendor Unique: 0x%x", - tvb_get_guint8(tvb, offset+7)); + proto_tree_add_item(sfc_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_NA); } } } static void -dissect_swils_ufc(tvbuff_t *tvb, proto_tree *ufc_tree, guint8 isreq) +dissect_swils_ufc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *ufc_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1521,15 +1509,13 @@ dissect_swils_ufc(tvbuff_t *tvb, proto_tree *ufc_tree, guint8 isreq) offset+5, 1, ENC_BIG_ENDIAN); proto_tree_add_item(ufc_tree, hf_swils_zone_reason, tvb, offset+6, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(ufc_tree, tvb, offset+7, 1, - "Vendor Unique: 0x%x", - tvb_get_guint8(tvb, offset+7)); + proto_tree_add_item(ufc_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_NA); } } } static void -dissect_swils_esc(tvbuff_t *tvb, proto_tree *esc_tree, guint8 isreq) +dissect_swils_esc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *esc_tree, guint8 isreq) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1539,8 +1525,7 @@ dissect_swils_esc(tvbuff_t *tvb, proto_tree *esc_tree, guint8 isreq) if (esc_tree) { if (isreq) { plen = tvb_get_ntohs(tvb, offset+2); - proto_tree_add_text(esc_tree, tvb, offset+2, 2, - "Payload Length: %d", plen); + proto_tree_add_item(esc_tree, hf_swils_esc_payload_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(esc_tree, hf_swils_esc_swvendorid, tvb, offset+4, 8, ENC_ASCII|ENC_NA); numrec = (plen - 12)/12; @@ -1571,7 +1556,7 @@ dissect_swils_esc(tvbuff_t *tvb, proto_tree *esc_tree, guint8 isreq) } static void -dissect_swils_drlir(tvbuff_t *tvb _U_, proto_tree *drlir_tree _U_, +dissect_swils_drlir(tvbuff_t *tvb _U_, packet_info* pinfo _U_, proto_tree *drlir_tree _U_, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ @@ -1579,7 +1564,7 @@ dissect_swils_drlir(tvbuff_t *tvb _U_, proto_tree *drlir_tree _U_, } static void -dissect_swils_swrjt(tvbuff_t *tvb, proto_tree *swrjt_tree, guint8 isreq _U_) +dissect_swils_swrjt(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *swrjt_tree, guint8 isreq _U_) { /* Set up structures needed to add the protocol subtree and manage it */ int offset = 0; @@ -1593,7 +1578,7 @@ dissect_swils_swrjt(tvbuff_t *tvb, proto_tree *swrjt_tree, guint8 isreq _U_) } static void -dissect_swils_ess(tvbuff_t *tvb, proto_tree *ess_tree, guint8 isreq _U_) +dissect_swils_ess(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *ess_tree, guint8 isreq _U_) { int offset = 0; gint16 numcapobj = 0; @@ -1631,7 +1616,7 @@ dissect_swils_ess(tvbuff_t *tvb, proto_tree *ess_tree, guint8 isreq _U_) } static void -dissect_swils_mrra(tvbuff_t *tvb, proto_tree *tree, guint8 isreq) +dissect_swils_mrra(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, guint8 isreq) { int offset = 0; @@ -1787,8 +1772,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) if (!conversation) { if (tree && (opcode == FC_SWILS_SWACC)) { /* No record of what this accept is for. Can't decode */ - proto_tree_add_text(swils_tree, tvb, 0, tvb_length(tvb), - "No record of Exchg. Unable to decode SW_ACC"); + proto_tree_add_expert_format(swils_tree, pinfo, &ei_swils_no_exchange, tvb, 0, -1, "No record of Exchg. Unable to decode SW_ACC"); return 0; } } @@ -1807,8 +1791,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) if (tree) { if ((cdata == NULL) && (opcode != FC_SWILS_SWRJT)) { /* No record of what this accept is for. Can't decode */ - proto_tree_add_text(swils_tree, tvb, 0, tvb_length(tvb), - "No record of SW_ILS Req. Unable to decode SW_ACC"); + proto_tree_add_expert_format(swils_tree, pinfo, &ei_swils_no_exchange, tvb, 0, -1, "No record of SW_ILS Req. Unable to decode SW_ACC"); return 0; } } @@ -1828,12 +1811,10 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) val_to_str(opcode, fc_swils_opcode_key_val, "0x%x")); } - if (tree) { - proto_tree_add_item(swils_tree, hf_swils_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); - } + proto_tree_add_item(swils_tree, hf_swils_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); if ((opcode < FC_SWILS_MAXCODE) && fcswils_func_table[opcode].func) { - fcswils_func_table[opcode].func(tvb, swils_tree, isreq); + fcswils_func_table[opcode].func(tvb, pinfo, swils_tree, isreq); } else if (opcode == FC_SWILS_AUTH_ILS) { /* This is treated differently */ if (isreq && fcsp_handle) @@ -2482,6 +2463,29 @@ proto_register_fcswils(void) FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}}, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_swils_requested_domain_id, { "Requested Domain ID", "swils.requested_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_granted_domain_id, { "Granted Domain ID", "swils.granted_domain_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrh_lsr_age, { "LSR Age", "swils.lsr.age", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrh_options, { "Options", "swils.lsr.options", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrh_checksum, { "Checksum", "swils.lsr.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrh_lsr_length, { "LSR Length", "swils.lsr.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsrec_number_of_links, { "Number of Links", "swils.lsr.number_of_links", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsupdate_flags, { "Flags", "swils.lsupdate.flags", FT_UINT8, BASE_HEX, VALS(fc_swils_fspf_lsrflags_val), 0x0, NULL, HFILL }}, + { &hf_swils_lsupdate_num_of_lsrs, { "Num of LSRs", "swils.lsupdate.num_of_lsrs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_lsack_flags, { "Flags", "swils.lsack.flags", FT_UINT8, BASE_HEX, VALS(fc_swils_fspf_lsrflags_val), 0x0, NULL, HFILL }}, + { &hf_swils_lsack_num_of_lsr_headers, { "Num of LSR Headers", "swils.lsack.num_of_lsr_headers", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_rscn_num_entries, { "Num Entries", "swils.rscn.num_entries", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_mbrflags, { "Flags", "swils.zone.flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_mbr_identifier_length, { "Identifier Length", "swils.zone.identifier_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_num_members, { "4", "swils.zone.num_members", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_active_zoneset_length, { "Active ZoneSet Length", "swils.zone.active_zoneset_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_num_zoning_objects, { "Number of zoning objects", "swils.zone.num_zoning_objects", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_full_zone_set_length, { "Full Zone Set Length", "swils.zone.full_zone_set_length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_zone_vendor_unique, { "Vendor Unique", "swils.zone.vendor_unique", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_domain_id_list_length, { "Domain ID List Length", "swils.aca.domain_id_list_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_sfc_zoneset_length, { "ZoneSet Length", "swils.sfc.zoneset_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_swils_esc_payload_length, { "Payload Length", "swils.esc.payload_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { @@ -2519,10 +2523,19 @@ proto_register_fcswils(void) &ett_fcswils_capinfo }; + static ei_register_info ei[] = { + { &ei_swils_efp_record_len, { "swils.efp.recordlen.zero", PI_UNDECODED, PI_NOTE, "Record length is zero", EXPFILL }}, + { &ei_swils_no_exchange, { "swils.no_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode", EXPFILL }}, + }; + + expert_module_t* expert_fcswils; + proto_fcswils = proto_register_protocol("Fibre Channel SW_ILS", "FC-SWILS", "swils"); proto_register_field_array(proto_fcswils, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fcswils = expert_register_protocol(proto_fcswils); + expert_register_field_array(expert_fcswils, ei, array_length(ei)); register_init_routine(&fcswils_init_protocol); } diff --git a/epan/dissectors/packet-hclnfsd.c b/epan/dissectors/packet-hclnfsd.c index f03a504b8b..df5d4e7b57 100644 --- a/epan/dissectors/packet-hclnfsd.c +++ b/epan/dissectors/packet-hclnfsd.c @@ -94,6 +94,14 @@ static int hf_hclnfsd_size = -1; static int hf_hclnfsd_copies = -1; static int hf_hclnfsd_auth_ident_obscure = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_hclnfsd_job_id = -1; +static int hf_hclnfsd_print_queues = -1; +static int hf_hclnfsd_print_jobs = -1; +static int hf_hclnfsd_gids = -1; +static int hf_hclnfsd_uids = -1; +static int hf_hclnfsd_password = -1; + static gint ett_hclnfsd = -1; static gint ett_hclnfsd_gids = -1; static gint ett_hclnfsd_groups = -1; @@ -106,7 +114,7 @@ static gint ett_hclnfsd_auth_ident = -1; static int dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - guint32 ngids, ngids_i, gid; + guint32 ngids, ngids_i; proto_tree *gidtree = NULL; proto_item *giditem = NULL; @@ -114,10 +122,8 @@ dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr ngids = tvb_get_ntohl(tvb, offset); if (tree) { - giditem = proto_tree_add_text(tree, tvb, offset, 4, "GIDs: %d", - ngids); - if (giditem) - gidtree = proto_item_add_subtree(giditem, ett_hclnfsd_gids); + giditem = proto_tree_add_item(tree, hf_hclnfsd_gids, tvb, offset, 4, ENC_BIG_ENDIAN); + gidtree = proto_item_add_subtree(giditem, ett_hclnfsd_gids); } offset += 4; @@ -125,9 +131,7 @@ dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tr { for (ngids_i = 0; ngids_i < ngids; ngids_i++) { - gid = tvb_get_ntohl(tvb, offset + (4 * ngids_i)); - proto_tree_add_text(gidtree, tvb, offset + (4 * ngids_i), 4, - "GID: %d", gid); + proto_tree_add_item(gidtree, hf_hclnfsd_gid, tvb, offset + (4 * ngids_i), 4, ENC_BIG_ENDIAN); } } offset += 4 * ngids; @@ -231,11 +235,8 @@ dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_ username = ident_decoded + 2; password = username + strlen(username) + 1; - proto_tree_add_text(ident_tree, tvb, offset, ident_len, - "Username: %s", username); - - proto_tree_add_text(ident_tree, tvb, offset, ident_len, - "Password: %s", password); + proto_tree_add_string(ident_tree, hf_hclnfsd_username, tvb, offset, ident_len, username); + proto_tree_add_string(ident_tree, hf_hclnfsd_password, tvb, offset, ident_len, password); offset = newoffset; } @@ -333,17 +334,13 @@ dissect_hclnfsd_uid_to_name_call(tvbuff_t *tvb, int offset, packet_info *pinfo _ nuids = tvb_get_ntohl(tvb, offset); if (tree) { - uiditem = proto_tree_add_text(tree, tvb, offset, 4, "UIDs: %d", - nuids); + uiditem = proto_tree_add_item(tree, hf_hclnfsd_uids, tvb, offset, 4, ENC_BIG_ENDIAN); if (uiditem) uidtree = proto_item_add_subtree(uiditem, ett_hclnfsd_uids); } offset += 4; - if (!uidtree) - return offset; - for (nuids_i = 0; nuids_i < nuids; nuids_i++) offset = dissect_rpc_uint32(tvb, uidtree, hf_hclnfsd_uid, offset); @@ -361,8 +358,7 @@ dissect_hclnfsd_uid_to_name_reply(tvbuff_t *tvb, int offset, packet_info *pinfo nusers = tvb_get_ntohl(tvb, offset); if (tree) { - useritem = proto_tree_add_text(tree, tvb, offset, 4, "UIDs: %d", - nusers); + useritem = proto_tree_add_item(tree, hf_hclnfsd_uids, tvb, offset, 4, ENC_BIG_ENDIAN); if (useritem) usertree = proto_item_add_subtree(useritem, ett_hclnfsd_usernames); @@ -553,8 +549,7 @@ dissect_hclnfsd_get_printers_reply(tvbuff_t *tvb, int offset, packet_info *pinfo nqueues = tvb_get_ntohl(tvb, offset); if (tree) { - queuesitem = proto_tree_add_text(tree, tvb, offset, 4, - "Print Queues: %d", nqueues); + queuesitem = proto_tree_add_item(tree, hf_hclnfsd_print_queues, tvb, offset, 4, ENC_BIG_ENDIAN); if (queuesitem) queuestree = proto_item_add_subtree(queuesitem, @@ -594,7 +589,7 @@ dissect_hclnfsd_get_printq_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U static int dissect_hclnfsd_get_printq_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { - guint datafollows, jobid; + guint datafollows; proto_item *queueitem = NULL; proto_tree *queuetree = NULL; proto_item *jobitem; @@ -611,21 +606,14 @@ dissect_hclnfsd_get_printq_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _ datafollows = tvb_get_ntohl(tvb, offset); if (tree) { - queueitem = proto_tree_add_text(tree, tvb, offset, 4, - "Print Jobs: %d", datafollows); - if (queueitem) - queuetree = proto_item_add_subtree(queueitem, ett_hclnfsd_printqueues); + queueitem = proto_tree_add_item(tree, hf_hclnfsd_print_jobs, tvb, offset, 4, ENC_BIG_ENDIAN); + queuetree = proto_item_add_subtree(queueitem, ett_hclnfsd_printqueues); } offset += 4; - if (!queuetree) - return offset; - while (datafollows) { - jobid = tvb_get_ntohl(tvb, offset); - jobitem = proto_tree_add_text(queuetree, tvb, offset, 4, "Job ID: %d", - jobid); + jobitem = proto_tree_add_item(queuetree, hf_hclnfsd_job_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; jobtree = proto_item_add_subtree(jobitem, ett_hclnfsd_printjob); @@ -642,8 +630,7 @@ dissect_hclnfsd_get_printq_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _ offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_timesubmitted, offset); offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_size, offset); offset = dissect_rpc_uint32(tvb, jobtree, hf_hclnfsd_copies, offset); - offset = dissect_rpc_string(tvb, jobtree, - hf_hclnfsd_queuecomment, offset, NULL); + offset = dissect_rpc_string(tvb, jobtree, hf_hclnfsd_queuecomment, offset, NULL); datafollows = tvb_get_ntohl(tvb, offset); offset += 4; @@ -867,6 +854,14 @@ proto_register_hclnfsd(void) { &hf_hclnfsd_auth_ident_obscure, { "Obscure Ident", "hclnfsd.authorize.ident.obscure", FT_STRING, BASE_NONE , NULL, 0, "Authentication Obscure Ident", HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_hclnfsd_gids, { "GIDs", "hclnfsd.gids", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_hclnfsd_password, { "Password", "hclnfsd.password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_hclnfsd_uids, { "UIDs", "hclnfsd.uids", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_hclnfsd_print_queues, { "Print Queues", "hclnfsd.print_queues", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_hclnfsd_print_jobs, { "Print Jobs", "hclnfsd.print_jobs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_hclnfsd_job_id, { "Job ID", "hclnfsd.job_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_hclnfsd, diff --git a/epan/dissectors/packet-igap.c b/epan/dissectors/packet-igap.c index 7a478b2cfd..2eb60928da 100644 --- a/epan/dissectors/packet-igap.c +++ b/epan/dissectors/packet-igap.c @@ -63,6 +63,14 @@ static int hf_asize = -1; static int hf_msize = -1; static int hf_account = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_igap_challenge = -1; +static int hf_igap_user_password = -1; +static int hf_igap_authentication_result = -1; +static int hf_igap_result_of_md5_calculation = -1; +static int hf_igap_accounting_status = -1; +static int hf_igap_unknown_message = -1; + static int ett_igap = -1; @@ -207,39 +215,27 @@ dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int off case IGAP_SUBTYPE_PASSWORD_LEAVE: /* Challenge field is user's password */ message[msize] = '\0'; - proto_tree_add_text(tree, tvb, offset, msize, - "User password: %s", message); + proto_tree_add_string(tree, hf_igap_user_password, tvb, offset, msize, message); break; case IGAP_SUBTYPE_CHALLENGE_RESPONSE_JOIN: case IGAP_SUBTYPE_CHALLENGE_RESPONSE_LEAVE: /* Challenge field is the results of MD5 calculation */ - proto_tree_add_text(tree, tvb, offset, msize, - "Result of MD5 calculation: 0x%s", - bytes_to_ep_str(message, msize)); + proto_tree_add_item(tree, hf_igap_result_of_md5_calculation, tvb, offset, msize, ENC_NA); break; case IGAP_SUBTYPE_CHALLENGE: /* Challenge field is the challenge value */ - proto_tree_add_text(tree, tvb, offset, msize, - "Challenge: 0x%s", - bytes_to_ep_str(message, msize)); + proto_tree_add_item(tree, hf_igap_challenge, tvb, offset, msize, ENC_NA); break; case IGAP_SUBTYPE_AUTH_MESSAGE: /* Challenge field indicates the result of the authenticaion */ - proto_tree_add_text(tree, tvb, offset, msize, - "Authentication result: %s (0x%x)", - val_to_str_const(message[0], igap_auth_result, "Unknown"), - message[0]); + proto_tree_add_uint(tree, hf_igap_authentication_result, tvb, offset, msize, message[0]); break; case IGAP_SUBTYPE_ACCOUNTING_MESSAGE: /* Challenge field indicates the accounting status */ - proto_tree_add_text(tree, tvb, offset, msize, - "Accounting status: %s (0x%x)", - val_to_str_const(message[0], igap_account_status, "Unknown"), - message[0]); + proto_tree_add_uint(tree, hf_igap_accounting_status, tvb, offset, msize, message[0]); break; default: - proto_tree_add_text(tree, tvb, offset, msize, - "Message: (Unknown)"); + proto_tree_add_item(tree, hf_igap_unknown_message, tvb, offset, msize, ENC_NA); } } offset += MESSAGE_SIZE; @@ -306,7 +302,14 @@ proto_register_igap(void) { &hf_account, { "User Account", "igap.account", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } - } + }, + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_igap_user_password, { "User password", "igap.user_password", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_igap_result_of_md5_calculation, { "Result of MD5 calculation", "igap.result_of_md5_calculation", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_igap_challenge, { "Challenge", "igap.challenge", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_igap_authentication_result, { "Authentication result", "igap.authentication_result", FT_UINT8, BASE_HEX, VALS(igap_auth_result), 0x0, NULL, HFILL }}, + { &hf_igap_accounting_status, { "Accounting status", "igap.accounting_status", FT_UINT8, BASE_HEX, VALS(igap_account_status), 0x0, NULL, HFILL }}, + { &hf_igap_unknown_message, { "Unknown message", "igap.unknown_message", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-juniper.c b/epan/dissectors/packet-juniper.c index 191457cdaf..3e3387a2c3 100644 --- a/epan/dissectors/packet-juniper.c +++ b/epan/dissectors/packet-juniper.c @@ -25,6 +25,7 @@ #include <glib.h> #include <epan/packet.h> +#include <epan/expert.h> #include <epan/etypes.h> #include <epan/addr_resolv.h> #include <epan/ppptypes.h> @@ -355,10 +356,11 @@ static const value_string juniper_ifle_vals[] = { static int proto_juniper = -1; -/* static int hf_juniper_magic = -1; */ +static int hf_juniper_magic = -1; static int hf_juniper_direction = -1; static int hf_juniper_l2hdr_presence = -1; static int hf_juniper_ext_total_len = -1; +static int hf_juniper_cookie_len = -1; static int hf_juniper_atm1_cookie = -1; static int hf_juniper_atm2_cookie = -1; static int hf_juniper_mlpic_cookie = -1; @@ -366,6 +368,8 @@ static int hf_juniper_lspic_cookie = -1; static int hf_juniper_aspic_cookie = -1; static int hf_juniper_vlan = -1; static int hf_juniper_proto = -1; +static int hf_juniper_payload_type = -1; +static int hf_juniper_encap_type = -1; static int hf_juniper_ext_ifd = -1; static int hf_juniper_ext_ifl = -1; static int hf_juniper_ext_unit = -1; @@ -373,6 +377,9 @@ static int hf_juniper_ext_ifmt = -1; static int hf_juniper_ext_ifle = -1; static int hf_juniper_ext_ttp_ifmt = -1; static int hf_juniper_ext_ttp_ifle = -1; +static int hf_juniper_unknown_data = -1; + +static expert_field ei_juniper_no_magic = EI_INIT; static gint ett_juniper = -1; @@ -390,8 +397,7 @@ static dissector_handle_t data_handle; static dissector_table_t osinl_incl_subdissector_table; static dissector_table_t osinl_excl_subdissector_table; -static int dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *ti, guint8 *flags); -static int dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,proto_item *ti, guint proto, guint offset); +static int dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *juniper_subtree, guint proto, guint offset); static void dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 atm_pictype); static gboolean ppp_heuristic_guess(guint16 proto); static guint ip_heuristic_guess(guint8 ip_header_byte); @@ -446,9 +452,6 @@ static const value_string juniper_proto_vals[] = { {0, NULL} }; -/* the first subtree is accessed by several routines */ -static proto_tree *juniper_subtree = NULL; - /* return a TLV value based on TLV length and TLV type (host/network order) */ static int juniper_ext_get_tlv_value(tvbuff_t *tvb, guint tlv_type, guint tlv_len, guint offset) { @@ -499,9 +502,9 @@ juniper_ext_get_tlv_value(tvbuff_t *tvb, guint tlv_type, guint tlv_len, guint of /* generic juniper header dissector */ static int -dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *ti, guint8 *flags) +dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *juniper_subtree, guint8 *flags) { - proto_item *tisub; + proto_item *tisub, *magic_item; guint8 l2hdr_presence,proto,ext_type,ext_len; guint16 ext_total_len,ext_offset=6,hdr_len; guint32 magic_number,ext_val; @@ -512,24 +515,19 @@ dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot *flags = tvb_get_guint8(tvb, 3); l2hdr_presence = *flags & JUNIPER_FLAG_NO_L2; - juniper_subtree = proto_item_add_subtree(ti, ett_juniper); + magic_item = proto_tree_add_item(juniper_subtree, hf_juniper_magic, tvb, 0, 3, ENC_BIG_ENDIAN); /* be liberal with magic-number detection - * some older JUNOS releases (e.g. 6.4), * which are still in the field do not generate magic-numbers */ if (magic_number != JUNIPER_PCAP_MAGIC) { - proto_tree_add_text (juniper_subtree, tvb, 0, 0, "no Magic-Number found !"); + expert_add_info(pinfo, magic_item, &ei_juniper_no_magic); return 0; } - proto_tree_add_text (juniper_subtree, tvb, 0, 3, - "Magic-Number: 0x%06x", magic_number); - proto_tree_add_item(juniper_subtree, hf_juniper_direction, tvb, 3, 1, ENC_NA); - proto_tree_add_uint_format (juniper_subtree, hf_juniper_l2hdr_presence, tvb, 3, 1, - l2hdr_presence, "L2-header: %s", - val_to_str_const(l2hdr_presence,juniper_l2hdr_presence_vals,"Unknown")); + proto_tree_add_uint(juniper_subtree, hf_juniper_l2hdr_presence, tvb, 3, 1, l2hdr_presence); /* calculate hdr_len before cookie, payload */ @@ -602,7 +600,7 @@ dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot if ((*flags & JUNIPER_FLAG_NO_L2) == JUNIPER_FLAG_NO_L2) { /* no link header present ? */ proto = tvb_get_letohl(tvb,hdr_len); /* proto is stored in host-order */ - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, proto, hdr_len + 4); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, hdr_len + 4); return -1; } @@ -613,14 +611,14 @@ dissect_juniper_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot /* print the payload protocol */ static int dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - proto_item *ti _U_, guint proto, guint offset) + proto_tree *juniper_subtree, guint proto, guint offset) { - + proto_item *ti; tvbuff_t *next_tvb; guint8 nlpid; - proto_tree_add_text (juniper_subtree, tvb, offset, 0, "[Payload Type: %s]", - val_to_str_const(proto,juniper_proto_vals,"Unknown")); + ti = proto_tree_add_uint(juniper_subtree, hf_juniper_payload_type, tvb, offset, 0, proto); + PROTO_ITEM_SET_GENERATED(ti); next_tvb = tvb_new_subset_remaining(tvb, offset); @@ -669,7 +667,7 @@ dissect_juniper_payload_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre call_dissector(chdlc_handle, next_tvb, pinfo, tree); break; case 0xa248: - proto_tree_add_text (juniper_subtree, tvb, offset, 4,"[Unknown data]"); + proto_tree_add_item(juniper_subtree, hf_juniper_unknown_data, tvb, offset, 4, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, offset+4); call_dissector(ipv4_handle, next_tvb, pinfo, tree); break; @@ -687,6 +685,7 @@ static void dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -700,10 +699,10 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper Multi-Link Frame-Relay (FRF.15)"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper Multi-Link Frame-Relay (FRF.15)"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; @@ -779,8 +778,10 @@ dissect_juniper_mlfr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto = PROTO_ISO; } - ti = proto_tree_add_text (juniper_subtree, tvb, offset, 0, "[Cookie length: %u]",cookie_len); - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, proto, offset); + ti = proto_tree_add_uint(juniper_subtree, hf_juniper_cookie_len, tvb, offset, 0, cookie_len); + PROTO_ITEM_SET_GENERATED(ti); + + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); } @@ -791,6 +792,7 @@ static void dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -804,10 +806,10 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper MLPPP"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper MLPPP"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; @@ -849,10 +851,11 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto = PROTO_PPP; } - ti = proto_tree_add_text (juniper_subtree, tvb, offset, 0, "[Cookie length: %u]",cookie_len); + ti = proto_tree_add_uint(juniper_subtree, hf_juniper_cookie_len, tvb, offset, 0, cookie_len); + PROTO_ITEM_SET_GENERATED(ti); offset += cookie_len; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, proto, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); } @@ -861,7 +864,7 @@ dissect_juniper_mlppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -871,17 +874,17 @@ dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper PPPoE PIC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper PPPoE PIC"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); } @@ -889,7 +892,7 @@ dissect_juniper_pppoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -899,17 +902,17 @@ dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper Ethernet"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper Ethernet"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); } @@ -917,7 +920,7 @@ dissect_juniper_ether(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -927,17 +930,17 @@ dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper PPP"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper PPP"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_PPP, offset+2); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_PPP, offset+2); } @@ -945,7 +948,7 @@ dissect_juniper_ppp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset; int bytes_processed; guint8 flags; @@ -955,17 +958,17 @@ dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = 0; - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper Frame-Relay"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper Frame-Relay"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_FRELAY, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_FRELAY, offset); } @@ -973,7 +976,7 @@ dissect_juniper_frelay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset = 0; int bytes_processed; guint8 flags; @@ -981,17 +984,17 @@ dissect_juniper_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper C-HDLC"); col_clear(pinfo->cinfo, COL_INFO); - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper C-HDLC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper C-HDLC"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else offset+=bytes_processed; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_CHDLC, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_CHDLC, offset); } @@ -1016,6 +1019,7 @@ static void dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 atm_pictype) { proto_item *ti; + proto_tree* juniper_subtree; guint8 next_proto = PROTO_UNKNOWN,atm1_header_len,atm2_header_len,flags; guint32 cookie1, proto; guint64 cookie2; @@ -1028,20 +1032,20 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 switch (atm_pictype) { case JUNIPER_PIC_ATM1: col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper ATM1"); - ti = proto_tree_add_text (tree, tvb, 0, 0 , "Juniper ATM1 PIC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, 0, 0 , ett_juniper, NULL, "Juniper ATM1 PIC"); break; case JUNIPER_PIC_ATM2: col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper ATM2"); - ti = proto_tree_add_text (tree, tvb, 0, 0 , "Juniper ATM2 PIC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, 0, 0 , ett_juniper, NULL, "Juniper ATM2 PIC"); break; default: /* should not happen */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper ATM unknown"); - proto_tree_add_text (tree, tvb, 0, 0 , "Juniper unknown ATM PIC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, 0, 0 , ett_juniper, NULL, "Juniper unknown ATM PIC"); return; } /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; else @@ -1075,7 +1079,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 next_tvb = tvb_new_subset_remaining(tvb, offset); if (next_proto == PROTO_OAM) { - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_OAM, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_OAM, offset); return; } @@ -1086,7 +1090,7 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * This begins with something that appears to be an LLC header for * OSI; is this LLC-multiplexed traffic? */ - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_LLC, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_LLC, offset); return; } @@ -1095,14 +1099,14 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * This begins with something that appears to be an LLC header for * SNAP; is this LLC-multiplexed traffic? */ - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_LLC_SNAP, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_LLC_SNAP, offset); return; } if ((flags & JUNIPER_FLAG_PKT_IN) != JUNIPER_FLAG_PKT_IN && /* ether-over-1483 encaps ? */ (cookie1 & JUNIPER_ATM2_GAP_COUNT_MASK) && atm_pictype != JUNIPER_PIC_ATM1) { - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_ETHER, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ETHER, offset); return; } @@ -1115,8 +1119,8 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * type; is this VC-multiplexed PPPoA? * That's not supported on ATM1 PICs. */ - ti = proto_tree_add_text (juniper_subtree, tvb, offset, 0, "Encapsulation Type: VC-MUX"); - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_PPP , offset); + proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 0, 0, "VC-MUX"); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_PPP, offset); return; } @@ -1127,8 +1131,8 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * Cisco style NLPID encaps? * Is the 0x03 an LLC UI control field? */ - ti = proto_tree_add_text (juniper_subtree, tvb, offset, 1, "Encapsulation Type: Cisco NLPID"); - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_ISO , offset+1); + proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 1, 1, "Cisco NLPID"); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_ISO , offset+1); return; } @@ -1138,20 +1142,21 @@ dissect_juniper_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 * This begins with something that might be the first byte of * an IPv4 or IPv6 packet; is this VC-multiplexed IP? */ - ti = proto_tree_add_text (juniper_subtree, tvb, offset, 0, "Encapsulation Type: VC-MUX"); - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, next_proto , offset); + proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_encap_type, tvb, offset, 0, 2, "VC-MUX"); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, next_proto , offset); return; } /* could not figure what it is */ - proto_tree_add_text (juniper_subtree, tvb, offset, -1, "Payload Type: unknown"); + ti = proto_tree_add_uint_format_value(juniper_subtree, hf_juniper_payload_type, tvb, offset, 0, 0xFFFF, "Unknown"); + proto_item_set_len(ti, tvb_reported_length_remaining(tvb, offset)); call_dissector(data_handle, next_tvb, pinfo, tree); } static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset = 0; int bytes_processed; guint8 flags; @@ -1160,10 +1165,10 @@ static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper GGSN"); col_clear(pinfo->cinfo, COL_INFO); - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper GGSN"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper GGSN"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; @@ -1176,13 +1181,13 @@ static void dissect_juniper_ggsn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* proto_tree_add_item(juniper_subtree, hf_juniper_vlan, tvb, offset+2, 2, ENC_LITTLE_ENDIAN); offset += 4; - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, proto, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, proto, offset); } static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset = 0; int bytes_processed; guint8 flags; @@ -1190,10 +1195,10 @@ static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper Voice PIC"); col_clear(pinfo->cinfo, COL_INFO); - ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper Voice PIC"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper Voice PIC"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if(bytes_processed == -1) return; @@ -1205,14 +1210,14 @@ static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr * For the future there should be sufficient space in the 18-byte * empty header before payload starts. */ - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_IP, offset+18); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_IP, offset+18); } /* Wrapper for Juniper service PIC coookie dissector */ static void dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_item *ti; + proto_tree* juniper_subtree; guint offset = 0; int bytes_processed = 0; guint8 flags; @@ -1220,10 +1225,10 @@ dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper Services"); col_clear(pinfo->cinfo, COL_INFO); - ti = proto_tree_add_text (tree, tvb, 0, 4, "Juniper Services cookie"); + juniper_subtree = proto_tree_add_subtree(tree, tvb, offset, 4, ett_juniper, NULL, "Juniper Services cookie"); /* parse header, match mgc, extract flags and build first tree */ - bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags); + bytes_processed = dissect_juniper_header(tvb, pinfo, tree, juniper_subtree, &flags); if (bytes_processed == -1) return; @@ -1237,7 +1242,7 @@ dissect_juniper_svcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += 12; } - dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_IP, offset); + dissect_juniper_payload_proto(tvb, pinfo, tree, juniper_subtree, PROTO_IP, offset); } /* list of Juniper supported PPP proto IDs */ @@ -1389,11 +1394,9 @@ void proto_register_juniper(void) { static hf_register_info hf[] = { -#if 0 { &hf_juniper_magic, { "Magic Number", "juniper.magic-number", FT_UINT24, BASE_HEX, NULL, 0x0, NULL, HFILL }}, -#endif { &hf_juniper_direction, { "Direction", "juniper.direction", FT_UINT8, BASE_HEX, VALS(juniper_direction_vals), 0x0, NULL, HFILL }}, @@ -1403,6 +1406,9 @@ proto_register_juniper(void) { &hf_juniper_ext_total_len, { "Extension(s) Total length", "juniper.ext_total_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_juniper_cookie_len, + { "Cookie length", "juniper.cookie_len", FT_UINT32, BASE_DEC, + NULL, 0x0, NULL, HFILL }}, { &hf_juniper_atm2_cookie, { "Cookie", "juniper.atm2.cookie", FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }}, @@ -1424,6 +1430,12 @@ proto_register_juniper(void) { &hf_juniper_proto, { "Protocol", "juniper.proto", FT_UINT16, BASE_DEC, VALS(juniper_proto_vals), 0x0, NULL, HFILL }}, + { &hf_juniper_payload_type, + { "Payload Type", "juniper.payload_type", FT_UINT16, BASE_DEC, + VALS(juniper_proto_vals), 0x0, NULL, HFILL }}, + { &hf_juniper_encap_type, + { "Encapsulation Type", "juniper.encap_type", FT_UINT8, BASE_DEC, + NULL, 0x0, NULL, HFILL }}, { &hf_juniper_ext_ifd, /* Juniper PCAP extensions */ { "Device Interface Index", "juniper.ext.ifd", FT_UINT32, BASE_DEC, @@ -1446,15 +1458,26 @@ proto_register_juniper(void) { &hf_juniper_ext_ttp_ifle, { "TTP derived Logical Interface Encapsulation", "juniper.ext.ttp_ifle", FT_UINT16, BASE_DEC, VALS(juniper_ifle_vals), 0x0, NULL, HFILL }}, + { &hf_juniper_unknown_data, + { "Unknown data", "juniper.unknown_data", FT_BYTES, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_juniper, }; + static ei_register_info ei[] = { + { &ei_juniper_no_magic, { "juniper.magic-number.none", PI_PROTOCOL, PI_WARN, "No Magic-Number found!", EXPFILL }}, + }; + + expert_module_t* expert_juniper; + proto_juniper = proto_register_protocol("Juniper", "Juniper", "juniper"); proto_register_field_array(proto_juniper, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_juniper = expert_register_protocol(proto_juniper); + expert_register_field_array(expert_juniper, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c index 2789a8c348..2a78d40838 100644 --- a/epan/dissectors/packet-kink.c +++ b/epan/dissectors/packet-kink.c @@ -48,6 +48,10 @@ static int hf_kink_length = -1; static int hf_kink_transactionId = -1; static int hf_kink_checkSumLength = -1; static int hf_kink_A = -1; +static int hf_kink_version = -1; +static int hf_kink_domain_of_interpretation = -1; +static int hf_kink_qmversion = -1; +static int hf_kink_error_code = -1; static int hf_kink_reserved8 = -1; static int hf_kink_reserved15 = -1; static int hf_kink_reserved16 = -1; @@ -63,6 +67,7 @@ static int hf_kink_princ_name_length = -1; static int hf_kink_princ_name = -1; static int hf_kink_tgt_length = -1; static int hf_kink_tgt = -1; +static int hf_kink_payload = -1; /* Argument for making the subtree */ static gint ett_kink = -1; @@ -199,7 +204,6 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_item *ti = NULL; proto_tree *kink_tree = NULL; guint8 type; - guint8 major_version, minor_version, version; guint32 doi; guint chsumlen; guint8 next_payload; @@ -221,19 +225,7 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_tree_add_uint(kink_tree, hf_kink_type, tvb, offset, 1, type); offset++; - /* This part is the version. Consider less than 1 octet value. - * Major version and minor version is 4bit. Front half of 1octet - * is major version, and second half of 1octet is minor version. - * The calculation of major version is shown below. - * The logical product of the value of 1octet and 0xf0 is performed. - * And It is performed 4bit right shift. - * Secondarily, the calculation of minor version is shown below. - * The logical product of the value of 1octet and 0x0f is performed. - */ - version = tvb_get_guint8(tvb,offset); - major_version = (version & FRONT_FOUR_BIT) >> VERSION_BIT_SHIFT; - minor_version = version & SECOND_FOUR_BIT; - proto_tree_add_text(kink_tree, tvb, offset, 1, "version: %u.%u", major_version, minor_version); + proto_tree_add_item(kink_tree, hf_kink_version, tvb, offset, 1, ENC_NA); offset++; proto_tree_add_item(kink_tree, hf_kink_length, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -242,10 +234,10 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ doi = tvb_get_ntohl(tvb, offset); if(doi == IPSEC){ - proto_tree_add_text(kink_tree, tvb, offset, 4, "Domain Of Interpretation: %s (%u)", "IPsec", doi); + proto_tree_add_uint_format_value(kink_tree, hf_kink_domain_of_interpretation, tvb, offset, 4, doi, "IPsec (%u)", doi); } else{ - proto_tree_add_text(kink_tree, tvb, offset, 4, "Domain Of Interpretation: %s (%u)", "Not IPsec", doi); + proto_tree_add_uint_format_value(kink_tree, hf_kink_domain_of_interpretation, tvb, offset, 4, doi, "Not IPsec (%u)", doi); } offset += 4; @@ -597,7 +589,6 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto guint payload_length,isakmp_length; int length, reported_length; guint8 inner_next_pload; - guint8 qm, qmmaj, qmmin; int start_payload_offset = 0; /* Keep the beginning of the payload offset */ tvbuff_t *isakmp_tvb; @@ -625,16 +616,7 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto proto_tree_add_uint(payload_kink_isakmp_tree, hf_kink_inner_next_pload, tvb, offset, 1, inner_next_pload); offset += 1; - /* The qmmaj is first half 4bit field of the octet. Therefore, the logical product - * of the 1octet value and 0xf0 is performed, and performed 4bit right shift. - * The qmmin is second half 4bit field of the octet. Therefore, the logical product - * of the 1octet value and 0x0f is performed. - */ - qm = tvb_get_guint8(tvb,offset); - qmmaj = (qm & FRONT_FOUR_BIT) >> VERSION_BIT_SHIFT; - qmmin = qm & SECOND_FOUR_BIT; - - proto_tree_add_text(payload_kink_isakmp_tree, tvb, offset, 1, "QMVersion: %u.%u", qmmaj, qmmin); + proto_tree_add_item(payload_kink_isakmp_tree, hf_kink_qmversion, tvb, offset, 1, ENC_NA); offset += 1; proto_tree_add_item(payload_kink_isakmp_tree, hf_kink_reserved16, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -726,7 +708,7 @@ dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, prot if(payload_length > PAYLOAD_HEADER){ inner_payload_length = payload_length - PAYLOAD_HEADER; - proto_tree_add_text(payload_kink_encrypt_tree, tvb, offset, inner_payload_length, "Payload"); + proto_tree_add_item(payload_kink_encrypt_tree, hf_kink_payload, tvb, offset, inner_payload_length, ENC_NA); /*offset += inner_payload_length;*/ } } @@ -764,23 +746,27 @@ dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree } #endif +static const range_string kink_error_rvals[] = { + { 0, 0, "KINK_OK" }, + { 1, 1, "KINK_PROTOERR" }, + { 2, 2, "KINK_INVDOI" }, + { 3, 3, "KINK_INVMAJ" }, + { 4, 4, "KINK_INVMIN" }, + { 5, 5, "KINK_INTERR" }, + { 6, 6, "KINK_BADQMVERS" }, + { BOTTOM_RESERVED, TOP_RESERVED, "RESERVED" }, + { BOTTOM_PRIVATE_USE, TOP_PRIVATE_USE, "PRIVATE USE" }, + { TOP_PRIVATE_USE+1, 0xffffffff, "This Error Code is not Defined." }, + { 0, 0, NULL } +}; + static void dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){ proto_tree *payload_kink_error_tree; proto_item *ti; guint8 next_payload; guint16 payload_length; - guint32 error_code; int start_payload_offset = 0; /* Keep the beginning of the payload offset */ - static const char *char_error_code[] = { - "KINK_OK", - "KINK_PROTOERR", - "KINK_INVDOI", - "KINK_INVMAJ", - "KINK_INVMIN", - "KINK_INTERR", - "KINK_BADQMVERS" - }; payload_length = tvb_get_ntohs(tvb,offset + TO_PAYLOAD_LENGTH); start_payload_offset = offset; @@ -802,31 +788,7 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_ } offset += 2; - error_code = tvb_get_ntohl(tvb, offset); - - /* Choosed the error code by erro_code */ - switch(error_code){ - case KINK_OK: - case KINK_PROTOERR: - case KINK_INVDOI: - case KINK_INVMAJ: - case KINK_INVMIN: - case KINK_INTERR: - case KINK_BADQMVERS: - proto_tree_add_text(payload_kink_error_tree, tvb, offset, 4, "ErrorCode: %s (%u)", char_error_code[error_code], error_code); - break; - default: - if(BOTTOM_RESERVED <= error_code && TOP_RESERVED >= error_code){ - proto_tree_add_text(payload_kink_error_tree, tvb, offset, 4, "ErrorCode: %s (%u)", "RESERVED", error_code); - } - else if(BOTTOM_PRIVATE_USE <= error_code && TOP_PRIVATE_USE >= error_code){ - proto_tree_add_text(payload_kink_error_tree, tvb, offset, 4, "ErrorCode: %s (%u)", "PRIVATE USE", error_code); - } - else{ - proto_tree_add_text(payload_kink_error_tree, tvb, offset, 4, "ErrorCode: %s (%u)", "This Error Code is not Defined.", error_code); - } - break; - } + proto_tree_add_item(payload_kink_error_tree, hf_kink_error_code, tvb, offset, 4, ENC_BIG_ENDIAN); offset = start_payload_offset + KINK_ERROR_LENGTH; control_payload(pinfo, tvb, offset, next_payload, tree); /* Recur control_payload() */ @@ -867,6 +829,26 @@ dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, } } +static void +kink_fmt_version( gchar *result, guint32 version ) +{ + guint8 major_version, minor_version; + + /* This part is the version. Consider less than 1 octet value. + * Major version and minor version is 4bit. Front half of 1octet + * is major version, and second half of 1octet is minor version. + * The calculation of major version is shown below. + * The logical product of the value of 1octet and 0xf0 is performed. + * And It is performed 4bit right shift. + * Secondarily, the calculation of minor version is shown below. + * The logical product of the value of 1octet and 0x0f is performed. + */ + major_version = (guint8)((version & FRONT_FOUR_BIT) >> VERSION_BIT_SHIFT); + minor_version = (guint8)(version & SECOND_FOUR_BIT); + + g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", major_version, minor_version); +} + /* Output part */ void proto_register_kink(void) { @@ -875,47 +857,63 @@ proto_register_kink(void) { { &hf_kink_type, { "Type", "kink.type", FT_UINT8, BASE_DEC, VALS(kink_type_vals), 0x0, - "the type of the kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_length, { "Length", "kink.length", FT_UINT16, BASE_DEC, NULL, 0x0, - "the length of the kink length", HFILL }}, + NULL, HFILL }}, { &hf_kink_transactionId, { "Transaction ID", "kink.transactionId", FT_UINT32, BASE_DEC, NULL, 0x0, - "the transactionID of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_checkSumLength, { "Checksum Length", "kink.checkSumLength", FT_UINT8, BASE_DEC, NULL, 0x0, - "the check sum length of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_A, { "A", "kink.A", FT_UINT8, BASE_DEC, VALS(kink_A_vals), 0x0, - "the A of kink", HFILL }}, + NULL, HFILL }}, + { &hf_kink_version, + { "Version", "kink.version", + FT_UINT8, BASE_CUSTOM, kink_fmt_version, 0x0, + NULL, HFILL }}, + { &hf_kink_domain_of_interpretation, + { "Domain Of Interpretation", "kink.domain_of_interpretation", + FT_UINT32, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + { &hf_kink_qmversion, + { "QMVersion", "kink.qmversion", + FT_UINT8, BASE_CUSTOM, kink_fmt_version, 0x0, + NULL, HFILL }}, + { &hf_kink_error_code, + { "ErrorCode", "kink.error_code", + FT_UINT32, BASE_DEC|BASE_RANGE_STRING, RVALS(kink_error_rvals), 0x0, + NULL, HFILL }}, { &hf_kink_reserved8, { "Reserved", "kink.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, - "the reserved of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_reserved15, { "Reserved", "kink.reserved", FT_UINT16, BASE_DEC, NULL, SECOND_FIFTEEN_BIT, - "the reserved of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_reserved16, { "Reserved", "kink.reserved", FT_UINT16, BASE_DEC, NULL, 0, - "the reserved of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_reserved24, { "Reserved", "kink.reserved", FT_UINT24, BASE_DEC, NULL, 0, - "the reserved of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_checkSum, { "Checksum", "kink.checkSum", FT_BYTES, BASE_NONE, NULL, 0x0, - "the checkSum of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_next_payload, { "Next Payload", "kink.nextPayload", FT_UINT8, BASE_DEC, VALS(kink_next_payload), 0x0, - "the next payload of kink", HFILL }}, + NULL, HFILL }}, { &hf_kink_payload_length, { "Payload Length", "kink.payloadLength", FT_UINT8, BASE_DEC, NULL, 0x0, @@ -952,6 +950,10 @@ proto_register_kink(void) { { "TGT", "kink.tgt", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, + { &hf_kink_payload, + { "Payload", "kink.payload", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, }; /* Argument for making the subtree. */ diff --git a/epan/dissectors/packet-kismet.c b/epan/dissectors/packet-kismet.c index 99695a58e8..bd171583d2 100644 --- a/epan/dissectors/packet-kismet.c +++ b/epan/dissectors/packet-kismet.c @@ -36,6 +36,13 @@ static int proto_kismet = -1; static int hf_kismet_response = -1; static int hf_kismet_request = -1; +static int hf_kismet_version = -1; +static int hf_kismet_start_time = -1; +static int hf_kismet_server_name = -1; +static int hf_kismet_build_revision = -1; +static int hf_kismet_unknown_field = -1; +static int hf_kismet_extended_version_string = -1; +static int hf_kismet_time = -1; static gint ett_kismet = -1; static gint ett_kismet_reqresp = -1; @@ -178,56 +185,49 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * da linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Kismet version: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, hf_kismet_version, tvb, offset, + tokenlen, format_text(line, tokenlen)); offset += (gint) (next_token - line); linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Start time: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, hf_kismet_start_time, tvb, offset, + tokenlen, format_text(line, tokenlen)); offset += (gint) (next_token - line); linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Server name: %s", - format_text(line + 1, tokenlen - 2)); + proto_tree_add_string(reqresp_tree, hf_kismet_server_name, tvb, offset, + tokenlen, format_text(line + 1, tokenlen - 2)); offset += (gint) (next_token - line); linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Build revision: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, hf_kismet_build_revision, tvb, offset, + tokenlen, format_text(line, tokenlen)); offset += (gint) (next_token - line); linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Unknown field: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, hf_kismet_unknown_field, tvb, offset, + tokenlen, format_text(line, tokenlen)); offset += (gint) (next_token - line); linelen -= (int) (next_token - line); line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, - "Extended version string: %s", - format_text(line, tokenlen)); + proto_tree_add_string(reqresp_tree, hf_kismet_extended_version_string, tvb, offset, + tokenlen, format_text(line, tokenlen)); } /* * *TIME: {Time} */ if (!strncmp(reqresp, "*TIME", 5)) { - time_t t; + nstime_t t; char *ptr; offset += (gint) (next_token - line); @@ -235,17 +235,15 @@ dissect_kismet(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * da line = next_token; tokenlen = get_token_len(line, line + linelen, &next_token); - /* - * Convert form ascii to time_t - */ - t = atoi(format_text (line, tokenlen)); + /* Convert form ascii to nstime */ + t.secs = atoi(format_text (line, tokenlen)); + t.nsecs = 0; /* * Format ascii representaion of time */ - ptr = abs_time_secs_to_str(wmem_packet_scope(), t, ABSOLUTE_TIME_LOCAL, TRUE); - proto_tree_add_text(reqresp_tree, tvb, offset, - tokenlen, "Time: %s", ptr); + ptr = abs_time_secs_to_str(wmem_packet_scope(), t.secs, ABSOLUTE_TIME_LOCAL, TRUE); + proto_tree_add_time_format_value(reqresp_tree, hf_kismet_time, tvb, offset, tokenlen, &t, "%s", ptr); } } @@ -282,7 +280,35 @@ proto_register_kismet(void) {&hf_kismet_request, {"Request", "kismet.request", FT_BOOLEAN, BASE_NONE, - NULL, 0x0, "TRUE if kismet request", HFILL}} + NULL, 0x0, "TRUE if kismet request", HFILL}}, + + {&hf_kismet_version, + {"Version", "kismet.version", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_start_time, + {"Start time", "kismet.start_time", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_server_name, + {"Server name", "kismet.server_name", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_build_revision, + {"Build revision", "kismet.build_revision", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_unknown_field, + {"Unknown field", "kismet.unknown_field", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_extended_version_string, + {"Extended version string", "kismet.extended_version_string", FT_STRING, BASE_NONE, + NULL, 0x0, NULL, HFILL}}, + + {&hf_kismet_time, + {"Time", "kismet.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, + NULL, 0x0, NULL, HFILL}}, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index d1bbc741d3..8f33134914 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -142,6 +142,8 @@ static int hf_mgcp_req_dup = -1; static int hf_mgcp_req_dup_frame = -1; static int hf_mgcp_rsp_dup = -1; static int hf_mgcp_rsp_dup_frame = -1; +static int hf_mgcp_unknown_parameter = -1; +static int hf_mgcp_malformed_parameter = -1; static const value_string mgcp_return_code_vals[] = { {000, "Response Acknowledgement"}, @@ -840,6 +842,12 @@ void proto_register_mgcp(void) { &hf_mgcp_rsp_dup_frame, { "Original Response Frame", "mgcp.rsp.dup.frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "Frame containing original response", HFILL }}, + { &hf_mgcp_unknown_parameter, + { "Unknown parameter", "mgcp.unknown_parameter", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_mgcp_malformed_parameter, + { "Malformed parameter", "mgcp.rsp.dup.frame", FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, }; static gint *ett[] = @@ -1924,13 +1932,13 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse } else { - proto_tree_add_text(tree, tvb, offset, tokenlen, "Unknown parameter: %s", tokens[i]); + proto_tree_add_string(tree, hf_mgcp_unknown_parameter, tvb, offset, tokenlen, tokens[i]); } } } else if (tree) { - proto_tree_add_text(tree, tvb, offset, tokenlen, "Malformed parameter: %s", tokens[i]); + proto_tree_add_string(tree, hf_mgcp_malformed_parameter, tvb, offset, tokenlen, tokens[i]); } offset += tokenlen + 1; /* 1 extra for the delimiter */ } @@ -2092,13 +2100,13 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint } else { - proto_tree_add_text(tree, tvb, offset, tokenlen, "Unknown parameter: %s", tokens[i]); + proto_tree_add_string(tree, hf_mgcp_unknown_parameter, tvb, offset, tokenlen, tokens[i]); } } } else if (tree) { - proto_tree_add_text(tree, tvb, offset, tokenlen, "Malformed parameter: %s", tokens[i]); + proto_tree_add_string(tree, hf_mgcp_malformed_parameter, tvb, offset, tokenlen, tokens[i]); } offset += tokenlen + 1; /* 1 extra for the delimiter */ } diff --git a/epan/dissectors/packet-nlsp.c b/epan/dissectors/packet-nlsp.c index bfe0b7b0ec..772a5d8a1e 100644 --- a/epan/dissectors/packet-nlsp.c +++ b/epan/dissectors/packet-nlsp.c @@ -57,6 +57,63 @@ static int hf_nlsp_lsp_link_info_clv_flags_cost_present = -1; static int hf_nlsp_lsp_link_info_clv_flags_cost_metric = -1; static int hf_nlsp_lsp_link_info_clv_flags_cost = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_nlsp_psnp_lsp_checksum = -1; +static int hf_nlsp_csnp_start_lsp_id_source_id = -1; +static int hf_nlsp_svcs_info_node_number = -1; +static int hf_nlsp_ext_routes_rip_delay = -1; +static int hf_nlsp_psnp_source_id_system_id = -1; +static int hf_nlsp_svcs_info_socket = -1; +static int hf_nlsp_hello_sending_router_system_id = -1; +static int hf_nlsp_csnp_start_lsp_id_lsp_number = -1; +static int hf_nlsp_lsp_id_system_id = -1; +static int hf_nlsp_psnp_lsp_id_pseudonode_id = -1; +static int hf_nlsp_csnp_end_lsp_id_lsp_number = -1; +static int hf_nlsp_remaining_lifetime = -1; +static int hf_nlsp_csnp_remaining_lifetime = -1; +static int hf_nlsp_psnp_lsp_id_source_id = -1; +static int hf_nlsp_ext_routes_hops = -1; +static int hf_nlsp_hello_local_mtu_mtu_size = -1; +static int hf_nlsp_link_info_throughput = -1; +static int hf_nlsp_link_info_media_type = -1; +static int hf_nlsp_mgt_info_name = -1; +static int hf_nlsp_mgt_info_node_number = -1; +static int hf_nlsp_csnp_end_lsp_id_source_id = -1; +static int hf_nlsp_csnp_lsp_id_pseudonode_id = -1; +static int hf_nlsp_psnp_lsp_sequence_number = -1; +static int hf_nlsp_link_info_mtu_size = -1; +static int hf_nlsp_lsp_id_lsp_number = -1; +static int hf_nlsp_unknown_code = -1; +static int hf_nlsp_mgt_info_ipx_version_number = -1; +static int hf_nlsp_link_info_router_pseudonode_id = -1; +static int hf_nlsp_psnp_source_id_pseudonode_id = -1; +static int hf_nlsp_csnp_lsp_id_lsp_number = -1; +static int hf_nlsp_csnp_source_id_pseudonode_id = -1; +static int hf_nlsp_csnp_end_lsp_id_pseudonode_id = -1; +static int hf_nlsp_csnp_lsp_sequence_number = -1; +static int hf_nlsp_link_info_router_system_id = -1; +static int hf_nlsp_svcs_info_type = -1; +static int hf_nlsp_csnp_lsp_checksum = -1; +static int hf_nlsp_hello_local_wan_circuit_id = -1; +static int hf_nlsp_svcs_info_service_name = -1; +static int hf_nlsp_mgt_info_name_length = -1; +static int hf_nlsp_neighbor = -1; +static int hf_nlsp_area_address_network_number = -1; +static int hf_nlsp_link_info_delay = -1; +static int hf_nlsp_csnp_start_lsp_id_pseudonode_id = -1; +static int hf_nlsp_svcs_info_network_number = -1; +static int hf_nlsp_csnp_source_id_system_id = -1; +static int hf_nlsp_mgt_info_network_number = -1; +static int hf_nlsp_hello_designated_router_pseudonode_id = -1; +static int hf_nlsp_lsp_id_pseudonode_id = -1; +static int hf_nlsp_csnp_lsp_id_source_id = -1; +static int hf_nlsp_psnp_remaining_lifetime = -1; +static int hf_nlsp_area_address_mask = -1; +static int hf_nlsp_hello_designated_router_system_id = -1; +static int hf_nlsp_svcs_info_hops_to_reach_the_service = -1; +static int hf_nlsp_psnp_lsp_id_lsp_number = -1; +static int hf_nlsp_ext_routes_network_number = -1; + static gint ett_nlsp = -1; static gint ett_nlsp_hello_clv_area_addr = -1; static gint ett_nlsp_hello_clv_neighbors = -1; @@ -224,9 +281,10 @@ nlsp_dissect_clvs(tvbuff_t *tvb, proto_tree *tree, int offset, opts[q].dissect(tvb, clv_tree, offset, length); } else { - proto_tree_add_text(tree, tvb, offset - 2, - length + 2, "Unknown code %u (%u)", - code, length); + proto_item* ti; + ti = proto_tree_add_uint_format_value(tree, hf_nlsp_unknown_code, tvb, offset - 2, + 1, code, "%u (%u)", code, length); + proto_item_set_len(ti, length + 2); } offset += length; len -= length; @@ -258,11 +316,8 @@ dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short area address entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Area address network number: 0x%08x", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_area_address_network_number, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; length -= 4; @@ -271,11 +326,8 @@ dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short area address entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Area address mask: 0x%08x", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_area_address_mask, tvb, offset, 4, ENC_BIG_ENDIAN); + offset += 4; length -= 4; } @@ -306,11 +358,7 @@ dissect_neighbor_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short neighbor entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Neighbor: %s", - tvb_ether_to_str(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_neighbor, tvb, offset, 6, ENC_NA); offset += 6; length -= 6; } @@ -340,11 +388,7 @@ dissect_hello_local_mtu_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "MTU Size: %u", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_hello_local_mtu_mtu_size, tvb, offset, 4, ENC_BIG_ENDIAN); } static const nlsp_clv_handle_t clv_hello_opts[] = { @@ -425,66 +469,42 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int len; guint16 holding_timer; - if (tree) { - if (hello_type == NLSP_TYPE_WAN_HELLO) { - proto_tree_add_item(tree, hf_nlsp_hello_state, tvb, - offset, 1, ENC_BIG_ENDIAN); - } else { - proto_tree_add_item(tree, hf_nlsp_hello_multicast, tvb, - offset, 1, ENC_BIG_ENDIAN); - } - proto_tree_add_item(tree, hf_nlsp_hello_circuit_type, tvb, - offset, 1, ENC_BIG_ENDIAN); + if (hello_type == NLSP_TYPE_WAN_HELLO) { + proto_tree_add_item(tree, hf_nlsp_hello_state, tvb, + offset, 1, ENC_BIG_ENDIAN); + } else { + proto_tree_add_item(tree, hf_nlsp_hello_multicast, tvb, + offset, 1, ENC_BIG_ENDIAN); } + proto_tree_add_item(tree, hf_nlsp_hello_circuit_type, tvb, + offset, 1, ENC_BIG_ENDIAN); offset += 1; - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Sending Router System ID: %s", - tvb_ether_to_str(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_hello_sending_router_system_id, tvb, offset, 6, ENC_NA); + col_append_fstr(pinfo->cinfo, COL_INFO, ", System ID: %s", tvb_ether_to_str(tvb, offset)); offset += 6; - if (tree) { - holding_timer = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint_format_value(tree, hf_nlsp_hello_holding_timer, - tvb, offset, 2, holding_timer, - "%us", holding_timer); - } + holding_timer = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint_format_value(tree, hf_nlsp_hello_holding_timer, + tvb, offset, 2, holding_timer, "%us", holding_timer); offset += 2; packet_length = tvb_get_ntohs(tvb, offset); - if (tree) { - proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, - offset, 2, packet_length); - } + proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, offset, 2, packet_length); offset += 2; - if (tree) { - proto_tree_add_item(tree, hf_nlsp_hello_priority, tvb, - offset, 1, ENC_BIG_ENDIAN); - } + proto_tree_add_item(tree, hf_nlsp_hello_priority, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (hello_type == NLSP_TYPE_WAN_HELLO) { - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, - "Local WAN Circuit ID: %u", - tvb_get_guint8(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_hello_local_wan_circuit_id, tvb, offset, 1, ENC_NA); offset += 1; } else { - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Designated Router System ID: %s", - tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset+6, 1, - "Designated Router Pseudonode ID: %u", - tvb_get_guint8(tvb, offset+6)); - } + proto_tree_add_item(tree, hf_nlsp_hello_designated_router_system_id, tvb, offset, 6, ENC_NA); + proto_tree_add_item(tree, hf_nlsp_hello_designated_router_pseudonode_id, tvb, offset+6, 1, ENC_NA); offset += 7; } @@ -530,11 +550,7 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short management info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Network number: 0x%08x", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_mgt_info_network_number, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -543,11 +559,7 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short management info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Node number: %s", - tvb_ether_to_str(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_mgt_info_node_number, tvb, offset, 6, ENC_NA); offset += 6; length -= 6; @@ -556,11 +568,8 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short management info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, - "IPX version number: %u", - tvb_get_guint8(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_mgt_info_ipx_version_number, tvb, offset, 1, ENC_NA); offset += 1; length -= 1; @@ -570,10 +579,7 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, return; } name_length = tvb_get_guint8(tvb, offset); - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, - "Name length: %u", name_length); - } + proto_tree_add_item(tree, hf_nlsp_mgt_info_name_length, tvb, offset, 1, ENC_NA); offset += 1; length -= 1; @@ -583,11 +589,7 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short management info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, name_length, - "Name: %s", - tvb_format_text(tvb, offset, name_length)); - } + proto_tree_add_item(tree, hf_nlsp_mgt_info_name, tvb, offset, name_length, ENC_NA|ENC_ASCII); } } @@ -683,14 +685,9 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Router System ID: %s", - tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset+6, 1, - "Router Pseudonode ID: %u", - tvb_get_guint8(tvb, offset+6)); - } + + proto_tree_add_item(tree, hf_nlsp_link_info_router_system_id, tvb, offset, 6, ENC_NA); + proto_tree_add_item(tree, hf_nlsp_link_info_router_pseudonode_id, tvb, offset+6, 1, ENC_NA); offset += 7; length -= 7; @@ -699,11 +696,7 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "MTU Size: %u", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_item(tree, hf_nlsp_link_info_mtu_size, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -712,11 +705,8 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Delay: %uus", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_uint_format_value(tree, hf_nlsp_link_info_delay, tvb, offset, 4, + tvb_get_ntohl(tvb, offset), "%uus", tvb_get_ntohl(tvb, offset)); offset += 4; length -= 4; @@ -725,11 +715,8 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Throughput: %u bits/s", - tvb_get_ntohl(tvb, offset)); - } + proto_tree_add_uint_format_value(tree, hf_nlsp_link_info_throughput, tvb, offset, 4, + tvb_get_ntohl(tvb, offset), "%u bits/s", tvb_get_ntohl(tvb, offset)); offset += 4; length -= 4; @@ -738,12 +725,7 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short link info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 2, - "Media type: %s", - val_to_str(tvb_get_ntohs(tvb, offset), media_type_vals, - "Unknown (0x%04x)")); - } + proto_tree_add_item(tree, hf_nlsp_link_info_media_type, tvb, offset, 2, ENC_BIG_ENDIAN); } /* @@ -770,11 +752,8 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short services info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, - "Hops to reach the service: %u", - tvb_get_guint8(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_svcs_info_hops_to_reach_the_service, tvb, offset, 1, ENC_NA); offset += 1; length -= 1; @@ -783,11 +762,8 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short services info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Network number: 0x%08x", - tvb_get_ntohl(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_svcs_info_network_number, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -796,11 +772,8 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short services info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 6, - "Node number: %s", - tvb_ether_to_str(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_svcs_info_node_number, tvb, offset, 6, ENC_NA); offset += 6; length -= 6; @@ -809,12 +782,8 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short services info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 2, - "Socket: %s", - val_to_str_ext(tvb_get_ntohs(tvb, offset), &ipx_socket_vals_ext, - "Unknown (0x%04x)")); - } + + proto_tree_add_item(tree, hf_nlsp_svcs_info_socket, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; length -= 2; @@ -823,21 +792,13 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short services info entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 2, - "Type: %s", - val_to_str_ext(tvb_get_ntohs(tvb, offset), &novell_server_vals_ext, - "Unknown (0x%04x)")); - } + + proto_tree_add_item(tree, hf_nlsp_svcs_info_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; length -= 2; if (length > 0) { - if (tree) { - proto_tree_add_text(tree, tvb, offset, length, - "Service Name: %s", - tvb_format_text(tvb, offset, length)); - } + proto_tree_add_item(tree, hf_nlsp_svcs_info_service_name, tvb, offset, length, ENC_NA|ENC_ASCII); } } @@ -867,11 +828,8 @@ dissect_lsp_ext_routes_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short external routes entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 1, - "Hops: %u", - tvb_get_guint8(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_ext_routes_hops, tvb, offset, 1, ENC_NA); offset += 1; length -= 1; @@ -880,11 +838,8 @@ dissect_lsp_ext_routes_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short external routes entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 4, - "Network number: 0x%08x", - tvb_get_ntohl(tvb, offset)); - } + + proto_tree_add_item(tree, hf_nlsp_ext_routes_network_number, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; length -= 4; @@ -893,11 +848,9 @@ dissect_lsp_ext_routes_clv(tvbuff_t *tvb, proto_tree *tree, int offset, "Short external routes entry"); return; } - if (tree) { - proto_tree_add_text(tree, tvb, offset, 2, - "RIP delay: %u ticks", - tvb_get_ntohs(tvb, offset)); - } + + proto_tree_add_uint_format_value(tree, hf_nlsp_ext_routes_rip_delay, tvb, offset, 2, + tvb_get_ntohs(tvb, offset), "%u ticks", tvb_get_ntohs(tvb, offset)); offset += 2; length -= 2; } @@ -985,37 +938,26 @@ nlsp_dissect_nlsp_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int len; packet_length = tvb_get_ntohs(tvb, offset); - if (tree) { - proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, + proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, offset, 2, packet_length); - } offset += 2; remaining_lifetime = tvb_get_ntohs(tvb, offset); - if (tree) { - proto_tree_add_text(tree, tvb, offset, 2, - "Remaining Lifetime: %us", - remaining_lifetime); - } + proto_tree_add_uint_format_value(tree, hf_nlsp_remaining_lifetime, tvb, offset, 2, + remaining_lifetime, "%us", remaining_lifetime); offset += 2; col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP ID: %s", tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset, 6, - "LSP ID system ID: %s", - tvb_ether_to_str(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_lsp_id_system_id, tvb, offset, 6, ENC_NA); offset += 6; /* XXX - append the pseudonode ID */ - proto_tree_add_text(tree, tvb, offset, 1, - "LSP ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_lsp_id_pseudonode_id, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_text(tree, tvb, offset, 1, - "LSP ID LSP number: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_lsp_id_lsp_number, tvb, offset, 1, ENC_NA); offset += 1; sequence_number = tvb_get_ntohl(tvb, offset); @@ -1101,27 +1043,16 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, tvb_get_ntohs(tvb, offset), tvb_get_ntohs(tvb, offset+14)); - proto_tree_add_text(subtree, tvb, offset+2, 6, - "LSP ID source ID: %s", - tvb_ether_to_str(tvb, offset+2)); - proto_tree_add_text(subtree, tvb, offset+8, 1, - "LSP ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset+8)); - proto_tree_add_text(subtree, tvb, offset+9, 1, - "LSP ID LSP number: %u", - tvb_get_guint8(tvb, offset+9)); + proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_id_source_id, tvb, offset+2, 6, ENC_NA); + proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_id_pseudonode_id, tvb, offset+8, 1, ENC_NA); + proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_id_lsp_number, tvb, offset+9, 1, ENC_NA); - proto_tree_add_text(subtree, tvb, offset+10, 4, - "LSP Sequence Number: 0x%08x", - tvb_get_ntohl(tvb, offset+10)); + proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_sequence_number, tvb, offset+10, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(subtree, tvb, offset, 2, - "Remaining Lifetime: %us", - tvb_get_ntohs(tvb, offset)); + proto_tree_add_uint_format_value(subtree, hf_nlsp_csnp_remaining_lifetime, tvb, offset, 2, + tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset)); - proto_tree_add_text(subtree, tvb, offset+14, 2, - "LSP checksum: 0x%04x", - tvb_get_ntohs(tvb, offset+14)); + proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_checksum, tvb, offset+14, 2, ENC_BIG_ENDIAN); length -= 16; offset += 16; @@ -1148,27 +1079,16 @@ dissect_psnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset, tvb_get_ntohs(tvb, offset), tvb_get_ntohs(tvb, offset+14)); - proto_tree_add_text(subtree, tvb, offset+2, 6, - "LSP ID source ID: %s", - tvb_ether_to_str(tvb, offset+2)); - proto_tree_add_text(subtree, tvb, offset+8, 1, - "LSP ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset+8)); - proto_tree_add_text(subtree, tvb, offset+9, 1, - "LSP ID LSP number: %u", - tvb_get_guint8(tvb, offset+9)); + proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_id_source_id, tvb, offset+2, 6, ENC_NA); + proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_id_pseudonode_id, tvb, offset+8, 1, ENC_NA); + proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_id_lsp_number, tvb, offset+9, 1, ENC_NA); - proto_tree_add_text(subtree, tvb, offset+10, 4, - "LSP Sequence Number: 0x%08x", - tvb_get_ntohl(tvb, offset+10)); + proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_sequence_number, tvb, offset+10, 4, ENC_BIG_ENDIAN); - proto_tree_add_text(subtree, tvb, offset, 2, - "Remaining Lifetime: %us", - tvb_get_ntohs(tvb, offset)); + proto_tree_add_uint_format_value(subtree, hf_nlsp_psnp_remaining_lifetime, tvb, offset, 2, + tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset)); - proto_tree_add_text(subtree, tvb, offset+14, 2, - "LSP checksum: 0x%04x", - tvb_get_ntohs(tvb, offset+14)); + proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_checksum, tvb, offset+14, 2, ENC_BIG_ENDIAN); length -= 16; offset += 16; @@ -1215,55 +1135,35 @@ nlsp_dissect_nlsp_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int len; packet_length = tvb_get_ntohs(tvb, offset); - if (tree) { - proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, - offset, 2, packet_length); - } + proto_tree_add_uint(tree, hf_nlsp_packet_length, tvb, offset, 2, packet_length); offset += 2; col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset, 6, - "Source ID system ID: %s", - tvb_ether_to_str(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_source_id_system_id, tvb, offset, 6, ENC_NA); offset += 6; - /* XXX - add the pseudonode ID */ - proto_tree_add_text(tree, tvb, offset, 1, - "Source ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_source_id_pseudonode_id, tvb, offset, 1, ENC_NA); offset += 1; col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP ID: %s", tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset, 6, - "Start LSP ID source ID: %s", - tvb_ether_to_str(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_start_lsp_id_source_id, tvb, offset, 6, ENC_NA); offset += 6; /* XXX - append the pseudonode ID */ - proto_tree_add_text(tree, tvb, offset, 1, - "Start LSP ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_start_lsp_id_pseudonode_id, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_text(tree, tvb, offset, 1, - "Start LSP ID LSP number: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_start_lsp_id_lsp_number, tvb, offset, 1, ENC_NA); offset += 1; col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP ID: %s", tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset, 6, - "End LSP ID source ID: %s", - tvb_ether_to_str(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_end_lsp_id_source_id, tvb, offset, 6, ENC_NA); offset += 6; /* XXX - append the pseudonode ID */ - proto_tree_add_text(tree, tvb, offset, 1, - "End LSP ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_end_lsp_id_pseudonode_id, tvb, offset, 1, ENC_NA); offset += 1; - proto_tree_add_text(tree, tvb, offset, 1, - "End LSP ID LSP number: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_csnp_end_lsp_id_lsp_number, tvb, offset, 1, ENC_NA); offset += 1; len = packet_length - header_length; @@ -1321,14 +1221,10 @@ nlsp_dissect_nlsp_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s", tvb_ether_to_str(tvb, offset)); - proto_tree_add_text(tree, tvb, offset, 6, - "Source ID system ID: %s", - tvb_ether_to_str(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_psnp_source_id_system_id, tvb, offset, 6, ENC_NA); offset += 6; /* XXX - add the pseudonode ID */ - proto_tree_add_text(tree, tvb, offset, 1, - "Source ID pseudonode ID: %u", - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_nlsp_psnp_source_id_pseudonode_id, tvb, offset, 1, ENC_NA); offset += 1; len = packet_length - header_length; @@ -1404,11 +1300,9 @@ dissect_nlsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type, nlsp_packet_type_vals, "Unknown (%u)")); if (packet_type == NLSP_TYPE_L1_LSP) { - proto_tree_add_boolean(nlsp_tree, hf_nlsp_nr, tvb, offset, 1, - packet_type_flags ); + proto_tree_add_boolean(nlsp_tree, hf_nlsp_nr, tvb, offset, 1, packet_type_flags ); } - proto_tree_add_uint(nlsp_tree, hf_nlsp_type, tvb, offset, 1, - packet_type_flags ); + proto_tree_add_uint(nlsp_tree, hf_nlsp_type, tvb, offset, 1, packet_type_flags ); offset += 1; proto_tree_add_item(nlsp_tree, hf_nlsp_major_version, tvb, @@ -1468,7 +1362,7 @@ proto_register_nlsp(void) static hf_register_info hf[] = { { &hf_nlsp_irpd, { "NetWare Link Services Protocol Discriminator", "nlsp.irpd", - FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_nlsp_header_length, { "PDU Header Length", "nlsp.header_length", @@ -1555,6 +1449,63 @@ proto_register_nlsp(void) { &hf_nlsp_lsp_link_info_clv_flags_cost, { "Cost", "nlsp.lsp.link_info_clv.flags.cost", FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL }}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_nlsp_unknown_code, { "Unknown code", "nlsp.unknown_code", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_area_address_network_number, { "Area address network number", "nlsp.area_address.network_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_area_address_mask, { "Area address mask", "nlsp.area_address.mask", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_neighbor, { "Neighbor", "nlsp.neighbor", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_hello_local_mtu_mtu_size, { "MTU Size", "nlsp.hello_local_mtu.mtu_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_hello_sending_router_system_id, { "Sending Router System ID", "nlsp.hello.sending_router_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_hello_local_wan_circuit_id, { "Local WAN Circuit ID", "nlsp.hello.local_wan_circuit_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_hello_designated_router_system_id, { "Designated Router System ID", "nlsp.hello.designated_router_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_hello_designated_router_pseudonode_id, { "Designated Router Pseudonode ID", "nlsp.hello.designated_router_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_mgt_info_network_number, { "Network number", "nlsp.mgt_info.network_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_mgt_info_node_number, { "Node number", "nlsp.mgt_info.node_number", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_mgt_info_ipx_version_number, { "IPX version number", "nlsp.mgt_info.ipx_version_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_mgt_info_name_length, { "Name length", "nlsp.mgt_info.name_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_mgt_info_name, { "Name", "nlsp.mgt_info.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_router_system_id, { "Router System ID", "nlsp.link_info.router_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_router_pseudonode_id, { "Router Pseudonode ID", "nlsp.link_info.router_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_mtu_size, { "MTU Size", "nlsp.link_info.mtu_size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_delay, { "Delay", "nlsp.link_info.delay", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_throughput, { "Throughput", "nlsp.link_info.throughput", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_link_info_media_type, { "Media type", "nlsp.link_info.media_type", FT_UINT16, BASE_DEC, VALS(media_type_vals), 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_hops_to_reach_the_service, { "Hops to reach the service", "nlsp.svcs_info.hops_to_reach_the_service", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_network_number, { "Network number", "nlsp.svcs_info.network_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_node_number, { "Node number", "nlsp.svcs_info.node_number", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_socket, { "Socket", "nlsp.svcs_info.socket", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ipx_socket_vals_ext, 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_type, { "Type", "nlsp.svcs_info.type", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &novell_server_vals_ext, 0x0, NULL, HFILL }}, + { &hf_nlsp_svcs_info_service_name, { "Service Name", "nlsp.svcs_info.service_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_ext_routes_hops, { "Hops", "nlsp.ext_routes.hops", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_ext_routes_network_number, { "Network number", "nlsp.ext_routes.network_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_ext_routes_rip_delay, { "RIP delay", "nlsp.ext_routes.rip_delay", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_remaining_lifetime, { "Remaining Lifetime", "nlsp.remaining_lifetime", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_lsp_id_system_id, { "LSP ID system ID", "nlsp.lsp_id_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_lsp_id_pseudonode_id, { "LSP ID pseudonode ID", "nlsp.lsp_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_lsp_id_lsp_number, { "LSP ID LSP number", "nlsp.lsp_id_lsp_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_lsp_id_source_id, { "LSP ID source ID", "nlsp.csnp.lsp_id_source_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_lsp_id_pseudonode_id, { "LSP ID pseudonode ID", "nlsp.csnp.lsp_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_lsp_id_lsp_number, { "LSP ID LSP number", "nlsp.csnp.lsp_id_lsp_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_lsp_sequence_number, { "LSP Sequence Number", "nlsp.csnp.lsp_sequence_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_remaining_lifetime, { "Remaining Lifetime", "nlsp.csnp.remaining_lifetime", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_lsp_checksum, { "LSP checksum", "nlsp.csnp.lsp_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_lsp_id_source_id, { "LSP ID source ID", "nlsp.psnp.lsp_id_source_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_lsp_id_pseudonode_id, { "LSP ID pseudonode ID", "nlsp.psnp.lsp_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_lsp_id_lsp_number, { "LSP ID LSP number", "nlsp.psnp.lsp_id_lsp_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_lsp_sequence_number, { "LSP Sequence Number", "nlsp.psnp.lsp_sequence_number", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_remaining_lifetime, { "Remaining Lifetime", "nlsp.psnp.remaining_lifetime", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_lsp_checksum, { "LSP checksum", "nlsp.psnp.lsp_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_source_id_system_id, { "Source ID system ID", "nlsp.csnp.source_id_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_source_id_pseudonode_id, { "Source ID pseudonode ID", "nlsp.csnp.source_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_start_lsp_id_source_id, { "Start LSP ID source ID", "nlsp.csnp.start_lsp_id_source_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_start_lsp_id_pseudonode_id, { "Start LSP ID pseudonode ID", "nlsp.csnp.start_lsp_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_start_lsp_id_lsp_number, { "Start LSP ID LSP number", "nlsp.csnp.start_lsp_id_lsp_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_end_lsp_id_source_id, { "End LSP ID source ID", "nlsp.csnp.end_lsp_id_source_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_end_lsp_id_pseudonode_id, { "End LSP ID pseudonode ID", "nlsp.csnp.end_lsp_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_csnp_end_lsp_id_lsp_number, { "End LSP ID LSP number", "nlsp.csnp.end_lsp_id_lsp_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_source_id_system_id, { "Source ID system ID", "nlsp.psnp.source_id_system_id", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_nlsp_psnp_source_id_pseudonode_id, { "Source ID pseudonode ID", "nlsp.psnp.source_id_pseudonode_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_nlsp, diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c index cd7c74b128..294c18c4e0 100644 --- a/epan/dissectors/packet-pdcp-lte.c +++ b/epan/dissectors/packet-pdcp-lte.c @@ -1,4 +1,5 @@ -/* Routines for LTE PDCP +/* packet-pdcp-lte.c + * Routines for LTE PDCP * * Martin Mathieson * diff --git a/epan/dissectors/packet-pnrp.c b/epan/dissectors/packet-pnrp.c index fbceadf016..18e3a6a158 100644 --- a/epan/dissectors/packet-pnrp.c +++ b/epan/dissectors/packet-pnrp.c @@ -324,6 +324,31 @@ static gint hf_pnrp_publicKey_publicKeyData = -1; /* Signature Structure */ static gint hf_pnrp_signature_signatureData = -1; +/* Generated from convert_proto_tree_add_text.pl */ +static int hf_pnrp_payload_port = -1; +static int hf_pnrp_signature_length = -1; +static int hf_pnrp_signature_structure_length = -1; +static int hf_pnrp_encodedCPA_total_bytes_of_payload = -1; +static int hf_pnrp_signature_hash_id = -1; +static int hf_pnrp_message_flags = -1; +static int hf_pnrp_encodedCPA_number_of_service_addresses = -1; +static int hf_pnrp_payload_iana_proto = -1; +static int hf_pnrp_reserved8 = -1; +static int hf_pnrp_reserved16 = -1; +static int hf_pnrp_encodedCPA_service_address_length = -1; +static int hf_pnrp_message_data = -1; +static int hf_pnrp_publicKey_length_of_structure = -1; +static int hf_pnrp_publicKey_size_of_cbdata = -1; +static int hf_pnrp_payload_type = -1; +static int hf_pnrp_publicKey_size_of_algorithm_oid = -1; +static int hf_pnrp_message_port_number = -1; +static int hf_pnrp_publicKey_reserved = -1; +static int hf_pnrp_encodedCPA_friendlyName_length = -1; +static int hf_pnrp_message_offset = -1; +static int hf_pnrp_publicKey_unused_bits = -1; +static int hf_pnrp_length_of_data = -1; +static int hf_pnrp_encodedCPA_number_of_payload_structures = -1; + /* Define variables to reference subtrees */ static gint ett_pnrp = -1; static gint ett_pnrp_header = -1; @@ -533,7 +558,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi default: - proto_tree_add_text(pnrp_message_tree, tvb, offset + 4, data_length -4, "Flags"); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_flags, tvb, offset + 4, data_length -4, ENC_BIG_ENDIAN); offset += data_length; break; } @@ -554,7 +579,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* D - Bit */ proto_tree_add_bits_item(pnrp_message_tree, hf_pnrp_message_flood_flags_Dbit, tvb,((offset + 4)*8)+15, 1, ENC_BIG_ENDIAN); /* Reserved 2 */ - proto_tree_add_text(pnrp_message_tree, tvb, offset + 6, 1, "Reserved 2: %d",tvb_get_guint8(tvb,offset+6)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_reserved8, tvb, offset + 6, 1, ENC_NA); /* Padding 1 */ proto_tree_add_item(pnrp_message_tree, hf_pnrp_padding, tvb, offset + 7, 1, ENC_NA); } @@ -569,9 +594,9 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi data_length, ett_pnrp_message, NULL, "Solicit Controls: "); proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_type, tvb, offset , 2, ENC_BIG_ENDIAN); proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - proto_tree_add_text(pnrp_message_tree, tvb, offset + 4, 1, "Reserved : %d",tvb_get_guint8(tvb,offset+4)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_reserved8, tvb, offset + 4, 1, ENC_NA); proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_solicitType, tvb, offset + 5, 1, ENC_BIG_ENDIAN); - proto_tree_add_text(pnrp_message_tree, tvb, offset + 6, 2, "Reserved : %d",tvb_get_ntohs(tvb,offset+6)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_reserved16, tvb, offset + 6, 2, ENC_LITTLE_ENDIAN); } offset += data_length +2; /* Padding involved */ break; @@ -591,7 +616,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Reason Code */ proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_lookupControls_reasonCode, tvb, offset + 9, 1, ENC_BIG_ENDIAN); /* Reserved */ - proto_tree_add_text(pnrp_message_tree, tvb, offset + 10, 2, "Reserved : %d",tvb_get_ntohs(tvb,offset+10)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_reserved16, tvb, offset + 10, 2, ENC_LITTLE_ENDIAN); } @@ -728,7 +753,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi /* Size of Authority Buffer */ proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_splitControls_authorityBuffer, tvb, offset + 4, 2, ENC_BIG_ENDIAN); /* Byte offset */ - proto_tree_add_text(pnrp_message_tree, tvb, offset + 6, 2, "Offset : %d",tvb_get_ntohs(tvb,offset+6)); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_offset, tvb, offset + 6, 2, ENC_BIG_ENDIAN); } @@ -806,7 +831,7 @@ static int dissect_pnrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); if(data_length > 4) { - proto_tree_add_text(pnrp_message_tree, tvb, offset + 4, data_length -4, "Data"); + proto_tree_add_item(pnrp_message_tree, hf_pnrp_message_data, tvb, offset + 4, data_length -4, ENC_NA); } else { return 0; @@ -869,7 +894,7 @@ static void dissect_ipv6_endpoint_structure(tvbuff_t *tvb, gint offset, gint len /* Check if we don't run out of data */ while (0 <= tvb_reported_length_remaining(tvb, offset+18) && 18 <=length) { /* Port Number */ - proto_tree_add_text(tree, tvb, offset, 2, "Port Number : %d",tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(tree, hf_pnrp_message_port_number, tvb, offset, 2, ENC_BIG_ENDIAN); /* IPv6 Addresses */ dissect_ipv6_address(tvb, offset+2,16,tree); offset += 18; @@ -911,7 +936,7 @@ static void dissect_encodedCPA_structure(tvbuff_t *tvb, gint offset, gint length proto_tree_add_bitmask(pnrp_encodedCPA_tree, tvb, offset+6, hf_pnrp_encodedCPA_flags, ett_pnrp_message_encodedCPA_flags, encodedCPA_flags, ENC_BIG_ENDIAN); flagsField = tvb_get_guint8(tvb,offset+6); /* Reserved */ - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset + 7, 1, "Reserved"); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_reserved8, tvb, offset + 7, 1, ENC_NA); /* Not After */ proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_notAfter, tvb, offset+8, 8, ENC_BIG_ENDIAN); /* Service Location */ @@ -941,23 +966,23 @@ static void dissect_encodedCPA_structure(tvbuff_t *tvb, gint offset, gint length /* Check if F Flag is set */ if (flagsField & FLAGS_ENCODED_CPA_F) { /* Friendly Name Length */ - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset,2, "Length of Friendly name : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_friendlyName_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); /* Friendly Name */ proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_friendlyName, tvb, offset+2, tvb_get_letohs(tvb,offset), ENC_ASCII|ENC_NA); offset +=tvb_get_letohs(tvb,offset)+2; } /* Service Address List */ - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset,2, "Number of Service Addresses : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_number_of_service_addresses, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset,2, "Service Address Length : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_service_address_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* A list of IPV6_Endpoint Structures follows */ dissect_ipv6_endpoint_structure(tvb, offset,tvb_get_letohs(tvb,offset-4)*tvb_get_letohs(tvb,offset-2) , pnrp_encodedCPA_tree); offset += tvb_get_letohs(tvb,offset-4)*tvb_get_letohs(tvb,offset-2); /* A number of Payload Structures */ - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset,2, "Number of Payload Structures : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_number_of_payload_structures, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_text(pnrp_encodedCPA_tree, tvb, offset,2, "Total Bytes of Payload : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_encodedCPA_tree, hf_pnrp_encodedCPA_total_bytes_of_payload, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; dissect_payload_structure(tvb,offset, tvb_get_letohs(tvb,offset-2)-4,pnrp_encodedCPA_tree); offset += tvb_get_letohs(tvb,offset-2)-4; @@ -982,20 +1007,19 @@ static void dissect_payload_structure(tvbuff_t *tvb, gint offset, gint length, p /* Dissect the Payload Structure */ /* Payload Type */ - proto_tree_add_text(pnrp_payload_tree, tvb, offset,4, "Payload Type : %d",tvb_get_letohl(tvb,offset)); + proto_tree_add_item(pnrp_payload_tree, hf_pnrp_payload_type, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* Data Length */ lengthOfData = tvb_get_letohs(tvb,offset); - proto_tree_add_text(pnrp_payload_tree, tvb, offset,2, "Length of Data : %d",lengthOfData); + proto_tree_add_item(pnrp_payload_tree, hf_pnrp_length_of_data, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* IPV6_APP_ENDPOINT Structure */ while (0 <= tvb_reported_length_remaining(tvb, offset+20)&& 20 <= lengthOfData) { dissect_ipv6_address(tvb, offset, 16, pnrp_payload_tree); offset += 16; - proto_tree_add_text(pnrp_payload_tree, tvb, offset,2, "Port Number : %d",tvb_get_letohs(tvb,offset)); - /* proto_tree_add_item(pnrp_payload_tree, hf_pnrp_payload_port, tvb, offset, 2, ENC_BIG_ENDIAN); */ + proto_tree_add_item(pnrp_payload_tree, hf_pnrp_payload_port, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; - proto_tree_add_text(pnrp_payload_tree, tvb, offset,2, "IANA Protocol Number : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_payload_tree, hf_pnrp_payload_iana_proto, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; lengthOfData -=20; } @@ -1012,21 +1036,21 @@ static void dissect_publicKey_structure(tvbuff_t *tvb, gint offset, gint length, pnrp_publicKey_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_pnrp_message_publicKeyStructure, NULL, "CPA Public Key Structure"); /* Parsing of Data */ /* Field Length of Structure */ - proto_tree_add_text(pnrp_publicKey_tree, tvb, offset,2, "Length of Structure : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_length_of_structure, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* ObjID length */ objIDLength = tvb_get_letohs(tvb,offset); - proto_tree_add_text(pnrp_publicKey_tree, tvb, offset,2, "Size of Algorithm OID : %d",objIDLength); + proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_size_of_algorithm_oid, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* Reserved */ - proto_tree_add_text(pnrp_publicKey_tree, tvb, offset,2, "Reserved : %d",tvb_get_ntohs(tvb,offset)); + proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_reserved, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset +=2; /* Public Key cbData Length */ cbDataLength = tvb_get_letohs(tvb,offset); - proto_tree_add_text(pnrp_publicKey_tree, tvb, offset,2, "Size of cbData : %d",cbDataLength); + proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_size_of_cbdata, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* Unused Bits, actually only 7... */ - proto_tree_add_text(pnrp_publicKey_tree, tvb, offset,1, "Unused Bits : %d",7); + proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_unused_bits, tvb, offset, 1, ENC_NA); offset +=1; /* Algorithm ObjID */ proto_tree_add_item(pnrp_publicKey_tree, hf_pnrp_publicKey_objID, tvb, offset, objIDLength, ENC_ASCII|ENC_NA); @@ -1046,14 +1070,14 @@ static void dissect_signature_structure(tvbuff_t *tvb, gint offset, gint length, pnrp_signature_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_pnrp_message_signatureStructure, NULL, "Signature Structure"); /* Parsing of Data */ /* Field Length of Structure */ - proto_tree_add_text(pnrp_signature_tree, tvb, offset,2, "Length of Structure : %d",tvb_get_letohs(tvb,offset)); + proto_tree_add_item(pnrp_signature_tree, hf_pnrp_signature_structure_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset +=2; /* Signature Length */ signatureLength = tvb_get_letohs(tvb,offset); - proto_tree_add_text(pnrp_signature_tree, tvb, offset,2, "Length of Signature : %d",signatureLength); + proto_tree_add_item(pnrp_signature_tree, hf_pnrp_signature_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* Hash Algorithm Identifier */ - proto_tree_add_text(pnrp_signature_tree, tvb, offset,4, "Hash Algorithm Identifier : %x",tvb_get_letohl(tvb,offset)); + proto_tree_add_item(pnrp_signature_tree, hf_pnrp_signature_hash_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; /* Signature Data */ proto_tree_add_item(pnrp_signature_tree, hf_pnrp_signature_signatureData, tvb, offset, signatureLength, ENC_NA); @@ -1313,7 +1337,33 @@ void proto_register_pnrp(void) { "Solicit Type", "pnrp.segment.solicitType", FT_UINT8, BASE_DEC, VALS(solicitType), 0x0, NULL, HFILL }}, { &hf_pnrp_message_ipv6, - { "IPv6 Address","pnrp.segment.ipv6Address",FT_IPv6, BASE_NONE, NULL, 0x0,NULL,HFILL}} + { "IPv6 Address","pnrp.segment.ipv6Address",FT_IPv6, BASE_NONE, NULL, 0x0,NULL,HFILL}}, + + /* Generated from convert_proto_tree_add_text.pl */ + { &hf_pnrp_message_flags, { "Flags", "pnrp.segment.flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_reserved8, { "Reserved", "pnrp.reserved", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_reserved16, { "Reserved", "pnrp.reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_message_offset, { "Offset", "pnrp.segment.offset", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_message_data, { "Data", "pnrp.segment.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_message_port_number, { "Port Number", "pnrp.segment.port_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_encodedCPA_friendlyName_length, { "Length of Friendly name", "pnrp.encodedCPA.friendlyName.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_encodedCPA_number_of_service_addresses, { "Number of Service Addresses", "pnrp.encodedCPA.number_of_service_addresses", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_encodedCPA_service_address_length, { "Service Address Length", "pnrp.encodedCPA.service_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_encodedCPA_number_of_payload_structures, { "Number of Payload Structures", "pnrp.encodedCPA.number_of_payload_structures", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_encodedCPA_total_bytes_of_payload, { "Total Bytes of Payload", "pnrp.encodedCPA.total_bytes_of_payload", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_payload_type, { "Payload Type", "pnrp.payload.type", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_length_of_data, { "Length of Data", "pnrp.payload.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_payload_port, { "Port Number", "pnrp.payload.port", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_payload_iana_proto, { "IANA Protocol Number", "pnrp.payload.iana_proto", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_publicKey_length_of_structure, { "Length of Structure", "pnrp.publicKey.structure_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_publicKey_size_of_algorithm_oid, { "Size of Algorithm OID", "pnrp.publicKey.algorithm_oid_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_publicKey_reserved, { "Reserved", "pnrp.publicKey.reserved", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_publicKey_size_of_cbdata, { "Size of cbData", "pnrp.publicKey.cbdata_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_publicKey_unused_bits, { "Unused Bits", "pnrp.publicKey.unused_bits", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_signature_structure_length, { "Length of Structure", "pnrp.signature.structure_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_signature_length, { "Length of Signature", "pnrp.signature.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_pnrp_signature_hash_id, { "Hash Algorithm Identifier", "pnrp.signature.hash_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + }; /* Protocol subtree array */ diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c index 17fb6cda36..ef3475e9e9 100644 --- a/epan/dissectors/packet-usb-video.c +++ b/epan/dissectors/packet-usb-video.c @@ -1096,7 +1096,7 @@ dissect_usb_video_streaming_input_header(proto_tree *tree, tvbuff_t *tvb, int of } else { - proto_tree_add_text(tree, tvb, offset+1, 1, "bTriggerUsage: Not applicable"); + proto_tree_add_uint_format_value(tree, hf_usb_vid_streaming_trigger_usage, tvb, offset+1, 1, 0, "Not applicable"); } offset += 2; |