1*a93a1f58Sgm /*
2*a93a1f58Sgm  * CDDL HEADER START
3*a93a1f58Sgm  *
4*a93a1f58Sgm  * The contents of this file are subject to the terms of the
5*a93a1f58Sgm  * Common Development and Distribution License (the "License").
6*a93a1f58Sgm  * You may not use this file except in compliance with the License.
7*a93a1f58Sgm  *
8*a93a1f58Sgm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*a93a1f58Sgm  * or http://www.opensolaris.org/os/licensing.
10*a93a1f58Sgm  * See the License for the specific language governing permissions
11*a93a1f58Sgm  * and limitations under the License.
12*a93a1f58Sgm  *
13*a93a1f58Sgm  * When distributing Covered Code, include this CDDL HEADER in each
14*a93a1f58Sgm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*a93a1f58Sgm  * If applicable, add the following below this CDDL HEADER, with the
16*a93a1f58Sgm  * fields enclosed by brackets "[]" replaced with your own identifying
17*a93a1f58Sgm  * information: Portions Copyright [yyyy] [name of copyright owner]
18*a93a1f58Sgm  *
19*a93a1f58Sgm  * CDDL HEADER END
20*a93a1f58Sgm  */
21*a93a1f58Sgm 
22*a93a1f58Sgm /*
23*a93a1f58Sgm  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*a93a1f58Sgm  * Use is subject to license terms.
25*a93a1f58Sgm  */
26*a93a1f58Sgm 
27*a93a1f58Sgm #ifndef _SDP_PARSE_H
28*a93a1f58Sgm #define	_SDP_PARSE_H
29*a93a1f58Sgm 
30*a93a1f58Sgm #ifdef __cplusplus
31*a93a1f58Sgm extern "C" {
32*a93a1f58Sgm #endif
33*a93a1f58Sgm 
34*a93a1f58Sgm #include <sdp.h>
35*a93a1f58Sgm #include <sys/types.h>
36*a93a1f58Sgm 
37*a93a1f58Sgm #define	SDP_MEMORY_ERROR		0x10000000
38*a93a1f58Sgm 
39*a93a1f58Sgm #define	SDP_VERSION_ORDER		" "
40*a93a1f58Sgm #define	SDP_ORIGIN_ORDER		"v"
41*a93a1f58Sgm #define	SDP_NAME_ORDER			"o"
42*a93a1f58Sgm #define	SDP_INFO_ORDER			"s"
43*a93a1f58Sgm #define	SDP_URI_ORDER			"is"
44*a93a1f58Sgm #define	SDP_EMAIL_ORDER			"euis"
45*a93a1f58Sgm #define	SDP_PHONE_ORDER			"peuis"
46*a93a1f58Sgm #define	SDP_CONN_ORDER			"peuis"
47*a93a1f58Sgm #define	SDP_BW_ORDER			"bcpeuis"
48*a93a1f58Sgm #define	SDP_TIME_ORDER			"tbcpeuis"
49*a93a1f58Sgm #define	SDP_REPEAT_ORDER		"rt"
50*a93a1f58Sgm #define	SDP_ZONE_ORDER			"rt"
51*a93a1f58Sgm #define	SDP_KEY_ORDER			"zrt"
52*a93a1f58Sgm #define	SDP_ATTR_ORDER			"akzrt"
53*a93a1f58Sgm #define	SDP_MEDIA_ORDER			"makzrt"
54*a93a1f58Sgm #define	SDP_M_INFO_ORDER		"m"
55*a93a1f58Sgm #define	SDP_M_CONN_ORDER		"cim"
56*a93a1f58Sgm #define	SDP_M_BW_ORDER			"bcim"
57*a93a1f58Sgm #define	SDP_M_KEY_ORDER			"bcim"
58*a93a1f58Sgm #define	SDP_M_ATTR_ORDER		"akbcim"
59*a93a1f58Sgm 
60*a93a1f58Sgm typedef struct sdp_description {
61*a93a1f58Sgm 	/*
62*a93a1f58Sgm 	 * Following boolean fields are used to
63*a93a1f58Sgm 	 * check for presence of mandatory fields
64*a93a1f58Sgm 	 * in session structure
65*a93a1f58Sgm 	 */
66*a93a1f58Sgm 	boolean_t	d_version;	/* Version field */
67*a93a1f58Sgm 	boolean_t	d_origin;	/* Origin field */
68*a93a1f58Sgm 	boolean_t	d_name;		/* Name field */
69*a93a1f58Sgm 	boolean_t	d_conn;		/* Connection field */
70*a93a1f58Sgm 	boolean_t	d_mconn;	/* Media connection field */
71*a93a1f58Sgm 	boolean_t	d_mparsed;	/* Media parsed */
72*a93a1f58Sgm 	boolean_t	d_tparsed;	/* Time parsed */
73*a93a1f58Sgm 	/*
74*a93a1f58Sgm 	 * keeps count of connection fields within
75*a93a1f58Sgm 	 * media section
76*a93a1f58Sgm 	 */
77*a93a1f58Sgm 	int		d_mccount;
78*a93a1f58Sgm 	sdp_media_t	*d_lmedia;	/* Last media field */
79*a93a1f58Sgm 	sdp_time_t	*d_ltime;	/* Last time field */
80*a93a1f58Sgm 	uint_t		d_perror;	/* Parse error */
81*a93a1f58Sgm 	char		d_prev;		/* previous field */
82*a93a1f58Sgm 	char		d_mprev;	/* previous field in media section */
83*a93a1f58Sgm } sdp_description_t;
84*a93a1f58Sgm 
85*a93a1f58Sgm extern int		add_value_to_list(sdp_list_t **, const char *, int,
86*a93a1f58Sgm 			    boolean_t);
87*a93a1f58Sgm extern int		sdp_list_to_str(sdp_list_t *, char **, boolean_t);
88*a93a1f58Sgm extern int		sdp_str_to_list(sdp_list_t **, const char *, int,
89*a93a1f58Sgm 			    boolean_t);
90*a93a1f58Sgm extern void		sdp_free_repeat(sdp_repeat_t *);
91*a93a1f58Sgm extern void		sdp_free_origin(sdp_origin_t *);
92*a93a1f58Sgm extern void		sdp_free_list(sdp_list_t *);
93*a93a1f58Sgm extern void		sdp_free_connection(sdp_conn_t *);
94*a93a1f58Sgm extern void		sdp_free_bandwidth(sdp_bandwidth_t *);
95*a93a1f58Sgm extern void		sdp_free_time(sdp_time_t *);
96*a93a1f58Sgm extern void		sdp_free_zone(sdp_zone_t *);
97*a93a1f58Sgm extern void		sdp_free_attribute(sdp_attr_t *);
98*a93a1f58Sgm extern void		sdp_free_key(sdp_key_t *);
99*a93a1f58Sgm extern void		sdp_free_media(sdp_media_t *);
100*a93a1f58Sgm 
101*a93a1f58Sgm #ifdef __cplusplus
102*a93a1f58Sgm }
103*a93a1f58Sgm #endif
104*a93a1f58Sgm 
105*a93a1f58Sgm #endif /* _SDP_PARSE_H */
106