aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-07-07 00:34:58 +0000
committerGuy Harris <guy@alum.mit.edu>1999-07-07 00:34:58 +0000
commitb547681d563bdaeece9f62ae43da5ab2ae93d953 (patch)
treec073c6e4a3438a5dcc8ccfe3ec9c26b292fadb63
parentbec7c4afe520dde06fdf82050ec9ac058f7335bd (diff)
Add support for RTSP (RFC 2326) over TCP, and SDP (RFC 2327) inside
RTSP, from Jason Lango <jal@netapp.com>. svn path=/trunk/; revision=340
-rw-r--r--AUTHORS4
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in21
-rw-r--r--ethereal.c3
-rw-r--r--packet-rtsp.c241
-rw-r--r--packet-sdp.c176
-rw-r--r--packet-tcp.c7
-rw-r--r--packet.h6
8 files changed, 446 insertions, 14 deletions
diff --git a/AUTHORS b/AUTHORS
index 111f9caa75..4ff2b8a8d4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -105,6 +105,10 @@ Aaron Hillegass <aaron@classmax.com> {
Summary dialogue
}
+Jason Lango <jal@netapp.com> {
+ RTSP, SDP
+}
+
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
give his permission to use his version of snprintf.c.
diff --git a/Makefile.am b/Makefile.am
index 7228a22e82..e9ae9d17a4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,6 +70,8 @@ ethereal_SOURCES = \
packet-rip.h \
packet-rsvp.c \
packet-rsvp.h \
+ packet-rtsp.c \
+ packet-sdp.c \
packet-smb.c \
packet-tcp.c \
packet-telnet.c\
diff --git a/Makefile.in b/Makefile.in
index a3623239a5..b1e2f49be9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -82,7 +82,7 @@ man_MANS = ethereal.1
sysconf_DATA = manuf
-ethereal_SOURCES = alignment.h capture.c capture.h column.c column.h config.h display.c display.h ethereal.c ethereal.h ethertype.c etypes.h file.c file.h filter.c filter.h follow.c follow.h gtkpacket.c gtkpacket.h menu.c menu.h packet-aarp.c packet-arp.c packet-atalk.c packet-bootp.c packet-cdp.c packet-data.c packet-dns.c packet-dns.h packet-eth.c packet-fddi.c packet-ftp.c packet-giop.c packet-gre.c packet-http.c packet-icmpv6.c packet-ip.c packet-ip.h packet-ipsec.c packet-ipv6.c packet-ipv6.h packet-ipx.c packet-ipx.h packet-isakmp.c packet-llc.c packet-lpd.c packet-nbipx.c packet-nbns.c packet-ncp.c packet-ncp.h packet-nntp.c packet-null.c packet-osi.c packet-ospf.c packet-ospf.h packet-pop.c packet-ppp.c packet-pppoe.c packet-pptp.c packet-raw.c packet-rip.c packet-rip.h packet-rsvp.c packet-rsvp.h packet-smb.c packet-tcp.c packet-telnet.c packet-tftp.c packet-tr.c packet-trmac.c packet-udp.c packet-vines.c packet-vines.h packet.c packet.h prefs.c prefs.h print.c print.h ps.c ps.h resolv.c resolv.h smb.h summary.h summary.c timestamp.h util.c util.h
+ethereal_SOURCES = alignment.h capture.c capture.h column.c column.h config.h display.c display.h ethereal.c ethereal.h ethertype.c etypes.h file.c file.h filter.c filter.h follow.c follow.h gtkpacket.c gtkpacket.h menu.c menu.h packet-aarp.c packet-arp.c packet-atalk.c packet-bootp.c packet-cdp.c packet-data.c packet-dns.c packet-dns.h packet-eth.c packet-fddi.c packet-ftp.c packet-giop.c packet-gre.c packet-http.c packet-icmpv6.c packet-ip.c packet-ip.h packet-ipsec.c packet-ipv6.c packet-ipv6.h packet-ipx.c packet-ipx.h packet-isakmp.c packet-llc.c packet-lpd.c packet-nbipx.c packet-nbns.c packet-ncp.c packet-ncp.h packet-nntp.c packet-null.c packet-osi.c packet-ospf.c packet-ospf.h packet-pop.c packet-ppp.c packet-pppoe.c packet-pptp.c packet-raw.c packet-rip.c packet-rip.h packet-rsvp.c packet-rsvp.h packet-rtsp.c packet-sdp.c packet-smb.c packet-tcp.c packet-telnet.c packet-tftp.c packet-tr.c packet-trmac.c packet-udp.c packet-vines.c packet-vines.h packet.c packet.h prefs.c prefs.h print.c print.h ps.c ps.h resolv.c resolv.h smb.h summary.h summary.c timestamp.h util.c util.h
EXTRA_ethereal_SOURCES = packet-snmp.c snprintf.c snprintf.h snprintf-imp.h strerror.c strerror.h
@@ -117,9 +117,10 @@ packet-http.o packet-icmpv6.o packet-ip.o packet-ipsec.o packet-ipv6.o \
packet-ipx.o packet-isakmp.o packet-llc.o packet-lpd.o packet-nbipx.o \
packet-nbns.o packet-ncp.o packet-nntp.o packet-null.o packet-osi.o \
packet-ospf.o packet-pop.o packet-ppp.o packet-pppoe.o packet-pptp.o \
-packet-raw.o packet-rip.o packet-rsvp.o packet-smb.o packet-tcp.o \
-packet-telnet.o packet-tftp.o packet-tr.o packet-trmac.o packet-udp.o \
-packet-vines.o packet.o prefs.o print.o ps.o resolv.o summary.o util.o
+packet-raw.o packet-rip.o packet-rsvp.o packet-rtsp.o packet-sdp.o \
+packet-smb.o packet-tcp.o packet-telnet.o packet-tftp.o packet-tr.o \
+packet-trmac.o packet-udp.o packet-vines.o packet.o prefs.o print.o \
+ps.o resolv.o summary.o util.o
ethereal_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -155,12 +156,12 @@ DEP_FILES = .deps/capture.P .deps/column.P .deps/display.P \
.deps/packet-null.P .deps/packet-osi.P .deps/packet-ospf.P \
.deps/packet-pop.P .deps/packet-ppp.P .deps/packet-pppoe.P \
.deps/packet-pptp.P .deps/packet-raw.P .deps/packet-rip.P \
-.deps/packet-rsvp.P .deps/packet-smb.P .deps/packet-snmp.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/strerror.P \
-.deps/summary.P .deps/util.P
+.deps/packet-rsvp.P .deps/packet-rtsp.P .deps/packet-sdp.P \
+.deps/packet-smb.P .deps/packet-snmp.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/strerror.P .deps/summary.P .deps/util.P
SOURCES = $(ethereal_SOURCES) $(EXTRA_ethereal_SOURCES)
OBJECTS = $(ethereal_OBJECTS)
diff --git a/ethereal.c b/ethereal.c
index 6a5cb60859..50994f566d 100644
--- a/ethereal.c
+++ b/ethereal.c
@@ -1,6 +1,6 @@
/* ethereal.c
*
- * $Id: ethereal.c,v 1.46 1999/06/25 06:49:46 guy Exp $
+ * $Id: ethereal.c,v 1.47 1999/07/07 00:34:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -147,6 +147,7 @@ about_ethereal( GtkWidget *w, gpointer data ) {
"Brad Robel-Forrest <bradr@watchguard.com>\n"
"Ashok Narayanan <ashokn@cisco.com>\n"
"Aaron Hillegass <aaron@classmax.com>\n"
+ "Jason Lango <jal@netapp.com>\n"
"\nSee http://ethereal.zing.org for more information",
VERSION, comp_info_str);
diff --git a/packet-rtsp.c b/packet-rtsp.c
new file mode 100644
index 0000000000..785d17b39a
--- /dev/null
+++ b/packet-rtsp.c
@@ -0,0 +1,241 @@
+/* packet-rtsp.c
+ * Routines for RTSP packet disassembly
+ *
+ * Jason Lango <jal@netapp.com>
+ * Liberally copied from packet-http.c, by Guy Harris <guy@netapp.com>
+ *
+ * $Id: packet-rtsp.c,v 1.1 1999/07/07 00:34:56 guy 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"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+#include <glib.h>
+#include "packet.h"
+
+static int is_rtsp_request_or_reply(const u_char *data, int linelen);
+
+static int
+is_content_sdp(const u_char *line, int linelen)
+{
+ const char *hdr = "Content-Type:";
+ size_t hdrlen = strlen(hdr);
+ const char *type = "application/sdp";
+ size_t typelen = strlen(type);
+
+ if (linelen < hdrlen || strncasecmp(hdr, line, hdrlen))
+ return 0;
+
+ line += hdrlen;
+ linelen -= hdrlen;
+ while (linelen > 0 && (*line == ' ' || *line == '\t')) {
+ line++;
+ linelen--;
+ }
+
+ if (linelen < typelen || strncasecmp(type, line, typelen))
+ return 0;
+
+ line += typelen;
+ linelen -= typelen;
+ if (linelen > 0 && !isspace(*line))
+ return 0;
+
+ return 1;
+}
+
+void dissect_rtsp(const u_char *pd, int offset, frame_data *fd,
+ proto_tree *tree)
+{
+ proto_tree *rtsp_tree;
+ proto_item *ti;
+ const u_char *data, *dataend;
+ const u_char *linep, *lineend, *eol;
+ int linelen;
+ u_char c;
+ int is_sdp = 0;
+
+ data = &pd[offset];
+ dataend = data + END_OF_FRAME;
+
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "RTSP");
+ if (check_col(fd, COL_INFO)) {
+ /*
+ * Put the first line from the buffer into the summary,
+ * if it's an RTSP request or reply.
+ * Otherwise, just call it a continuation.
+ */
+ lineend = find_line_end(data, dataend, &eol);
+ linelen = lineend - data;
+ if (is_rtsp_request_or_reply(data, linelen))
+ col_add_str(fd, COL_INFO, format_text(data, linelen));
+ else
+ col_add_str(fd, COL_INFO, "Continuation");
+ }
+
+ rtsp_tree = NULL;
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, offset, END_OF_FRAME,
+ "Real Time Streaming Protocol");
+ rtsp_tree = proto_tree_new();
+ proto_item_add_subtree(ti, rtsp_tree, ETT_RTSP);
+ }
+
+ while (data < dataend) {
+ /*
+ * Find the end of the line.
+ */
+ lineend = find_line_end(data, dataend, &eol);
+ linelen = lineend - data;
+
+ /*
+ * OK, does it look like an RTSP request or
+ * response?
+ */
+ if (is_rtsp_request_or_reply(data, linelen))
+ goto is_rtsp;
+
+ /*
+ * No. Does it look like a blank line (as would
+ * appear at the end of an RTSP request)?
+ */
+ if (linelen == 1) {
+ if (*data == '\n')
+ goto is_rtsp;
+ }
+ if (linelen == 2) {
+ if (strncmp(data, "\r\n", 2) == 0 ||
+ strncmp(data, "\n\r", 2) == 0)
+ goto is_rtsp;
+ }
+
+ /*
+ * No. Does it look like a MIME header?
+ */
+ linep = data;
+ while (linep < lineend) {
+ c = *linep++;
+ if (!isprint(c))
+ break; /* not printable, not a MIME header */
+ switch (c) {
+
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case '@':
+ case ',':
+ case ';':
+ case '\\':
+ case '"':
+ case '/':
+ case '[':
+ case ']':
+ case '?':
+ case '=':
+ case '{':
+ case '}':
+ /*
+ * It's a tspecial, so it's not
+ * part of a token, so it's not
+ * a field name for the beginning
+ * of a MIME header.
+ */
+ goto not_rtsp;
+
+ case ':':
+ /*
+ * This ends the token; we consider
+ * this to be a MIME header.
+ */
+ if (is_content_sdp(data, linelen))
+ is_sdp = 1;
+ goto is_rtsp;
+ }
+ }
+
+ not_rtsp:
+ /*
+ * We don't consider this part of an RTSP request or
+ * reply, so we don't display it.
+ */
+ break;
+
+ is_rtsp:
+ /*
+ * Put this line.
+ */
+ if (rtsp_tree) {
+ proto_tree_add_item(rtsp_tree, offset, linelen, "%s",
+ format_text(data, linelen));
+ }
+ offset += linelen;
+ data = lineend;
+ }
+
+ if (is_sdp) {
+ dissect_sdp(pd, offset, fd, tree);
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "RTSP/SDP");
+ }
+ else if (rtsp_tree && data < dataend) {
+ proto_tree_add_item(rtsp_tree, offset, END_OF_FRAME,
+ "Data (%d bytes)", END_OF_FRAME);
+ }
+}
+
+const char *rtsp_methods[] = {
+ "DESCRIBE", "ANNOUNCE", "GET_PARAMETER", "OPTIONS",
+ "PAUSE", "PLAY", "RECORD", "REDIRECT", "SETUP",
+ "SET_PARAMETER", "TEARDOWN"
+};
+const int rtsp_nmethods = sizeof(rtsp_methods) / sizeof(*rtsp_methods);
+
+static int
+is_rtsp_request_or_reply(const u_char *data, int linelen)
+{
+ int ii;
+ size_t len;
+
+ /* Reply */
+ if (linelen >= 5 && !strncasecmp("RTSP/", data, 5))
+ return TRUE;
+
+ /* Request Methods */
+ for (ii = 0; ii < rtsp_nmethods; ii++) {
+ len = strlen(rtsp_methods[ii]);
+ if (linelen >= len && !strncasecmp(rtsp_methods[ii], data, len))
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/packet-sdp.c b/packet-sdp.c
new file mode 100644
index 0000000000..25f5f28a83
--- /dev/null
+++ b/packet-sdp.c
@@ -0,0 +1,176 @@
+/* packet-sdp.c
+ * Routines for SDP packet disassembly
+ *
+ * Jason Lango <jal@netapp.com>
+ * Liberally copied from packet-http.c, by Guy Harris <guy@netapp.com>
+ *
+ * $Id: packet-sdp.c,v 1.1 1999/07/07 00:34:56 guy 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"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+#include <glib.h>
+#include "packet.h"
+
+void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
+ proto_tree *tree)
+{
+ proto_tree *sdp_tree;
+ proto_item *ti;
+ const u_char *data, *dataend;
+ const u_char *lineend, *eol;
+ int linelen;
+ u_char section;
+ u_char type;
+ const u_char *value;
+ int valuelen;
+ const char *typename;
+
+ data = &pd[offset];
+ dataend = data + END_OF_FRAME;
+
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "SDP");
+
+ if (check_col(fd, COL_INFO)) {
+ /* XXX: Needs description. */
+ col_add_str(fd, COL_INFO, "Session Description");
+ }
+
+ if (!tree)
+ return;
+
+ ti = proto_tree_add_item(tree, offset, END_OF_FRAME,
+ "Session Description Protocol");
+ sdp_tree = proto_tree_new();
+ proto_item_add_subtree(ti, sdp_tree, ETT_SDP);
+
+ section = 0;
+ for (; data < dataend; offset += linelen, data = lineend) {
+ /*
+ * Find the end of the line.
+ */
+ lineend = find_line_end(data, dataend, &eol);
+ linelen = lineend - data;
+
+ /*
+ * Line must contain at least e.g. "v=".
+ */
+ if (linelen < 2)
+ break;
+
+ type = data[0];
+ if (data[1] != '=') {
+ proto_tree_add_item(sdp_tree, offset, linelen,
+ "Invalid line: %s",
+ format_text(data, linelen));
+ continue;
+ }
+ value = data + 2;
+ valuelen = linelen - 2;
+
+ /*
+ * Attributes.
+ */
+ switch (type) {
+ case 'v':
+ section = 'v';
+ typename = "Session Description, version";
+ break;
+ case 'o':
+ typename = "Owner/Creator, Session Id";
+ break;
+ case 's':
+ typename = "Session Name";
+ break;
+ case 'i':
+ if (section == 'v')
+ typename = "Session Information";
+ else if (section == 'm')
+ typename = "Media Title";
+ else
+ typename = "Misplaced";
+ break;
+ case 'u':
+ typename = "URI of Description";
+ break;
+ case 'e':
+ typename = "E-mail Address";
+ break;
+ case 'p':
+ typename = "Phone Number";
+ break;
+ case 'c':
+ typename = "Connection Information";
+ break;
+ case 'b':
+ typename = "Bandwidth Information";
+ break;
+ case 't':
+ section = 't';
+ typename = "Time Description, active time";
+ break;
+ case 'r':
+ typename = "Repeat Time";
+ break;
+ case 'm':
+ section = 'm';
+ typename = "Media Description, name and address";
+ break;
+ case 'k':
+ typename = "Encryption Key";
+ break;
+ case 'a':
+ if (section == 'v')
+ typename = "Session Attribute";
+ else if (section == 'm')
+ typename = "Media Attribute";
+ else
+ typename = "Misplaced";
+ break;
+ case 'z':
+ typename = "Time Zone Adjustment";
+ break;
+ default:
+ typename = "Unknown";
+ break;
+ }
+
+ proto_tree_add_item(sdp_tree, offset, linelen,
+ "%s (%c): %s", typename, type,
+ format_text(value, valuelen));
+ }
+
+ if (data < dataend) {
+ proto_tree_add_item(sdp_tree, offset, END_OF_FRAME,
+ "Data (%d bytes)", END_OF_FRAME);
+ }
+}
diff --git a/packet-tcp.c b/packet-tcp.c
index 23d874f47b..f9534a9322 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.24 1999/06/11 15:30:40 gram Exp $
+ * $Id: packet-tcp.c,v 1.25 1999/07/07 00:34:57 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -74,6 +74,7 @@ static int info_len;
#define TCP_PORT_PRINTER 515
#define TCP_ALT_PORT_HTTP 8080
#define TCP_PORT_PPTP 1723
+#define TCP_PORT_RTSP 554
/* TCP structs and definitions */
@@ -483,7 +484,9 @@ dissect_tcp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
else if (PORT_IS(TCP_PORT_NBSS)) {
pi.match_port = TCP_PORT_NBSS;
dissect_nbss(pd, offset, fd, tree, payload);
- } else {
+ } else if (PORT_IS(TCP_PORT_RTSP))
+ dissect_rtsp(pd, offset, fd, tree);
+ else {
/* check existence of high level protocols */
if (memcmp(&pd[offset], "GIOP", 4) == 0) {
diff --git a/packet.h b/packet.h
index d6f20b710c..2b7955f1e3 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.63 1999/07/01 04:04:38 sharpe Exp $
+ * $Id: packet.h,v 1.64 1999/07/07 00:34:58 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -273,6 +273,8 @@ enum {
ETT_RSVP_ADSPEC_SUBTREE1,
ETT_RSVP_ADSPEC_SUBTREE2,
ETT_RSVP_ADSPEC_SUBTREE3,
+ ETT_RTSP,
+ ETT_SDP,
NUM_TREE_TYPES /* last item number plus one */
};
@@ -417,6 +419,8 @@ void dissect_pppoes(const u_char *, int, frame_data *, proto_tree *);
void dissect_isakmp(const u_char *, int, frame_data *, proto_tree *);
void dissect_rip(const u_char *, int, frame_data *, proto_tree *);
void dissect_rsvp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_rtsp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_sdp(const u_char *, int, frame_data *, proto_tree *);
void dissect_snmp(const u_char *, int, frame_data *, proto_tree *);
void dissect_tcp(const u_char *, int, frame_data *, proto_tree *);
void dissect_tftp(const u_char *, int, frame_data *, proto_tree *);