diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-10-20 18:10:39 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-10-20 18:10:39 +0000 |
commit | de1ecee779f57d6bf8995b7c7ac1b971a8cc2ba2 (patch) | |
tree | aaf87a49ccff8900af31d437b255c3e6f3cd017f /packet-ipx.c | |
parent | 9e6172205a1be289fb3f391b1000cc40e3f06f79 (diff) |
Use "val_to_str()", rather than "match_strval()", in "socket_text()".
Make the source and destination socket fields enumerated types, so we
don't have to use "proto_tree_add_uint_format()" on them, and so that
you can match on them by service name.
Use lower-case letters when formatting the hex value of sockets; that's
what's done with fields not added with "proto_tree_add_XXX_format".
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4046 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ipx.c')
-rw-r--r-- | packet-ipx.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/packet-ipx.c b/packet-ipx.c index 0dd52c6f88..8b18400522 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez <gram@xiexie.org> * - * $Id: packet-ipx.c,v 1.89 2001/10/08 18:20:01 nneul Exp $ + * $Id: packet-ipx.c,v 1.90 2001/10/20 18:10:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -155,15 +155,7 @@ static const value_string ipx_socket_vals[] = { static const char* socket_text(guint16 socket) { - const char *p; - - p = match_strval(socket, ipx_socket_vals); - if (p) { - return p; - } - else { - return "Unknown"; - } + return val_to_str(socket, ipx_socket_vals, "Unknown"); } static const value_string ipx_packet_type_vals[] = { @@ -241,7 +233,7 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) SET_ADDRESS(&pinfo->dst, AT_IPX, 10, dst_net_node); if (check_col(pinfo->fd, COL_INFO)) - col_add_fstr(pinfo->fd, COL_INFO, "%s (0x%04X)", + col_add_fstr(pinfo->fd, COL_INFO, "%s (0x%04x)", socket_text(ipx_dsocket), ipx_dsocket); if (tree) { @@ -260,15 +252,13 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Destination */ proto_tree_add_item(ipx_tree, hf_ipx_dnet, tvb, 6, 4, FALSE); proto_tree_add_item(ipx_tree, hf_ipx_dnode, tvb, 10, 6, FALSE); - proto_tree_add_uint_format(ipx_tree, hf_ipx_dsocket, tvb, 16, 2, - ipx_dsocket, "Destination Socket: %s (0x%04X)", - socket_text(ipx_dsocket), ipx_dsocket); + proto_tree_add_uint(ipx_tree, hf_ipx_dsocket, tvb, 16, 2, + ipx_dsocket); /* Source */ proto_tree_add_item(ipx_tree, hf_ipx_snet, tvb, 18, 4, FALSE); proto_tree_add_item(ipx_tree, hf_ipx_snode, tvb, 22, 6, FALSE); - proto_tree_add_uint_format(ipx_tree, hf_ipx_ssocket, tvb, 28, 2, - ipx_ssocket, "Source Socket: %s (0x%04X)", socket_text(ipx_ssocket), + proto_tree_add_uint(ipx_tree, hf_ipx_ssocket, tvb, 28, 2, ipx_ssocket); } @@ -633,7 +623,7 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ipxnet_to_string((guint8*)tvb_get_ptr(tvb, cursor+50, 4))); proto_tree_add_text(s_tree, tvb, cursor+54, 6, "Node: %s", ether_to_str((guint8*)tvb_get_ptr(tvb, cursor+54, 6))); - proto_tree_add_text(s_tree, tvb, cursor+60, 2, "Socket: %s (0x%04X)", + proto_tree_add_text(s_tree, tvb, cursor+60, 2, "Socket: %s (0x%04x)", socket_text(server.server_port), server.server_port); proto_tree_add_text(s_tree, tvb, cursor+62, 2, "Intermediate Networks: %d", @@ -677,7 +667,8 @@ proto_register_ipx(void) "", HFILL }}, { &hf_ipx_dsocket, - { "Destination Socket", "ipx.dst.socket", FT_UINT16, BASE_HEX, NULL, 0x0, + { "Destination Socket", "ipx.dst.socket", FT_UINT16, BASE_HEX, + VALS(ipx_socket_vals), 0x0, "", HFILL }}, { &hf_ipx_snet, @@ -689,7 +680,8 @@ proto_register_ipx(void) "", HFILL }}, { &hf_ipx_ssocket, - { "Source Socket", "ipx.src.socket", FT_UINT16, BASE_HEX, NULL, 0x0, + { "Source Socket", "ipx.src.socket", FT_UINT16, BASE_HEX, + VALS(ipx_socket_vals), 0x0, "", HFILL }}, }; |