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
21 #ifndef _OSIP_WWW_AUTHENTICATE_H_
22 #define _OSIP_WWW_AUTHENTICATE_H_
26 * @file osip_www_authenticate.h
27 * @brief oSIP osip_www_authenticate header definition.
31 * @defgroup oSIP_WWW_AUTHENTICATE oSIP www-authenticate header definition.
32 * @ingroup oSIP_HEADERS
37 * Structure for WWW-Authenticate headers.
38 * @defvar osip_www_authenticate_t
40 typedef struct osip_www_authenticate osip_www_authenticate_t;
42 struct osip_www_authenticate
44 char *auth_type; /* ( "Basic" | "Digest" ) */
45 char *realm; /* mandatory ( quoted-string ) */
46 char *domain; /* optional <"> 1#URI <"> */
47 char *nonce; /* mandatory */
48 char *opaque; /* optional */
49 char *stale; /* optional ( "true" | "false" ) */
50 char *algorithm; /* optional ( "MD5" | token ) */
51 char *qop_options; /* optional */
52 char *auth_param; /* optional */
62 * Allocate a Www-Authenticate element.
63 * @param header The element to work on.
65 int osip_www_authenticate_init (osip_www_authenticate_t ** header);
67 * Parse a Www-Authenticate element.
68 * @param header The element to work on.
69 * @param hvalue The string to parse.
71 int osip_www_authenticate_parse (osip_www_authenticate_t * header, const char *hvalue);
73 * Get a string representation of a Www-Authenticate element.
74 * @param header The element to work on.
75 * @param dest A pointer on the new allocated string.
77 int osip_www_authenticate_to_str (const osip_www_authenticate_t * header, char **dest);
79 * Free a Www-Authenticate element.
80 * @param header The element to work on.
82 void osip_www_authenticate_free (osip_www_authenticate_t * header);
84 * Clone a Www-Authenticate element.
85 * @param header The element to work on.
86 * @param dest A pointer on the copy of the element.
88 int osip_www_authenticate_clone (const osip_www_authenticate_t * header,
89 osip_www_authenticate_t ** dest);
92 * Get value of the auth_type parameter from a Www-Authenticate element.
93 * @param header The element to work on.
95 char *osip_www_authenticate_get_auth_type (osip_www_authenticate_t * header);
97 * Add the auth_type parameter from a Www-Authenticate element.
98 * @param header The element to work on.
99 * @param value The value of the new parameter.
101 void osip_www_authenticate_set_auth_type (osip_www_authenticate_t * header,
104 * Get value of the realm parameter from a Www-Authenticate element.
105 * @param header The element to work on.
107 char *osip_www_authenticate_get_realm (osip_www_authenticate_t * header);
109 * Add the realm parameter from a Www-Authenticate element.
110 * @param header The element to work on.
111 * @param value The value of the new parameter.
113 void osip_www_authenticate_set_realm (osip_www_authenticate_t * header, char *value);
115 * Get value of the domain parameter from a Www-Authenticate element.
116 * @param header The element to work on.
118 char *osip_www_authenticate_get_domain (osip_www_authenticate_t * header);
120 * Add the domain parameter from a Www-Authenticate element.
121 * @param header The element to work on.
122 * @param value The value of the new parameter.
124 void osip_www_authenticate_set_domain (osip_www_authenticate_t * header, char *value);
126 * Get value of the nonce parameter from a Www-Authenticate element.
127 * @param header The element to work on.
129 char *osip_www_authenticate_get_nonce (osip_www_authenticate_t * header);
131 * Add the nonce parameter from a Www-Authenticate element.
132 * @param header The element to work on.
133 * @param value The value of the new parameter.
135 void osip_www_authenticate_set_nonce (osip_www_authenticate_t * header, char *value);
137 * Get value of the opaque parameter from a Www-Authenticate element.
138 * @param header The element to work on.
140 char *osip_www_authenticate_get_opaque (osip_www_authenticate_t * header);
142 * Add the opaque parameter from a Www-Authenticate element.
143 * @param header The element to work on.
144 * @param value The value of the new parameter.
146 void osip_www_authenticate_set_opaque (osip_www_authenticate_t * header, char *value);
148 * Get value of the stale parameter from a Www-Authenticate element.
149 * @param header The element to work on.
151 char *osip_www_authenticate_get_stale (osip_www_authenticate_t * header);
153 * Add the stale parameter in a Www-Authenticate element.
154 * @param header The element to work on.
155 * @param value The value of the new parameter.
157 void osip_www_authenticate_set_stale (osip_www_authenticate_t * header, char *value);
159 * Add a stale parameter set to "true" in a Www-Authenticate element.
160 * @param header The element to work on.
162 #define osip_www_authenticate_set_stale_true(header) osip_www_authenticate_set_stale(header,osip_strdup("true"))
164 * Add a stale parameter set to "false" in a Www-Authenticate element.
165 * @param header The element to work on.
167 #define osip_www_authenticate_set_stale_false(header) osip_www_authenticate_set_stale(header,osip_strdup("false"))
169 * Get value of the algorithm parameter from a Www-Authenticate element.
170 * @param header The element to work on.
172 char *osip_www_authenticate_get_algorithm (osip_www_authenticate_t * header);
174 * Add the algorithm parameter in a Www-Authenticate element.
175 * @param header The element to work on.
176 * @param value The value of the new parameter.
178 void osip_www_authenticate_set_algorithm (osip_www_authenticate_t * header,
181 * Add the algorithm parameter set to "MD5" in a Www-Authenticate element.
182 * @param header The element to work on.
184 #define osip_www_authenticate_set_algorithm_MD5(header) osip_www_authenticate_set_algorithm(header,osip_strdup("MD5"))
186 * Get value of the qop_options parameter from a Www-Authenticate element.
187 * @param header The element to work on.
189 char *osip_www_authenticate_get_qop_options (osip_www_authenticate_t * header);
191 * Add the qop_options parameter from a Www-Authenticate element.
192 * @param header The element to work on.
193 * @param value The value of the new parameter.
195 void osip_www_authenticate_set_qop_options (osip_www_authenticate_t * header,