diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-11-20 05:35:15 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-11-20 05:35:15 +0000 |
commit | 2da6ff3be5d6c0fa312550e238049707b28c0777 (patch) | |
tree | b2d621b197a4d1522118d4a4e43906ede7c7b3c5 /packet.c | |
parent | 2f996a14984f2114256f3e31986a5a2f1a49753a (diff) | |
download | wireshark-2da6ff3be5d6c0fa312550e238049707b28c0777.tar.gz |
Enable ether name resolution for packet summary lines of IPX packets
(in the src/dst of the CList). In order to do this, I had to:
1. Add a new function, ether_to_str_punct(const guint8*, char) which
turns a 6-byt ether address into a string, using whatever punctuation
is passed as the char. If a null char is passed, no separator
is put between the hex digits. Unresolved IPX addresses look better
with the ether portion having no punctuation (IMHO)
2. Changed ether_to_str() to call ether_to_str_punct with ':' as the char
argument. That is, code abstraction.
3. MAXNAMELEN was moved from resolv.c to resolv.h so that packet-ipx.c
could see it.
4. A new resolve function, get_ether_name_if_known(), returns the resolved name
of an ether address, or NULL if there is none. This differs
from get_ether_name() by returning NULL rather than a text version
of the ether address.
svn path=/trunk/; revision=1076
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1,7 +1,7 @@ /* packet.c * Routines for packet disassembly * - * $Id: packet.c,v 1.55 1999/11/17 21:58:32 guy Exp $ + * $Id: packet.c,v 1.56 1999/11/20 05:35:14 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -76,8 +76,21 @@ static int hf_frame_capture_len = -1; static gint ett_frame = -1; +/* Wrapper for the most common case of asking + * for a string using a colon as the hex-digit separator. + */ +gchar * +ether_to_str(const guint8 *ad) +{ + return ether_to_str_punct(ad, ':'); +} + +/* Places char punct in the string as the hex-digit separator. + * If punct is '\0', no punctuation is applied (and thus + * the resulting string is 5 bytes shorter) + */ gchar * -ether_to_str(const guint8 *ad) { +ether_to_str_punct(const guint8 *ad, char punct) { static gchar str[3][18]; static gchar *cur; gchar *p; @@ -102,7 +115,8 @@ ether_to_str(const guint8 *ad) { *--p = hex_digits[octet&0xF]; if (i == 0) break; - *--p = ':'; + if (punct) + *--p = punct; i--; } return p; |