iptsec  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
auth_plugin.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef AUTH_PLUGIN_H
26 
27 #define AUTH_PLUGIN_H
28 
37 #ifndef AUTH_MODULE_H
38 #include "sofia-sip/auth_module.h"
39 #endif
40 
41 #ifndef AUTH_DIGEST_H
42 #include "sofia-sip/auth_digest.h"
43 #endif
44 
45 #ifndef AUTH_COMMON_H
46 #include "sofia-sip/auth_common.h"
47 #endif
48 
49 #ifndef MSG_DATE_H
50 #include <sofia-sip/msg_date.h>
51 #endif
52 
53 #ifndef SU_MD5_H
54 #include <sofia-sip/su_md5.h>
55 #endif
56 
57 #include <sofia-sip/htable.h>
58 
59 SOFIA_BEGIN_DECLS
60 
61 /* ====================================================================== */
62 /* Plugin interface for authentication */
63 
66 {
68  char const *asch_method;
69 
71  usize_t asch_size;
72 
74  int (*asch_init)(auth_mod_t *am,
75  auth_scheme_t *base,
76  su_root_t *root,
77  tag_type_t tag, tag_value_t value, ...);
78 
80  void (*asch_check)(auth_mod_t *am,
81  auth_status_t *as,
82  msg_auth_t *auth,
83  auth_challenger_t const *ch);
84 
87  auth_status_t *as,
88  auth_challenger_t const *ch);
89 
93  void (*asch_cancel)(auth_mod_t *am,
94  auth_status_t *as);
95 
100  void (*asch_destroy)(auth_mod_t *am);
101 
102 };
103 
105 typedef struct
106 {
107  unsigned apw_index;
108  void const *apw_type;
110  char const *apw_user;
111  char const *apw_realm;
112  char const *apw_pass;
113  char const *apw_hash;
114  char const *apw_ident;
116 } auth_passwd_t;
117 
118 
119 HTABLE_DECLARE_WITH(auth_htable, aht, auth_passwd_t, usize_t, unsigned);
120 
121 struct stat;
122 
125 {
126  su_home_t am_home[1];
127  unsigned _am_refcount;
129  /* User database / cache */
130  char const *am_db;
131  struct stat *am_stat;
132  auth_htable_t am_users[1];
134  void *am_buffer;
136  size_t am_local_count;
140  /* Attributes */
142  char const *am_realm;
143  char const *am_opaque;
144  char const *am_gssapi_data;
145  char const *am_targetname;
147  char const **am_allow;
148  msg_param_t am_algorithm;
149  msg_param_t am_qop;
150  unsigned am_expires;
151  unsigned am_next_exp;
152  unsigned am_blacklist;
153  unsigned am_forbidden:1;
154  unsigned am_anonymous:1;
155  unsigned am_challenge:1;
156  unsigned am_nextnonce:1;
157  unsigned am_mutual:1;
158  unsigned am_fake:1;
160  unsigned :0;
161  unsigned am_count;
168  unsigned am_max_ncount:1;
169 };
170 
173  char const *user,
174  char const *realm);
175 
178  char const *user,
179  char const *realm);
180 
182 
184 
185 SOFIAPUBFUN msg_auth_t *auth_mod_credentials(msg_auth_t *auth,
186  char const *scheme,
187  char const *realm);
188 
190  tag_type_t, tag_value_t, ...);
191 
192 #define AUTH_PLUGIN(am) (auth_plugin_t *)((am) + 1)
193 
196  auth_scheme_t *base,
197  su_root_t *root,
198  tag_type_t tag, tag_value_t value, ...);
199 
202 
205 
209  auth_status_t *as,
210  msg_auth_t *auth,
211  auth_challenger_t const *ach);
212 
215  auth_status_t *as,
216  auth_challenger_t const *ach);
217 
220 msg_auth_t *auth_digest_credentials(msg_auth_t *auth,
221  char const *realm,
222  char const *opaque);
223 
226  auth_status_t *as,
227  msg_auth_t *au,
228  auth_challenger_t const *ach);
229 
232  auth_status_t *as,
233  auth_challenger_t const *ach);
234 
237  auth_status_t *as,
238  auth_response_t *ar,
239  auth_challenger_t const *ach);
240 
243  auth_status_t *as,
244  auth_challenger_t const *ach);
245 
248  char buffer[],
249  size_t buffer_len,
250  int nextnonce,
251  msg_time_t now);
252 
255  auth_status_t *as,
256  auth_response_t *ar,
257  msg_time_t now);
258 
260 
263 SOFIAPUBFUN void auth_md5_hmac_digest(auth_mod_t *am, su_md5_t *md5,
264  void *hmac, size_t size);
265 
266 SOFIA_END_DECLS
267 
268 #endif /* !defined AUTH_PLUGIN_H */

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.