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