diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 34 | ||||
-rw-r--r-- | ethertype.c | 11 | ||||
-rw-r--r-- | etypes.h | 11 | ||||
-rw-r--r-- | packet-cdp.c | 61 | ||||
-rw-r--r-- | packet-dns.c | 4 | ||||
-rw-r--r-- | packet.h | 6 |
7 files changed, 106 insertions, 22 deletions
diff --git a/Makefile.am b/Makefile.am index ba5eae2c41..d0626b00fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,7 @@ ethereal_SOURCES = \ packet-arp.c \ packet-atalk.c \ packet-bootp.c \ + packet-cdp.c \ packet-data.c \ packet-dns.c \ packet-eth.c \ diff --git a/Makefile.in b/Makefile.in index 8abb2aaec0..ec36358334 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,6 +93,7 @@ ethereal_SOURCES = \ packet-arp.c \ packet-atalk.c \ packet-bootp.c \ + packet-cdp.c \ packet-data.c \ packet-dns.c \ packet-eth.c \ @@ -181,12 +182,12 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ethereal_OBJECTS = capture.o column.o ethereal.o ethertype.o file.o \ filter.o follow.o menu.o packet.o packet-aarp.o packet-arp.o \ -packet-atalk.o packet-bootp.o packet-data.o packet-dns.o packet-eth.o \ -packet-fddi.o packet-giop.o packet-llc.o packet-lpd.o packet-ip.o \ -packet-ipv6.o packet-ipx.o packet-nbipx.o packet-nbns.o packet-ncp.o \ -packet-null.o packet-osi.o packet-ospf.o packet-ppp.o packet-raw.o \ -packet-rip.o packet-tcp.o packet-tr.o packet-trmac.o packet-udp.o \ -packet-vines.o prefs.o print.o ps.o resolv.o util.o +packet-atalk.o packet-bootp.o packet-cdp.o packet-data.o packet-dns.o \ +packet-eth.o packet-fddi.o packet-giop.o packet-llc.o packet-lpd.o \ +packet-ip.o packet-ipv6.o packet-ipx.o packet-nbipx.o packet-nbns.o \ +packet-ncp.o packet-null.o packet-osi.o packet-ospf.o packet-ppp.o \ +packet-raw.o packet-rip.o packet-tcp.o packet-tr.o packet-trmac.o \ +packet-udp.o packet-vines.o prefs.o print.o ps.o resolv.o util.o ethereal_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @@ -210,16 +211,17 @@ GZIP = --best DEP_FILES = .deps/capture.P .deps/column.P .deps/ethereal.P \ .deps/ethertype.P .deps/file.P .deps/filter.P .deps/follow.P \ .deps/menu.P .deps/packet-aarp.P .deps/packet-arp.P \ -.deps/packet-atalk.P .deps/packet-bootp.P .deps/packet-data.P \ -.deps/packet-dns.P .deps/packet-eth.P .deps/packet-fddi.P \ -.deps/packet-giop.P .deps/packet-ip.P .deps/packet-ipv6.P \ -.deps/packet-ipx.P .deps/packet-llc.P .deps/packet-lpd.P \ -.deps/packet-nbipx.P .deps/packet-nbns.P .deps/packet-ncp.P \ -.deps/packet-null.P .deps/packet-osi.P .deps/packet-ospf.P \ -.deps/packet-ppp.P .deps/packet-raw.P .deps/packet-rip.P \ -.deps/packet-tcp.P .deps/packet-tr.P .deps/packet-trmac.P \ -.deps/packet-udp.P .deps/packet-vines.P .deps/packet.P .deps/prefs.P \ -.deps/print.P .deps/ps.P .deps/resolv.P .deps/snprintf.P .deps/util.P +.deps/packet-atalk.P .deps/packet-bootp.P .deps/packet-cdp.P \ +.deps/packet-data.P .deps/packet-dns.P .deps/packet-eth.P \ +.deps/packet-fddi.P .deps/packet-giop.P .deps/packet-ip.P \ +.deps/packet-ipv6.P .deps/packet-ipx.P .deps/packet-llc.P \ +.deps/packet-lpd.P .deps/packet-nbipx.P .deps/packet-nbns.P \ +.deps/packet-ncp.P .deps/packet-null.P .deps/packet-osi.P \ +.deps/packet-ospf.P .deps/packet-ppp.P .deps/packet-raw.P \ +.deps/packet-rip.P .deps/packet-tcp.P .deps/packet-tr.P \ +.deps/packet-trmac.P .deps/packet-udp.P .deps/packet-vines.P \ +.deps/packet.P .deps/prefs.P .deps/print.P .deps/ps.P .deps/resolv.P \ +.deps/snprintf.P .deps/util.P SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES) OBJECTS = $(ethereal_OBJECTS) diff --git a/ethertype.c b/ethertype.c index 0ae599aec7..2cb06c96b9 100644 --- a/ethertype.c +++ b/ethertype.c @@ -2,7 +2,7 @@ * Routines for calling the right protocol for the ethertype. * This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP) * - * $Id: ethertype.c,v 1.10 1998/11/17 04:28:46 gerald Exp $ + * $Id: ethertype.c,v 1.11 1998/12/19 00:12:19 hannes Exp $ * * Gilbert Ramirez <gram@verdict.uthscsa.edu> * @@ -54,6 +54,8 @@ ethertype_to_str(guint16 etype, const char *fmt) {ETHERTYPE_AARP, "AARP" }, {ETHERTYPE_IPX, "Netware IPX/SPX"}, {ETHERTYPE_VINES, "Vines" }, + {ETHERTYPE_CDP, "CDP" }, /* Cisco Discovery Protocol */ + {ETHERTYPE_LOOP, "Loopback" }, /* Ethernet Loopback */ {0, NULL } }; return val_to_str(etype, etype_vals, fmt); @@ -93,6 +95,13 @@ ethertype(guint16 etype, int offset, case ETHERTYPE_VINES: dissect_vines(pd, offset, fd, tree); break; + case ETHERTYPE_CDP: + dissect_cdp(pd, offset, fd, tree); + break; + case ETHERTYPE_LOOP: + dissect_data(pd, offset, fd, tree); + if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "LOOP"); } + break; default: dissect_data(pd, offset, fd, tree); if (check_col(fd, COL_PROTOCOL)) { col_add_fstr(fd, COL_PROTOCOL, "0x%04x", etype); } @@ -1,7 +1,7 @@ /* etypes.h * Defines ethernet packet types, similar to tcpdump's ethertype.h * - * $Id: etypes.h,v 1.3 1998/09/17 02:37:45 gerald Exp $ + * $Id: etypes.h,v 1.4 1998/12/19 00:12:20 hannes Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -69,4 +69,13 @@ #ifndef ETHERTYPE_VINES #define ETHERTYPE_VINES 0xbad #endif + +#ifndef ETHERTYPE_CDP +#define ETHERTYPE_CDP 0x2000 /* Cisco Discovery Protocol */ +#endif + +#ifndef ETHERTYPE_LOOP +#define ETHERTYPE_LOOP 0x9000 /* used for layer 2 testing (do i see my own frames on the wire) */ +#endif + #endif /* etypes.h */ diff --git a/packet-cdp.c b/packet-cdp.c new file mode 100644 index 0000000000..e72ffeb265 --- /dev/null +++ b/packet-cdp.c @@ -0,0 +1,61 @@ +/* packet-cdp.c + * Routines for + * (c) Copyright Hannes R. Boehm <hannes@boehm.org> + * + * $Id: packet-cdp.c,v 1.1 1998/12/19 00:12:21 hannes 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. + */ + +#include "config.h" + +#include <gtk/gtk.h> + +#include <stdio.h> + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif + +#include "ethereal.h" +#include "packet.h" + +void +dissect_cdp(const u_char *pd, int offset, frame_data *fd, GtkTree *tree) { + GtkWidget *cdp_tree = NULL, *ti; + + if (check_col(fd, COL_PROTOCOL)) + col_add_str(fd, COL_PROTOCOL, "CDP"); + if (check_col(fd, COL_INFO)) + col_add_str(fd, COL_INFO, "Cisco Discovery Protocol"); + + if(tree){ + ti = add_item_to_tree(GTK_WIDGET(tree), offset, (fd->cap_len - offset), + "Cisco Discovery Protocoll"); + cdp_tree = gtk_tree_new(); + add_subtree(ti, cdp_tree, ETT_CDP); + dissect_data(pd, offset, fd, (GtkTree *) cdp_tree); + } +} + diff --git a/packet-dns.c b/packet-dns.c index a7c1f2af92..f9110f93d7 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.10 1998/12/04 05:59:10 guy Exp $ + * $Id: packet-dns.c,v 1.11 1998/12/19 00:12:22 hannes Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -216,7 +216,7 @@ get_dns_name(const u_char *dns_data_ptr, const u_char *pd, int offset, const u_char *dataptr = pd + offset; int str_len = 0; - memset (nameptr, 0, maxname); + bzero (nameptr, maxname); len = copy_name_component_rec(dns_data_ptr, dataptr, nameptr, &str_len); return len; @@ -1,7 +1,7 @@ /* packet.h * Definitions for packet disassembly structures and routines * - * $Id: packet.h,v 1.27 1998/12/04 05:59:14 guy Exp $ + * $Id: packet.h,v 1.28 1998/12/19 00:12:23 hannes Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -435,6 +435,7 @@ enum { ETT_AARP, ETT_GIOP, ETT_NBDGM, + ETT_CDP, NUM_TREE_TYPES /* last item number plus one */ }; @@ -527,15 +528,16 @@ void dissect_tr(const u_char *, frame_data *, GtkTree *); void dissect_aarp(const u_char *, int, frame_data *, GtkTree *); void dissect_arp(const u_char *, int, frame_data *, GtkTree *); void dissect_bootp(const u_char *, int, frame_data *, GtkTree *); +void dissect_cdp(const u_char *, int, frame_data *, GtkTree *); void dissect_data(const u_char *, int, frame_data *, GtkTree *); void dissect_ddp(const u_char *, int, frame_data *, GtkTree *); void dissect_dns(const u_char *, int, frame_data *, GtkTree *); +void dissect_giop(const u_char *, int, frame_data *, GtkTree *); void dissect_icmp(const u_char *, int, frame_data *, GtkTree *); void dissect_igmp(const u_char *, int, frame_data *, GtkTree *); void dissect_ip(const u_char *, int, frame_data *, GtkTree *); void dissect_ipv6(const u_char *, int, frame_data *, GtkTree *); void dissect_ipx(const u_char *, int, frame_data *, GtkTree *); -void dissect_giop(const u_char *, int, frame_data *, GtkTree *); void dissect_llc(const u_char *, int, frame_data *, GtkTree *); void dissect_lpd(const u_char *, int, frame_data *, GtkTree *); void dissect_nbdgm(const u_char *, int, frame_data *, GtkTree *); |