Move appletalk- and sna-related address routines out of the dissectors

and into epan.

svn path=/trunk/; revision=3160
This commit is contained in:
Gilbert Ramirez 2001-03-22 16:24:16 +00:00
parent 5175434166
commit a8b0c240e6
12 changed files with 215 additions and 52 deletions

View 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 \

46
epan/atalk-utils.c Normal file
View File

@ -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;
}

53
epan/atalk-utils.h Normal file
View File

@ -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

View 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>
@ -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"

53
epan/sna-utils.c Normal file
View File

@ -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;
}

43
epan/sna-utils.h Normal file
View File

@ -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

View 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>
*
@ -34,10 +34,10 @@
#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" },

View 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"

View 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"

View 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"

View 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"

View 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)