diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-16 04:33:42 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-16 04:33:42 +0000 |
commit | 77b3392e7271abe0a51eedba7ac85494a7615599 (patch) | |
tree | 7917b750ae0fe16fd8a26f70af891e7932d27bee /epan | |
parent | 61876001c35547972282a50854957c7c4deaaccf (diff) |
Introduce, and start using, tvb_fc_to_str() and tvb_fcwwm_to_str(): these
functions act like their non-tvb counterparts except that they take a tvb and
and offset instead of a pointer to a byte array.
This basically saves the dissectors from having to call tvb_get_ptr()--which in
this case eliminates a couple of typos in the length given to tvb_get_ptr().
svn path=/trunk/; revision=35549
Diffstat (limited to 'epan')
-rw-r--r-- | epan/address_to_str.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-fcdns.c | 148 | ||||
-rw-r--r-- | epan/dissectors/packet-fcels.c | 69 | ||||
-rw-r--r-- | epan/dissectors/packet-fcfcs.c | 54 | ||||
-rw-r--r-- | epan/to_str.h | 2 |
5 files changed, 120 insertions, 165 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c index 7f4691a66a..d3cf15fab3 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -263,6 +263,12 @@ fc_to_str(const guint8 *ad) return bytestring_to_str (ad, 3, '.'); } +gchar * +tvb_fc_to_str(tvbuff_t *tvb, const gint offset) +{ + return bytestring_to_str (tvb_get_ptr(tvb, offset, 3), 3, '.'); +} + /* FC Network Header Network Address Authority Identifiers */ #define FC_NH_NAA_IEEE 1 /* IEEE 802.1a */ @@ -317,6 +323,12 @@ fcwwn_to_str (const guint8 *ad) return (ethstr); } +gchar * +tvb_fcwwn_to_str(tvbuff_t *tvb, const gint offset) +{ + return fcwwn_to_str (tvb_get_ptr(tvb, offset, 8)); +} + /*XXX FIXME the code below may be called very very frequently in the future. optimize it for speed and get rid of the slow sprintfs */ /* XXX - perhaps we should have individual address types register diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index 6932abfa98..b8643a4b8f 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -428,7 +428,7 @@ dissect_fcdns_req_portid (tvbuff_t *tvb, proto_tree *tree, int offset) { if (tree) { proto_tree_add_string (tree, hf_fcdns_req_portid, tvb, offset, 3, - fc_to_str (tvb_get_ptr (tvb, offset, 3))); + tvb_fc_to_str (tvb, offset)); } } @@ -447,11 +447,10 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) 1, 0); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+4, - 8))); + tvb_fcwwn_to_str (tvb, offset+4)); len = tvb_get_guint8 (tvb, offset+12); proto_tree_add_item (req_tree, hf_fcdns_rply_spnamelen, tvb, offset+12, 1, 0); @@ -466,9 +465,7 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (tvb_offset_exists (tvb, 292)) { proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb, offset+268, 8, - fcwwn_to_str (tvb_get_ptr (tvb, - offset+268, - 0))); + tvb_fcwwn_to_str (tvb, offset+268)); } if (tvb_offset_exists (tvb, 548)) { len = tvb_get_guint8 (tvb, offset+276); @@ -500,14 +497,12 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (tvb_offset_exists (tvb, 632)) { proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb, offset+608, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+608, - 8))); + tvb_fcwwn_to_str (tvb, offset+608)); } if (tvb_offset_exists (tvb, 635)) { proto_tree_add_string (req_tree, hf_fcdns_rply_hrdaddr, tvb, offset+617, 3, - fc_to_str (tvb_get_ptr (tvb, offset+617, - 3))); + tvb_fc_to_str (tvb, offset+617)); } } } @@ -524,8 +519,7 @@ dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) } else { proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset)); } } } @@ -542,8 +536,7 @@ dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) else { proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } } } @@ -626,8 +619,7 @@ dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) else { proto_tree_add_string (req_tree, hf_fcdns_rply_fpname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } } @@ -683,14 +675,12 @@ dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); } } } @@ -704,8 +694,7 @@ dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (req_tree, hf_fcdns_rply_ipport, tvb, offset, @@ -724,16 +713,14 @@ dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { do { islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); offset += 4; } while (!(islast & 0x80)); } @@ -749,8 +736,7 @@ dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (req_tree, hf_fcdns_rply_ipnode, tvb, offset, @@ -769,21 +755,17 @@ dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { do { islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset+8, 8, - fcwwn_to_str (tvb_get_ptr (tvb, - offset+8, - 8))); + tvb_fcwwn_to_str (tvb, offset+8)); offset += 16; } while (!(islast & 0x80)); } @@ -800,8 +782,7 @@ dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { len = tvb_get_guint8 (tvb, offset); @@ -833,8 +814,7 @@ dissect_fcdns_gidft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); offset += 4; } while (!(islast & 0x80)); } @@ -861,12 +841,10 @@ dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_rply_pname, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+8, - 8))); + tvb_fcwwn_to_str (tvb, offset+8)); offset += 16; } while (!(islast & 0x80)); } @@ -893,12 +871,10 @@ dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_rply_nname, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+8, - 8))); + tvb_fcwwn_to_str (tvb, offset+8)); offset += 16; } while (!(islast & 0x80)); } @@ -925,8 +901,7 @@ dissect_fcdns_gidpt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); offset += 4; } while (!(islast & 0x80)); } @@ -949,8 +924,7 @@ dissect_fcdns_gidipp (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); offset += 4; } while (!(islast & 0x80)); } @@ -976,8 +950,7 @@ dissect_fcdns_gidff (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) islast = tvb_get_guint8 (tvb, offset); proto_tree_add_string (req_tree, hf_fcdns_rply_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); offset += 4; } while (!(islast & 0x80)); } @@ -993,12 +966,10 @@ dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+4, - 8))); + tvb_fcwwn_to_str (tvb, offset+4)); } } } @@ -1012,12 +983,10 @@ dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+4, - 8))); + tvb_fcwwn_to_str (tvb, offset+4)); } } } @@ -1030,8 +999,7 @@ dissect_fcdns_rcsid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); dissect_cos_flags(req_tree, tvb, offset+4, hf_fcdns_req_cos); } } @@ -1044,8 +1012,7 @@ dissect_fcdns_rptid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_item (req_tree, hf_fcdns_req_ptype, tvb, offset+4, 1, 0); } @@ -1059,8 +1026,7 @@ dissect_fcdns_rftid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types); } } @@ -1074,8 +1040,7 @@ dissect_fcdns_rspnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_item (req_tree, hf_fcdns_req_spnamelen, tvb, offset+4, 1, 0); len = tvb_get_guint8 (tvb, offset+4); @@ -1093,8 +1058,7 @@ dissect_fcdns_rippid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+4, 16, 0); } @@ -1109,8 +1073,7 @@ dissect_fcdns_rfdid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + tvb_fc_to_str (tvb, offset+1)); dissect_fc4type(req_tree, tvb, offset+4, hf_fcdns_req_fc4types); len = tvb_length (tvb) - offset - 36; @@ -1135,7 +1098,7 @@ dissect_fcdns_rffid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); dissect_fc4features_and_type(req_tree, tvb, offset+6); } } @@ -1147,7 +1110,7 @@ dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); proto_tree_add_item (req_tree, hf_fcdns_req_ip, tvb, offset+8, 16, 0); } } @@ -1160,7 +1123,7 @@ dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); len = tvb_get_guint8 (tvb, offset+8); proto_tree_add_item (req_tree, hf_fcdns_req_snamelen, tvb, offset+8, @@ -1177,7 +1140,7 @@ dissect_fcdns_daid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree && isreq) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); } } @@ -1208,9 +1171,7 @@ dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) case FC_SWILS_ZONEMBR_WWN: proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb, offset+4, 8, - fcwwn_to_str (tvb_get_ptr (tvb, - offset+4, - 8))); + tvb_fcwwn_to_str (tvb, offset+4)); break; case FC_SWILS_ZONEMBR_DP: g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl (tvb, offset+4)); @@ -1220,9 +1181,7 @@ dissect_fcdns_zone_mbr (tvbuff_t *tvb, proto_tree *zmbr_tree, int offset) case FC_SWILS_ZONEMBR_FCID: proto_tree_add_string (zmbr_tree, hf_fcdns_zone_mbrid, tvb, offset+4, 4, - fc_to_str (tvb_get_ptr (tvb, - offset+5, - 3))); + tvb_fc_to_str (tvb, offset+5)); break; case FC_SWILS_ZONEMBR_ALIAS: str = zonenm_to_str (tvb, offset+4); @@ -1260,10 +1219,9 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) proto_tree_add_item (tree, hf_fcdns_rply_ptype, tvb, offset+4, 1, 0); proto_tree_add_string (tree, hf_fcdns_rply_portid, tvb, offset+5, 3, - fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + tvb_fc_to_str (tvb, offset+5)); proto_tree_add_string (tree, hf_fcdns_rply_pname, tvb, offset+8, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+8, - 8))); + tvb_fcwwn_to_str (tvb, offset+8)); offset += 16; if (!(objfmt & 0x1)) { len = tvb_get_guint8 (tvb, offset); @@ -1274,7 +1232,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) offset += 256; } proto_tree_add_string (tree, hf_fcdns_rply_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); offset += 8; if (!(objfmt & 0x1)) { len = tvb_get_guint8 (tvb, offset); @@ -1292,12 +1250,9 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) proto_tree_add_item (tree, hf_fcdns_rply_ipport, tvb, offset+60, 16, 0); proto_tree_add_string (tree, hf_fcdns_rply_fpname, tvb, offset+76, - 8, fcwwn_to_str (tvb_get_ptr (tvb, - offset+76, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset+76)); proto_tree_add_string (tree, hf_fcdns_rply_hrdaddr, tvb, offset+85, - 3, fc_to_str (tvb_get_ptr (tvb, offset+85, - 3))); + 3, tvb_fc_to_str (tvb, offset+85)); offset += 88; if (objfmt & 0x2) { dissect_fc4features(tree, tvb, offset); @@ -1330,8 +1285,7 @@ dissect_fcdns_geid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { if (req_tree) { proto_tree_add_string (req_tree, hf_fcdns_req_portid, tvb, offset+1, - 3, fc_to_str (tvb_get_ptr (tvb, offset+1, - 3))); + 3, tvb_fc_to_str (tvb, offset+1)); } } else { @@ -1346,7 +1300,7 @@ dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { if (req_tree) { proto_tree_add_string (req_tree, hf_fcdns_req_pname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } } else { @@ -1362,7 +1316,7 @@ dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (isreq) { if (req_tree) { proto_tree_add_string (req_tree, hf_fcdns_req_nname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } } else { diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index 225d38248c..cb75eea6f7 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -1001,9 +1001,9 @@ dissect_fcels_logi (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (cmnsvc_tree, hf_fcels_reloffset, tvb, offset+14, 2, FALSE); proto_tree_add_item (cmnsvc_tree, hf_fcels_edtov, tvb, offset+16, 4, FALSE); proto_tree_add_string (cmnsvc_tree, hf_fcels_npname, tvb, offset+20, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+20, 8))); + tvb_fcwwn_to_str (tvb, offset+20)); proto_tree_add_string (cmnsvc_tree, hf_fcels_fnname, tvb, offset+28, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+28, 8))); + tvb_fcwwn_to_str (tvb, offset+28)); /* Add subtree for class paramters */ offset = 36; @@ -1072,9 +1072,9 @@ dissect_fcels_logout (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } proto_tree_add_string (logo_tree, hf_fcels_nportid, tvb, offset, 3, - fc_to_str (tvb_get_ptr (tvb, offset, 3))); + tvb_fc_to_str (tvb, offset)); proto_tree_add_string (logo_tree, hf_fcels_npname, tvb, offset+3, 6, - fcwwn_to_str (tvb_get_ptr (tvb, offset+3, 6))); + tvb_fcwwn_to_str (tvb, offset+3)); } } @@ -1099,7 +1099,7 @@ dissect_fcels_abtx (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, "Recovery Qualifier Status: 0x%x", tvb_get_guint8 (tvb, offset+4)); proto_tree_add_string (abtx_tree, hf_fcels_nportid, tvb, offset+5, 3, - fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + tvb_fc_to_str (tvb, offset+5)); proto_tree_add_item (abtx_tree, hf_fcels_oxid, tvb, offset+8, 2, FALSE); proto_tree_add_item (abtx_tree, hf_fcels_rxid, tvb, offset+10, 2, FALSE); } @@ -1122,7 +1122,7 @@ dissect_fcels_rsi (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (rsi_tree, hf_fcels_recovqual, tvb, offset, 1, FALSE); proto_tree_add_string (rsi_tree, hf_fcels_nportid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); proto_tree_add_item (rsi_tree, hf_fcels_rxid, tvb, offset+4, 2, FALSE); proto_tree_add_item (rsi_tree, hf_fcels_oxid, tvb, offset+6, 2, FALSE); } @@ -1144,7 +1144,7 @@ dissect_fcels_rrq (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, return; proto_tree_add_string (rrq_tree, hf_fcels_nportid, tvb, offset+5, 3, - fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + tvb_fc_to_str (tvb, offset+5)); proto_tree_add_item (rrq_tree, hf_fcels_oxid, tvb, offset+8, 2, FALSE); proto_tree_add_item (rrq_tree, hf_fcels_rxid, tvb, offset+10, 2, FALSE); } @@ -1166,7 +1166,7 @@ dissect_fcels_rec (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (isreq) { proto_tree_add_string (rec_tree, hf_fcels_nportid, tvb, offset+5, 3, - fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + tvb_fc_to_str (tvb, offset+5)); proto_tree_add_item (rec_tree, hf_fcels_oxid, tvb, offset+8, 2, FALSE); proto_tree_add_item (rec_tree, hf_fcels_rxid, tvb, @@ -1178,10 +1178,10 @@ dissect_fcels_rec (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, offset+6, 2, FALSE); proto_tree_add_string (rec_tree, hf_fcels_nportid, tvb, offset+9, 3, - fc_to_str (tvb_get_ptr (tvb, offset+9, 3))); + tvb_fc_to_str (tvb, offset+9)); proto_tree_add_string (rec_tree, hf_fcels_resportid, tvb, offset+13, 3, - fc_to_str (tvb_get_ptr (tvb, offset+13, 3))); + tvb_fc_to_str (tvb, offset+13)); proto_tree_add_item (rec_tree, hf_fcels_rec_fc4, tvb, offset+16, 4, FALSE); proto_tree_add_bitmask (rec_tree, tvb, offset+20, hf_fcels_estat, @@ -1219,13 +1219,13 @@ dissect_fcels_adisc (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (adisc_tree, hf_fcels_opcode, tvb, offset-5, 1, FALSE); proto_tree_add_string (adisc_tree, hf_fcels_hardaddr, tvb, offset, 3, - fc_to_str (tvb_get_ptr (tvb, offset, 3))); + tvb_fc_to_str (tvb, offset)); proto_tree_add_string (adisc_tree, hf_fcels_npname, tvb, offset+3, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+3, 8))); + tvb_fcwwn_to_str (tvb, offset+3)); proto_tree_add_string (adisc_tree, hf_fcels_fnname, tvb, offset+11, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+11, 8))); + tvb_fcwwn_to_str (tvb, offset+11)); proto_tree_add_string (adisc_tree, hf_fcels_nportid, tvb, offset+20, 3, - fc_to_str (tvb_get_ptr (tvb, offset+20, 3))); + tvb_fc_to_str (tvb, offset+20)); } } @@ -1245,19 +1245,19 @@ dissect_fcels_farp (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (farp_tree, hf_fcels_farp_matchcodept, tvb, offset, 1, FALSE); proto_tree_add_string (farp_tree, hf_fcels_nportid, tvb, offset+1, - 3, fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + 3, tvb_fc_to_str (tvb, offset+1)); proto_tree_add_item (farp_tree, hf_fcels_farp_respaction, tvb, offset+4, 1, FALSE); proto_tree_add_string (farp_tree, hf_fcels_resportid, tvb, offset+5, - 3, fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + 3, tvb_fc_to_str (tvb, offset+5)); proto_tree_add_string (farp_tree, hf_fcels_npname, tvb, offset+8, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+8, 8))); + 8, tvb_fcwwn_to_str (tvb, offset+8)); proto_tree_add_string (farp_tree, hf_fcels_fnname, tvb, offset+16, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+16, 8))); + 8, tvb_fcwwn_to_str (tvb, offset+16)); proto_tree_add_string (farp_tree, hf_fcels_respname, tvb, offset+24, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+24, 8))); + 8, tvb_fcwwn_to_str (tvb, offset+24)); proto_tree_add_string (farp_tree, hf_fcels_respnname, tvb, offset+32, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset+32, 8))); + 8, tvb_fcwwn_to_str (tvb, offset+32)); proto_tree_add_item (farp_tree, hf_fcels_reqipaddr, tvb, offset+40, 16, FALSE); proto_tree_add_item (farp_tree, hf_fcels_respipaddr, tvb, offset+56, @@ -1300,9 +1300,7 @@ dissect_fcels_rps (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (flag & 0x2) { proto_tree_add_string (rps_tree, hf_fcels_npname, tvb, offset+1, - 8, fcwwn_to_str (tvb_get_ptr (tvb, - offset+1, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset+1)); } else if (flag & 0x1) { proto_tree_add_item (rps_tree, hf_fcels_rps_portnum, tvb, @@ -1409,10 +1407,10 @@ dissect_fcels_rpl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, tvb_get_ntohl (tvb, offset)); proto_tree_add_text (pb_tree, tvb, offset+5, 3, "Port Identifier: %s", - fc_to_str (tvb_get_ptr (tvb, offset+5, 3))); + tvb_fc_to_str (tvb, offset+5)); proto_tree_add_text (pb_tree, tvb, offset+8, 8, "Port Name: %s", - fcwwn_to_str (tvb_get_ptr (tvb, offset+8, 8))); + tvb_fcwwn_to_str (tvb, offset+8)); offset += 16; } } @@ -1433,11 +1431,11 @@ dissect_fcels_fan (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (fan_tree, hf_fcels_opcode, tvb, offset-5, 1, FALSE); proto_tree_add_string (fan_tree, hf_fcels_fabricaddr, tvb, offset, 3, - fc_to_str (tvb_get_ptr (tvb, offset, 3))); + tvb_fc_to_str (tvb, offset)); proto_tree_add_string (fan_tree, hf_fcels_fabricpname, tvb, offset+3, - 8, fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + 8, tvb_fcwwn_to_str (tvb, offset)); proto_tree_add_string (fan_tree, hf_fcels_fnname, tvb, offset+11, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+11, 8))); + tvb_fcwwn_to_str (tvb, offset+11)); } } @@ -1657,7 +1655,7 @@ dissect_fcels_prlilo_payload (tvbuff_t *tvb, packet_info *pinfo _U_, else if (opcode == FC_ELS_TPRLO) { proto_tree_add_text (svcpg_tree, tvb, offset+13, 3, "3rd Party N_Port Id: %s", - fc_to_str (tvb_get_ptr (tvb, offset+13, 3))); + tvb_fc_to_str (tvb, offset+13)); } } } @@ -1754,7 +1752,7 @@ dissect_fcels_srl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } proto_tree_add_text (srl_tree, tvb, offset+1, 3, "FL_Port Addr: %s", - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); } } @@ -1812,9 +1810,9 @@ dissect_fcels_cbind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (cbind_tree, hf_fcels_cbind_userinfo, tvb, offset+8, 4, FALSE); proto_tree_add_string (cbind_tree, hf_fcels_cbind_snpname, tvb, offset+12, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+12, 8))); + tvb_fcwwn_to_str (tvb, offset+12)); proto_tree_add_string (cbind_tree, hf_fcels_cbind_dnpname, tvb, offset+20, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+20, 8))); + tvb_fcwwn_to_str (tvb, offset+20)); switch(tvb_reported_length(tvb)){ case 32: /* 28 byte Request + 4 bytes FC CRC */ @@ -1889,13 +1887,10 @@ dissect_fcels_rnid (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, if (clen) { proto_tree_add_string (rnid_tree, hf_fcels_npname, tvb, offset+8, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+8, - 8))); + tvb_fcwwn_to_str (tvb, offset+8)); proto_tree_add_string (rnid_tree, hf_fcels_fnname, tvb, offset+16, 8, - fcwwn_to_str (tvb_get_ptr (tvb, - offset+16, - 8))); + tvb_fcwwn_to_str (tvb, offset+16)); } if (tvb_get_guint8 (tvb, offset+4) == 0xDF) { /* Decode the Specific Node ID Format as this is known */ diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index a51f74d997..3b23dc448b 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -152,7 +152,7 @@ dissect_fcfcs_giel (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+11, 1, 0); offset += 12; } @@ -167,7 +167,7 @@ dissect_fcfcs_giet (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+3, 1, 0); @@ -183,7 +183,7 @@ dissect_fcfcs_gdid (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (tree, hf_fcs_iedomainid, tvb, offset+1, 1, 0); @@ -199,11 +199,11 @@ dissect_fcfcs_gmid (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_string (tree, hf_fcs_mgmtid, tvb, offset+1, 3, - fc_to_str (tvb_get_ptr (tvb, offset+1, 3))); + tvb_fc_to_str (tvb, offset+1)); } } } @@ -216,11 +216,11 @@ dissect_fcfcs_gfn (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_string (tree, hf_fcs_fabricname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } } } @@ -233,7 +233,7 @@ dissect_fcfcs_gieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d", @@ -253,7 +253,7 @@ dissect_fcfcs_gmal (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -281,7 +281,7 @@ dissect_fcfcs_gieil (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { tot_len = tvb_get_guint8 (tvb, offset+3); @@ -325,7 +325,7 @@ dissect_fcfcs_gpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -336,8 +336,7 @@ dissect_fcfcs_gpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) for (i = 0; i < numelem; i++) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); proto_tree_add_item (tree, hf_fcs_portmodtype, tvb, offset+9, 1, 0); proto_tree_add_item (tree, hf_fcs_porttxtype, tvb, offset+10, @@ -358,7 +357,7 @@ dissect_fcfcs_gpt (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, 0); @@ -374,7 +373,7 @@ dissect_fcfcs_gppn (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (tree, hf_fcs_physportnum, tvb, offset, 4, 0); @@ -391,7 +390,7 @@ dissect_fcfcs_gapnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -401,8 +400,7 @@ dissect_fcfcs_gapnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + tvb_fcwwn_to_str (tvb, offset)); proto_tree_add_item (tree, hf_fcs_portflags, tvb, offset+10, 1, 0); proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+11, @@ -421,7 +419,7 @@ dissect_fcfcs_gps (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, 0); @@ -452,9 +450,7 @@ dissect_fcfcs_gplnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, - 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset)); offset += 8; } } @@ -524,7 +520,7 @@ dissect_fcfcs_gnpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } else { len = tvb_get_guint8 (tvb, offset); @@ -572,7 +568,7 @@ dissect_fcfcs_rieln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); len = tvb_get_guint8 (tvb, offset+8); proto_tree_add_text (tree, tvb, offset+8, 1, "Logical Name Length: %d", len); @@ -616,9 +612,7 @@ dissect_fcfcs_rpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) offset += 4; for (i = 0; i < numelem; i++) { proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, - 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset)); offset += 8; } } @@ -639,9 +633,7 @@ dissect_fcfcs_rpln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1, len, 0); proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset+256, - 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset+256, - 8))); + 8, tvb_fcwwn_to_str (tvb, offset+256)); } } } @@ -712,7 +704,7 @@ dissect_fcfcs_dpln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) if (tree) { if (isreq) { proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, 8, - fcwwn_to_str (tvb_get_ptr (tvb, offset, 8))); + tvb_fcwwn_to_str (tvb, offset)); } } } diff --git a/epan/to_str.h b/epan/to_str.h index c4528910d8..1b1c2b4ed9 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -54,6 +54,8 @@ extern const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset); extern void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len); extern gchar* fc_to_str(const guint8 *); extern gchar* fcwwn_to_str (const guint8 *); +extern gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset); +extern gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset); extern gchar* ip6_to_str(const struct e_in6_addr *); extern gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset); extern void ip6_to_str_buf(const struct e_in6_addr *, gchar *); |