xref: /onnv-gate/usr/src/lib/libsip/common/sip_parse_uri.h (revision 2882:5f4abbf1f03e)
1*2882Svi117747 /*
2*2882Svi117747  * CDDL HEADER START
3*2882Svi117747  *
4*2882Svi117747  * The contents of this file are subject to the terms of the
5*2882Svi117747  * Common Development and Distribution License (the "License").
6*2882Svi117747  * You may not use this file except in compliance with the License.
7*2882Svi117747  *
8*2882Svi117747  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2882Svi117747  * or http://www.opensolaris.org/os/licensing.
10*2882Svi117747  * See the License for the specific language governing permissions
11*2882Svi117747  * and limitations under the License.
12*2882Svi117747  *
13*2882Svi117747  * When distributing Covered Code, include this CDDL HEADER in each
14*2882Svi117747  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2882Svi117747  * If applicable, add the following below this CDDL HEADER, with the
16*2882Svi117747  * fields enclosed by brackets "[]" replaced with your own identifying
17*2882Svi117747  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2882Svi117747  *
19*2882Svi117747  * CDDL HEADER END
20*2882Svi117747  */
21*2882Svi117747 
22*2882Svi117747 /*
23*2882Svi117747  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*2882Svi117747  * Use is subject to license terms.
25*2882Svi117747  */
26*2882Svi117747 
27*2882Svi117747 #ifndef	_SIP_PARSE_URI_H
28*2882Svi117747 #define	_SIP_PARSE_URI_H
29*2882Svi117747 
30*2882Svi117747 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*2882Svi117747 
32*2882Svi117747 #ifdef	__cplusplus
33*2882Svi117747 extern "C" {
34*2882Svi117747 #endif
35*2882Svi117747 
36*2882Svi117747 #include <sys/types.h>
37*2882Svi117747 #include <sip.h>
38*2882Svi117747 
39*2882Svi117747 #define	SIP_URI_BUF_SIZE	128
40*2882Svi117747 
41*2882Svi117747 #define	SIP_SCHEME		"sip"
42*2882Svi117747 #define	SIPS_SCHEME		"sips"
43*2882Svi117747 
44*2882Svi117747 #define	SIP_SCHEME_LEN		3
45*2882Svi117747 #define	SIPS_SCHEME_LEN		4
46*2882Svi117747 
47*2882Svi117747 /*
48*2882Svi117747  * SIP-URI = "sip:" [ userinfo ] hostport
49*2882Svi117747  *           uri-parameters [ headers ]
50*2882Svi117747  * SIPS-URI =  "sips:" [ userinfo ] hostport
51*2882Svi117747  *           uri-parameters [ headers ]
52*2882Svi117747  * uri-parameters = *( ";" uri-parameter)
53*2882Svi117747  * uri-parameter = transport-param / user-param / method-param
54*2882Svi117747  *                 / ttl-param / maddr-param / lr-param / other-param
55*2882Svi117747  * transport-param   =  "transport="
56*2882Svi117747  *                      "udp" / "tcp" / "sctp" / "tls"/ other-transport)
57*2882Svi117747  * other-transport   =  token
58*2882Svi117747  * headers  =  "?" header *( "&" header )
59*2882Svi117747  */
60*2882Svi117747 typedef struct sip_uri_sip_s {
61*2882Svi117747 	sip_param_t 	*sip_params;
62*2882Svi117747 	sip_str_t 	sip_headers;
63*2882Svi117747 } sip_uri_sip_t;
64*2882Svi117747 
65*2882Svi117747 /*
66*2882Svi117747  * opaque	uri opaque part
67*2882Svi117747  * query	uri query
68*2882Svi117747  * path		uri path
69*2882Svi117747  * regname	uri reg-name
70*2882Svi117747  */
71*2882Svi117747 typedef struct sip_uri_abs_s {
72*2882Svi117747 	sip_str_t	sip_uri_opaque;
73*2882Svi117747 	sip_str_t 	sip_uri_query;
74*2882Svi117747 	sip_str_t 	sip_uri_path;
75*2882Svi117747 	sip_str_t 	sip_uri_regname;
76*2882Svi117747 } sip_uri_abs_t;
77*2882Svi117747 
78*2882Svi117747 /*
79*2882Svi117747  * structure for a parsed URI
80*2882Svi117747  *   sip_uri_scheme		URI scheme
81*2882Svi117747  *   sip_uri_user		user name
82*2882Svi117747  *   sip_uri_password		password for the user
83*2882Svi117747  *   sip_uri_host		host name
84*2882Svi117747  *   sip_uri_port		port number for the host (0 = none specified)
85*2882Svi117747  *   sip_uri_errflags		error flags
86*2882Svi117747  *   sip_uri_issip		is this a SIP  URI.
87*2882Svi117747  *   sip_uri_isteluser		user is a telephone-subscriber
88*2882Svi117747  */
89*2882Svi117747 typedef struct sip_uri {
90*2882Svi117747 	sip_str_t	sip_uri_scheme;
91*2882Svi117747 	sip_str_t 	sip_uri_user;
92*2882Svi117747 	sip_str_t	sip_uri_password;
93*2882Svi117747 	sip_str_t	sip_uri_host;
94*2882Svi117747 	uint_t		sip_uri_port;
95*2882Svi117747 	uint_t		sip_uri_errflags;
96*2882Svi117747 	boolean_t	sip_uri_issip;
97*2882Svi117747 	boolean_t	sip_uri_isteluser;
98*2882Svi117747 	union {
99*2882Svi117747 		sip_uri_sip_t	sip_sipuri;	/* SIP URI */
100*2882Svi117747 		sip_uri_abs_t	sip_absuri;	/* Absolute URI */
101*2882Svi117747 	} specific;
102*2882Svi117747 }_sip_uri_t;
103*2882Svi117747 
104*2882Svi117747 #define	sip_uri_params		specific.sip_sipuri.sip_params
105*2882Svi117747 #define	sip_uri_headers		specific.sip_sipuri.sip_headers
106*2882Svi117747 #define	sip_uri_opaque		specific.sip_absuri.sip_uri_opaque
107*2882Svi117747 #define	sip_uri_query		specific.sip_absuri.sip_uri_query
108*2882Svi117747 #define	sip_uri_path		specific.sip_absuri.sip_uri_path
109*2882Svi117747 #define	sip_uri_regname		specific.sip_absuri.sip_uri_regname
110*2882Svi117747 
111*2882Svi117747 extern void	sip_uri_parse_it(_sip_uri_t *, sip_str_t *);
112*2882Svi117747 
113*2882Svi117747 #ifdef	__cplusplus
114*2882Svi117747 }
115*2882Svi117747 #endif
116*2882Svi117747 
117*2882Svi117747 #endif	/* _SIP_PARSE_URI_H */
118