aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-01-21 02:48:55 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-01-21 02:48:55 +0000
commit6e0fcb7ab5d1e24abfdd80eb51e4537b5b2dd191 (patch)
treeb0e59e8026e85564d0963662dbd4e08a5738bea0
parent03066d08202df49fab3daaa84287dea16cdd3510 (diff)
Introduce, and start using, tvb_eth_to_str().
Export tvb_*_to_str() and put them in alphabetical order. svn path=/trunk/; revision=35602
-rw-r--r--epan/address_to_str.c6
-rw-r--r--epan/dissectors/packet-atm.c2
-rw-r--r--epan/dissectors/packet-cdp.c12
-rw-r--r--epan/dissectors/packet-ipx.c2
-rw-r--r--epan/dissectors/packet-ismp.c2
-rw-r--r--epan/dissectors/packet-mactelnet.c4
-rw-r--r--epan/dissectors/packet-nbns.c2
-rw-r--r--epan/dissectors/packet-netbios.c4
-rw-r--r--epan/dissectors/packet-nlsp.c42
-rw-r--r--epan/dissectors/packet-ppp.c2
-rw-r--r--epan/dissectors/packet-radius.c2
-rw-r--r--epan/dissectors/packet-trmac.c2
-rw-r--r--epan/dissectors/packet-vines.c2
-rw-r--r--epan/libwireshark.def7
-rw-r--r--epan/to_str.h1
15 files changed, 51 insertions, 41 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c
index d3cf15fab3..0ffc6ab7b2 100644
--- a/epan/address_to_str.c
+++ b/epan/address_to_str.c
@@ -91,6 +91,12 @@ ether_to_str(const guint8 *ad)
return bytestring_to_str(ad, 6, ':');
}
+gchar *
+tvb_ether_to_str(tvbuff_t *tvb, const gint offset)
+{
+ return bytestring_to_str(tvb_get_ptr(tvb, offset, 6), 6, ':');
+}
+
/*
This function is very fast and this function is called a lot.
XXX update the ep_address_to_str stuff to use this function.
diff --git a/epan/dissectors/packet-atm.c b/epan/dissectors/packet-atm.c
index 67ca855a75..0f670f0b25 100644
--- a/epan/dissectors/packet-atm.c
+++ b/epan/dissectors/packet-atm.c
@@ -220,7 +220,7 @@ dissect_lan_destination(tvbuff_t *tvb, int offset, const char *type, proto_tree
case TAG_MAC_ADDRESS:
proto_tree_add_text(dest_tree, tvb, offset, 6, "MAC address: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
break;
case TAG_ROUTE_DESCRIPTOR:
diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c
index 7c5c6b86b4..a3200d48c4 100644
--- a/epan/dissectors/packet-cdp.c
+++ b/epan/dissectors/packet-cdp.c
@@ -501,10 +501,10 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_get_guint8(tvb, offset+20));
proto_tree_add_text(tlv_tree, tvb, offset+21, 6,
"Cluster Commander MAC: %s",
- ether_to_str(tvb_get_ptr(tvb, offset+21, 6)));
+ tvb_ether_to_str(tvb, offset+21));
proto_tree_add_text(tlv_tree, tvb, offset+27, 6,
"Switch's MAC: %s",
- ether_to_str(tvb_get_ptr(tvb, offset+27, 6)));
+ tvb_ether_to_str(tvb, offset+27));
proto_tree_add_text(tlv_tree, tvb, offset+33, 1,
"UNKNOWN: 0x%02X",
tvb_get_guint8(tvb, offset+33));
@@ -893,7 +893,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case TYPE_SPARE_POE:
if (tree) {
- tlvi = proto_tree_add_text(cdp_tree, tvb, offset, length,
+ tlvi = proto_tree_add_text(cdp_tree, tvb, offset, length,
"Spare Pair PoE");
tlv_tree = proto_item_add_subtree(tlvi, ett_cdp_tlv);
@@ -1176,8 +1176,8 @@ dissect_nrgyz_tlv(tvbuff_t *tvb, int offset, guint16 length, guint16 num,
}
static void
-dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length,
- proto_tree *tree)
+dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length,
+ proto_tree *tree)
{
proto_item *ti;
proto_tree *tlv_tree;
@@ -1188,7 +1188,7 @@ dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length,
}
tlv_data = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_text(tree, tvb, offset, length,
+ ti = proto_tree_add_text(tree, tvb, offset, length,
"Spare Pair PoE: 0x%02x", tlv_data);
tlv_tree = proto_item_add_subtree(ti, ett_cdp_spare_poe_tlv);
diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c
index 4eb1cb35cf..ee73bca51a 100644
--- a/epan/dissectors/packet-ipx.c
+++ b/epan/dissectors/packet-ipx.c
@@ -1266,7 +1266,7 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_text(s_tree, tvb, cursor+50, 4, "Network: %s",
ipxnet_to_string(tvb_get_ptr(tvb, cursor+50, 4)));
proto_tree_add_text(s_tree, tvb, cursor+54, 6, "Node: %s",
- ether_to_str(tvb_get_ptr(tvb, cursor+54, 6)));
+ tvb_ether_to_str(tvb, cursor+54));
server_port = tvb_get_ntohs(tvb, cursor+60);
proto_tree_add_text(s_tree, tvb, cursor+60, 2, "Socket: %s (0x%04x)",
socket_text(server_port),
diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c
index 4fbe4b5090..da82c80f37 100644
--- a/epan/dissectors/packet-ismp.c
+++ b/epan/dissectors/packet-ismp.c
@@ -260,7 +260,7 @@ dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp
col_add_fstr(pinfo->cinfo, COL_INFO, "MIP %s, MMAC %s, ifIdx %d",
tvb_ip_to_str(tvb, offset+2),
- ether_to_str(tvb_get_ptr(tvb, offset+6, 6)),
+ tvb_ether_to_str(tvb, offset+6),
tvb_get_ntohl(tvb, offset+12));
proto_tree_add_item(edp_tree, hf_ismp_edp_version, tvb, offset, 2, FALSE);
diff --git a/epan/dissectors/packet-mactelnet.c b/epan/dissectors/packet-mactelnet.c
index 91f4a12302..7a9e58f79c 100644
--- a/epan/dissectors/packet-mactelnet.c
+++ b/epan/dissectors/packet-mactelnet.c
@@ -125,8 +125,8 @@ dissect_mactelnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
type = tvb_get_guint8(tvb, 1);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s > %s Type: %s",
- ether_to_str(tvb_get_ptr(tvb, 2, 6)),
- ether_to_str(tvb_get_ptr(tvb, 8, 6)),
+ tvb_ether_to_str(tvb, 2),
+ tvb_ether_to_str(tvb, 8),
val_to_str(type, packettypenames, "Unknown Type:0x%02x"));
if (tree) {
diff --git a/epan/dissectors/packet-nbns.c b/epan/dissectors/packet-nbns.c
index 0c7993f843..e99839cad3 100644
--- a/epan/dissectors/packet-nbns.c
+++ b/epan/dissectors/packet-nbns.c
@@ -775,7 +775,7 @@ dissect_nbns_answer(tvbuff_t *tvb, int offset, int nbns_data_offset,
}
proto_tree_add_text(rr_tree, tvb, cur_offset, 6,
"Unit ID: %s",
- ether_to_str(tvb_get_ptr(tvb, cur_offset, 6)));
+ tvb_ether_to_str(tvb, cur_offset));
cur_offset += 6;
data_len -= 6;
diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c
index 600f082da6..e63bb01246 100644
--- a/epan/dissectors/packet-netbios.c
+++ b/epan/dissectors/packet-netbios.c
@@ -686,7 +686,7 @@ dissect_netb_datagram( tvbuff_t *tvb, int offset, proto_tree *tree)
if (tvb_memeql(tvb, offset + NB_SENDER_NAME, zeroes, 10) == 0) {
proto_tree_add_text( tree, tvb, offset + NB_SENDER_NAME + 10, 6,
"Sender's MAC Address: %s",
- ether_to_str( tvb_get_ptr( tvb,offset + NB_SENDER_NAME + 10, 6)));
+ tvb_ether_to_str(tvb, offset + NB_SENDER_NAME + 10));
} else {
netbios_add_name("Sender's Name", tvb, offset + NB_SENDER_NAME,
tree);
@@ -705,7 +705,7 @@ dissect_netb_datagram_bcast( tvbuff_t *tvb, int offset, proto_tree *tree)
if (tvb_memeql(tvb, offset + NB_SENDER_NAME, zeroes, 10) == 0) {
proto_tree_add_text( tree, tvb, offset + NB_SENDER_NAME + 10, 6,
"Sender's Node Address: %s",
- ether_to_str( tvb_get_ptr( tvb,offset + NB_SENDER_NAME + 10, 6)));
+ tvb_ether_to_str(tvb, offset + NB_SENDER_NAME + 10));
} else {
netbios_add_name("Sender's Name", tvb, offset + NB_SENDER_NAME,
tree);
diff --git a/epan/dissectors/packet-nlsp.c b/epan/dissectors/packet-nlsp.c
index 3147a8021c..6697eba73e 100644
--- a/epan/dissectors/packet-nlsp.c
+++ b/epan/dissectors/packet-nlsp.c
@@ -307,7 +307,7 @@ dissect_neighbor_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Neighbor: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
length -= 6;
@@ -441,11 +441,11 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Sending Router System ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", System ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
@@ -481,7 +481,7 @@ nlsp_dissect_nlsp_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Designated Router System ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
proto_tree_add_text(tree, tvb, offset+6, 1,
"Designated Router Pseudonode ID: %u",
tvb_get_guint8(tvb, offset+6));
@@ -547,7 +547,7 @@ dissect_lsp_mgt_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Node number: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
length -= 6;
@@ -696,7 +696,7 @@ dissect_lsp_link_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Router System ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
proto_tree_add_text(tree, tvb, offset+6, 1,
"Router Pseudonode ID: %u",
tvb_get_guint8(tvb, offset+6));
@@ -811,7 +811,7 @@ dissect_lsp_svcs_info_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Node number: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
length -= 6;
@@ -1013,12 +1013,12 @@ nlsp_dissect_nlsp_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"LSP ID system ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
/* XXX - append the pseudonode ID */
@@ -1117,7 +1117,7 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
ti = proto_tree_add_text(tree, tvb, offset, 16,
"LSP-ID: %s, Sequence: 0x%08x, Lifetime: %5us, Checksum: 0x%04x",
- ether_to_str(tvb_get_ptr(tvb, offset+2, 6)), /* XXX - rest of system ID */
+ tvb_ether_to_str(tvb, offset+2), /* XXX - rest of system ID */
tvb_get_ntohl(tvb, offset+10),
tvb_get_ntohs(tvb, offset),
tvb_get_ntohs(tvb, offset+14));
@@ -1126,7 +1126,7 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
proto_tree_add_text(subtree, tvb, offset+2, 6,
"LSP ID source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset+2, 6)));
+ tvb_ether_to_str(tvb, offset+2));
proto_tree_add_text(subtree, tvb, offset+8, 1,
"LSP ID pseudonode ID: %u",
tvb_get_guint8(tvb, offset+8));
@@ -1166,7 +1166,7 @@ dissect_psnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
ti = proto_tree_add_text(tree, tvb, offset, 16,
"LSP-ID: %s, Sequence: 0x%08x, Lifetime: %5us, Checksum: 0x%04x",
- ether_to_str(tvb_get_ptr(tvb, offset+2, 6)), /* XXX - rest of system ID */
+ tvb_ether_to_str(tvb, offset+2), /* XXX - rest of system ID */
tvb_get_ntohl(tvb, offset+10),
tvb_get_ntohs(tvb, offset),
tvb_get_ntohs(tvb, offset+14));
@@ -1175,7 +1175,7 @@ dissect_psnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
proto_tree_add_text(subtree, tvb, offset+2, 6,
"LSP ID source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset+2, 6)));
+ tvb_ether_to_str(tvb, offset+2));
proto_tree_add_text(subtree, tvb, offset+8, 1,
"LSP ID pseudonode ID: %u",
tvb_get_guint8(tvb, offset+8));
@@ -1248,12 +1248,12 @@ nlsp_dissect_nlsp_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Source ID system ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
/* XXX - add the pseudonode ID */
@@ -1266,12 +1266,12 @@ nlsp_dissect_nlsp_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Start LSP ID source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
/* XXX - append the pseudonode ID */
@@ -1290,12 +1290,12 @@ nlsp_dissect_nlsp_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"End LSP ID source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
/* XXX - append the pseudonode ID */
@@ -1369,12 +1369,12 @@ nlsp_dissect_nlsp_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, ", Source ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
if (tree) {
proto_tree_add_text(tree, tvb, offset, 6,
"Source ID system ID: %s",
- ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ tvb_ether_to_str(tvb, offset));
}
offset += 6;
/* XXX - add the pseudonode ID */
diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c
index 71172e9e22..b01505e359 100644
--- a/epan/dissectors/packet-ppp.c
+++ b/epan/dissectors/packet-ppp.c
@@ -2121,7 +2121,7 @@ dissect_lcp_multilink_ep_disc_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
length, plurality(length, "", "s"));
} else {
proto_tree_add_text(field_tree, tvb, offset, length,
- "Address: %s", ether_to_str(tvb_get_ptr(tvb, offset, 6)));
+ "Address: %s", tvb_ether_to_str(tvb, offset));
}
break;
diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c
index 6a84d7d601..96520869b6 100644
--- a/epan/dissectors/packet-radius.c
+++ b/epan/dissectors/packet-radius.c
@@ -724,7 +724,7 @@ void radius_ether(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U
}
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
- proto_item_append_text(avp_item, "%s", ether_to_str(tvb_get_ptr(tvb, offset, len)));
+ proto_item_append_text(avp_item, "%s", tvb_ether_to_str(tvb, offset));
}
void radius_ifid(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c
index a2ccd2cfc3..698b20f637 100644
--- a/epan/dissectors/packet-trmac.c
+++ b/epan/dissectors/packet-trmac.c
@@ -181,7 +181,7 @@ sv_text(tvbuff_t *tvb, int svoff, proto_tree *tree)
case 0x0A: /* Address of last neighbor notification */
proto_tree_add_text(tree, tvb, svoff+1, sv_length-1,
"Address of Last Neighbor Notification: %s",
- ether_to_str(tvb_get_ptr(tvb, svoff+2, 6)));
+ tvb_ether_to_str(tvb, svoff+2));
break;
case 0x0B: /* Physical Location */
diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c
index f798db39c1..43658d21fc 100644
--- a/epan/dissectors/packet-vines.c
+++ b/epan/dissectors/packet-vines.c
@@ -1478,7 +1478,7 @@ rtp_show_gateway_info(proto_tree *tree, tvbuff_t *tvb, int offset,
proto_tree_add_text(tree, tvb, offset, link_addr_length,
"Preferred Gateway Data Link Address: %s",
link_addr_length == 6 ?
- ether_to_str(tvb_get_ptr(tvb, offset, link_addr_length)) :
+ tvb_ether_to_str(tvb, offset) :
tvb_bytes_to_str(tvb, offset, link_addr_length));
offset += link_addr_length;
}
diff --git a/epan/libwireshark.def b/epan/libwireshark.def
index 612f733cbb..05f27ff49a 100644
--- a/epan/libwireshark.def
+++ b/epan/libwireshark.def
@@ -614,10 +614,8 @@ InfoRequestNakReason_vals DATA
init_dissection
init_progfile_dir
ip6_to_str
-tvb_ip6_to_str
in_cksum
ip_to_str
-tvb_ip_to_str
ipprotostr
ipv4_get_net_order_addr
is_big_endian
@@ -1033,7 +1031,10 @@ tvb_bytes_to_str
tvb_bytes_to_str_punct
tvb_ensure_bytes_exist
tvb_ensure_length_remaining
+tvb_eth_to_str
tvb_fake_unicode
+tvb_fc_to_str
+tvb_fcwwm_to_str
tvb_find_guint8
tvb_find_line_end
tvb_find_line_end_unquoted
@@ -1077,6 +1078,8 @@ tvb_get_ntohs
tvb_get_ptr
tvb_get_string
tvb_get_stringz
+tvb_ip6_to_str
+tvb_ip_to_str
tvb_length
tvb_length_remaining
tvb_memcpy
diff --git a/epan/to_str.h b/epan/to_str.h
index 1b1c2b4ed9..3fc560cf1f 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -49,6 +49,7 @@ extern gchar* se_address_to_str(const address *);
extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
extern gchar* bytestring_to_str(const guint8 *, const guint32, const char);
extern gchar* ether_to_str(const guint8 *);
+extern gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset);
extern const gchar* ip_to_str(const guint8 *);
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);