2 The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3 Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org
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.
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.
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
24 #include <osipparser2/osip_list.h>
28 * @brief oSIP osip_via header definition.
32 * @defgroup oSIP_VIA oSIP via header definition.
33 * @ingroup oSIP_HEADERS
38 * Structure for Via headers.
41 typedef struct osip_via osip_via_t;
50 osip_list_t *via_params;
59 * Allocate a Via element.
60 * @param header The element to work on.
62 int osip_via_init (osip_via_t ** header);
65 * @param header The element to work on.
67 void osip_via_free (osip_via_t * header);
69 * Parse a Via element.
70 * @param header The element to work on.
71 * @param hvalue The string to parse.
73 int osip_via_parse (osip_via_t * header, const char *hvalue);
75 * Get a string representation of a Via element.
76 * @param header The element to work on.
77 * @param dest A pointer on the new allocated string.
79 int osip_via_to_str (const osip_via_t * header, char **dest);
81 * Clone a Via element.
82 * @param header The element to work on.
83 * @param dest A pointer on the copy of the element.
85 int osip_via_clone (const osip_via_t * header, osip_via_t ** dest);
87 * Set the SIP version in the Via element.
88 * @param header The element to work on.
89 * @param value The value of the element.
91 void via_set_version (osip_via_t * header, char *value);
93 * Get the SIP version from a Via header.
94 * @param header The element to work on.
96 char *via_get_version (osip_via_t * header);
98 * Set the protocol in the Via element.
99 * @param header The element to work on.
100 * @param value The value of the element.
102 void via_set_protocol (osip_via_t * header, char *value);
104 * Get the protocol from a Via header.
105 * @param header The element to work on.
107 char *via_get_protocol (osip_via_t * header);
109 * Set the host in the Via element.
110 * @param header The element to work on.
111 * @param value The value of the element.
113 void via_set_host (osip_via_t * header, char *value);
115 * Get the host from a Via header.
116 * @param header The element to work on.
118 char *via_get_host (osip_via_t * header);
120 * Set the port in the Via element.
121 * @param header The element to work on.
122 * @param value The value of the element.
124 void via_set_port (osip_via_t * header, char *value);
126 * Get the port from a Via header.
127 * @param header The element to work on.
129 char *via_get_port (osip_via_t * header);
131 * Set the comment in the Via element.
132 * @param header The element to work on.
133 * @param value The value of the element.
135 void via_set_comment (osip_via_t * header, char *value);
137 * Get the comment from a Via header.
138 * @param header The element to work on.
140 char *via_get_comment (osip_via_t * header);
143 * Allocate and add a hidden parameter element in a list.
144 * @param header The element to work on.
146 #define osip_via_set_hidden(header) osip_generic_param_add((header)->via_params,osip_strdup("hidden"),NULL)
148 * Allocate and add a ttl parameter element in a list.
149 * @param header The element to work on.
150 * @param value The token value.
152 #define osip_via_set_ttl(header,value) osip_generic_param_add((header)->via_params,osip_strdup("ttl"),value)
154 * Allocate and add a maddr parameter element in a list.
155 * @param header The element to work on.
156 * @param value The token value.
158 #define osip_via_set_maddr(header,value) osip_generic_param_add((header)->via_params,osip_strdup("maddr"),value)
160 * Allocate and add a received parameter element in a list.
161 * @param header The element to work on.
162 * @param value The token value.
164 #define osip_via_set_received(header,value) osip_generic_param_add((header)->via_params,osip_strdup("received"),value)
166 * Allocate and add a branch parameter element in a list.
167 * @param header The element to work on.
168 * @param value The token value.
170 #define osip_via_set_branch(header,value) osip_generic_param_add((header)->via_params,osip_strdup("branch"),value)
173 * Allocate and add a generic parameter element in a list.
174 * @param header The element to work on.
175 * @param name The token name.
176 * @param value The token value.
178 #define osip_via_param_add(header,name,value) osip_generic_param_add((header)->via_params,name,value)
180 * Find a header parameter in a Via element.
181 * @param header The element to work on.
182 * @param name The token name to search.
183 * @param dest A pointer on the element found.
185 #define osip_via_param_get_byname(header,name,dest) osip_generic_param_get_byname((header)->via_params,name,dest)
188 * Check if the Via headers match.
189 * NOTE: THIS IS AN INTERNAL METHOD ONLY
190 * @param via1 The first Via header.
191 * @param via2 The second Via header.
193 int osip_via_match (osip_via_t * via1, osip_via_t * via2);