1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SDP_PARSE_H
28 #define	_SDP_PARSE_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sdp.h>
35 #include <sys/types.h>
36 
37 #define	SDP_MEMORY_ERROR		0x10000000
38 
39 #define	SDP_VERSION_ORDER		" "
40 #define	SDP_ORIGIN_ORDER		"v"
41 #define	SDP_NAME_ORDER			"o"
42 #define	SDP_INFO_ORDER			"s"
43 #define	SDP_URI_ORDER			"is"
44 #define	SDP_EMAIL_ORDER			"euis"
45 #define	SDP_PHONE_ORDER			"peuis"
46 #define	SDP_CONN_ORDER			"peuis"
47 #define	SDP_BW_ORDER			"bcpeuis"
48 #define	SDP_TIME_ORDER			"tbcpeuis"
49 #define	SDP_REPEAT_ORDER		"rt"
50 #define	SDP_ZONE_ORDER			"rt"
51 #define	SDP_KEY_ORDER			"zrt"
52 #define	SDP_ATTR_ORDER			"akzrt"
53 #define	SDP_MEDIA_ORDER			"makzrt"
54 #define	SDP_M_INFO_ORDER		"m"
55 #define	SDP_M_CONN_ORDER		"cim"
56 #define	SDP_M_BW_ORDER			"bcim"
57 #define	SDP_M_KEY_ORDER			"bcim"
58 #define	SDP_M_ATTR_ORDER		"akbcim"
59 
60 typedef struct sdp_description {
61 	/*
62 	 * Following boolean fields are used to
63 	 * check for presence of mandatory fields
64 	 * in session structure
65 	 */
66 	boolean_t	d_version;	/* Version field */
67 	boolean_t	d_origin;	/* Origin field */
68 	boolean_t	d_name;		/* Name field */
69 	boolean_t	d_conn;		/* Connection field */
70 	boolean_t	d_mconn;	/* Media connection field */
71 	boolean_t	d_mparsed;	/* Media parsed */
72 	boolean_t	d_tparsed;	/* Time parsed */
73 	/*
74 	 * keeps count of connection fields within
75 	 * media section
76 	 */
77 	int		d_mccount;
78 	sdp_media_t	*d_lmedia;	/* Last media field */
79 	sdp_time_t	*d_ltime;	/* Last time field */
80 	uint_t		d_perror;	/* Parse error */
81 	char		d_prev;		/* previous field */
82 	char		d_mprev;	/* previous field in media section */
83 } sdp_description_t;
84 
85 extern int		add_value_to_list(sdp_list_t **, const char *, int,
86 			    boolean_t);
87 extern int		sdp_list_to_str(sdp_list_t *, char **, boolean_t);
88 extern int		sdp_str_to_list(sdp_list_t **, const char *, int,
89 			    boolean_t);
90 extern void		sdp_free_repeat(sdp_repeat_t *);
91 extern void		sdp_free_origin(sdp_origin_t *);
92 extern void		sdp_free_list(sdp_list_t *);
93 extern void		sdp_free_connection(sdp_conn_t *);
94 extern void		sdp_free_bandwidth(sdp_bandwidth_t *);
95 extern void		sdp_free_time(sdp_time_t *);
96 extern void		sdp_free_zone(sdp_zone_t *);
97 extern void		sdp_free_attribute(sdp_attr_t *);
98 extern void		sdp_free_key(sdp_key_t *);
99 extern void		sdp_free_media(sdp_media_t *);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* _SDP_PARSE_H */
106