4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include <sys/types.h>
38 #define SDP_VERSION_FIELD 'v'
39 #define SDP_ORIGIN_FIELD 'o'
40 #define SDP_NAME_FIELD 's'
41 #define SDP_INFO_FIELD 'i'
42 #define SDP_URI_FIELD 'u'
43 #define SDP_EMAIL_FIELD 'e'
44 #define SDP_PHONE_FIELD 'p'
45 #define SDP_CONNECTION_FIELD 'c'
46 #define SDP_BANDWIDTH_FIELD 'b'
47 #define SDP_TIME_FIELD 't'
48 #define SDP_REPEAT_FIELD 'r'
49 #define SDP_ZONE_FIELD 'z'
50 #define SDP_KEY_FIELD 'k'
51 #define SDP_ATTRIBUTE_FIELD 'a'
52 #define SDP_MEDIA_FIELD 'm'
54 /* SDP Parse errors */
55 #define SDP_VERSION_ERROR 0x00000001
56 #define SDP_ORIGIN_ERROR 0x00000002
57 #define SDP_NAME_ERROR 0x00000004
58 #define SDP_INFO_ERROR 0x00000008
59 #define SDP_URI_ERROR 0x00000010
60 #define SDP_EMAIL_ERROR 0x00000020
61 #define SDP_PHONE_ERROR 0x00000040
62 #define SDP_CONNECTION_ERROR 0x00000080
63 #define SDP_BANDWIDTH_ERROR 0x00000100
64 #define SDP_TIME_ERROR 0x00000200
65 #define SDP_REPEAT_TIME_ERROR 0x00000400
66 #define SDP_ZONE_ERROR 0x00000800
67 #define SDP_KEY_ERROR 0x00001000
68 #define SDP_ATTRIBUTE_ERROR 0x00002000
69 #define SDP_MEDIA_ERROR 0x00004000
70 #define SDP_FIELDS_ORDER_ERROR 0x00008000
71 #define SDP_MISSING_FIELDS 0x00010000
73 #define SDP_AUDIO "audio"
74 #define SDP_VIDEO "video"
75 #define SDP_TEXT "text"
76 #define SDP_APPLICATION "application"
77 #define SDP_MESSAGE "message"
78 #define SDP_RTPMAP "rtpmap"
80 #define SDP_SESSION_VERSION_1 1
82 typedef struct sdp_list
{
84 struct sdp_list
*next
;
89 * o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
91 typedef struct sdp_origin
{
101 * SDP connection field.
102 * c=<nettype> <addrtype> <connection-address>[/ttl]/<number of addresses>
104 typedef struct sdp_conn
{
109 struct sdp_conn
*c_next
;
114 * SDP repeat field. Always found in time structure.
115 * r=<repeat interval> <active duration> <offsets from start-time>
117 typedef struct sdp_repeat
{
120 sdp_list_t
*r_offset
;
121 struct sdp_repeat
*r_next
;
126 * t=<start-time> <stop-time>
128 typedef struct sdp_time
{
131 sdp_repeat_t
*t_repeat
;
132 struct sdp_time
*t_next
;
136 * SDP time zone field.
137 * z=<adjustment time> <offset> <adjustment time> <offset> ....
139 typedef struct sdp_zone
{
142 struct sdp_zone
*z_next
;
146 * SDP attribute field.
147 * a=<attribute> or a=<attribute>:<value>
149 typedef struct sdp_attr
{
152 struct sdp_attr
*a_next
;
156 * SDP bandwidth field.
157 * b=<bwtype>:<bandwidth>
159 typedef struct sdp_bandwidth
{
162 struct sdp_bandwidth
*b_next
;
166 * SDP key field to session or media section of SDP.
167 * k=<method> or k=<method>:<encryption key>
169 typedef struct sdp_key
{
174 typedef struct sdp_session sdp_session_t
;
177 * SDP media section, contains media fields and other fields within
179 * m=<media> <port>[/portcount] <proto> <fmt> ...
181 typedef struct sdp_media
{
186 sdp_list_t
*m_format
;
189 sdp_bandwidth_t
*m_bw
;
192 struct sdp_media
*m_next
;
193 sdp_session_t
*m_session
;
197 int sdp_session_version
;
199 sdp_origin_t
*s_origin
;
206 sdp_bandwidth_t
*s_bw
;
211 sdp_media_t
*s_media
;
214 extern int sdp_parse(const char *, int, int, sdp_session_t
**,
216 extern sdp_media_t
*sdp_find_media(sdp_media_t
*, const char *);
217 extern sdp_attr_t
*sdp_find_attribute(sdp_attr_t
*, const char *);
218 extern sdp_attr_t
*sdp_find_media_rtpmap(sdp_media_t
*, const char *);
219 extern sdp_session_t
*sdp_clone_session(const sdp_session_t
*);
220 extern sdp_session_t
*sdp_new_session();
221 extern int sdp_add_origin(sdp_session_t
*, const char *, uint64_t,
222 uint64_t, const char *, const char *, const char *);
223 extern int sdp_add_name(sdp_session_t
*, const char *);
224 extern int sdp_add_information(char **, const char *);
225 extern int sdp_add_uri(sdp_session_t
*, const char *);
226 extern int sdp_add_email(sdp_session_t
*, const char *);
227 extern int sdp_add_phone(sdp_session_t
*, const char *);
228 extern int sdp_add_connection(sdp_conn_t
**, const char *,
229 const char *, const char *, uint8_t, int);
230 extern int sdp_add_bandwidth(sdp_bandwidth_t
**, const char *,
232 extern int sdp_add_repeat(sdp_time_t
*, uint64_t, uint64_t,
234 extern int sdp_add_time(sdp_session_t
*, uint64_t, uint64_t,
236 extern int sdp_add_zone(sdp_session_t
*, uint64_t, const char *);
237 extern int sdp_add_key(sdp_key_t
**, const char *, const char *);
238 extern int sdp_add_attribute(sdp_attr_t
**, const char *,
240 extern int sdp_add_media(sdp_session_t
*, const char *, uint_t
,
241 int, const char *, const char *, sdp_media_t
**);
242 extern int sdp_delete_all_field(sdp_session_t
*, const char);
243 extern int sdp_delete_all_media_field(sdp_media_t
*, const char);
244 extern int sdp_delete_media(sdp_media_t
**, sdp_media_t
*);
245 extern int sdp_delete_attribute(sdp_attr_t
**, sdp_attr_t
*);
246 extern void sdp_free_session(sdp_session_t
*);
247 extern char *sdp_session_to_str(const sdp_session_t
*, int *);