Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages
include / osipparser2

osip_uri.h

Go to the documentation of this file.
00001 /*
00002  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
00003  Copyright (C) 2001,2002,2003,2004 Aymeric MOIZARD jack@atosc.org
00004 
00005  This library is free software; you can redistribute it and/or
00006  modify it under the terms of the GNU Lesser General Public
00007  License as published by the Free Software Foundation; either
00008  version 2.1 of the License, or (at your option) any later version.
00009 
00010  This library is distributed in the hope that it will be useful,
00011  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  Lesser General Public License for more details.
00014 
00015  You should have received a copy of the GNU Lesser General Public
00016  License along with this library; if not, write to the Free Software
00017  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00018 */
00019 
00020 #ifndef _URLS_H_
00021 #define _URLS_H_
00022 
00023 #include <osipparser2/osip_const.h>
00024 #include <osipparser2/osip_list.h>
00025 
00041 #ifdef __cplusplus
00042 extern "C"
00043 {
00044 #endif
00045 
00050 typedef struct osip_uri_param osip_uri_param_t;
00051 
00056 struct osip_uri_param
00057 {
00058 char *gname; 
00059 char *gvalue; 
00060 };
00061 
00066 typedef osip_uri_param_t osip_uri_header_t;
00067 
00072 int osip_uri_param_init (osip_uri_param_t ** url_param);
00077 void osip_uri_param_free (osip_uri_param_t * url_param);
00084 int osip_uri_param_set (osip_uri_param_t * url_param, char *name,
00085 char *value);
00091 int osip_uri_param_clone (const osip_uri_param_t * url_param,
00092 osip_uri_param_t ** dest);
00093 #ifndef DOXYGEN
00094 /*
00095  * Free a list of a url parameter element.
00096  * @param url_params The list of url parameter element to free.
00097  */
00098 void osip_uri_param_freelist (osip_list_t * url_params);
00099 #endif
00100 
00106 int osip_uri_param_add (osip_list_t * url_params, char *name, char *value);
00113 int osip_uri_param_get_byname (osip_list_t * url_params, char *name,
00114 osip_uri_param_t ** dest);
00115 
00120 #define osip_uri_header_init(url_header) osip_uri_param_init(url_header)
00121 
00125 #define osip_uri_header_free(url_header) osip_uri_param_free(url_header)
00126 
00132 #define osip_uri_header_set(url_header, name, value) osip_uri_param_set(url_header, name, value)
00133 
00138 #define osip_uri_header_clone(url_header,dest) osip_uri_param_clone(url_header,dest)
00139 #ifndef DOXYGEN
00140 /*
00141  * Free a list of a generic parameter element.
00142  * @param LIST The list of generic parameter element to free.
00143  */
00144 #define osip_uri_header_freelist(LIST) osip_uri_param_freelist(LIST)
00145 #endif
00146 
00152 #define osip_uri_header_add(url_headers,name,value) osip_uri_param_add(url_headers,name,value)
00153 
00159 #define osip_uri_header_get_byname(url_headers,name,dest) osip_uri_param_get_byname(url_headers,name,dest)
00160 
00165 typedef struct osip_uri osip_uri_t;
00166 
00171 struct osip_uri
00172 {
00173 char *scheme; 
00174 char *username; 
00175 char *password; 
00176 char *host; 
00177 char *port; 
00178 osip_list_t *url_params; 
00179 osip_list_t *url_headers; 
00181 char *string; 
00182 };
00183 
00188 int osip_uri_init (osip_uri_t ** url);
00193 void osip_uri_free (osip_uri_t * url);
00199 int osip_uri_parse (osip_uri_t * url, const char *buf);
00200 #ifndef DOXYGEN
00201 
00206 int osip_uri_parse_headers (osip_uri_t * url, const char *buf);
00212 int osip_uri_parse_params (osip_uri_t * url, const char *buf);
00213 #endif
00214 
00219 int osip_uri_to_str (const osip_uri_t * url, char **dest);
00225 int osip_uri_clone (const osip_uri_t * url, osip_uri_t ** dest);
00232 int osip_uri_to_str_canonical (const osip_uri_t * url, char **dest);
00233 
00239 void osip_uri_set_scheme (osip_uri_t * url, char *value);
00244 char *osip_uri_get_scheme (osip_uri_t * url);
00250 void osip_uri_set_host (osip_uri_t * url, char *value);
00255 char *osip_uri_get_host (osip_uri_t * url);
00261 void osip_uri_set_username (osip_uri_t * url, char *value);
00266 char *osip_uri_get_username (osip_uri_t * url);
00272 void osip_uri_set_password (osip_uri_t * url, char *value);
00277 char *osip_uri_get_password (osip_uri_t * url);
00283 void osip_uri_set_port (osip_uri_t * url, char *value);
00288 char *osip_uri_get_port (osip_uri_t * url);
00289 
00290 
00291 
00296 #define osip_uri_set_transport_udp(url) osip_uri_param_add((url)->url_params, osip_strdup("transport"), osip_strdup("udp"))
00297 
00301 #define osip_uri_set_transport_tcp(url) osip_uri_param_add((url)->url_params, osip_strdup("transport"), osip_strdup("tcp"))
00302 
00306 #define osip_uri_set_transport_sctp(url) osip_uri_param_add((url)->url_params, osip_strdup("transport"), osip_strdup("sctp"))
00307 
00311 #define osip_uri_set_transport_tls(url) osip_uri_param_add((url)->url_params, osip_strdup("transport"), osip_strdup("tls"))
00312 
00317 #define osip_uri_set_transport(url,value) osip_uri_param_add((url)->url_params, osip_strdup("transport"), value)
00318 
00323 #define osip_uri_set_user_phone(url) osip_uri_param_add((url)->url_params, osip_strdup("user"), osip_strdup("phone"))
00324 
00328 #define osip_uri_set_user_ip(url) osip_uri_param_add((url)->url_params, osip_strdup("user"), osip_strdup("ip"))
00329 
00333 #define osip_uri_set_method_invite(url) osip_uri_param_add((url)->url_params, osip_strdup("method"), osip_strdup("INVITE"))
00334 
00338 #define osip_uri_set_method_ack(url) osip_uri_param_add((url)->url_params, osip_strdup("method"), osip_strdup("ACK"))
00339 
00343 #define osip_uri_set_method_options(url) osip_uri_param_add((url)->url_params, osip_strdup("method"), osip_strdup("OPTIONS"))
00344 
00348 #define osip_uri_set_method_bye(url) osip_uri_param_add((url)->url_params, osip_strdup("method"), osip_strdup("BYE"))
00349 
00353 #define osip_uri_set_method_cancel(url) osip_uri_param_add((url)->url_params, osip_strdup("method"), osip_strdup("CANCEL"))
00354 
00358 #define osip_uri_set_method_register(url) osip_uri_param_add((url)->url_params,osip_strdup("method"), osip_strdup("REGISTER"))
00359 
00364 #define osip_uri_set_method(url, value) osip_uri_param_add((url)->url_params, osip_strdup("method"), value)
00365 
00370 #define osip_uri_set_ttl(url, value) osip_uri_param_add((url)->url_params, osip_strdup("ttl"), value)
00371 
00376 #define osip_uri_set_maddr(url, value) osip_uri_param_add((url)->url_params, osip_strdup("maddr"), value)
00377 
00384 #define osip_uri_uparam_add(url,name,value) osip_uri_param_add((url)->url_params,name,value)
00385 
00391 #define osip_uri_uparam_get_byname(url,name,dest) osip_uri_param_get_byname((url)->url_params,name,dest)
00392 
00399 #define osip_uri_uheader_add(url,name,value) osip_uri_header_add(url->url_headers,name,value)
00400 
00406 #define osip_uri_uheader_get_byname(url,name,dest) osip_uri_header_get_byname(url->url_headers,name,dest)
00407 
00408 #ifndef DOXYGEN
00409 /* internal method */
00410 char *next_separator (const char *ch, int separator_osip_to_find,
00411 int before_separator);
00412 
00413 char *__osip_uri_escape_nonascii_and_nondef (const char *string,
00414 const char *def);
00415 char *__osip_uri_escape_userinfo (const char *string);
00416 char *__osip_uri_escape_password (const char *string);
00417 char *__osip_uri_escape_uri_param (char *string);
00418 char *__osip_uri_escape_header_param (char *string);
00419 void __osip_uri_unescape (char *string);
00420 
00421 #endif
00422 
00425 #ifdef __cplusplus
00426 }
00427 #endif
00428 
00429 #endif /* _URLS_H_ */

Generated on Tue Feb 22 00:59:47 2005 for libosip by doxygen 1.4.1

AltStyle によって変換されたページ (->オリジナル) /