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