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_AUTHORIZATION_H_
22 #define _OSIP_AUTHORIZATION_H_
26 * @file osip_authorization.h
27 * @brief oSIP osip_authorization header definition.
31 * @defgroup oSIP_AUTHORIZATION oSIP authorization header definition.
32 * @ingroup oSIP_HEADERS
37 * Structure for Authorization headers.
38 * @defvar osip_authorization_t
40 typedef struct osip_authorization osip_authorization_t;
42 struct osip_authorization
44 char *auth_type; /* ( "Basic" | "Digest" ) */
46 char *realm; /* mandatory ( quoted-string ) */
50 char *digest; /* DO NOT USE IT IN AUTHORIZATION_T HEADER?? */
51 char *algorithm; /* optionnal, default is "md5" */
52 char *cnonce; /* optionnal */
53 char *opaque; /* optionnal */
54 char *message_qop; /* optionnal */
55 char *nonce_count; /* optionnal */
56 char *auth_param; /* optionnal */
66 * Allocate a Authorization element.
67 * @param header The element to work on.
69 int osip_authorization_init (osip_authorization_t ** header);
71 * Parse a Authorization element.
72 * @param header The element to work on.
73 * @param hvalue The string to parse.
75 int osip_authorization_parse (osip_authorization_t * header, const char *hvalue);
77 * Get a string representation of a Authorization element.
78 * @param header The element to work on.
79 * @param dest A pointer on the new allocated string.
81 int osip_authorization_to_str (const osip_authorization_t * header, char **dest);
83 * Free a Authorization element.
84 * @param header The element to work on.
86 void osip_authorization_free (osip_authorization_t * header);
88 * Clone a Authorization element.
89 * @param header The element to work on.
90 * @param dest A pointer on the copy of the element.
92 int osip_authorization_clone (const osip_authorization_t * header,
93 osip_authorization_t ** dest);
96 * Get value of the auth_type parameter from a Authorization element.
97 * @param header The element to work on.
99 char *osip_authorization_get_auth_type (const osip_authorization_t * header);
101 * Add the auth_type parameter from a Authorization element.
102 * @param header The element to work on.
103 * @param value The value of the new parameter.
105 void osip_authorization_set_auth_type (osip_authorization_t * header, char *value);
107 * Get value of the username parameter from a Authorization element.
108 * @param header The element to work on.
110 char *osip_authorization_get_username (osip_authorization_t * header);
112 * Add the username parameter from a Authorization element.
113 * @param header The element to work on.
114 * @param value The value of the new parameter.
116 void osip_authorization_set_username (osip_authorization_t * header, char *value);
118 * Get value of the realm parameter from a Authorization element.
119 * @param header The element to work on.
121 char *osip_authorization_get_realm (osip_authorization_t * header);
123 * Add the realm parameter from a Authorization element.
124 * @param header The element to work on.
125 * @param value The value of the new parameter.
127 void osip_authorization_set_realm (osip_authorization_t * header, char *value);
129 * Get value of the nonce parameter from a Authorization element.
130 * @param header The element to work on.
132 char *osip_authorization_get_nonce (osip_authorization_t * header);
134 * Add the nonce parameter from a Authorization element.
135 * @param header The element to work on.
136 * @param value The value of the new parameter.
138 void osip_authorization_set_nonce (osip_authorization_t * header, char *value);
140 * Get value of the uri parameter from a Authorization element.
141 * @param header The element to work on.
143 char *osip_authorization_get_uri (osip_authorization_t * header);
145 * Add the uri parameter from a Authorization element.
146 * @param header The element to work on.
147 * @param value The value of the new parameter.
149 void osip_authorization_set_uri (osip_authorization_t * header, char *value);
151 * Get value of the response parameter from a Authorization element.
152 * @param header The element to work on.
154 char *osip_authorization_get_response (osip_authorization_t * header);
156 * Add the response parameter from a Authorization element.
157 * @param header The element to work on.
158 * @param value The value of the new parameter.
160 void osip_authorization_set_response (osip_authorization_t * header, char *value);
162 * Get value of the digest parameter from a Authorization element.
163 * @param header The element to work on.
165 char *osip_authorization_get_digest (osip_authorization_t * header);
167 * Add the digest parameter from a Authorization element.
168 * @param header The element to work on.
169 * @param value The value of the new parameter.
171 void osip_authorization_set_digest (osip_authorization_t * header, char *value);
173 * Get value of the algorithm parameter from a Authorization element.
174 * @param header The element to work on.
176 char *osip_authorization_get_algorithm (osip_authorization_t * header);
178 * Add the algorithm parameter from a Authorization element.
179 * @param header The element to work on.
180 * @param value The value of the new parameter.
182 void osip_authorization_set_algorithm (osip_authorization_t * header, char *value);
184 * Get value of the cnonce parameter from a Authorization element.
185 * @param header The element to work on.
187 char *osip_authorization_get_cnonce (osip_authorization_t * header);
189 * Add the cnonce parameter from a Authorization element.
190 * @param header The element to work on.
191 * @param value The value of the new parameter.
193 void osip_authorization_set_cnonce (osip_authorization_t * header, char *value);
195 * Get value of the opaque parameter from a Authorization element.
196 * @param header The element to work on.
198 char *osip_authorization_get_opaque (osip_authorization_t * header);
200 * Add the opaque parameter from a Authorization element.
201 * @param header The element to work on.
202 * @param value The value of the new parameter.
204 void osip_authorization_set_opaque (osip_authorization_t * header, char *value);
206 * Get value of the message_qop parameter from a Authorization element.
207 * @param header The element to work on.
209 char *osip_authorization_get_message_qop (osip_authorization_t * header);
211 * Add the message_qop parameter from a Authorization element.
212 * @param header The element to work on.
213 * @param value The value of the new parameter.
215 void osip_authorization_set_message_qop (osip_authorization_t * header, char *value);
217 * Get value of the nonce_count parameter from a Authorization element.
218 * @param header The element to work on.
220 char *osip_authorization_get_nonce_count (osip_authorization_t * header);
222 * Add the nonce_count parameter from a Authorization element.
223 * @param header The element to work on.
224 * @param value The value of the new parameter.
226 void osip_authorization_set_nonce_count (osip_authorization_t * header, char *value);