2 * Routines for SDP packet disassembly (RFC 2327)
4 * Jason Lango <jal@netapp.com>
5 * Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
7 * $Id: packet-sdp.c,v 1.6 2000/01/22 06:22:17 guy 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 static int proto_sdp = -1;
45 static int ett_sdp = -1;
47 void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
52 const u_char *data, *dataend;
53 const u_char *lineend, *eol;
62 dataend = data + END_OF_FRAME;
64 if (check_col(fd, COL_PROTOCOL))
65 col_add_str(fd, COL_PROTOCOL, "SDP");
67 if (check_col(fd, COL_INFO)) {
68 /* XXX: Needs description. */
69 col_add_str(fd, COL_INFO, "Session Description");
75 ti = proto_tree_add_item(tree, proto_sdp, offset, END_OF_FRAME, NULL);
76 sdp_tree = proto_item_add_subtree(ti, ett_sdp);
79 for (; data < dataend; offset += linelen, data = lineend) {
81 * Find the end of the line.
83 lineend = find_line_end(data, dataend, &eol);
84 linelen = lineend - data;
87 * Line must contain at least e.g. "v=".
94 proto_tree_add_text(sdp_tree, offset, linelen,
96 format_text(data, linelen));
100 valuelen = linelen - 2;
108 typename = "Session Description, version";
111 typename = "Owner/Creator, Session Id";
114 typename = "Session Name";
118 typename = "Session Information";
119 else if (section == 'm')
120 typename = "Media Title";
122 typename = "Misplaced";
125 typename = "URI of Description";
128 typename = "E-mail Address";
131 typename = "Phone Number";
134 typename = "Connection Information";
137 typename = "Bandwidth Information";
141 typename = "Time Description, active time";
144 typename = "Repeat Time";
148 typename = "Media Description, name and address";
151 typename = "Encryption Key";
155 typename = "Session Attribute";
156 else if (section == 'm')
157 typename = "Media Attribute";
159 typename = "Misplaced";
162 typename = "Time Zone Adjustment";
165 typename = "Unknown";
169 proto_tree_add_text(sdp_tree, offset, linelen,
170 "%s (%c): %s", typename, type,
171 format_text(value, valuelen));
174 if (data < dataend) {
175 proto_tree_add_text(sdp_tree, offset, END_OF_FRAME,
176 "Data (%d bytes)", END_OF_FRAME);
181 proto_register_sdp(void)
183 /* static hf_register_info hf[] = {
185 { "Name", "sdp.abbreviation", TYPE, VALS_POINTER }},
187 static gint *ett[] = {
191 proto_sdp = proto_register_protocol("Session Description Protocol", "sdp");
192 /* proto_register_field_array(proto_sdp, hf, array_length(hf));*/
193 proto_register_subtree_array(ett, array_length(ett));