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