40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi/*
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * CDDL HEADER START
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi *
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * The contents of this file are subject to the terms of the
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Common Development and Distribution License (the "License").
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * You may not use this file except in compliance with the License.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi *
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * or http://www.opensolaris.org/os/licensing.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * See the License for the specific language governing permissions
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * and limitations under the License.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi *
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * When distributing Covered Code, include this CDDL HEADER in each
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * If applicable, add the following below this CDDL HEADER, with the
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * fields enclosed by brackets "[]" replaced with your own identifying
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * information: Portions Copyright [yyyy] [name of copyright owner]
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi *
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * CDDL HEADER END
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi/*
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * Use is subject to license terms.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#ifndef _SIP_PARSE_URI_H
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define _SIP_PARSE_URI_H
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#pragma ident "%Z%%M% %I% %E% SMI"
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#ifdef __cplusplus
40cb5e5daa7b80bb70fcf8dadfb20f9281566331viextern "C" {
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#endif
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#include <sys/types.h>
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#include <sip.h>
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define SIP_URI_BUF_SIZE 128
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define SIP_SCHEME "sip"
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define SIPS_SCHEME "sips"
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define SIP_SCHEME_LEN 3
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define SIPS_SCHEME_LEN 4
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi/*
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * SIP-URI = "sip:" [ userinfo ] hostport
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * uri-parameters [ headers ]
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * SIPS-URI = "sips:" [ userinfo ] hostport
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * uri-parameters [ headers ]
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * uri-parameters = *( ";" uri-parameter)
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * uri-parameter = transport-param / user-param / method-param
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * / ttl-param / maddr-param / lr-param / other-param
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * transport-param = "transport="
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * "udp" / "tcp" / "sctp" / "tls"/ other-transport)
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * other-transport = token
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * headers = "?" header *( "&" header )
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vitypedef struct sip_uri_sip_s {
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_param_t *sip_params;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_headers;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi} sip_uri_sip_t;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi/*
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * opaque uri opaque part
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * query uri query
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * path uri path
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * regname uri reg-name
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vitypedef struct sip_uri_abs_s {
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_opaque;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_query;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_path;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_regname;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi} sip_uri_abs_t;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi/*
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * structure for a parsed URI
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_scheme URI scheme
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_user user name
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_password password for the user
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_host host name
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_port port number for the host (0 = none specified)
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_errflags error flags
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_issip is this a SIP URI.
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi * sip_uri_isteluser user is a telephone-subscriber
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vitypedef struct sip_uri {
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_scheme;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_user;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_password;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_str_t sip_uri_host;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi uint_t sip_uri_port;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi uint_t sip_uri_errflags;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi boolean_t sip_uri_issip;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi boolean_t sip_uri_isteluser;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi union {
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_uri_sip_t sip_sipuri; /* SIP URI */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi sip_uri_abs_t sip_absuri; /* Absolute URI */
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi } specific;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi}_sip_uri_t;
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_params specific.sip_sipuri.sip_params
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_headers specific.sip_sipuri.sip_headers
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_opaque specific.sip_absuri.sip_uri_opaque
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_query specific.sip_absuri.sip_uri_query
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_path specific.sip_absuri.sip_uri_path
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#define sip_uri_regname specific.sip_absuri.sip_uri_regname
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331viextern void sip_uri_parse_it(_sip_uri_t *, sip_str_t *);
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#ifdef __cplusplus
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi}
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#endif
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi
40cb5e5daa7b80bb70fcf8dadfb20f9281566331vi#endif /* _SIP_PARSE_URI_H */