aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2001-03-22 16:24:16 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2001-03-22 16:24:16 +0000
commita8b0c240e6a57e9bb3e696d871c02420b7594b01 (patch)
tree8dcce7638fb2b14aaa319ad72b530e33d6816dfd /epan
parent5175434166d0ec5f21a675c08af10c79a30f9e80 (diff)
Move appletalk- and sna-related address routines out of the dissectors
and into epan. svn path=/trunk/; revision=3160
Diffstat (limited to 'epan')
-rw-r--r--epan/Makefile.am6
-rw-r--r--epan/atalk-utils.c46
-rw-r--r--epan/atalk-utils.h53
-rw-r--r--epan/packet.c6
-rw-r--r--epan/sna-utils.c53
-rw-r--r--epan/sna-utils.h43
6 files changed, 203 insertions, 4 deletions
diff --git a/epan/Makefile.am b/epan/Makefile.am
index e3448e772d..c7e6204c81 100644
--- a/epan/Makefile.am
+++ b/epan/Makefile.am
@@ -2,7 +2,7 @@
# Automake file for the EPAN library
# (Ethereal Protocol ANalyzer Library)
#
-# $Id: Makefile.am,v 1.16 2001/02/01 20:21:15 gram Exp $
+# $Id: Makefile.am,v 1.17 2001/03/22 16:24:16 gram Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@@ -35,6 +35,8 @@ noinst_LIBRARIES = libethereal.a
INCLUDES = -I$(srcdir)/..
libethereal_a_SOURCES = \
+ atalk-utils.c \
+ atalk-utils.h \
bitswap.c \
bitswap.h \
conversation.c \
@@ -58,6 +60,8 @@ libethereal_a_SOURCES = \
proto.h \
resolv.c \
resolv.h \
+ sna-utils.c \
+ sna-utils.h \
strutil.c \
strutil.h \
tvbuff.c \
diff --git a/epan/atalk-utils.c b/epan/atalk-utils.c
new file mode 100644
index 0000000000..b6877da18a
--- /dev/null
+++ b/epan/atalk-utils.c
@@ -0,0 +1,46 @@
+/* atalk-utils.c
+ * Routines for Appletalk utilities (DDP, currently).
+ *
+ * $Id: atalk-utils.c,v 1.1 2001/03/22 16:24:16 gram Exp $
+ *
+ * Simon Wilkinson <sxw@dcs.ed.ac.uk>
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "atalk-utils.h"
+
+gchar *
+atalk_addr_to_str(const struct atalk_ddp_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, "%u.%u:%u", addrp->net, addrp->node, addrp->port);
+ return cur;
+}
+
diff --git a/epan/atalk-utils.h b/epan/atalk-utils.h
new file mode 100644
index 0000000000..258d1f8392
--- /dev/null
+++ b/epan/atalk-utils.h
@@ -0,0 +1,53 @@
+/* atalk-utils.h
+ * Definitions for Appletalk utilities (DDP, currently).
+ *
+ * $Id: atalk-utils.h,v 1.1 2001/03/22 16:24:16 gram 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.
+ */
+
+#ifndef __ATALK_UTILS_H__
+#define __ATALK_UTILS_H__
+
+#include <glib.h>
+#include <stdio.h>
+/*
+ * Structure used to represent a DDP address; gives the layout of the
+ * data pointed to by an AT_ATALK "address" structure.
+ */
+struct atalk_ddp_addr {
+ guint16 net;
+ guint8 node;
+ guint8 port;
+};
+
+/*
+ * DDP packet types.
+ */
+#define DDP_RTMPDATA 0x01
+#define DDP_NBP 0x02
+#define DDP_ATP 0x03
+#define DDP_AEP 0x04
+#define DDP_RTMPREQ 0x05
+#define DDP_ZIP 0x06
+#define DDP_ADSP 0x07
+#define DDP_EIGRP 0x58
+
+/*
+ * Routine to take a DDP address and generate a string.
+ */
+extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp);
+
+#endif
diff --git a/epan/packet.c b/epan/packet.c
index 2923d12334..3fa6e4a56b 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
- * $Id: packet.c,v 1.21 2001/03/15 06:41:13 guy Exp $
+ * $Id: packet.c,v 1.22 2001/03/22 16:24:16 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -73,10 +73,10 @@
#include "timestamp.h"
#include "file.h"
-#include "packet-atalk.h"
+#include "atalk-utils.h"
#include "packet-frame.h"
#include "packet-ipv6.h"
-#include "packet-sna.h"
+#include "sna-utils.h"
#include "packet-vines.h"
#include "packet-osi.h"
diff --git a/epan/sna-utils.c b/epan/sna-utils.c
new file mode 100644
index 0000000000..80f4b7597d
--- /dev/null
+++ b/epan/sna-utils.c
@@ -0,0 +1,53 @@
+/* packet-sna.c
+ * Routines for SNA
+ * Gilbert Ramirez <gram@xiexie.org>
+ *
+ * $Id: sna-utils.c,v 1.1 2001/03/22 16:24:16 gram Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@zing.org>
+ * Copyright 1998 Gerald Combs
+ *
+ *
+ * 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.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "sna-utils.h"
+
+/* 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;
+}
+
diff --git a/epan/sna-utils.h b/epan/sna-utils.h
new file mode 100644
index 0000000000..163446b039
--- /dev/null
+++ b/epan/sna-utils.h
@@ -0,0 +1,43 @@
+/* packet-sna.h
+ * Definitions for SNA dissection.
+ *
+ * $Id: sna-utils.h,v 1.1 2001/03/22 16:24:16 gram 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.
+ */
+
+#ifndef __SNA_UTILS__
+#define __SNA_UTILS__
+
+#include <glib.h>
+#include <stdio.h>
+
+/*
+ * 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);
+
+#endif