From 71c02b20eb798569393da09fc6557c314244e3e8 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 24 Dec 2014 00:06:35 -0500 Subject: [PATCH] Create FT_FCWWN field type. Also, convert the "string" hf_ entries that used tvb_fcwwn_to_str as a string to use proto_tree_add_item with FT_FCWWN type. Change-Id: I4ca77870499fd8239584a70874998b5d194a7167 Reviewed-on: https://code.wireshark.org/review/6036 Petri-Dish: Michael Mann Reviewed-by: Michael Mann --- doc/README.dissector | 16 ++-- epan/address.h | 1 + epan/address_to_str.c | 47 +++++++----- epan/dfilter/semcheck.c | 5 +- epan/dissectors/packet-fc.c | 10 +-- epan/dissectors/packet-fcdns.c | 124 ++++++++++++------------------ epan/dissectors/packet-fcels.c | 73 ++++++++---------- epan/dissectors/packet-fcfcs.c | 76 +++++++----------- epan/dissectors/packet-fcip.c | 10 +-- epan/dissectors/packet-fcsp.c | 11 ++- epan/dissectors/packet-fcswils.c | 127 +++++++++++++++---------------- epan/dissectors/packet-fip.c | 23 +++--- epan/dissectors/packet-ipfc.c | 10 +-- epan/dissectors/packet-scsi.c | 6 +- epan/ftypes/ftype-bytes.c | 76 +++++++++++++++++- epan/ftypes/ftypes-int.h | 1 + epan/ftypes/ftypes.h | 2 + epan/proto.c | 40 ++++++++++ epan/to_str.h | 14 ++-- epan/wslua/wslua_field.c | 8 ++ epan/wslua/wslua_proto.c | 3 + epan/wslua/wslua_tree.c | 2 + tools/checkAPIs.pl | 1 - ui/gtk/packet_win.c | 5 +- 24 files changed, 381 insertions(+), 310 deletions(-) diff --git a/doc/README.dissector b/doc/README.dissector index d30e042b8a..78a2723134 100644 --- a/doc/README.dissector +++ b/doc/README.dissector @@ -106,7 +106,8 @@ FIELDTYPE FT_NONE, FT_BOOLEAN, FT_UINT8, FT_UINT16, FT_UINT24, FT_RELATIVE_TIME, FT_STRING, FT_STRINGZ, FT_EUI64, FT_UINT_STRING, FT_ETHER, FT_BYTES, FT_UINT_BYTES, FT_IPv4, FT_IPv6, FT_IPXNET, FT_FRAMENUM, FT_PROTOCOL, FT_GUID, FT_OID, - FT_REL_OID + FT_REL_OID, FT_AX25, FT_VINES, FT_SYSTEM_ID, FT_FCWWN + FIELDDISPLAY --For FT_UINT{8,16,24,32,64} and FT_INT{8,16,24,32,64): BASE_DEC, BASE_HEX, BASE_OCT, BASE_DEC_HEX, BASE_HEX_DEC, @@ -741,7 +742,11 @@ The type of value this field holds. The current field types are: FT_GUID A Globally Unique Identifier FT_OID An ASN.1 Object Identifier FT_REL_OID An ASN.1 Relative Object Identifier - FT_EUI64 A EUI-64 Address + FT_EUI64 A EUI-64 Address + FT_AX25 A AX-25 Address + FT_VINES A Vines Address + FT_SYSTEM_ID An OSI System-ID + FT_FCWWN A Fibre Channel WWN Address Some of these field types are still not handled in the display filter routines, but the most common ones are. The FT_UINT* variables all @@ -1374,9 +1379,10 @@ proto_register_*() function) and a value. The value will be fetched from the tvbuff by proto_tree_add_item(), based on the type of the field and the encoding of the value as specified by the "encoding" argument. -For FT_NONE, FT_BYTES, FT_ETHER, FT_IPv6, FT_IPXNET, FT_OID, FT_REL_OID -fields, and 'protocol' fields the encoding is not relevant; the 'encoding' -argument should be ENC_NA (Not Applicable). +For FT_NONE, FT_BYTES, FT_ETHER, FT_IPv6, FT_IPXNET, FT_OID, FT_REL_OID, +FT_AX25, FT_VINES, FT_SYSTEM_ID, FT_FCWWN fields, and 'protocol' fields +the encoding is not relevant; the 'encoding' argument should be +ENC_NA (Not Applicable). For integral, floating-point, Boolean, FT_GUID, and FT_EUI64 fields, the encoding specifies the byte order of the value; the 'encoding' diff --git a/epan/address.h b/epan/address.h index f3ab362d37..a2582f3d00 100644 --- a/epan/address.h +++ b/epan/address.h @@ -46,6 +46,7 @@ typedef enum { AT_OSI, /* OSI NSAP */ AT_ARCNET, /* ARCNET */ AT_FC, /* Fibre Channel */ + AT_FCWWN, /* Fibre Channel WWN */ AT_SS7PC, /* SS7 Point Code */ AT_STRINGZ, /* null-terminated string */ AT_EUI64, /* IEEE EUI-64 */ diff --git a/epan/address_to_str.c b/epan/address_to_str.c index 7c21441520..62a79edb17 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -380,52 +380,56 @@ tvb_fc_to_str(tvbuff_t *tvb, const gint offset) #define FC_NH_NAA_CCITT_INDV 12 /* CCITT 60 bit individual address */ #define FC_NH_NAA_CCITT_GRP 14 /* CCITT 60 bit group address */ -gchar * -fcwwn_to_str (const guint8 *ad) +static void +fcwwn_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len) { int fmt; guint8 oui[6]; - gchar *ethstr; gchar *ethptr; - if (ad == NULL) return NULL; - - ethstr=(gchar *)ep_alloc(512); - ethptr = bytes_to_hexstr_punct(ethstr, ad, 8, ':'); /* 23 bytes */ - - fmt = (ad[0] & 0xF0) >> 4; + if (buf_len < 200) { /* This is mostly for manufacturer name */ + g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len); /* Let the unexpected value alert user */ + return; + } + ethptr = bytes_to_hexstr_punct(buf, addrp, 8, ':'); /* 23 bytes */ + fmt = (addrp[0] & 0xF0) >> 4; switch (fmt) { case FC_NH_NAA_IEEE: case FC_NH_NAA_IEEE_E: - memcpy (oui, &ad[2], 6); + memcpy (oui, &addrp[2], 6); - g_snprintf (ethptr, 512-23, " (%s)", get_manuf_name (oui)); + g_snprintf (ethptr, buf_len-23, " (%s)", get_manuf_name (oui)); break; case FC_NH_NAA_IEEE_R: - oui[0] = ((ad[0] & 0x0F) << 4) | ((ad[1] & 0xF0) >> 4); - oui[1] = ((ad[1] & 0x0F) << 4) | ((ad[2] & 0xF0) >> 4); - oui[2] = ((ad[2] & 0x0F) << 4) | ((ad[3] & 0xF0) >> 4); - oui[3] = ((ad[3] & 0x0F) << 4) | ((ad[4] & 0xF0) >> 4); - oui[4] = ((ad[4] & 0x0F) << 4) | ((ad[5] & 0xF0) >> 4); - oui[5] = ((ad[5] & 0x0F) << 4) | ((ad[6] & 0xF0) >> 4); + oui[0] = ((addrp[0] & 0x0F) << 4) | ((addrp[1] & 0xF0) >> 4); + oui[1] = ((addrp[1] & 0x0F) << 4) | ((addrp[2] & 0xF0) >> 4); + oui[2] = ((addrp[2] & 0x0F) << 4) | ((addrp[3] & 0xF0) >> 4); + oui[3] = ((addrp[3] & 0x0F) << 4) | ((addrp[4] & 0xF0) >> 4); + oui[4] = ((addrp[4] & 0x0F) << 4) | ((addrp[5] & 0xF0) >> 4); + oui[5] = ((addrp[5] & 0x0F) << 4) | ((addrp[6] & 0xF0) >> 4); - g_snprintf (ethptr, 512-23, " (%s)", get_manuf_name (oui)); + g_snprintf (ethptr, buf_len-23, " (%s)", get_manuf_name (oui)); break; default: *ethptr = '\0'; break; } - return (ethstr); } gchar * tvb_fcwwn_to_str(tvbuff_t *tvb, const gint offset) { - return fcwwn_to_str (tvb_get_ptr(tvb, offset, 8)); + gchar *buf; + + buf=(gchar *)ep_alloc(512); + + fcwwn_addr_to_str_buf(tvb_get_ptr(tvb, offset, FCWWN_ADDR_LEN), buf, 512); + + return buf; } /*XXX FIXME the code below may be called very very frequently in the future. @@ -516,6 +520,9 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len) case AT_FC: /* 9 bytes */ tempptr = bytes_to_hexstr_punct(tempptr, (const guint8 *)addr->data, 3, '.'); /* 8 bytes */ break; + case AT_FCWWN: + fcwwn_addr_to_str_buf((const guint8 *)addr->data, buf, buf_len); + break; case AT_SS7PC: mtp3_addr_to_str_buf((const mtp3_addr_pc_t *)addr->data, buf, buf_len); break; diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 39174e4e7c..bda8f49c4b 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -82,10 +82,11 @@ compatible_ftypes(ftenum_t a, ftenum_t b) case FT_OID: case FT_AX25: case FT_VINES: + case FT_FCWWN: case FT_REL_OID: case FT_SYSTEM_ID: - return (b == FT_ETHER || b == FT_BYTES || b == FT_UINT_BYTES || b == FT_GUID || b == FT_OID || b == FT_AX25 || b == FT_VINES || b == FT_REL_OID || b == FT_SYSTEM_ID); + return (b == FT_ETHER || b == FT_BYTES || b == FT_UINT_BYTES || b == FT_GUID || b == FT_OID || b == FT_AX25 || b == FT_VINES || b == FT_FCWWN || b == FT_REL_OID || b == FT_SYSTEM_ID); case FT_BOOLEAN: case FT_FRAMENUM: @@ -182,6 +183,7 @@ mk_fvalue_from_val_string(header_field_info *hfinfo, char *s) case FT_IPXNET: case FT_AX25: case FT_VINES: + case FT_FCWWN: case FT_ETHER: case FT_BYTES: case FT_UINT_BYTES: @@ -296,6 +298,7 @@ is_bytes_type(enum ftenum type) switch(type) { case FT_AX25: case FT_VINES: + case FT_FCWWN: case FT_ETHER: case FT_BYTES: case FT_UINT_BYTES: diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index 45efa6ab2b..2423620d46 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -1048,10 +1048,8 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean if (df_ctl & FC_DFCTL_NH) { /* Yes - dissect it. */ if (tree) { - proto_tree_add_string (fc_tree, hf_fc_nh_da, tvb, next_offset, 8, - fcwwn_to_str (tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 8, ENC_ASCII))); - proto_tree_add_string (fc_tree, hf_fc_nh_sa, tvb, offset+8, 8, - fcwwn_to_str (tvb_get_string_enc(wmem_packet_scope(), tvb, offset+8, 8, ENC_ASCII))); + proto_tree_add_item(fc_tree, hf_fc_nh_da, tvb, next_offset, 8, ENC_NA); + proto_tree_add_item(fc_tree, hf_fc_nh_sa, tvb, next_offset+8, 8, ENC_NA); } next_offset += 16; } @@ -1455,10 +1453,10 @@ proto_register_fc(void) {"Reassembled Frame", "fc.reassembled", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fc_nh_da, - {"Network DA", "fc.nethdr.da", FT_STRING, BASE_NONE, NULL, + {"Network DA", "fc.nethdr.da", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fc_nh_sa, - {"Network SA", "fc.nethdr.sa", FT_STRING, BASE_NONE, NULL, + {"Network SA", "fc.nethdr.sa", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, /* Basic Link Svc field definitions */ diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c index f23ccea98e..271c9f2996 100644 --- a/epan/dissectors/packet-fcdns.c +++ b/epan/dissectors/packet-fcdns.c @@ -71,11 +71,11 @@ static header_field_info hfi_fcdns_req_portid FCDNS_HFI_INIT = NULL, HFILL}; static header_field_info hfi_fcdns_rply_pname FCDNS_HFI_INIT = - {"Port Name", "fcdns.rply.pname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, + {"Port Name", "fcdns.rply.pname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_rply_nname FCDNS_HFI_INIT = - {"Node Name", "fcdns.rply.nname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, + {"Node Name", "fcdns.rply.nname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_rply_gft FCDNS_HFI_INIT = @@ -95,7 +95,7 @@ static header_field_info hfi_fcdns_rply_ptype FCDNS_HFI_INIT = VALS (fc_dns_port_type_val), 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_rply_fpname FCDNS_HFI_INIT = - {"Fabric Port Name", "fcdns.rply.fpname", FT_STRING, BASE_NONE, NULL, + {"Fabric Port Name", "fcdns.rply.fpname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_fc4type FCDNS_HFI_INIT = @@ -111,7 +111,7 @@ static header_field_info hfi_fcdns_rply_fc4desc FCDNS_HFI_INIT = 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_req_pname FCDNS_HFI_INIT = - {"Port Name", "fcdns.req.portname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Port Name", "fcdns.req.portname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT = @@ -119,7 +119,7 @@ static header_field_info hfi_fcdns_rply_portid FCDNS_HFI_INIT = 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_req_nname FCDNS_HFI_INIT = - {"Node Name", "fcdns.req.nname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Node Name", "fcdns.req.nname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}; static header_field_info hfi_fcdns_req_domainscope FCDNS_HFI_INIT = @@ -584,9 +584,8 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb, - offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+4)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_pname, tvb, + offset+4, 8, ENC_NA); len = tvb_get_guint8 (tvb, offset+12); proto_tree_add_item (req_tree, &hfi_fcdns_rply_spnamelen, tvb, offset+12, 1, ENC_BIG_ENDIAN); @@ -599,9 +598,8 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) } if (tvb_offset_exists (tvb, 292)) { - proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb, - offset+268, 8, - tvb_fcwwn_to_str (tvb, offset+268)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_nname, tvb, + offset+268, 8, ENC_NA); } if (tvb_offset_exists (tvb, 548)) { len = tvb_get_guint8 (tvb, offset+276); @@ -631,9 +629,8 @@ dissect_fcdns_ganxt (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) offset+592, 16, ENC_NA); } if (tvb_offset_exists (tvb, 632)) { - proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb, - offset+608, 8, - tvb_fcwwn_to_str (tvb, offset+608)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_fpname, tvb, + offset+608, 8, ENC_NA); } if (tvb_offset_exists (tvb, 635)) { proto_tree_add_string (req_tree, &hfi_fcdns_rply_hrdaddr, tvb, @@ -654,8 +651,8 @@ dissect_fcdns_gpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) dissect_fcdns_req_portid (tvb, req_tree, offset+1); } else { - proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, tvb, offset, - 8, tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_pname, tvb, offset, + 8, ENC_NA); } } } @@ -670,9 +667,8 @@ dissect_fcdns_gnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) dissect_fcdns_req_portid (tvb, req_tree, offset+1); } else { - proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_nname, tvb, + offset, 8, ENC_NA); } } } @@ -753,9 +749,8 @@ dissect_fcdns_gfpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) dissect_fcdns_req_portid (tvb, req_tree, offset+1); } else { - proto_tree_add_string (req_tree, &hfi_fcdns_rply_fpname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_fpname, tvb, + offset, 8, ENC_NA); } } @@ -809,9 +804,8 @@ dissect_fcdns_gidpn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_pname, tvb, + offset, 8, ENC_NA); } else { proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb, @@ -828,9 +822,8 @@ dissect_fcdns_gipppn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_pname, tvb, + offset, 8, ENC_NA); } else { proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipport, tvb, offset, @@ -847,9 +840,8 @@ dissect_fcdns_gidnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, + offset, 8, ENC_NA); } else { do { @@ -870,9 +862,8 @@ dissect_fcdns_gipnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, + offset, 8, ENC_NA); } else { proto_tree_add_item (req_tree, &hfi_fcdns_rply_ipnode, tvb, offset, @@ -889,9 +880,8 @@ dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, + offset, 8, ENC_NA); } else { do { @@ -899,9 +889,8 @@ dissect_fcdns_gpnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, - tvb, offset+8, 8, - tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_pname, + tvb, offset+8, 8, ENC_NA); offset += 16; } while (!(islast & 0x80)); } @@ -916,9 +905,8 @@ dissect_fcdns_gsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) if (req_tree) { if (isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, - offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, + offset, 8, ENC_NA); } else { len = tvb_get_guint8 (tvb, offset); @@ -978,9 +966,8 @@ dissect_fcdns_gpnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_rply_pname, - tvb, offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_pname, + tvb, offset+4, 8, ENC_NA); offset += 16; } while (!(islast & 0x80)); } @@ -1008,9 +995,8 @@ dissect_fcdns_gnnft (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_rply_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_rply_nname, - tvb, offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item (req_tree, &hfi_fcdns_rply_nname, + tvb, offset+4, 8, ENC_NA); offset += 16; } while (!(islast & 0x80)); } @@ -1103,9 +1089,8 @@ dissect_fcdns_rpnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, - offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+4)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_pname, tvb, + offset+4, 8, ENC_NA); } } } @@ -1120,9 +1105,8 @@ dissect_fcdns_rnnid (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) proto_tree_add_string (req_tree, &hfi_fcdns_req_portid, tvb, offset+1, 3, tvb_fc_to_str (tvb, offset+1)); - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, - offset+4, 8, - tvb_fcwwn_to_str (tvb, offset+4)); + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, + offset+4, 8, ENC_NA); } } } @@ -1243,9 +1227,8 @@ dissect_fcdns_ripnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) { int offset = 16; /* past the fc_ct header */ - if (req_tree && isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + if (isreq) { + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, ENC_NA); proto_tree_add_item (req_tree, &hfi_fcdns_req_ip, tvb, offset+8, 16, ENC_NA); } } @@ -1256,9 +1239,8 @@ dissect_fcdns_rsnnnn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) int offset = 16; /* past the fc_ct header */ guint8 len; - if (req_tree && isreq) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + if (isreq) { + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, ENC_NA); len = tvb_get_guint8 (tvb, offset+8); proto_tree_add_item (req_tree, &hfi_fcdns_req_snamelen, tvb, offset+8, @@ -1350,8 +1332,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) 1, ENC_BIG_ENDIAN); proto_tree_add_string (tree, &hfi_fcdns_rply_portid, tvb, offset+5, 3, tvb_fc_to_str (tvb, offset+5)); - proto_tree_add_string (tree, &hfi_fcdns_rply_pname, tvb, offset+8, 8, - tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item (tree, &hfi_fcdns_rply_pname, tvb, offset+8, 8, ENC_NA); offset += 16; if (!(objfmt & 0x1)) { len = tvb_get_guint8 (tvb, offset); @@ -1361,8 +1342,7 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) offset+1, len, ENC_ASCII|ENC_NA); offset += 256; } - proto_tree_add_string (tree, &hfi_fcdns_rply_nname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, &hfi_fcdns_rply_nname, tvb, offset, 8, ENC_NA); offset += 8; if (!(objfmt & 0x1)) { len = tvb_get_guint8 (tvb, offset); @@ -1379,8 +1359,8 @@ dissect_fcdns_swils_entries (tvbuff_t *tvb, proto_tree *tree, int offset) dissect_fc4type(tree, tvb, offset+28, &hfi_fcdns_rply_gft); proto_tree_add_item (tree, &hfi_fcdns_rply_ipport, tvb, offset+60, 16, ENC_NA); - proto_tree_add_string (tree, &hfi_fcdns_rply_fpname, tvb, offset+76, - 8, tvb_fcwwn_to_str (tvb, offset+76)); + proto_tree_add_item (tree, &hfi_fcdns_rply_fpname, tvb, offset+76, + 8, ENC_NA); proto_tree_add_string (tree, &hfi_fcdns_rply_hrdaddr, tvb, offset+85, 3, tvb_fc_to_str (tvb, offset+85)); offset += 88; @@ -1428,10 +1408,7 @@ dissect_fcdns_gepn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) { int offset = 16; /* past the fc_ct header */ if (isreq) { - if (req_tree) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_pname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); - } + proto_tree_add_item(req_tree, &hfi_fcdns_req_pname, tvb, offset, 8, ENC_NA); } else { dissect_fcdns_swils_entries (tvb, req_tree, offset); @@ -1444,10 +1421,7 @@ dissect_fcdns_genn (tvbuff_t *tvb, proto_tree *req_tree, gboolean isreq) int offset = 16; /* past the fc_ct header */ if (isreq) { - if (req_tree) { - proto_tree_add_string (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); - } + proto_tree_add_item (req_tree, &hfi_fcdns_req_nname, tvb, offset, 8, ENC_NA); } else { dissect_fcdns_swils_entries (tvb, req_tree, offset); diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c index 4e015bae43..c91f2a9159 100644 --- a/epan/dissectors/packet-fcels.c +++ b/epan/dissectors/packet-fcels.c @@ -1194,10 +1194,8 @@ dissect_fcels_logi (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (cmnsvc_tree, hf_fcels_maxconseq, tvb, offset+12, 2, ENC_BIG_ENDIAN); proto_tree_add_item (cmnsvc_tree, hf_fcels_reloffset, tvb, offset+14, 2, ENC_BIG_ENDIAN); proto_tree_add_item (cmnsvc_tree, hf_fcels_edtov, tvb, offset+16, 4, ENC_BIG_ENDIAN); - proto_tree_add_string (cmnsvc_tree, hf_fcels_npname, tvb, offset+20, 8, - tvb_fcwwn_to_str (tvb, offset+20)); - proto_tree_add_string (cmnsvc_tree, hf_fcels_fnname, tvb, offset+28, 8, - tvb_fcwwn_to_str (tvb, offset+28)); + proto_tree_add_item (cmnsvc_tree, hf_fcels_npname, tvb, offset+20, 8, ENC_NA); + proto_tree_add_item (cmnsvc_tree, hf_fcels_fnname, tvb, offset+28, 8, ENC_NA); /* Add subtree for class paramters */ offset = 36; @@ -1266,8 +1264,7 @@ 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, tvb_fc_to_str (tvb, offset)); - proto_tree_add_string (logo_tree, hf_fcels_npname, tvb, offset+3, 6, - tvb_fcwwn_to_str (tvb, offset+3)); + proto_tree_add_item (logo_tree, hf_fcels_npname, tvb, offset+3, 6, ENC_NA); } } @@ -1411,10 +1408,8 @@ dissect_fcels_adisc (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_string (adisc_tree, hf_fcels_hardaddr, tvb, offset, 3, tvb_fc_to_str (tvb, offset)); - proto_tree_add_string (adisc_tree, hf_fcels_npname, tvb, offset+3, 8, - tvb_fcwwn_to_str (tvb, offset+3)); - proto_tree_add_string (adisc_tree, hf_fcels_fnname, tvb, offset+11, 8, - tvb_fcwwn_to_str (tvb, offset+11)); + proto_tree_add_item (adisc_tree, hf_fcels_npname, tvb, offset+3, 8, ENC_NA); + proto_tree_add_item (adisc_tree, hf_fcels_fnname, tvb, offset+11, 8, ENC_NA); proto_tree_add_string (adisc_tree, hf_fcels_nportid, tvb, offset+20, 3, tvb_fc_to_str (tvb, offset+20)); } @@ -1441,14 +1436,12 @@ dissect_fcels_farp (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, offset+4, 1, ENC_BIG_ENDIAN); proto_tree_add_string (farp_tree, hf_fcels_resportid, tvb, offset+5, 3, tvb_fc_to_str (tvb, offset+5)); - proto_tree_add_string (farp_tree, hf_fcels_npname, tvb, offset+8, - 8, tvb_fcwwn_to_str (tvb, offset+8)); - proto_tree_add_string (farp_tree, hf_fcels_fnname, tvb, offset+16, - 8, tvb_fcwwn_to_str (tvb, offset+16)); - proto_tree_add_string (farp_tree, hf_fcels_respname, tvb, offset+24, - 8, tvb_fcwwn_to_str (tvb, offset+24)); - proto_tree_add_string (farp_tree, hf_fcels_respnname, tvb, offset+32, - 8, tvb_fcwwn_to_str (tvb, offset+32)); + proto_tree_add_item (farp_tree, hf_fcels_npname, tvb, offset+8, 8, ENC_NA); + proto_tree_add_item (farp_tree, hf_fcels_fnname, tvb, offset+16, 8, ENC_NA); + proto_tree_add_item (farp_tree, hf_fcels_respname, tvb, offset+24, + 8, ENC_NA); + proto_tree_add_item (farp_tree, hf_fcels_respnname, tvb, offset+32, + 8, ENC_NA); proto_tree_add_item (farp_tree, hf_fcels_reqipaddr, tvb, offset+40, 16, ENC_NA); proto_tree_add_item (farp_tree, hf_fcels_respipaddr, tvb, offset+56, @@ -1490,8 +1483,7 @@ dissect_fcels_rps (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (rps_tree, hf_fcels_opcode, tvb, offset-3, 1, ENC_BIG_ENDIAN); if (flag & 0x2) { - proto_tree_add_string (rps_tree, hf_fcels_npname, tvb, offset+1, - 8, tvb_fcwwn_to_str (tvb, offset+1)); + proto_tree_add_item (rps_tree, hf_fcels_npname, tvb, offset+1, 8, ENC_NA); } else if (flag & 0x1) { proto_tree_add_item (rps_tree, hf_fcels_rps_portnum, tvb, @@ -1555,7 +1547,7 @@ dissect_fcels_rpl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(pb_tree, hf_fcels_rpl_physical_port, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_string(pb_tree, hf_fcels_rpl_port_identifier, tvb, offset+5, 3, tvb_fc_to_str (tvb, offset+5)); - proto_tree_add_string(pb_tree, hf_fcels_rpl_port_name, tvb, offset+8, 8, tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item(pb_tree, hf_fcels_rpl_port_name, tvb, offset+8, 8, ENC_NA); offset += 16; } } @@ -1577,10 +1569,9 @@ dissect_fcels_fan (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_string (fan_tree, hf_fcels_fabricaddr, tvb, offset, 3, tvb_fc_to_str (tvb, offset)); - proto_tree_add_string (fan_tree, hf_fcels_fabricpname, tvb, offset+3, - 8, tvb_fcwwn_to_str (tvb, offset)); - proto_tree_add_string (fan_tree, hf_fcels_fnname, tvb, offset+11, 8, - tvb_fcwwn_to_str (tvb, offset+11)); + proto_tree_add_item (fan_tree, hf_fcels_fabricpname, tvb, offset+3, + 8, ENC_NA); + proto_tree_add_item (fan_tree, hf_fcels_fnname, tvb, offset+11, 8, ENC_NA); } } @@ -1896,10 +1887,8 @@ dissect_fcels_cbind (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (cbind_tree, hf_fcels_cbind_ifcp_version, tvb, offset+7, 1, ENC_BIG_ENDIAN); proto_tree_add_item (cbind_tree, hf_fcels_cbind_userinfo, tvb, offset+8, 4, ENC_BIG_ENDIAN); - proto_tree_add_string (cbind_tree, hf_fcels_cbind_snpname, 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, - tvb_fcwwn_to_str (tvb, offset+20)); + proto_tree_add_item (cbind_tree, hf_fcels_cbind_snpname, tvb, offset+12, 8, ENC_NA); + proto_tree_add_item (cbind_tree, hf_fcels_cbind_dnpname, tvb, offset+20, 8, ENC_NA); switch(tvb_reported_length(tvb)){ case 32: /* 28 byte Request + 4 bytes FC CRC */ @@ -1970,12 +1959,10 @@ dissect_fcels_rnid (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item (rnid_tree, hf_fcels_spidlen, tvb, offset+7, 1, ENC_BIG_ENDIAN); if (clen) { - proto_tree_add_string (rnid_tree, hf_fcels_npname, tvb, - offset+8, 8, - tvb_fcwwn_to_str (tvb, offset+8)); - proto_tree_add_string (rnid_tree, hf_fcels_fnname, tvb, - offset+16, 8, - tvb_fcwwn_to_str (tvb, offset+16)); + proto_tree_add_item (rnid_tree, hf_fcels_npname, tvb, + offset+8, 8, ENC_NA); + proto_tree_add_item (rnid_tree, hf_fcels_fnname, tvb, + offset+16, 8, ENC_NA); } if (tvb_get_guint8 (tvb, offset+4) == 0xDF) { /* Decode the Specific Node ID Format as this is known */ @@ -2358,10 +2345,10 @@ proto_register_fcels (void) { &hf_fcels_edtov, {"E_D_TOV", "fcels.edtov", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_npname, - {"N_Port Port_Name", "fcels.npname", FT_STRING, BASE_NONE, NULL, 0x0, + {"N_Port Port_Name", "fcels.npname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_fnname, - {"Fabric/Node Name", "fcels.fnname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Fabric/Node Name", "fcels.fnname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, #if 0 { &hf_fcels_cls1param, @@ -2412,7 +2399,7 @@ proto_register_fcels (void) {"Fabric Address", "fcels.faddr", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_fabricpname, - {"Fabric Port Name", "fcels.fpname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Fabric Port Name", "fcels.fpname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_failedrcvr, {"Failed Receiver AL_PA", "fcels.faildrcvr", FT_UINT8, BASE_HEX, NULL, @@ -2445,10 +2432,10 @@ proto_register_fcels (void) {"Responding Port ID", "fcels.resportid", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_respname, - {"Responding Port Name", "fcels.respname", FT_STRING, BASE_NONE, + {"Responding Port Name", "fcels.respname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_respnname, - {"Responding Node Name", "fcels.respnname", FT_STRING, BASE_NONE, + {"Responding Node Name", "fcels.respnname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_reqipaddr, {"Requesting IP Address", "fcels.reqipaddr", FT_IPv6, BASE_NONE, @@ -2549,10 +2536,10 @@ proto_register_fcels (void) {"UserInfo", "fcels.cbind.userinfo", FT_UINT32, BASE_HEX, NULL, 0x0, "Userinfo token", HFILL}}, { &hf_fcels_cbind_snpname, - {"Source N_Port Port_Name", "fcels.cbind.snpname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Source N_Port Port_Name", "fcels.cbind.snpname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_cbind_dnpname, - {"Destination N_Port Port_Name", "fcels.cbind.dnpname", FT_STRING, BASE_NONE, NULL, 0x0, + {"Destination N_Port Port_Name", "fcels.cbind.dnpname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcels_cbind_status, {"Status", "fcels.cbind.status", FT_UINT16, BASE_DEC, @@ -2740,7 +2727,7 @@ proto_register_fcels (void) { &hf_fcels_rpl_index_of_i_port_block, { "Index of I Port Block", "fcels.rpl.index_of_i_port_block", FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_fcels_rpl_physical_port, { "Physical Port #", "fcels.rpl.physical_port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_fcels_rpl_port_identifier, { "Port Identifier", "fcels.rpl.port_identifier", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, - { &hf_fcels_rpl_port_name, { "Port Name", "fcels.rpl.port_name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_fcels_rpl_port_name, { "Port Name", "fcels.rpl.port_name", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_fcels_rscn_page_len, { "Page Len", "fcels.rscn.page_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_fcels_rscn_payload_len, { "Payload Len", "fcels.rscn.payload_len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_fcels_rnft_max_size, { "Max Size", "fcels.rnft.max_size", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c index 4c57509dfd..57c2e6ae17 100644 --- a/epan/dissectors/packet-fcfcs.c +++ b/epan/dissectors/packet-fcfcs.c @@ -136,8 +136,7 @@ dissect_fcfcs_giel (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) numelem); offset += 4; for (i = 0; i < numelem; i++) { - proto_tree_add_string (tree, hf_fcs_iename, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+11, 1, ENC_BIG_ENDIAN); offset += 12; } @@ -151,8 +150,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { proto_tree_add_item (tree, hf_fcs_ietype, tvb, offset+3, 1, ENC_BIG_ENDIAN); @@ -167,8 +165,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { proto_tree_add_item (tree, hf_fcs_iedomainid, tvb, offset+1, 1, ENC_BIG_ENDIAN); @@ -183,8 +180,7 @@ 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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { proto_tree_add_string (tree, hf_fcs_mgmtid, tvb, offset+1, 3, @@ -200,12 +196,10 @@ 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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { - proto_tree_add_string (tree, hf_fcs_fabricname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_fabricname, tvb, offset, 8, ENC_NA); } } } @@ -217,8 +211,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { proto_tree_add_text (tree, tvb, offset, 1, "Name Length: %d", @@ -237,8 +230,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -265,8 +257,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { tot_len = tvb_get_guint8 (tvb, offset+3); @@ -309,8 +300,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -320,8 +310,7 @@ dissect_fcfcs_gpl (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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); proto_tree_add_item (tree, hf_fcs_portmodtype, tvb, offset+9, 1, ENC_BIG_ENDIAN); proto_tree_add_item (tree, hf_fcs_porttxtype, tvb, offset+10, @@ -341,8 +330,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); } else { proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, ENC_BIG_ENDIAN); @@ -357,8 +345,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); } else { proto_tree_add_item (tree, hf_fcs_physportnum, tvb, offset, 4, ENC_NA); @@ -374,8 +361,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); } else { numelem = tvb_get_ntohl (tvb, offset); @@ -384,8 +370,7 @@ dissect_fcfcs_gapnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) numelem); offset += 4; for (i = 0; i < numelem; i++) { - proto_tree_add_string (tree, hf_fcs_portname, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); proto_tree_add_item (tree, hf_fcs_portflags, tvb, offset+10, 1, ENC_BIG_ENDIAN); proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+11, @@ -403,8 +388,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_portname, tvb, offset, 8, ENC_NA); } else { proto_tree_add_item (tree, hf_fcs_porttype, tvb, offset+3, 1, ENC_BIG_ENDIAN); @@ -433,8 +417,8 @@ dissect_fcfcs_gplnl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) numelem); offset += 4; for (i = 0; i < numelem; i++) { - proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, - 8, tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset, + 8, ENC_NA); offset += 8; } } @@ -501,8 +485,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset, 8, ENC_NA); } else { len = tvb_get_guint8 (tvb, offset); @@ -546,8 +529,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_iename, tvb, offset, 8, ENC_NA); len = tvb_get_guint8 (tvb, offset+8); proto_tree_add_text (tree, tvb, offset+8, 1, "Logical Name Length: %d", len); @@ -589,8 +571,7 @@ dissect_fcfcs_rpl (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) numelem); offset += 4; for (i = 0; i < numelem; i++) { - proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset, - 8, tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset, 8, ENC_NA); offset += 8; } } @@ -609,8 +590,8 @@ dissect_fcfcs_rpln (tvbuff_t *tvb, proto_tree *tree, gboolean isreq) proto_tree_add_uint (tree, hf_fcs_platformname_len, tvb, offset, 1, len); proto_tree_add_item (tree, hf_fcs_platformname, tvb, offset+1, len, ENC_NA); - proto_tree_add_string (tree, hf_fcs_platformnname, tvb, offset+256, - 8, tvb_fcwwn_to_str (tvb, offset+256)); + proto_tree_add_item (tree, hf_fcs_platformnname, tvb, offset+256, + 8, ENC_NA); } } } @@ -677,8 +658,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, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item(tree, hf_fcs_platformnname, tvb, offset, 8, ENC_NA); } } } @@ -981,7 +961,7 @@ proto_register_fcfcs (void) {"Opcode", "fcs.opcode", FT_UINT16, BASE_HEX, VALS (fc_fcs_opcode_val), 0x0, NULL, HFILL}}, { &hf_fcs_iename, - {"Interconnect Element Name", "fcs.ie.name", FT_STRING, BASE_NONE, + {"Interconnect Element Name", "fcs.ie.name", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_ietype, {"Interconnect Element Type", "fcs.ie.type", FT_UINT8, BASE_HEX, @@ -993,7 +973,7 @@ proto_register_fcfcs (void) {"Interconnect Element Mgmt. ID", "fcs.ie.mgmtid", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_fabricname, - {"Interconnect Element Fabric Name", "fcs.ie.fname", FT_STRING, + {"Interconnect Element Fabric Name", "fcs.ie.fname", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_mgmtaddr, {"Interconnect Element Mgmt. Address", "fcs.ie.mgmtaddr", FT_STRING, @@ -1008,7 +988,7 @@ proto_register_fcfcs (void) {"Model Name/Number", "fcs.modelname", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_portname, - {"Port Name", "fcs.port.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, + {"Port Name", "fcs.port.name", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_portmodtype, {"Port Module Type", "fcs.port.moduletype", FT_UINT8, BASE_HEX, @@ -1035,7 +1015,7 @@ proto_register_fcfcs (void) {"Platform Name", "fcs.platform.name", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_platformnname, - {"Platform Node Name", "fcs.platform.nodename", FT_STRING, BASE_NONE, + {"Platform Node Name", "fcs.platform.nodename", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcs_platformtype, {"Platform Type", "fcs.platform.type", FT_UINT8, BASE_HEX, diff --git a/epan/dissectors/packet-fcip.c b/epan/dissectors/packet-fcip.c index ecb94f07b4..b0c90bb0c8 100644 --- a/epan/dissectors/packet-fcip.c +++ b/epan/dissectors/packet-fcip.c @@ -349,8 +349,7 @@ static void dissect_fcip_sf (tvbuff_t *tvb, proto_tree *tree, gint offset) { if (tree) { - proto_tree_add_string (tree, hf_fcip_src_wwn, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); + proto_tree_add_item (tree, hf_fcip_src_wwn, tvb, offset, 8, ENC_NA); proto_tree_add_item (tree, hf_fcip_src_entity_id, tvb, offset+8, 8, ENC_NA); proto_tree_add_item (tree, hf_fcip_conn_nonce, tvb, offset+16, 8, @@ -358,8 +357,7 @@ dissect_fcip_sf (tvbuff_t *tvb, proto_tree *tree, gint offset) /* XXX - break out these flags */ proto_tree_add_item (tree, hf_fcip_conn_flags, tvb, offset+24, 1, ENC_BIG_ENDIAN); proto_tree_add_item (tree, hf_fcip_conn_code, tvb, offset+26, 2, ENC_BIG_ENDIAN); - proto_tree_add_string (tree, hf_fcip_dst_wwn, tvb, offset+30, 8, - tvb_fcwwn_to_str (tvb, offset+30)); + proto_tree_add_item (tree, hf_fcip_dst_wwn, tvb, offset+30, 8, ENC_NA); proto_tree_add_item (tree, hf_fcip_katov, tvb, offset+38, 4, ENC_BIG_ENDIAN); } } @@ -595,10 +593,10 @@ proto_register_fcip (void) {"Pflags (1's Complement)", "fcip.pflagsc", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}}, { &hf_fcip_src_wwn, - {"Source Fabric WWN", "fcip.srcwwn", FT_STRING, BASE_NONE, + {"Source Fabric WWN", "fcip.srcwwn", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcip_dst_wwn, - {"Destination Fabric WWN", "fcip.dstwwn", FT_STRING, BASE_NONE, + {"Destination Fabric WWN", "fcip.dstwwn", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_fcip_src_entity_id, {"FC/FCIP Entity Id", "fcip.srcid", FT_BYTES, BASE_NONE, diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c index 72487b5566..28a5e44506 100644 --- a/epan/dissectors/packet-fcsp.c +++ b/epan/dissectors/packet-fcsp.c @@ -233,8 +233,8 @@ static void dissect_fcsp_dhchap_challenge(tvbuff_t *tvb, proto_tree *tree) name_len = tvb_get_ntohs(tvb, offset+2); if (name_type == FC_AUTH_NAME_TYPE_WWN) { - proto_tree_add_string(tree, hf_auth_responder_wwn, tvb, offset+4, - 8, tvb_fcwwn_to_str(tvb, offset+4)); + proto_tree_add_item(tree, hf_auth_responder_wwn, tvb, offset+4, + 8, ENC_NA); } else { proto_tree_add_item(tree, hf_auth_responder_name, tvb, offset+4, @@ -322,8 +322,7 @@ static void dissect_fcsp_auth_negotiate(tvbuff_t *tvb, proto_tree *tree) name_len = tvb_get_ntohs(tvb, offset+2); if (name_type == FC_AUTH_NAME_TYPE_WWN) { - proto_tree_add_string(tree, hf_auth_initiator_wwn, tvb, offset+4, 8, - tvb_fcwwn_to_str(tvb, offset+4)); + proto_tree_add_item(tree, hf_auth_initiator_wwn, tvb, offset+4, 8, ENC_NA); } else { proto_tree_add_item(tree, hf_auth_initiator_name, tvb, offset+4, @@ -464,7 +463,7 @@ proto_register_fcsp(void) { &hf_auth_initiator_wwn, { "Initiator Name (WWN)", "fcsp.initwwn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_auth_initiator_name, @@ -499,7 +498,7 @@ proto_register_fcsp(void) { &hf_auth_responder_wwn, { "Responder Name (WWN)", "fcsp.rspwwn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_auth_responder_name, diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index e01b83c82c..482a0bbb65 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -720,39 +720,36 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g { /* Set up structures needed to add the protocol subtree and manage it */ - int offset = 0; - const gchar *flags; - fcswils_elp elp; - /* Response i.e. SW_ACC for an ELP has the same format as the request */ /* We skip the initial 4 bytes as we don't care about the opcode */ - tvb_memcpy(tvb, (guint8 *)&elp, 4, FC_SWILS_ELP_SIZE); - - elp.r_a_tov = g_ntohl(elp.r_a_tov); - elp.e_d_tov = g_ntohl(elp.e_d_tov); - elp.isl_flwctrl_mode = g_ntohs(elp.isl_flwctrl_mode); - elp.flw_ctrl_parmlen = g_ntohs(elp.flw_ctrl_parmlen); + int offset = 4; + const gchar *flags; + guint32 r_a_tov; + guint32 e_d_tov; + guint16 isl_flwctrl_mode; + guint8 clsf_svcparm[6], cls1_svcparm[2], cls2_svcparm[2], cls3_svcparm[2]; if (elp_tree) { offset += 4; proto_tree_add_item(elp_tree, hf_swils_elp_rev, tvb, offset++, 1, ENC_BIG_ENDIAN); proto_tree_add_item(elp_tree, hf_swils_elp_flags, tvb, offset, 2, ENC_NA); offset += 3; + r_a_tov = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_r_a_tov, tvb, offset, 4, - elp.r_a_tov, "%d msecs", elp.r_a_tov); + r_a_tov, "%d msecs", r_a_tov); offset += 4; + e_d_tov = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_e_d_tov, tvb, offset, 4, - elp.e_d_tov, "%d msecs", elp.e_d_tov); + e_d_tov, "%d msecs", e_d_tov); offset += 4; - proto_tree_add_string(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8, - fcwwn_to_str(elp.req_epname)); + proto_tree_add_item(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8, ENC_NA); offset += 8; - proto_tree_add_string(elp_tree, hf_swils_elp_req_esn, tvb, offset, 8, - fcwwn_to_str(elp.req_sname)); + proto_tree_add_item(elp_tree, hf_swils_elp_req_esn, tvb, offset, 8, ENC_NA); offset += 8; - if (elp.clsf_svcparm[0] & 0x80) { - if (elp.clsf_svcparm[4] & 0x20) { + tvb_memcpy(tvb, clsf_svcparm, offset, 6); + if (clsf_svcparm[0] & 0x80) { + if (clsf_svcparm[4] & 0x20) { flags="Class F Valid | X_ID Interlock"; } else { flags="Class F Valid | No X_ID Interlk"; @@ -761,7 +758,7 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g flags="Class F Invld"; } proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_clsf_svcp, tvb, offset, 6, - &elp.clsf_svcparm[0], "(%s)", flags); + clsf_svcparm, "(%s)", flags); offset += 6; proto_tree_add_item(elp_tree, hf_swils_elp_clsf_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -773,7 +770,8 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g proto_tree_add_item(elp_tree, hf_swils_elp_clsf_openseq, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 4; - if (elp.cls1_svcparm[0] & 0x80) { + tvb_memcpy(tvb, cls1_svcparm, offset, 2); + if (cls1_svcparm[0] & 0x80) { #define MAX_FLAGS_LEN 40 char *flagsbuf; gint stroff, returned_length; @@ -784,15 +782,15 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, "Class 1 Valid"); stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff); - if (elp.cls1_svcparm[0] & 0x40) { + if (cls1_svcparm[0] & 0x40) { returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IMX"); stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff); } - if (elp.cls1_svcparm[0] & 0x20) { + if (cls1_svcparm[0] & 0x20) { returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IPS"); stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff); } - if (elp.cls1_svcparm[0] & 0x10) { + if (cls1_svcparm[0] & 0x10) { /*returned_length =*/ g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | LKS"); } flags=flagsbuf; @@ -804,13 +802,14 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls1_svcp, tvb, offset, 2, NULL, "(%s)", flags); offset += 2; - if (elp.cls1_svcparm[0] & 0x80) { + if (cls1_svcparm[0] & 0x80) { proto_tree_add_item(elp_tree, hf_swils_elp_cls1_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN); } offset += 2; - if (elp.cls2_svcparm[0] & 0x80) { - if (elp.cls2_svcparm[0] & 0x08) { + tvb_memcpy(tvb, cls2_svcparm, offset, 2); + if (cls2_svcparm[0] & 0x80) { + if (cls2_svcparm[0] & 0x08) { flags="Class 2 Valid | Seq Delivery"; } else { @@ -822,17 +821,18 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g } proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls2_svcp, tvb, offset, 2, - &elp.cls2_svcparm[0], + cls2_svcparm, "(%s)", flags); offset += 2; - if (elp.cls2_svcparm[0] & 0x80) { + if (cls2_svcparm[0] & 0x80) { proto_tree_add_item(elp_tree, hf_swils_elp_cls2_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN); } offset += 2; - if (elp.cls3_svcparm[0] & 0x80) { - if (elp.cls3_svcparm[0] & 0x08) { + tvb_memcpy(tvb, cls3_svcparm, offset, 2); + if (cls3_svcparm[0] & 0x80) { + if (cls3_svcparm[0] & 0x08) { flags="Class 3 Valid | Seq Delivery"; } else { @@ -843,17 +843,18 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g flags="Class 3 Invld"; } proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls3_svcp, tvb, offset, 2, - &elp.cls3_svcparm[0], + cls3_svcparm, "(%s)", flags); offset += 2; - if (elp.cls3_svcparm[0] & 0x80) { + if (cls3_svcparm[0] & 0x80) { proto_tree_add_item(elp_tree, hf_swils_elp_cls3_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN); } offset += 22; + isl_flwctrl_mode = tvb_get_ntohs(tvb, offset); proto_tree_add_string(elp_tree, hf_swils_elp_isl_fc_mode, tvb, offset, 2, - val_to_str_const(elp.isl_flwctrl_mode, fcswils_elp_fc_val, "Vendor Unique")); + val_to_str_const(isl_flwctrl_mode, fcswils_elp_fc_val, "Vendor Unique")); offset += 2; proto_tree_add_item(elp_tree, hf_swils_elp_fcplen, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -878,20 +879,20 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint proto_tree *lrec_tree; proto_item *rec_item; int num_listrec = 0; - int offset = 0; - fcswils_efp efp; + int offset = 1; /* Skip opcode */ + guint8 reclen; + guint16 payload_len; guint8 rec_type; + reclen = tvb_get_guint8(tvb, offset); + rec_item = proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, reclen); offset += 1; - efp.reclen = tvb_get_guint8(tvb, offset); - 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) { + payload_len = tvb_get_ntohs(tvb, offset); + if (payload_len < FC_SWILS_EFP_SIZE) { proto_tree_add_uint_format_value(efp_tree, hf_swils_efp_payload_len, - tvb, offset, 2, efp.payload_len, + tvb, offset, 2, payload_len, "%u (bogus, must be >= %u)", - efp.payload_len, FC_SWILS_EFP_SIZE); + payload_len, FC_SWILS_EFP_SIZE); return; } proto_tree_add_item(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -899,18 +900,16 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint 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); - proto_tree_add_string(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, - 8, fcwwn_to_str(efp.pswitch_name)); + proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, 8, ENC_NA); offset += 8; - if (efp.reclen == 0) { + if (reclen == 0) { expert_add_info(pinfo, rec_item, &ei_swils_efp_record_len); return; } /* Add List Records now */ if (efp_tree) { - num_listrec = (efp.payload_len - FC_SWILS_EFP_SIZE)/efp.reclen; + num_listrec = (payload_len - FC_SWILS_EFP_SIZE)/reclen; while (num_listrec-- > 0) { rec_type = tvb_get_guint8(tvb, offset); lrec_tree = proto_tree_add_subtree(efp_tree, tvb, offset, -1, @@ -924,15 +923,14 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint case FC_SWILS_LRECTYPE_DOMAIN: proto_tree_add_item(lrec_tree, hf_swils_efp_dom_id, tvb, offset+1, 1, ENC_BIG_ENDIAN); - proto_tree_add_string(lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8, - tvb_fcwwn_to_str(tvb, offset+8)); + proto_tree_add_item(lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8, ENC_NA); break; case FC_SWILS_LRECTYPE_MCAST: proto_tree_add_item(lrec_tree, hf_swils_efp_mcast_grpno, tvb, offset+1, 1, ENC_BIG_ENDIAN); break; } - offset += efp.reclen; + offset += reclen; } } } @@ -944,8 +942,8 @@ dissect_swils_dia(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *dia_tree, g int offset = 0; if (dia_tree) { - proto_tree_add_string(dia_tree, hf_swils_dia_switch_name, tvb, offset+4, - 8, tvb_fcwwn_to_str(tvb, offset+4)); + proto_tree_add_item(dia_tree, hf_swils_dia_switch_name, tvb, offset+4, + 8, ENC_NA); } } @@ -960,8 +958,7 @@ dissect_swils_rdi(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rdi_tree, g plen = tvb_get_ntohs(tvb, offset+2); proto_tree_add_item(rdi_tree, hf_swils_rdi_payload_len, tvb, offset+2, 2, ENC_BIG_ENDIAN); - proto_tree_add_string(rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4, - 8, tvb_fcwwn_to_str(tvb, offset+4)); + proto_tree_add_item(rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4, 8, ENC_NA); /* 12 is the length of the initial header and 4 is the size of each * domain request record. @@ -1162,10 +1159,8 @@ dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree, proto_tree_add_item(dev_tree, hf_swils_rscn_portstate, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_string(dev_tree, hf_swils_rscn_portid, tvb, offset+1, 3, tvb_fc_to_str(tvb, offset+1)); - proto_tree_add_string(dev_tree, hf_swils_rscn_pwwn, tvb, offset+4, 8, - tvb_fcwwn_to_str(tvb, offset+4)); - proto_tree_add_string(dev_tree, hf_swils_rscn_nwwn, tvb, offset+12, 8, - tvb_fcwwn_to_str(tvb, offset+12)); + proto_tree_add_item(dev_tree, hf_swils_rscn_pwwn, tvb, offset+4, 8, ENC_NA); + proto_tree_add_item(dev_tree, hf_swils_rscn_nwwn, tvb, offset+12, 8, ENC_NA); offset += 20; } } @@ -1856,12 +1851,12 @@ proto_register_fcswils(void) { &hf_swils_elp_req_epn, {"Req Eport Name", "swils.elp.reqepn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_elp_req_esn, {"Req Switch Name", "swils.elp.reqesn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_elp_clsf_svcp, @@ -1966,7 +1961,7 @@ proto_register_fcswils(void) { &hf_swils_efp_switch_name, {"Switch Name", "swils.efp.sname", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_efp_mcast_grpno, @@ -1998,12 +1993,12 @@ proto_register_fcswils(void) { &hf_swils_efp_pswitch_name, {"Principal Switch Name", "swils.efp.psname", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_dia_switch_name, {"Switch Name", "swils.dia.sname", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_rdi_payload_len, @@ -2013,7 +2008,7 @@ proto_register_fcswils(void) { &hf_swils_rdi_req_sname, {"Req Switch Name", "swils.rdi.reqsn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, #if 0 @@ -2150,12 +2145,12 @@ proto_register_fcswils(void) { &hf_swils_rscn_pwwn, {"Port WWN", "swils.rscn.pwwn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_rscn_nwwn, {"Node WWN", "swils.rscn.nwwn", - FT_STRING, BASE_NONE, NULL, 0x0, + FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_swils_esc_swvendorid, diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c index 7a20ce8b02..d035da40f1 100644 --- a/epan/dissectors/packet-fip.c +++ b/epan/dissectors/packet-fip.c @@ -465,10 +465,8 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case FIP_DT_NAME: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_name, &item); - text = tvb_fcwwn_to_str(desc_tvb, 4); - proto_tree_add_string(subtree, hf_fip_desc_name, - desc_tvb, 4, 8, text); - proto_item_append_text(item, "%s", text); + proto_tree_add_item(subtree, hf_fip_desc_name, desc_tvb, 4, 8, ENC_NA); + proto_item_append_text(item, "%s", tvb_fcwwn_to_str(desc_tvb, 4)); break; case FIP_DT_FAB: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_fab, &item); @@ -477,10 +475,8 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) text = tvb_fc_to_str(desc_tvb, 5); proto_tree_add_string(subtree, hf_fip_desc_fab_map, desc_tvb, 5, 3, text); - text = tvb_fcwwn_to_str(desc_tvb, 8); - proto_tree_add_string(subtree, hf_fip_desc_fab_name, - desc_tvb, 8, 8, text); - proto_item_append_text(item, "%s", text); + proto_tree_add_item(subtree, hf_fip_desc_fab_name, desc_tvb, 8, 8, ENC_NA); + proto_item_append_text(item, "%s", tvb_fcwwn_to_str(desc_tvb, 8)); break; case FIP_DT_FCOE_SIZE: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_mdl, &item); @@ -507,9 +503,8 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) 2, 6, ENC_NA); proto_tree_add_item(subtree, hf_fip_desc_vn_fid, desc_tvb, 9, 3, ENC_BIG_ENDIAN); - text = tvb_fcwwn_to_str(desc_tvb, 12); - proto_tree_add_string(subtree, hf_fip_desc_vn_wwpn, - desc_tvb, 12, 8, text); + proto_tree_add_item(subtree, hf_fip_desc_vn_wwpn, + desc_tvb, 12, 8, ENC_NA); proto_item_append_text(item, "MAC %s FC_ID %6.6x", tvb_bytes_to_ep_str_punct(desc_tvb, 2, 6, ':'), tvb_get_ntoh24(desc_tvb, 9)); @@ -668,7 +663,7 @@ proto_register_fip(void) { &hf_fip_desc_name, { "Switch or Node Name", "fip.name", - FT_STRING, BASE_NONE, NULL, 0, + FT_FCWWN, BASE_NONE, NULL, 0, NULL, HFILL}}, { &hf_fip_desc_fab_vfid, @@ -683,7 +678,7 @@ proto_register_fip(void) { &hf_fip_desc_fab_name, { "Fabric Name", "fip.fab.name", - FT_STRING, BASE_NONE, NULL, 0, + FT_FCWWN, BASE_NONE, NULL, 0, NULL, HFILL}}, { &hf_fip_desc_fcoe_size, @@ -703,7 +698,7 @@ proto_register_fip(void) { &hf_fip_desc_vn_wwpn, { "Port Name", "fip.vn.pwwn", - FT_STRING, BASE_NONE, NULL, 0, + FT_FCWWN, BASE_NONE, NULL, 0, NULL, HFILL}}, { &hf_fip_desc_fka, diff --git a/epan/dissectors/packet-ipfc.c b/epan/dissectors/packet-ipfc.c index e78ab281b3..9108671239 100644 --- a/epan/dissectors/packet-ipfc.c +++ b/epan/dissectors/packet-ipfc.c @@ -74,10 +74,8 @@ dissect_ipfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) "IP Over FC Network_Header"); ipfc_tree = proto_item_add_subtree (ti, ett_ipfc); - proto_tree_add_string (ipfc_tree, hf_ipfc_network_da, tvb, offset, 8, - tvb_fcwwn_to_str (tvb, offset)); - proto_tree_add_string (ipfc_tree, hf_ipfc_network_sa, tvb, offset+8, 8, - tvb_fcwwn_to_str (tvb, offset+8)); + proto_tree_add_item (ipfc_tree, hf_ipfc_network_da, tvb, offset, 8, ENC_NA); + proto_tree_add_item (ipfc_tree, hf_ipfc_network_sa, tvb, offset+8, 8, ENC_NA); } next_tvb = tvb_new_subset_remaining (tvb, 16); @@ -97,10 +95,10 @@ proto_register_ipfc (void) /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &hf_ipfc_network_da, - {"Network DA", "ipfc.nh.da", FT_STRING, BASE_NONE, NULL, + {"Network DA", "ipfc.nh.da", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, { &hf_ipfc_network_sa, - {"Network SA", "ipfc.nh.sa", FT_STRING, BASE_NONE, NULL, + {"Network SA", "ipfc.nh.sa", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL}}, }; diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 1506353964..1feb1cf912 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -2757,7 +2757,7 @@ dissect_scsi_evpd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_tree_add_item(evpd_tree, hf_scsi_inq_evpd_devid_identifier_str, tvb, offset, idlen, ENC_NA|ENC_ASCII); } } else if (codeset == CODESET_BINARY && identifier_type == DEVID_TYPE_WWN) { - proto_tree_add_string(evpd_tree, hf_scsi_wwn, tvb, offset, plen, tvb_fcwwn_to_str(tvb, offset)); + proto_tree_add_item(evpd_tree, hf_scsi_wwn, tvb, offset, plen, ENC_NA); } else { /* * XXX - decode this based on the identifier type, @@ -3405,7 +3405,7 @@ dissect_spc_extcopy(tvbuff_t *tvb, packet_info *pinfo _U_, offset += 1; proto_tree_add_bytes_format(cscd_desc_tree, hf_scsi_designator, tvb, offset, 20, NULL, "Designator (20 bytes, zero padded, used length %u)", des_len); if (code_set == CODESET_BINARY && des_type == DEVID_TYPE_WWN) { /* des_type 3 = WWN */ - proto_tree_add_string(cscd_desc_tree, hf_scsi_wwn, tvb, offset, des_len, tvb_fcwwn_to_str(tvb, offset)); + proto_tree_add_item(cscd_desc_tree, hf_scsi_wwn, tvb, offset, des_len, ENC_NA); } offset += 20; dev_tree = proto_tree_add_subtree(cscd_tree, tvb, offset, 4, ett_scsi_xcopy_dev_params, NULL, "Device type specific parameters"); @@ -7371,7 +7371,7 @@ proto_register_scsi(void) { &hf_scsi_recv_copy_inline_data_gran, { "Inline data granularity", "scsi.recv_copy.inline_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_recv_copy_held_data_gran, { "Held data granularity", "scsi.recv_copy.held_data_gran", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_recv_copy_implemented_desc_list_len, { "Implemented description list length", "scsi.recv_copy.implemented_desc_list_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - { &hf_scsi_wwn, { "WWN", "scsi.wwn", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_scsi_wwn, { "WWN", "scsi.wwn", FT_FCWWN, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_designator, { "Designator", "scsi.designator", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_segment_descriptor_length, { "Segment descriptor length (bytes)", "scsi.segment_descriptor_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_scsi_inline_data, { "Inline data", "scsi.inline_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 8231406f38..5c2a094156 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -185,6 +185,12 @@ ether_fvalue_set(fvalue_t *fv, const guint8 *value) common_fvalue_set(fv, value, FT_ETHER_LEN); } +static void +fcwwn_fvalue_set(fvalue_t *fv, const guint8 *value) +{ + common_fvalue_set(fv, value, FT_FCWWN_LEN); +} + static void oid_fvalue_set(fvalue_t *fv, GByteArray *value) { @@ -453,12 +459,36 @@ system_id_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_valu return TRUE; } - /* XXX - need better validation of Vines address */ + /* XXX - need better validation of OSI System-ID address */ logfunc("\"%s\" is not a valid OSI System-ID.", s); return FALSE; } +static gboolean +fcwwn_from_unparsed(fvalue_t *fv, const char *s, gboolean allow_partial_value _U_, LogFunc logfunc) +{ + /* + * Don't log a message if this fails; we'll try looking it + * up as another way if it does, and if that fails, + * we'll log a message. + */ + if (bytes_from_unparsed(fv, s, TRUE, NULL)) { + if (fv->value.bytes->len > FT_FCWWN_LEN) { + logfunc("\"%s\" contains too many bytes to be a valid FCWWN.", + s); + return FALSE; + } + + return TRUE; + } + + /* XXX - need better validation of FCWWN address */ + + logfunc("\"%s\" is not a valid FCWWN.", s); + return FALSE; +} + static guint len(fvalue_t *fv) { @@ -1008,6 +1038,49 @@ ftype_register_bytes(void) slice, }; + static ftype_t fcwwc_type = { + FT_FCWWN, /* ftype */ + "FT_FCWWN", /* name */ + "Fibre Channel WWN", /* pretty_name */ + FT_FCWWN_LEN, /* wire_size */ + bytes_fvalue_new, /* new_value */ + bytes_fvalue_free, /* free_value */ + fcwwn_from_unparsed, /* val_from_unparsed */ + NULL, /* val_from_string */ + bytes_to_repr, /* val_to_string_repr */ + bytes_repr_len, /* len_string_repr */ + + NULL, /* set_value_byte_array */ + fcwwn_fvalue_set, /* set_value_bytes */ + NULL, /* set_value_guid */ + NULL, /* set_value_time */ + NULL, /* set_value_string */ + NULL, /* set_value_tvbuff */ + NULL, /* set_value_uinteger */ + NULL, /* set_value_sinteger */ + NULL, /* set_value_integer64 */ + NULL, /* set_value_floating */ + + value_get, /* get_value */ + NULL, /* get_value_uinteger */ + NULL, /* get_value_sinteger */ + NULL, /* get_value_integer64 */ + NULL, /* get_value_floating */ + + cmp_eq, + cmp_ne, + cmp_gt, + cmp_ge, + cmp_lt, + cmp_le, + cmp_bitwise_and, + cmp_contains, + CMP_MATCHES, + + len, + slice, + }; + ftype_register(FT_BYTES, &bytes_type); ftype_register(FT_UINT_BYTES, &uint_bytes_type); ftype_register(FT_AX25, &ax25_type); @@ -1016,4 +1089,5 @@ ftype_register_bytes(void) ftype_register(FT_OID, &oid_type); ftype_register(FT_REL_OID, &rel_oid_type); ftype_register(FT_SYSTEM_ID, &system_id_type); + ftype_register(FT_FCWWN, &fcwwc_type); } diff --git a/epan/ftypes/ftypes-int.h b/epan/ftypes/ftypes-int.h index 68065d85a9..e78917f036 100644 --- a/epan/ftypes/ftypes-int.h +++ b/epan/ftypes/ftypes-int.h @@ -34,6 +34,7 @@ ftype_register(enum ftenum ftype, ftype_t *ft); * that I don't mind doing it by hand for now. */ void ftype_register_bytes(void); void ftype_register_double(void); +void ftype_register_fc(void); void ftype_register_integers(void); void ftype_register_ipv4(void); void ftype_register_ipv6(void); diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index 53042778f2..46a25fbb1b 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -69,6 +69,7 @@ enum ftenum { FT_REL_OID, /* RELATIVE-OID */ FT_SYSTEM_ID, FT_STRINGZPAD, /* for use with proto_tree_add_item() */ + FT_FCWWN, FT_NUM_TYPES /* last item number plus one */ }; @@ -86,6 +87,7 @@ enum ftenum { #define FT_EUI64_LEN 8 #define FT_AX25_ADDR_LEN 7 #define FT_VINES_ADDR_LEN 6 +#define FT_FCWWN_LEN 8 typedef enum ftenum ftenum_t; diff --git a/epan/proto.c b/epan/proto.c index bb666270f0..20f5eadf83 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -226,6 +226,8 @@ proto_tree_set_ipv6(field_info *fi, const guint8* value_ptr); static void proto_tree_set_ipv6_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length); static void +proto_tree_set_fcwwn_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length); +static void proto_tree_set_guid(field_info *fi, const e_guid_t *value_ptr); static void proto_tree_set_guid_tvb(field_info *fi, tvbuff_t *tvb, gint start, const guint encoding); @@ -1756,6 +1758,14 @@ proto_tree_new_item(field_info *new_fi, proto_tree *tree, proto_tree_set_ipv6_tvb(new_fi, tvb, start, length); break; + case FT_FCWWN: + if (length != FT_FCWWN_LEN) { + length_error = length < FT_FCWWN_LEN ? TRUE : FALSE; + report_type_length_mismatch(tree, "an FCWWN address", length, length_error); + } + proto_tree_set_fcwwn_tvb(new_fi, tvb, start, length); + break; + case FT_AX25: if (length != 7) { length_error = length < 7 ? TRUE : FALSE; @@ -2810,6 +2820,20 @@ proto_tree_set_ipv6_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length) proto_tree_set_ipv6(fi, tvb_get_ptr(tvb, start, length)); } +/* Set the FT_FCWWN value */ +static void +proto_tree_set_fcwwn(field_info *fi, const guint8* value_ptr) +{ + DISSECTOR_ASSERT(value_ptr != NULL); + fvalue_set_bytes(&fi->value, value_ptr); +} + +static void +proto_tree_set_fcwwn_tvb(field_info *fi, tvbuff_t *tvb, gint start, gint length) +{ + proto_tree_set_fcwwn(fi, tvb_get_ptr(tvb, start, length)); +} + /* Add a FT_GUID to a proto_tree */ proto_item * proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, @@ -4364,6 +4388,12 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence, offset_r = (int)strlen(result); break; + case FT_FCWWN: + SET_ADDRESS (&addr, AT_FCWWN, FCWWN_ADDR_LEN, fvalue_get(&finfo->value)); + address_to_str_buf(&addr, result+offset_r, size-offset_r); + offset_r = (int)strlen(result); + break; + case FT_ETHER: offset_r += protoo_strlcpy(result+offset_r, bytes_to_ep_str_punct((const guint8 *)fvalue_get(&finfo->value), @@ -6085,6 +6115,16 @@ proto_item_fill_label(field_info *fi, gchar *label_str) ep_address_to_str(&addr)); break; + case FT_FCWWN: + addr.type = AT_FCWWN; + addr.len = FCWWN_ADDR_LEN; + addr.data = (guint8 *)fvalue_get(&fi->value); + + g_snprintf(label_str, ITEM_LABEL_LENGTH, + "%s: %s", hfinfo->name, + ep_address_to_str( &addr )); + break; + case FT_GUID: guid = (e_guid_t *)fvalue_get(&fi->value); label_fill(label_str, 0, hfinfo, guid_to_ep_str(guid)); diff --git a/epan/to_str.h b/epan/to_str.h index fa43290e0f..0f1ab5b559 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -31,13 +31,14 @@ #include "ws_symbol_export.h" #include "wmem/wmem.h" -#define GUID_STR_LEN 37 -#define MAX_IP_STR_LEN 16 -#define MAX_IP6_STR_LEN 40 +#define GUID_STR_LEN 37 +#define MAX_IP_STR_LEN 16 +#define MAX_IP6_STR_LEN 40 #define MAX_ADDR_STR_LEN 256 -#define VINES_ADDR_LEN 6 -#define EUI64_STR_LEN 24 -#define AX25_ADDR_LEN 7 +#define VINES_ADDR_LEN 6 +#define EUI64_STR_LEN 24 +#define AX25_ADDR_LEN 7 +#define FCWWN_ADDR_LEN 8 #ifdef __cplusplus extern "C" { @@ -56,7 +57,6 @@ WS_DLL_PUBLIC void address_to_str_buf(const address *addr, gchar *buf, int b WS_DLL_PUBLIC const gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset); WS_DLL_PUBLIC const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset); void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len); -extern gchar* fcwwn_to_str (const guint8 *); WS_DLL_PUBLIC const gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset); WS_DLL_PUBLIC gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset); diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c index b07e98aa1a..6abbd1ccad 100644 --- a/epan/wslua/wslua_field.c +++ b/epan/wslua/wslua_field.c @@ -141,6 +141,14 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) { pushAddress(L,ipv6); return 1; } + case FT_FCWWN: { + Address fcwwn = (Address)g_malloc(sizeof(address)); + fcwwn->type = AT_FCWWN; + fcwwn->len = fi->ws_fi->length; + fcwwn->data = tvb_memdup(NULL,fi->ws_fi->ds_tvb,fi->ws_fi->start,fi->ws_fi->length); + pushAddress(L,fcwwn); + return 1; + } case FT_IPXNET:{ Address ipx = (Address)g_malloc(sizeof(address)); ipx->type = AT_IPX; diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index ce6c49291e..8e974a46e6 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -491,6 +491,7 @@ static const wslua_ft_types_t ftenums[] = { {"ftypes.SYSTEM_ID", FT_SYSTEM_ID}, {"ftypes.REL_OID", FT_REL_OID}, {"ftypes.EUI64", FT_EUI64}, + {"ftypes.FCWWN", FT_FCWWN}, {NULL, FT_NONE} }; @@ -849,6 +850,8 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) { case FT_SYSTEM_ID: case FT_REL_OID: case FT_EUI64: + case FT_VINES: + case FT_FCWWN: if (base != BASE_NONE) { WSLUA_OPTARG_ERROR(ProtoField_new,BASE,"Base must be base.NONE"); return 0; diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c index 141229611a..193727d1cc 100644 --- a/epan/wslua/wslua_tree.c +++ b/epan/wslua/wslua_tree.c @@ -373,6 +373,8 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) { case FT_OID: case FT_REL_OID: case FT_SYSTEM_ID: + case FT_VINES: + case FT_FCWWN: default: luaL_error(L,"FT_ not yet supported"); return 0; diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl index 4f205d3009..f616a8f1fa 100755 --- a/tools/checkAPIs.pl +++ b/tools/checkAPIs.pl @@ -1466,7 +1466,6 @@ my @TvbPtrAPIs = ( 'proto_tree_add_bytes_format_value', 'proto_tree_add_ether', # Use the tvb_* version of these: - 'fcwwn_to_str', # Use tvb_bytes_to_str[_punct] instead of: 'bytes_to_str', 'bytes_to_str_punct', diff --git a/ui/gtk/packet_win.c b/ui/gtk/packet_win.c index 59ba1676a1..9c193f0cfa 100644 --- a/ui/gtk/packet_win.c +++ b/ui/gtk/packet_win.c @@ -641,9 +641,10 @@ not_supported: FT_INT64, FT_UINT64, ; should work with FT_INT[8,16,24,32] code FT_FLOAT, FT_DOUBLE, FT_IPXNET, FT_IPv6, FT_ETHER, - FT_GUID, FT_OID, FT_SYSTEM_ID + FT_GUID, FT_OID, FT_SYSTEM_ID, FT_UINT_STRING, - FT_ABSOLUTE_TIME, FT_RELATIVE_TIME + FT_ABSOLUTE_TIME, FT_RELATIVE_TIME, + FT_VINES, FT_FCWWN, */ fvalue_edit = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(fvalue_edit), "");