libosip  4.0.0
osip_via.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 
21 #ifndef _OSIP_VIA_H_
22 #define _OSIP_VIA_H_
23 
24 #include <osipparser2/osip_list.h>
25 
41  typedef struct osip_via osip_via_t;
42 
47  struct osip_via
48  {
49  char *version;
50  char *protocol;
51  char *host;
52  char *port;
53  char *comment;
55  };
56 
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
66  int osip_via_init (osip_via_t ** header);
71  void osip_via_free (osip_via_t * header);
77  int osip_via_parse (osip_via_t * header, const char *hvalue);
83  int osip_via_to_str (const osip_via_t * header, char **dest);
89  int osip_via_clone (const osip_via_t * header, osip_via_t ** dest);
95  void via_set_version (osip_via_t * header, char *value);
96 #define osip_via_set_version via_set_version
97 
101  char *via_get_version (osip_via_t * header);
102 #define osip_via_get_version via_get_version
103 
108  void via_set_protocol (osip_via_t * header, char *value);
109 #define osip_via_set_protocol via_set_protocol
110 
114  char *via_get_protocol (osip_via_t * header);
115 #define osip_via_get_protocol via_get_protocol
116 
121  void via_set_host (osip_via_t * header, char *value);
122 #define osip_via_set_host via_set_host
123 
127  char *via_get_host (osip_via_t * header);
128 #define osip_via_get_host via_get_host
129 
134  void via_set_port (osip_via_t * header, char *value);
135 #define osip_via_set_port via_set_port
136 
140  char *via_get_port (osip_via_t * header);
141 #define osip_via_get_port via_get_port
142 
147  void via_set_comment (osip_via_t * header, char *value);
148 #define osip_via_set_comment via_set_comment
149 
153  char *via_get_comment (osip_via_t * header);
154 #define osip_via_get_comment via_get_comment
155 
160 #define osip_via_set_hidden(header) osip_generic_param_add((&(header)->via_params),osip_strdup("hidden"),NULL)
161 
166 #define osip_via_set_ttl(header,value) osip_generic_param_add((&(header)->via_params),osip_strdup("ttl"),value)
167 
172 #define osip_via_set_maddr(header,value) osip_generic_param_add((&(header)->via_params),osip_strdup("maddr"),value)
173 
178 #define osip_via_set_received(header,value) osip_generic_param_add((&(header)->via_params),osip_strdup("received"),value)
179 
184 #define osip_via_set_branch(header,value) osip_generic_param_add((&(header)->via_params),osip_strdup("branch"),value)
185 
192 #define osip_via_param_add(header,name,value) osip_generic_param_add((&(header)->via_params),name,value)
193 
199 #define osip_via_param_get_byname(header,name,dest) osip_generic_param_get_byname((&(header)->via_params),name,dest)
200 
207  int osip_via_match (osip_via_t * via1, osip_via_t * via2);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
215 #endif