00001 /* 00002 The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) 00003 Copyright (C) 2001,2002,2003,2004,2005 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 00021 #ifndef _OSIP_VIA_H_ 00022 #define _OSIP_VIA_H_ 00023 00024 #include <osipparser2/osip_list.h> 00025 00041 typedef struct osip_via osip_via_t; 00042 00047 struct osip_via 00048 { 00049 char *version; 00050 char *protocol; 00051 char *host; 00052 char *port; 00053 char *comment; 00054 osip_list_t *via_params; 00055 }; 00056 00057 #ifdef __cplusplus 00058 extern "C" 00059 { 00060 #endif 00061 00066 int osip_via_init (osip_via_t ** header); 00071 void osip_via_free (osip_via_t * header); 00077 int osip_via_parse (osip_via_t * header, const char *hvalue); 00083 int osip_via_to_str (const osip_via_t * header, char **dest); 00089 int osip_via_clone (const osip_via_t * header, osip_via_t ** dest); 00095 #define osip_via_set_version via_set_version 00096 void via_set_version (osip_via_t * header, char *value); 00101 #define osip_via_get_version via_get_version 00102 char *via_get_version (osip_via_t * header); 00108 #define osip_via_set_protocol via_set_protocol 00109 void via_set_protocol (osip_via_t * header, char *value); 00114 #define osip_via_get_protocol via_get_protocol 00115 char *via_get_protocol (osip_via_t * header); 00121 #define osip_via_set_host via_set_host 00122 void via_set_host (osip_via_t * header, char *value); 00127 #define osip_via_get_host via_get_host 00128 char *via_get_host (osip_via_t * header); 00134 #define osip_via_set_port via_set_port 00135 void via_set_port (osip_via_t * header, char *value); 00140 #define osip_via_get_port via_get_port 00141 char *via_get_port (osip_via_t * header); 00147 #define osip_via_set_comment via_set_comment 00148 void via_set_comment (osip_via_t * header, char *value); 00153 #define osip_via_get_comment via_get_comment 00154 char *via_get_comment (osip_via_t * header); 00155 00160 #define osip_via_set_hidden(header) osip_generic_param_add((header)->via_params,osip_strdup("hidden"),NULL) 00161 00166 #define osip_via_set_ttl(header,value) osip_generic_param_add((header)->via_params,osip_strdup("ttl"),value) 00167 00172 #define osip_via_set_maddr(header,value) osip_generic_param_add((header)->via_params,osip_strdup("maddr"),value) 00173 00178 #define osip_via_set_received(header,value) osip_generic_param_add((header)->via_params,osip_strdup("received"),value) 00179 00184 #define osip_via_set_branch(header,value) osip_generic_param_add((header)->via_params,osip_strdup("branch"),value) 00185 00192 #define osip_via_param_add(header,name,value) osip_generic_param_add((header)->via_params,name,value) 00193 00199 #define osip_via_param_get_byname(header,name,dest) osip_generic_param_get_byname((header)->via_params,name,dest) 00200 00207 int osip_via_match (osip_via_t * via1, osip_via_t * via2); 00208 00209 #ifdef __cplusplus 00210 } 00211 #endif 00212 00215 #endif