aboutsummaryrefslogtreecommitdiffstats
path: root/packet.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-11-27 04:01:43 +0000
committerGuy Harris <guy@alum.mit.edu>1999-11-27 04:01:43 +0000
commitad0cf4f6ef9398b72df0d39ddfb9d07d04c76a19 (patch)
treef578d70d9f04d356e5b3adabf73a091a8c369e80 /packet.c
parentb09955d91ddfc5e357d4845d2e8cf27b1b56f6c8 (diff)
downloadwireshark-ad0cf4f6ef9398b72df0d39ddfb9d07d04c76a19.tar.gz
wireshark-ad0cf4f6ef9398b72df0d39ddfb9d07d04c76a19.tar.bz2
wireshark-ad0cf4f6ef9398b72df0d39ddfb9d07d04c76a19.zip
ARP requests with a hardware type of ARPHRD_ATM2225 are ATM ARP
requests, as described in RFC 2225; they do *not* have the same format as regular ARP requests, so dissect them differently. Inverse ARP is also used on ATM, so add the Inverse ARP request and reply message types. (It's also used with other protocols, e.g. Frame Relay.) Handle zero-length addresses (meaning the address is absent). They can have up to 6 different address fields, so make "bytes_to_str()" have six static buffers in which it can return strings. svn path=/trunk/; revision=1123
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/packet.c b/packet.c
index fa9ee0ea5b..560c411cc8 100644
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.56 1999/11/20 05:35:14 gram Exp $
+ * $Id: packet.c,v 1.57 1999/11/27 04:01:42 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -225,22 +225,21 @@ time_secs_to_str(guint32 time)
#define MAX_BYTE_STR_LEN 20
/* Turn an array of bytes into a string showing the bytes in hex. */
+#define N_BYTES_TO_STR_STRINGS 6
gchar *
bytes_to_str(const guint8 *bd, int bd_len) {
- static gchar str[3][MAX_BYTE_STR_LEN+3+1];
- static gchar *cur;
+ static gchar str[N_BYTES_TO_STR_STRINGS][MAX_BYTE_STR_LEN+3+1];
+ static int cur_idx;
+ gchar *cur;
gchar *p;
int len;
static const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- if (cur == &str[0][0]) {
- cur = &str[1][0];
- } else if (cur == &str[1][0]) {
- cur = &str[2][0];
- } else {
- cur = &str[0][0];
- }
+ cur_idx++;
+ if (cur_idx >= N_BYTES_TO_STR_STRINGS)
+ cur_idx = 0;
+ cur = &str[cur_idx][0];
p = cur;
len = MAX_BYTE_STR_LEN;
while (bd_len > 0 && len > 0) {