2 * Routines for SDP packet disassembly
4 * Jason Lango <jal@netapp.com>
5 * Liberally copied from packet-http.c, by Guy Harris <guy@netapp.com>
7 * $Id: packet-sdp.c,v 1.2 1999/07/07 22:51:53 gram Exp $
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@zing.org>
11 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #ifdef HAVE_SYS_TYPES_H
34 #include <sys/types.h>
43 void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
48 const u_char *data, *dataend;
49 const u_char *lineend, *eol;
58 dataend = data + END_OF_FRAME;
60 if (check_col(fd, COL_PROTOCOL))
61 col_add_str(fd, COL_PROTOCOL, "SDP");
63 if (check_col(fd, COL_INFO)) {
64 /* XXX: Needs description. */
65 col_add_str(fd, COL_INFO, "Session Description");
71 ti = proto_tree_add_text(tree, offset, END_OF_FRAME,
72 "Session Description Protocol");
73 sdp_tree = proto_item_add_subtree(ti, ETT_SDP);
76 for (; data < dataend; offset += linelen, data = lineend) {
78 * Find the end of the line.
80 lineend = find_line_end(data, dataend, &eol);
81 linelen = lineend - data;
84 * Line must contain at least e.g. "v=".
91 proto_tree_add_text(sdp_tree, offset, linelen,
93 format_text(data, linelen));
97 valuelen = linelen - 2;
105 typename = "Session Description, version";
108 typename = "Owner/Creator, Session Id";
111 typename = "Session Name";
115 typename = "Session Information";
116 else if (section == 'm')
117 typename = "Media Title";
119 typename = "Misplaced";
122 typename = "URI of Description";
125 typename = "E-mail Address";
128 typename = "Phone Number";
131 typename = "Connection Information";
134 typename = "Bandwidth Information";
138 typename = "Time Description, active time";
141 typename = "Repeat Time";
145 typename = "Media Description, name and address";
148 typename = "Encryption Key";
152 typename = "Session Attribute";
153 else if (section == 'm')
154 typename = "Media Attribute";
156 typename = "Misplaced";
159 typename = "Time Zone Adjustment";
162 typename = "Unknown";
166 proto_tree_add_text(sdp_tree, offset, linelen,
167 "%s (%c): %s", typename, type,
168 format_text(value, valuelen));
171 if (data < dataend) {
172 proto_tree_add_text(sdp_tree, offset, END_OF_FRAME,
173 "Data (%d bytes)", END_OF_FRAME);