Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / libosip2 / include / osipparser2 / headers / osip_www_authenticate.h
1 /*
2   The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3   Copyright (C) 2001  Aymeric MOIZARD jack@atosc.org
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_WWW_AUTHENTICATE_H_
22 #define _OSIP_WWW_AUTHENTICATE_H_
23
24
25 /**
26  * @file osip_www_authenticate.h
27  * @brief oSIP osip_www_authenticate header definition.
28  */
29
30 /**
31  * @defgroup oSIP_WWW_AUTHENTICATE oSIP www-authenticate header definition.
32  * @ingroup oSIP_HEADERS
33  * @{
34  */
35
36 /**
37  * Structure for WWW-Authenticate headers.
38  * @defvar osip_www_authenticate_t
39  */
40   typedef struct osip_www_authenticate osip_www_authenticate_t;
41
42   struct osip_www_authenticate
43   {
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  */
53   };
54
55
56 #ifdef __cplusplus
57 extern "C"
58 {
59 #endif
60
61 /**
62  * Allocate a Www-Authenticate element.
63  * @param header The element to work on.
64  */
65   int osip_www_authenticate_init (osip_www_authenticate_t ** header);
66 /**
67  * Parse a Www-Authenticate element.
68  * @param header The element to work on.
69  * @param hvalue The string to parse.
70  */
71   int osip_www_authenticate_parse (osip_www_authenticate_t * header, const char *hvalue);
72 /**
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.
76  */
77   int osip_www_authenticate_to_str (const osip_www_authenticate_t * header, char **dest);
78 /**
79  * Free a Www-Authenticate element.
80  * @param header The element to work on.
81  */
82   void osip_www_authenticate_free (osip_www_authenticate_t * header);
83 /**
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.
87  */
88   int osip_www_authenticate_clone (const osip_www_authenticate_t * header,
89                               osip_www_authenticate_t ** dest);
90
91 /**
92  * Get value of the auth_type parameter from a Www-Authenticate element.
93  * @param header The element to work on.
94  */
95   char *osip_www_authenticate_get_auth_type (osip_www_authenticate_t * header);
96 /**
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.
100  */
101   void osip_www_authenticate_set_auth_type (osip_www_authenticate_t * header,
102                                       char *value);
103 /**
104  * Get value of the realm parameter from a Www-Authenticate element.
105  * @param header The element to work on.
106  */
107   char *osip_www_authenticate_get_realm (osip_www_authenticate_t * header);
108 /**
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.
112  */
113   void osip_www_authenticate_set_realm (osip_www_authenticate_t * header, char *value);
114 /**
115  * Get value of the domain parameter from a Www-Authenticate element.
116  * @param header The element to work on.
117  */
118   char *osip_www_authenticate_get_domain (osip_www_authenticate_t * header);
119 /**
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.
123  */
124   void osip_www_authenticate_set_domain (osip_www_authenticate_t * header, char *value);
125 /**
126  * Get value of the nonce parameter from a Www-Authenticate element.
127  * @param header The element to work on.
128  */
129   char *osip_www_authenticate_get_nonce (osip_www_authenticate_t * header);
130 /**
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.
134  */
135   void osip_www_authenticate_set_nonce (osip_www_authenticate_t * header, char *value);
136 /**
137  * Get value of the opaque parameter from a Www-Authenticate element.
138  * @param header The element to work on.
139  */
140   char *osip_www_authenticate_get_opaque (osip_www_authenticate_t * header);
141 /**
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.
145  */
146   void osip_www_authenticate_set_opaque (osip_www_authenticate_t * header, char *value);
147 /**
148  * Get value of the stale parameter from a Www-Authenticate element.
149  * @param header The element to work on.
150  */
151   char *osip_www_authenticate_get_stale (osip_www_authenticate_t * header);
152 /**
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.
156  */
157   void osip_www_authenticate_set_stale (osip_www_authenticate_t * header, char *value);
158 /**
159  * Add a stale parameter set to "true" in a Www-Authenticate element.
160  * @param header The element to work on.
161  */
162 #define osip_www_authenticate_set_stale_true(header) osip_www_authenticate_set_stale(header,osip_strdup("true"))
163 /**
164  * Add a stale parameter set to "false" in a Www-Authenticate element.
165  * @param header The element to work on.
166  */
167 #define osip_www_authenticate_set_stale_false(header) osip_www_authenticate_set_stale(header,osip_strdup("false"))
168 /**
169  * Get value of the algorithm parameter from a Www-Authenticate element.
170  * @param header The element to work on.
171  */
172   char *osip_www_authenticate_get_algorithm (osip_www_authenticate_t * header);
173 /**
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.
177  */
178   void osip_www_authenticate_set_algorithm (osip_www_authenticate_t * header,
179                                       char *value);
180 /**
181  * Add the algorithm parameter set to "MD5" in a Www-Authenticate element.
182  * @param header The element to work on.
183  */
184 #define osip_www_authenticate_set_algorithm_MD5(header) osip_www_authenticate_set_algorithm(header,osip_strdup("MD5"))
185 /**
186  * Get value of the qop_options parameter from a Www-Authenticate element.
187  * @param header The element to work on.
188  */
189   char *osip_www_authenticate_get_qop_options (osip_www_authenticate_t * header);
190 /**
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.
194  */
195   void osip_www_authenticate_set_qop_options (osip_www_authenticate_t * header,
196                                         char *value);
197
198 #ifdef __cplusplus
199 }
200 #endif
201
202 /** @} */
203
204 #endif