Move appletalk- and sna-related address routines out of the dissectors
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 22 Mar 2001 16:24:16 +0000 (16:24 +0000)
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 22 Mar 2001 16:24:16 +0000 (16:24 +0000)
and into epan.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3160 f5534014-38df-0310-8fa8-9805f1628bb7

12 files changed:
epan/Makefile.am
epan/atalk-utils.c [new file with mode: 0644]
epan/atalk-utils.h [new file with mode: 0644]
epan/packet.c
epan/sna-utils.c [new file with mode: 0644]
epan/sna-utils.h [new file with mode: 0644]
packet-atalk.c
packet-eigrp.c
packet-llc.c
packet-null.c
packet-ppp.c
packet-sna.c

index e3448e772d7bf1b23eafa6de116482f4006ae71f..c7e6204c81d6e43afc5255ebb9a3d7a5e429c313 100644 (file)
@@ -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 (file)
index 0000000..b6877da
--- /dev/null
@@ -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 (file)
index 0000000..258d1f8
--- /dev/null
@@ -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
index 2923d1233447689ec4ebc96df5772021982c0fc4..3fa6e4a56bb67e602dde507b7c816fb8d117230d 100644 (file)
@@ -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>
 #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 (file)
index 0000000..80f4b75
--- /dev/null
@@ -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 (file)
index 0000000..163446b
--- /dev/null
@@ -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
index 139dc0d7bc6d1e1f0070eff1a88808d57f5c3d38..54c9e77837704e8a72b0bf92c97027a606049b6b 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-atalk.c
  * Routines for Appletalk packet disassembly (DDP, currently).
  *
- * $Id: packet-atalk.c,v 1.51 2001/03/15 09:11:00 guy Exp $
+ * $Id: packet-atalk.c,v 1.52 2001/03/22 16:24:14 gram Exp $
  *
  * Simon Wilkinson <sxw@dcs.ed.ac.uk>
  *
 
 #include <glib.h>
 #include "packet.h"
-#include "packet-atalk.h"
 #include "etypes.h"
 #include "ppptypes.h"
 #include "aftypes.h"
+#include "atalk-utils.h"
 
 static int proto_ddp = -1;
 static int hf_ddp_hopcount = -1;
@@ -104,23 +104,6 @@ typedef struct _e_ddp {
 
 #define DDP_HEADER_SIZE 13
 
-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;
-}
 
 static const value_string op_vals[] = {
   {DDP_RTMPDATA, "AppleTalk Routing Table response or data" },
index a53bb69d3effd0f3ea725a7be9a26ba8f70f33d2..5546d77cc992deb0c595dfa52f8a992a64d58f80 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for EIGRP dissection
  * Copyright 2000, Paul Ionescu <paul@acorp.ro>
  *
- * $Id: packet-eigrp.c,v 1.12 2001/01/22 03:33:45 guy Exp $
+ * $Id: packet-eigrp.c,v 1.13 2001/03/22 16:24:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -40,7 +40,7 @@
 #include "packet.h"
 #include "resolv.h"
 
-#include "packet-atalk.h"
+#include "atalk-utils.h"
 #include "packet-ip.h"
 #include "packet-ipx.h"
 
index f4e7e3d5f99364d9c39cb4a31395aa5708bd5ea2..378eaa128ccf9199c7daae3ecc2c71aa4dc190ea 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for IEEE 802.2 LLC layer
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-llc.c,v 1.82 2001/01/21 22:51:46 guy Exp $
+ * $Id: packet-llc.c,v 1.83 2001/03/22 16:24:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -43,7 +43,7 @@
 #include "packet-ipx.h"
 #include "packet-netbios.h"
 #include "packet-osi.h"
-#include "packet-sna.h"
+#include "sna-utils.h"
 
 #include "packet-llc.h"
 
index d34ee770ddb3c64a205fde528434ecc656a4f606..c857cde8c1ff014bdfb8a95db04e622748d9a9e4 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-null.c
  * Routines for null packet disassembly
  *
- * $Id: packet-null.c,v 1.40 2001/01/22 00:20:29 guy Exp $
+ * $Id: packet-null.c,v 1.41 2001/03/22 16:24:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -41,7 +41,7 @@
 #include <string.h>
 #include "packet.h"
 #include "packet-null.h"
-#include "packet-atalk.h"
+#include "atalk-utils.h"
 #include "packet-ip.h"
 #include "packet-ipv6.h"
 #include "packet-ipx.h"
index 4433d8b688cb73aae305b8921e2b88e66fd9a9ac..868c2917bdb8e2151d4504075377bdddd10933eb 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ppp.c
  * Routines for ppp packet disassembly
  *
- * $Id: packet-ppp.c,v 1.56 2001/03/15 09:11:01 guy Exp $
+ * $Id: packet-ppp.c,v 1.57 2001/03/22 16:24:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -38,7 +38,7 @@
 #include "packet-ppp.h"
 #include "ppptypes.h"
 #include "etypes.h"
-#include "packet-atalk.h"
+#include "atalk-utils.h"
 #include "packet-chdlc.h"
 #include "packet-ip.h"
 #include "packet-ipv6.h"
index 5aa5ea89266630d88e1f9291de85e0b475572b8a..8dcf6dfdeadaea5f5432c2ee2e41452ff49032c7 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for SNA
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-sna.c,v 1.26 2001/03/13 21:34:24 gram Exp $
+ * $Id: packet-sna.c,v 1.27 2001/03/22 16:24:14 gram Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -35,7 +35,7 @@
 #include <glib.h>
 #include "packet.h"
 #include "llcsaps.h"
-#include "packet-sna.h"
+#include "sna-utils.h"
 
 /*
  * http://www.wanresources.com/snacell.html
@@ -550,25 +550,6 @@ dissect_fid3(tvbuff_t *tvb, proto_tree *tree)
        return bytes_in_header;
 }
 
-/* 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(tvbuff_t *tvb, proto_tree *tree)