aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in23
-rw-r--r--packet-nntp.c109
-rw-r--r--packet-tcp.c16
-rw-r--r--packet.h4
6 files changed, 137 insertions, 17 deletions
diff --git a/AUTHORS b/AUTHORS
index ce2ab4866a..4a4330dfbe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -53,6 +53,7 @@ Guy Harris <guy@netapp.com> {
Bitfield decoding
IP and TCP option decoding
HTTP support
+ NNTP support
Miscellaneous enhancements and fixes
}
diff --git a/Makefile.am b/Makefile.am
index 8387062205..da64ac7ba7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,6 +37,7 @@ ethereal_SOURCES = \
packet-nbipx.c \
packet-nbns.c \
packet-ncp.c \
+ packet-nntp.c \
packet-null.c \
packet-osi.c \
packet-ospf.c \
diff --git a/Makefile.in b/Makefile.in
index 79748649af..6630e4e386 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -111,6 +111,7 @@ ethereal_SOURCES = \
packet-nbipx.c \
packet-nbns.c \
packet-ncp.c \
+ packet-nntp.c \
packet-null.c \
packet-osi.c \
packet-ospf.c \
@@ -195,10 +196,10 @@ packet-arp.o packet-atalk.o packet-bootp.o packet-cdp.o packet-data.o \
packet-dns.o packet-eth.o packet-ftp.o packet-fddi.o packet-giop.o \
packet-http.o packet-ip.o packet-icmpv6.o packet-ipsec.o packet-ipv6.o \
packet-ipx.o packet-llc.o packet-lpd.o packet-nbipx.o packet-nbns.o \
-packet-ncp.o packet-null.o packet-osi.o packet-ospf.o packet-pop.o \
-packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o packet-telnet.o \
-packet-tftp.o packet-tr.o packet-trmac.o packet-udp.o packet-vines.o \
-prefs.o print.o ps.o resolv.o util.o
+packet-ncp.o packet-nntp.o packet-null.o packet-osi.o packet-ospf.o \
+packet-pop.o packet-ppp.o packet-raw.o packet-rip.o packet-tcp.o \
+packet-telnet.o packet-tftp.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)
@@ -228,13 +229,13 @@ DEP_FILES = .deps/capture.P .deps/column.P .deps/ethereal.P \
.deps/packet-http.P .deps/packet-icmpv6.P .deps/packet-ip.P \
.deps/packet-ipsec.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-pop.P \
-.deps/packet-ppp.P .deps/packet-raw.P .deps/packet-rip.P \
-.deps/packet-tcp.P .deps/packet-telnet.P .deps/packet-tftp.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-nbns.P .deps/packet-ncp.P .deps/packet-nntp.P \
+.deps/packet-null.P .deps/packet-osi.P .deps/packet-ospf.P \
+.deps/packet-pop.P .deps/packet-ppp.P .deps/packet-raw.P \
+.deps/packet-rip.P .deps/packet-tcp.P .deps/packet-telnet.P \
+.deps/packet-tftp.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/packet-nntp.c b/packet-nntp.c
new file mode 100644
index 0000000000..7aabb1382e
--- /dev/null
+++ b/packet-nntp.c
@@ -0,0 +1,109 @@
+/* packet-nntp.c
+ * Routines for nntp packet dissection
+ * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
+ *
+ * $Id: packet-nntp.c,v 1.1 1999/04/06 02:02:11 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@unicom.net>
+ * 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 <stdio.h>
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include "packet.h"
+
+extern packet_info pi;
+
+void
+dissect_nntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int max_data)
+{
+ gchar *type;
+ proto_tree *nntp_tree, *ti;
+ const u_char *data, *dataend;
+ const u_char *lineend, *eol;
+ int linelen;
+
+ data = &pd[offset];
+ dataend = data + END_OF_FRAME;
+ if (dataend > data + max_data)
+ dataend = data + max_data;
+
+ if (pi.match_port == pi.destport)
+ type = "Request";
+ else
+ type = "Response";
+
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "NNTP");
+
+ if (check_col(fd, COL_INFO)) {
+ /*
+ * Put the first line from the buffer into the summary.
+ */
+ lineend = find_line_end(data, dataend, &eol);
+ linelen = eol - data;
+ col_add_fstr(fd, COL_INFO, "%s: %s", type,
+ format_text(data, linelen));
+ }
+
+ if (tree) {
+
+ ti = proto_tree_add_item(tree, offset, END_OF_FRAME,
+ "Network News Transfer Protocol");
+ nntp_tree = proto_tree_new();
+ proto_item_add_subtree(ti, nntp_tree, ETT_NNTP);
+
+ /*
+ * Show the request or response as text, a line at a time.
+ * XXX - for requests, we could display the stuff after the
+ * first line, if any, based on what the request was, and
+ * for responses, we could display it based on what the
+ * matching request was, although the latter requires us to
+ * know what the matching request was....
+ */
+ while (data < dataend) {
+ /*
+ * Find the end of the line.
+ */
+ lineend = find_line_end(data, dataend, &eol);
+ linelen = lineend - data;
+
+ /*
+ * Put this line.
+ */
+ proto_tree_add_item(nntp_tree, offset, linelen, "%s",
+ format_text(data, linelen));
+ offset += linelen;
+ data = lineend;
+ }
+ }
+}
diff --git a/packet-tcp.c b/packet-tcp.c
index aa40d0a8d8..85d0919117 100644
--- a/packet-tcp.c
+++ b/packet-tcp.c
@@ -1,7 +1,7 @@
/* packet-tcp.c
* Routines for TCP packet disassembly
*
- * $Id: packet-tcp.c,v 1.19 1999/04/05 21:54:40 guy Exp $
+ * $Id: packet-tcp.c,v 1.20 1999/04/06 02:02:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -69,6 +69,7 @@ static int info_len;
#define TCP_PORT_SMTP 25
#define TCP_PORT_HTTP 80
#define TCP_PORT_POP 110
+#define TCP_PORT_NNTP 119
#define TCP_PORT_PRINTER 515
#define TCP_ALT_PORT_HTTP 8080
@@ -480,12 +481,17 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_pop(pd, offset, fd, tree, payload);
break;
-
- case TCP_PORT_HTTP:
- case TCP_ALT_PORT_HTTP:
+ case TCP_PORT_NNTP:
+ pi.match_port = TCP_PORT_NNTP;
+ dissect_nntp(pd, offset, fd, tree, payload);
+ break;
+
+ case TCP_PORT_HTTP:
+ case TCP_ALT_PORT_HTTP:
dissect_http(pd, offset, fd, tree);
break;
- default:
+
+ default:
/* check existence of high level protocols */
if (memcmp(&pd[offset], "GIOP", 4) == 0) {
diff --git a/packet.h b/packet.h
index 097376707b..3410ae1e8d 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.45 1999/04/05 21:54:41 guy Exp $
+ * $Id: packet.h,v 1.46 1999/04/06 02:02:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -222,6 +222,7 @@ enum {
ETT_FTP,
ETT_TELNET,
ETT_TELNET_SUBOPT,
+ ETT_NNTP,
NUM_TREE_TYPES /* last item number plus one */
};
@@ -353,6 +354,7 @@ void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *);
void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *);
void dissect_nbns(const u_char *, int, frame_data *, proto_tree *);
void dissect_ncp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_nntp(const u_char *, int, frame_data *, proto_tree *, int);
void dissect_nwlink_dg(const u_char *, int, frame_data *, proto_tree *);
void dissect_osi(const u_char *, int, frame_data *, proto_tree *);
void dissect_ospf(const u_char *, int, frame_data *, proto_tree *);