aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-10-22 08:53:41 +0000
committerGuy Harris <guy@alum.mit.edu>1999-10-22 08:53:41 +0000
commite30a15f04ff01f31d0d6c86983271e8a9351866c (patch)
treee3b3c8f6c5a7516146e506129805fc5547813885
parent518c23417f5769e0222b3fbd1a37991509f2bf1e (diff)
Add support for SNA FID type 4 addresses to the code that handles the
"address" type. Use that in the SNA FID type 4 dissector. svn path=/trunk/; revision=915
-rw-r--r--file.c11
-rw-r--r--packet-sna.c45
-rw-r--r--packet-sna.h35
3 files changed, 80 insertions, 11 deletions
diff --git a/file.c b/file.c
index d8e920c183..30eb0af405 100644
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
- * $Id: file.c,v 1.112 1999/10/22 08:30:02 guy Exp $
+ * $Id: file.c,v 1.113 1999/10/22 08:53:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -95,6 +95,8 @@
#include "packet-ncp.h"
+#include "packet-sna.h"
+
extern GtkWidget *packet_list, *prog_bar, *info_bar, *byte_view, *tree_view;
extern guint file_ctx;
extern int sync_pipe[];
@@ -590,6 +592,7 @@ col_set_addr(frame_data *fd, int col, address *addr, gboolean is_res)
u_int ipv4_addr;
struct e_in6_addr ipv6_addr;
struct atalk_ddp_addr ddp_addr;
+ struct sna_fid_type_4_addr sna_fid_type_4_addr;
switch (addr->type) {
@@ -632,6 +635,12 @@ col_set_addr(frame_data *fd, int col, address *addr, gboolean is_res)
snprintf(fd->cinfo->col_data[col], COL_MAX_LEN, "%04X",
pntohs(&addr->data[0]));
break;
+
+ case SNA_FID_TYPE_4_ADDR_LEN:
+ memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
+ strncpy(fd->cinfo->col_data[col],
+ sna_fid_type_4_addr_to_str(&sna_fid_type_4_addr), COL_MAX_LEN);
+ break;
}
break;
diff --git a/packet-sna.c b/packet-sna.c
index 63b7f06af2..dcda63b615 100644
--- a/packet-sna.c
+++ b/packet-sna.c
@@ -2,7 +2,7 @@
* Routines for SNA
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-sna.c,v 1.6 1999/10/22 07:17:41 guy Exp $
+ * $Id: packet-sna.c,v 1.7 1999/10/22 08:53:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -34,6 +34,7 @@
#include <glib.h>
#include "packet.h"
+#include "packet-sna.h"
/*
* http://www.wanresources.com/snacell.html
@@ -524,6 +525,25 @@ dissect_fid3 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
/* FID Type 4 */
+
+gchar *
+sna_fid_type_4_addr_to_str(const struct sna_fid_type_4_addr *addrp)
+{
+ static gchar str[3][14];
+ static gchar *cur;
+
+ if (cur == &str[0][0]) {
+ cur = &str[1][0];
+ } else if (cur == &str[1][0]) {
+ cur = &str[2][0];
+ } else {
+ cur = &str[0][0];
+ }
+
+ sprintf(cur, "%08X.%04X", addrp->saf, addrp->ef);
+ return cur;
+}
+
static int
dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
@@ -533,6 +553,7 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
guint16 th_word;
guint16 def, oef, snf, dcf;
guint32 dsaf, osaf;
+ static struct sna_fid_type_4_addr src, dst;
static int bytes_in_header = 26;
@@ -547,15 +568,19 @@ dissect_fid4 (const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
snf = pntohs(&pd[offset+22]);
dcf = pntohs(&pd[offset+24]);
- /* Addresses in FID 2 are FT_UINT8 */
- if (check_col(fd, COL_RES_NET_DST))
- col_add_fstr(fd, COL_RES_NET_DST, "%08X.%04X", dsaf, def);
- if (check_col(fd, COL_UNRES_NET_DST))
- col_add_fstr(fd, COL_UNRES_NET_DST, "%08X.%04X", dsaf, def);
- if (check_col(fd, COL_RES_NET_SRC))
- col_add_fstr(fd, COL_RES_NET_SRC, "%08X.%04X", osaf, oef);
- if (check_col(fd, COL_RES_NET_SRC))
- col_add_fstr(fd, COL_UNRES_NET_SRC, "%08X.%04X", osaf, oef);
+ /* Addresses in FID 4 are discontiguous, sigh */
+ src.saf = osaf;
+ src.ef = oef;
+ dst.saf = dsaf;
+ dst.ef = def;
+ SET_ADDRESS(&pi.net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
+ (guint8 *)&src);
+ SET_ADDRESS(&pi.src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
+ (guint8 *)&src);
+ SET_ADDRESS(&pi.net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
+ (guint8 *)&dst);
+ SET_ADDRESS(&pi.dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
+ (guint8 *)&dst);
if (!tree) {
return bytes_in_header;
diff --git a/packet-sna.h b/packet-sna.h
new file mode 100644
index 0000000000..0159fbfeb3
--- /dev/null
+++ b/packet-sna.h
@@ -0,0 +1,35 @@
+/* packet-sna.h
+ * Definitions for SNA dissection.
+ *
+ * $Id: packet-sna.h,v 1.1 1999/10/22 08:53:41 guy Exp $
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Structure used to represent an FID Type 4 address; gives the layout of the
+ * data pointed to by an AT_SNA "address" structure if the size is
+ * SNA_FID_TYPE_4_ADDR_LEN.
+ */
+#define SNA_FID_TYPE_4_ADDR_LEN 6
+struct sna_fid_type_4_addr {
+ guint32 saf;
+ guint16 ef;
+};
+
+/*
+ * Routine to take an SNA FID Type 4 address and generate a string.
+ */
+extern gchar *sna_fid_type_4_addr_to_str(const struct sna_fid_type_4_addr *addrp);