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