and added files
[bcm963xx.git] / userapps / opensource / libosip2 / include / osipparser2 / headers / osip_authorization.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_AUTHORIZATION_H_
22 #define _OSIP_AUTHORIZATION_H_
23
24
25 /**
26  * @file osip_authorization.h
27  * @brief oSIP osip_authorization header definition.
28  */
29
30 /**
31  * @defgroup oSIP_AUTHORIZATION oSIP authorization header definition.
32  * @ingroup oSIP_HEADERS
33  * @{
34  */
35
36 /**
37  * Structure for Authorization headers.
38  * @defvar osip_authorization_t
39  */
40   typedef struct osip_authorization osip_authorization_t;
41
42   struct osip_authorization
43   {
44     char *auth_type;            /* ( "Basic" | "Digest" )      */
45     char *username;
46     char *realm;                /* mandatory ( quoted-string ) */
47     char *nonce;
48     char *uri;
49     char *response;
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 */
57   };
58
59
60 #ifdef __cplusplus
61 extern "C"
62 {
63 #endif
64
65 /**
66  * Allocate a Authorization element.
67  * @param header The element to work on.
68  */
69   int osip_authorization_init (osip_authorization_t ** header);
70 /**
71  * Parse a Authorization element.
72  * @param header The element to work on.
73  * @param hvalue The string to parse.
74  */
75   int osip_authorization_parse (osip_authorization_t * header, const char *hvalue);
76 /**
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.
80  */
81   int osip_authorization_to_str (const osip_authorization_t * header, char **dest);
82 /**
83  * Free a Authorization element.
84  * @param header The element to work on.
85  */
86   void osip_authorization_free (osip_authorization_t * header);
87 /**
88  * Clone a Authorization element.
89  * @param header The element to work on.
90  * @param dest A pointer on the copy of the element.
91  */
92   int osip_authorization_clone (const osip_authorization_t * header,
93                            osip_authorization_t ** dest);
94
95 /**
96  * Get value of the auth_type parameter from a Authorization element.
97  * @param header The element to work on.
98  */
99   char *osip_authorization_get_auth_type (const osip_authorization_t * header);
100 /**
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.
104  */
105   void osip_authorization_set_auth_type (osip_authorization_t * header, char *value);
106 /**
107  * Get value of the username parameter from a Authorization element.
108  * @param header The element to work on.
109  */
110   char *osip_authorization_get_username (osip_authorization_t * header);
111 /**
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.
115  */
116   void osip_authorization_set_username (osip_authorization_t * header, char *value);
117 /**
118  * Get value of the realm parameter from a Authorization element.
119  * @param header The element to work on.
120  */
121   char *osip_authorization_get_realm (osip_authorization_t * header);
122 /**
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.
126  */
127   void osip_authorization_set_realm (osip_authorization_t * header, char *value);
128 /**
129  * Get value of the nonce parameter from a Authorization element.
130  * @param header The element to work on.
131  */
132   char *osip_authorization_get_nonce (osip_authorization_t * header);
133 /**
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.
137  */
138   void osip_authorization_set_nonce (osip_authorization_t * header, char *value);
139 /**
140  * Get value of the uri parameter from a Authorization element.
141  * @param header The element to work on.
142  */
143   char *osip_authorization_get_uri (osip_authorization_t * header);
144 /**
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.
148  */
149   void osip_authorization_set_uri (osip_authorization_t * header, char *value);
150 /**
151  * Get value of the response parameter from a Authorization element.
152  * @param header The element to work on.
153  */
154   char *osip_authorization_get_response (osip_authorization_t * header);
155 /**
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.
159  */
160   void osip_authorization_set_response (osip_authorization_t * header, char *value);
161 /**
162  * Get value of the digest parameter from a Authorization element.
163  * @param header The element to work on.
164  */
165   char *osip_authorization_get_digest (osip_authorization_t * header);
166 /**
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.
170  */
171   void osip_authorization_set_digest (osip_authorization_t * header, char *value);
172 /**
173  * Get value of the algorithm parameter from a Authorization element.
174  * @param header The element to work on.
175  */
176   char *osip_authorization_get_algorithm (osip_authorization_t * header);
177 /**
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.
181  */
182   void osip_authorization_set_algorithm (osip_authorization_t * header, char *value);
183 /**
184  * Get value of the cnonce parameter from a Authorization element.
185  * @param header The element to work on.
186  */
187   char *osip_authorization_get_cnonce (osip_authorization_t * header);
188 /**
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.
192  */
193   void osip_authorization_set_cnonce (osip_authorization_t * header, char *value);
194 /**
195  * Get value of the opaque parameter from a Authorization element.
196  * @param header The element to work on.
197  */
198   char *osip_authorization_get_opaque (osip_authorization_t * header);
199 /**
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.
203  */
204   void osip_authorization_set_opaque (osip_authorization_t * header, char *value);
205 /**
206  * Get value of the message_qop parameter from a Authorization element.
207  * @param header The element to work on.
208  */
209   char *osip_authorization_get_message_qop (osip_authorization_t * header);
210 /**
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.
214  */
215   void osip_authorization_set_message_qop (osip_authorization_t * header, char *value);
216 /**
217  * Get value of the nonce_count parameter from a Authorization element.
218  * @param header The element to work on.
219  */
220   char *osip_authorization_get_nonce_count (osip_authorization_t * header);
221 /**
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.
225  */
226   void osip_authorization_set_nonce_count (osip_authorization_t * header, char *value);
227
228 #ifdef __cplusplus
229 }
230 #endif
231
232 /** @} */
233
234 #endif