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.3 1999/07/29 05:47:03 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 static int proto_sdp = -1;
45 void dissect_sdp(const u_char *pd, int offset, frame_data *fd,
50 const u_char *data, *dataend;
51 const u_char *lineend, *eol;
60 dataend = data + END_OF_FRAME;
62 if (check_col(fd, COL_PROTOCOL))
63 col_add_str(fd, COL_PROTOCOL, "SDP");
65 if (check_col(fd, COL_INFO)) {
66 /* XXX: Needs description. */
67 col_add_str(fd, COL_INFO, "Session Description");
73 ti = proto_tree_add_item(tree, proto_sdp, offset, END_OF_FRAME, NULL);
74 sdp_tree = proto_item_add_subtree(ti, ETT_SDP);
77 for (; data < dataend; offset += linelen, data = lineend) {
79 * Find the end of the line.
81 lineend = find_line_end(data, dataend, &eol);
82 linelen = lineend - data;
85 * Line must contain at least e.g. "v=".
92 proto_tree_add_text(sdp_tree, offset, linelen,
94 format_text(data, linelen));
98 valuelen = linelen - 2;
106 typename = "Session Description, version";
109 typename = "Owner/Creator, Session Id";
112 typename = "Session Name";
116 typename = "Session Information";
117 else if (section == 'm')
118 typename = "Media Title";
120 typename = "Misplaced";
123 typename = "URI of Description";
126 typename = "E-mail Address";
129 typename = "Phone Number";
132 typename = "Connection Information";
135 typename = "Bandwidth Information";
139 typename = "Time Description, active time";
142 typename = "Repeat Time";
146 typename = "Media Description, name and address";
149 typename = "Encryption Key";
153 typename = "Session Attribute";
154 else if (section == 'm')
155 typename = "Media Attribute";
157 typename = "Misplaced";
160 typename = "Time Zone Adjustment";
163 typename = "Unknown";
167 proto_tree_add_text(sdp_tree, offset, linelen,
168 "%s (%c): %s", typename, type,
169 format_text(value, valuelen));
172 if (data < dataend) {
173 proto_tree_add_text(sdp_tree, offset, END_OF_FRAME,
174 "Data (%d bytes)", END_OF_FRAME);
179 proto_register_sdp(void)
181 /* static hf_register_info hf[] = {
183 { "Name", "sdp.abbreviation", TYPE, VALS_POINTER }},
186 proto_sdp = proto_register_protocol("Session Description Protocol", "sdp");
187 /* proto_register_field_array(proto_sdp, hf, array_length(hf));*/