1999-07-07 00:34:58 +00:00
|
|
|
/* packet-rtsp.c
|
2000-01-13 03:12:07 +00:00
|
|
|
* Routines for RTSP packet disassembly (RFC 2326)
|
1999-07-07 00:34:58 +00:00
|
|
|
*
|
|
|
|
* Jason Lango <jal@netapp.com>
|
2000-01-22 06:22:44 +00:00
|
|
|
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
|
1999-07-07 00:34:58 +00:00
|
|
|
*
|
As RFC 2327 says, "SDP is purely a format for session description - it
does not incorporate a transport protocol, and is intended to use
different transport protocols as appropriate including the Session
Announcement Protocol [4], Session Initiation Protocol [11], Real- Time
Streaming Protocol [12], electronic mail using the MIME extensions, and
the Hypertext Transport Protocol."
As such, it shouldn't set the protocol column to SDP, as that means
the protocol column won't indicate what the transport protocol was;
instead, it should append "/SDP" to the protocol column - RTSP was,
after calling "dissect_sdp()", setting the protocol column to
"RTSP/SDP", and this change means that all protocols using SDP will have
the protocol column set in that fashion, and that the RTSP dissector
doesn't have to explicitly set the protocol column to cause that to
happen.
svn path=/trunk/; revision=2624
2000-11-12 21:23:53 +00:00
|
|
|
* $Id: packet-rtsp.c,v 1.24 2000/11/12 21:23:53 guy Exp $
|
1999-07-07 00:34:58 +00:00
|
|
|
*
|
|
|
|
* 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"
|
2000-02-15 21:06:58 +00:00
|
|
|
#include "packet-sdp.h"
|
2000-04-21 01:45:58 +00:00
|
|
|
#include "packet-rtp.h"
|
|
|
|
#include "packet-rtcp.h"
|
|
|
|
#include "conversation.h"
|
2000-09-11 16:16:13 +00:00
|
|
|
#include "strutil.h"
|
1999-07-07 00:34:58 +00:00
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_rtsp = -1;
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_rtsp = -1;
|
|
|
|
|
2000-01-13 03:07:26 +00:00
|
|
|
static int hf_rtsp_method = -1;
|
|
|
|
static int hf_rtsp_url = -1;
|
|
|
|
static int hf_rtsp_status = -1;
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define TCP_PORT_RTSP 554
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
static void process_rtsp_request(tvbuff_t *tvb, int offset, const u_char *data,
|
2000-01-13 03:07:26 +00:00
|
|
|
int linelen, proto_tree *tree);
|
1999-07-07 00:34:58 +00:00
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
static void process_rtsp_reply(tvbuff_t *tvb, int offset, const u_char *data,
|
|
|
|
int linelen, proto_tree *tree);
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
RTSP_REQUEST,
|
|
|
|
RTSP_REPLY,
|
|
|
|
NOT_RTSP
|
|
|
|
} rtsp_type_t;
|
|
|
|
|
|
|
|
static const char *rtsp_methods[] = {
|
|
|
|
"DESCRIBE", "ANNOUNCE", "GET_PARAMETER", "OPTIONS",
|
|
|
|
"PAUSE", "PLAY", "RECORD", "REDIRECT", "SETUP",
|
|
|
|
"SET_PARAMETER", "TEARDOWN"
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RTSP_NMETHODS (sizeof rtsp_methods / sizeof rtsp_methods[0])
|
|
|
|
|
|
|
|
static rtsp_type_t
|
|
|
|
is_rtsp_request_or_reply(const u_char *line, int linelen)
|
|
|
|
{
|
|
|
|
int ii;
|
|
|
|
|
|
|
|
/* Is this an RTSP reply? */
|
|
|
|
if (linelen >= 5 && strncasecmp("RTSP/", line, 5) == 0) {
|
|
|
|
/*
|
|
|
|
* Yes.
|
|
|
|
*/
|
|
|
|
return RTSP_REPLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Is this an RTSP request?
|
|
|
|
* Check whether the line begins with one of the RTSP request
|
|
|
|
* methods.
|
|
|
|
*/
|
|
|
|
for (ii = 0; ii < RTSP_NMETHODS; ii++) {
|
|
|
|
size_t len = strlen(rtsp_methods[ii]);
|
|
|
|
if (linelen >= len &&
|
|
|
|
strncasecmp(rtsp_methods[ii], line, len) == 0)
|
|
|
|
return RTSP_REQUEST;
|
|
|
|
}
|
|
|
|
return NOT_RTSP;
|
|
|
|
}
|
|
|
|
|
1999-07-07 00:34:58 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-04-21 01:45:58 +00:00
|
|
|
static const char rtsp_transport[] = "Transport:";
|
|
|
|
static const char rtsp_sps[] = "server_port=";
|
|
|
|
static const char rtsp_cps[] = "client_port=";
|
|
|
|
static const char rtsp_rtp[] = "rtp/avp";
|
|
|
|
|
|
|
|
static void
|
|
|
|
rtsp_create_conversation(const u_char *trans_begin, const u_char *trans_end)
|
|
|
|
{
|
|
|
|
conversation_t *conv;
|
2000-04-21 01:52:35 +00:00
|
|
|
u_char tbuf[256];
|
|
|
|
u_char *tmp;
|
2000-04-21 01:45:58 +00:00
|
|
|
int c_data_port, c_mon_port;
|
|
|
|
int s_data_port, s_mon_port;
|
|
|
|
|
|
|
|
strncpy(tbuf, trans_begin, trans_end - trans_begin);
|
|
|
|
tbuf[sizeof(tbuf)-1] = 0;
|
|
|
|
|
|
|
|
tmp = tbuf + strlen(rtsp_transport);
|
|
|
|
while (*tmp && isspace(*tmp))
|
|
|
|
tmp++;
|
|
|
|
if (strncasecmp(tmp, rtsp_rtp, strlen(rtsp_rtp)) != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
c_data_port = c_mon_port = 0;
|
|
|
|
s_data_port = s_mon_port = 0;
|
|
|
|
if ((tmp = strstr(tbuf, rtsp_sps))) {
|
|
|
|
tmp += strlen(rtsp_sps);
|
|
|
|
if (sscanf(tmp, "%u-%u", &s_data_port, &s_mon_port) < 1)
|
|
|
|
g_warning("rtsp: failed to parse server_port");
|
|
|
|
}
|
|
|
|
if ((tmp = strstr(tbuf, rtsp_cps))) {
|
|
|
|
tmp += strlen(rtsp_cps);
|
|
|
|
if (sscanf(tmp, "%u-%u", &c_data_port, &c_mon_port) < 1)
|
|
|
|
g_warning("rtsp: failed to parse client_port");
|
|
|
|
}
|
|
|
|
if (!c_data_port || !s_data_port)
|
|
|
|
return;
|
|
|
|
|
|
|
|
conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_data_port,
|
2000-10-21 05:52:28 +00:00
|
|
|
c_data_port, 0, 0);
|
2000-10-19 06:45:11 +00:00
|
|
|
conversation_set_dissector(conv, dissect_rtp);
|
2000-04-21 01:45:58 +00:00
|
|
|
|
|
|
|
if (!c_mon_port || !s_mon_port)
|
|
|
|
return;
|
|
|
|
|
|
|
|
conv = conversation_new(&pi.src, &pi.dst, PT_UDP, s_mon_port,
|
2000-10-21 05:52:28 +00:00
|
|
|
c_mon_port, 0, 0);
|
2000-10-19 06:45:11 +00:00
|
|
|
conversation_set_dissector(conv, dissect_rtcp);
|
2000-04-21 01:45:58 +00:00
|
|
|
}
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
static void
|
|
|
|
dissect_rtsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-07-07 00:34:58 +00:00
|
|
|
{
|
|
|
|
proto_tree *rtsp_tree;
|
2000-11-09 10:56:33 +00:00
|
|
|
proto_item *ti = NULL;
|
|
|
|
gint offset = 0;
|
|
|
|
const u_char *line;
|
|
|
|
gint next_offset;
|
|
|
|
const u_char *linep, *lineend;
|
1999-07-07 00:34:58 +00:00
|
|
|
int linelen;
|
|
|
|
u_char c;
|
2000-11-09 10:56:33 +00:00
|
|
|
int is_sdp = FALSE;
|
|
|
|
int datalen;
|
1999-07-07 00:34:58 +00:00
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
CHECK_DISPLAY_AS_DATA(proto_rtsp, tvb, pinfo, tree);
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
pinfo->current_proto = "RTSP";
|
2000-01-13 03:07:26 +00:00
|
|
|
|
|
|
|
rtsp_tree = NULL;
|
|
|
|
if (tree) {
|
2000-11-09 10:56:33 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_rtsp, tvb, offset,
|
|
|
|
tvb_length_remaining(tvb, offset), FALSE);
|
2000-01-13 03:07:26 +00:00
|
|
|
rtsp_tree = proto_item_add_subtree(ti, ett_rtsp);
|
|
|
|
}
|
1999-07-07 00:34:58 +00:00
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL))
|
|
|
|
col_add_str(pinfo->fd, COL_PROTOCOL, "RTSP");
|
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
1999-07-07 00:34:58 +00:00
|
|
|
/*
|
2000-01-13 03:07:26 +00:00
|
|
|
* Put the first line from the buffer into the summary
|
2000-11-09 10:56:33 +00:00
|
|
|
* if it's an RTSP request or reply (but leave out the
|
|
|
|
* line terminator).
|
|
|
|
* Otherwise, just call it a continuation.
|
1999-07-07 00:34:58 +00:00
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
|
|
|
|
line = tvb_get_ptr(tvb, offset, linelen);
|
|
|
|
switch (is_rtsp_request_or_reply(line, linelen)) {
|
|
|
|
|
|
|
|
case RTSP_REQUEST:
|
|
|
|
case RTSP_REPLY:
|
|
|
|
col_add_str(pinfo->fd, COL_INFO,
|
|
|
|
format_text(line, linelen));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
col_add_str(pinfo->fd, COL_INFO, "Continuation");
|
|
|
|
break;
|
|
|
|
}
|
1999-07-07 00:34:58 +00:00
|
|
|
}
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
/*
|
|
|
|
* Process the packet data, a line at a time.
|
|
|
|
*/
|
|
|
|
while (tvb_length_remaining(tvb, offset)) {
|
1999-07-07 00:34:58 +00:00
|
|
|
/*
|
|
|
|
* Find the end of the line.
|
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
linelen = tvb_find_line_end(tvb, offset, -1, &next_offset);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a buffer that refers to the line.
|
|
|
|
*/
|
|
|
|
line = tvb_get_ptr(tvb, offset, linelen);
|
|
|
|
lineend = line + linelen;
|
1999-07-07 00:34:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* OK, does it look like an RTSP request or
|
|
|
|
* response?
|
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
switch (is_rtsp_request_or_reply(line, linelen)) {
|
|
|
|
|
|
|
|
case RTSP_REQUEST:
|
|
|
|
if (rtsp_tree != NULL)
|
|
|
|
process_rtsp_request(tvb, offset, line, linelen,
|
|
|
|
rtsp_tree);
|
|
|
|
goto is_rtsp;
|
|
|
|
|
|
|
|
case RTSP_REPLY:
|
|
|
|
if (rtsp_tree != NULL)
|
|
|
|
process_rtsp_reply(tvb, offset, line, linelen,
|
|
|
|
rtsp_tree);
|
1999-07-07 00:34:58 +00:00
|
|
|
goto is_rtsp;
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
case NOT_RTSP:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-07-07 00:34:58 +00:00
|
|
|
/*
|
|
|
|
* No. Does it look like a blank line (as would
|
|
|
|
* appear at the end of an RTSP request)?
|
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
if (linelen == 0)
|
|
|
|
goto is_rtsp; /* Yes. */
|
1999-07-07 00:34:58 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* No. Does it look like a MIME header?
|
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
linep = line;
|
1999-07-07 00:34:58 +00:00
|
|
|
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.
|
|
|
|
*/
|
2000-11-09 10:56:33 +00:00
|
|
|
if (is_content_sdp(line, linelen))
|
|
|
|
is_sdp = TRUE;
|
1999-07-07 00:34:58 +00:00
|
|
|
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.
|
|
|
|
*/
|
2000-04-21 07:43:53 +00:00
|
|
|
if (rtsp_tree) {
|
2000-11-09 10:56:33 +00:00
|
|
|
proto_tree_add_text(rtsp_tree, tvb, offset,
|
|
|
|
next_offset - offset, "%s",
|
|
|
|
tvb_format_text(tvb, offset, next_offset - offset));
|
2000-04-21 07:43:53 +00:00
|
|
|
}
|
2000-04-21 01:45:58 +00:00
|
|
|
if (linelen > strlen(rtsp_transport) &&
|
2000-11-09 10:56:33 +00:00
|
|
|
strncasecmp(line, rtsp_transport,
|
2000-04-21 01:45:58 +00:00
|
|
|
strlen(rtsp_transport)) == 0)
|
2000-11-09 10:56:33 +00:00
|
|
|
rtsp_create_conversation(line, line + linelen);
|
|
|
|
offset = next_offset;
|
1999-07-07 00:34:58 +00:00
|
|
|
}
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
datalen = tvb_length_remaining(tvb, offset);
|
1999-07-07 00:34:58 +00:00
|
|
|
if (is_sdp) {
|
2000-11-09 10:56:33 +00:00
|
|
|
if (datalen > 0) {
|
2000-11-10 06:50:37 +00:00
|
|
|
tvbuff_t *new_tvb;
|
2000-11-09 10:56:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Fix up the top-level item so that it doesn't
|
|
|
|
* include the SDP stuff.
|
|
|
|
*/
|
|
|
|
if (ti != NULL)
|
|
|
|
proto_item_set_len(ti, offset);
|
|
|
|
|
|
|
|
/*
|
2000-11-10 06:50:37 +00:00
|
|
|
* Now creat a tvbuff for the SDP stuff and
|
|
|
|
* dissect it.
|
2000-11-09 10:56:33 +00:00
|
|
|
*/
|
2000-11-10 06:50:37 +00:00
|
|
|
new_tvb = tvb_new_subset(tvb, offset, -1, -1);
|
|
|
|
dissect_sdp(new_tvb, pinfo, tree);
|
2000-11-09 10:56:33 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (datalen > 0) {
|
|
|
|
proto_tree_add_text(rtsp_tree, tvb, offset, datalen,
|
|
|
|
"Data (%d bytes)", datalen);
|
|
|
|
}
|
1999-07-07 00:34:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-09 10:56:33 +00:00
|
|
|
static void
|
|
|
|
process_rtsp_request(tvbuff_t *tvb, int offset, const u_char *data,
|
|
|
|
int linelen, proto_tree *tree)
|
1999-07-07 00:34:58 +00:00
|
|
|
{
|
2000-01-13 03:07:26 +00:00
|
|
|
const u_char *lineend = data + linelen;
|
2000-11-09 10:56:33 +00:00
|
|
|
int ii;
|
|
|
|
const u_char *url;
|
|
|
|
const u_char *url_start;
|
|
|
|
u_char *tmp_url;
|
1999-07-07 00:34:58 +00:00
|
|
|
|
|
|
|
/* Request Methods */
|
2000-11-09 10:56:33 +00:00
|
|
|
for (ii = 0; ii < RTSP_NMETHODS; ii++) {
|
2000-01-13 03:07:26 +00:00
|
|
|
size_t len = strlen(rtsp_methods[ii]);
|
1999-07-07 00:34:58 +00:00
|
|
|
if (linelen >= len && !strncasecmp(rtsp_methods[ii], data, len))
|
2000-01-13 03:07:26 +00:00
|
|
|
break;
|
1999-07-07 00:34:58 +00:00
|
|
|
}
|
2000-11-09 10:56:33 +00:00
|
|
|
if (ii == RTSP_NMETHODS) {
|
|
|
|
/*
|
|
|
|
* We got here because "is_rtsp_request_or_reply()" returned
|
|
|
|
* RTSP_REQUEST, so we know one of the request methods
|
|
|
|
* matched, so we "can't get here".
|
|
|
|
*/
|
|
|
|
g_assert_not_reached();
|
2000-01-13 03:07:26 +00:00
|
|
|
}
|
2000-11-09 10:56:33 +00:00
|
|
|
|
|
|
|
/* Method name */
|
|
|
|
proto_tree_add_string_hidden(tree, hf_rtsp_method, tvb, offset,
|
|
|
|
strlen(rtsp_methods[ii]), rtsp_methods[ii]);
|
|
|
|
|
|
|
|
/* URL */
|
|
|
|
url = data;
|
|
|
|
while (url < lineend && !isspace(*url))
|
|
|
|
url++;
|
|
|
|
while (url < lineend && isspace(*url))
|
|
|
|
url++;
|
|
|
|
url_start = url;
|
|
|
|
while (url < lineend && !isspace(*url))
|
|
|
|
url++;
|
|
|
|
tmp_url = g_malloc(url - url_start + 1);
|
|
|
|
memcpy(tmp_url, url_start, url - url_start);
|
|
|
|
tmp_url[url - url_start] = 0;
|
|
|
|
proto_tree_add_string_hidden(tree, hf_rtsp_url, tvb,
|
|
|
|
offset + (url_start - data), url - url_start, tmp_url);
|
|
|
|
g_free(tmp_url);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
process_rtsp_reply(tvbuff_t *tvb, int offset, const u_char *data,
|
|
|
|
int linelen, proto_tree *tree)
|
|
|
|
{
|
|
|
|
const u_char *lineend = data + linelen;
|
|
|
|
const u_char *status = data;
|
|
|
|
const u_char *status_start;
|
|
|
|
unsigned int status_i;
|
|
|
|
|
|
|
|
/* status code */
|
|
|
|
while (status < lineend && !isspace(*status))
|
|
|
|
status++;
|
|
|
|
while (status < lineend && isspace(*status))
|
|
|
|
status++;
|
|
|
|
status_start = status;
|
|
|
|
status_i = 0;
|
|
|
|
while (status < lineend && isdigit(*status))
|
|
|
|
status_i = status_i * 10 + *status++ - '0';
|
|
|
|
proto_tree_add_uint_hidden(tree, hf_rtsp_status, tvb,
|
|
|
|
offset + (status_start - data),
|
|
|
|
status - status_start, status_i);
|
1999-07-07 00:34:58 +00:00
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_rtsp(void)
|
|
|
|
{
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rtsp,
|
|
|
|
};
|
2000-01-13 03:07:26 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_rtsp_method,
|
|
|
|
{ "Method", "rtsp.method", FT_STRING, BASE_NONE, NULL, 0 }},
|
|
|
|
{ &hf_rtsp_url,
|
|
|
|
{ "URL", "rtsp.url", FT_STRING, BASE_NONE, NULL, 0 }},
|
|
|
|
{ &hf_rtsp_status,
|
|
|
|
{ "Status", "rtsp.status", FT_UINT32, BASE_DEC, NULL, 0 }},
|
|
|
|
};
|
1999-07-29 05:47:07 +00:00
|
|
|
|
2000-01-13 03:07:26 +00:00
|
|
|
proto_rtsp = proto_register_protocol("Real Time Streaming Protocol",
|
|
|
|
"rtsp");
|
|
|
|
proto_register_field_array(proto_rtsp, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rtsp(void)
|
|
|
|
{
|
2000-11-09 10:56:33 +00:00
|
|
|
dissector_add("tcp.port", TCP_PORT_RTSP, dissect_rtsp);
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|