sofia-sip/auth_digest.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef AUTH_DIGEST_H
00026 
00027 #define AUTH_DIGEST_H
00028 
00046 #ifndef SU_ALLOC_H
00047 #include <sofia-sip/su_alloc.h>
00048 #endif
00049 
00050 SOFIA_BEGIN_DECLS
00051 
00075 typedef struct {
00076   int         ac_size;
00077   char const *ac_realm;         
00078   char const *ac_domain;        
00079   char const *ac_nonce;         
00080   char const *ac_opaque;        
00081   char const *ac_algorithm;     
00082   char const *ac_qop;           
00083   unsigned    ac_stale : 1;     
00084   unsigned    ac_md5 : 1;       
00085   unsigned    ac_md5sess : 1;   
00086   unsigned    ac_sha1 : 1;      
00087   unsigned    ac_auth : 1;      
00088   unsigned    ac_auth_int : 1;  
00089   unsigned : 0;
00090 } auth_challenge_t;
00091 
00117 typedef struct {
00118   int         ar_size;
00119   char const *ar_username;
00120   char const *ar_realm;         
00121   char const *ar_nonce;         
00122   char const *ar_uri;           
00123   char const *ar_response;      
00124   char const *ar_algorithm;     
00125   char const *ar_cnonce;        
00126   char const *ar_opaque;        
00127   char const *ar_qop;           
00128   char const *ar_nc;            
00129   unsigned    ar_md5 : 1;       
00130   unsigned    ar_md5sess : 1;   
00131   unsigned    ar_sha1 : 1;      
00132   unsigned    ar_auth : 1;      
00133   unsigned    ar_auth_int : 1;  
00134   unsigned : 0;
00135 } auth_response_t;
00136 
00137 typedef char auth_hexmd5_t[33];
00138 
00139 SOFIAPUBFUN int auth_digest_challenge_get(su_home_t *, auth_challenge_t *,
00140                                           char const * const params[]);
00141 SOFIAPUBFUN void auth_digest_challenge_free_params(su_home_t *home,
00142                                                    auth_challenge_t *ac);
00143 SOFIAPUBFUN int auth_digest_response_get(su_home_t *, auth_response_t *,
00144                                          char const * const params[]);
00145 
00146 SOFIAPUBFUN int auth_digest_a1(auth_response_t *ar,
00147                                auth_hexmd5_t ha1,
00148                                char const *secret);
00149 
00150 SOFIAPUBFUN int auth_digest_a1sess(auth_response_t *ar,
00151                                    auth_hexmd5_t ha1sess,
00152                                    char const *ha1);
00153 
00154 SOFIAPUBFUN int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
00155                                        char const *secret);
00156 SOFIAPUBFUN int auth_digest_response(auth_response_t *, auth_hexmd5_t response,
00157                                      auth_hexmd5_t const ha1,
00158                                      char const *method_name,
00159                                      void const *data, int dlen);
00160 
00161 SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, int s_size);
00162 
00163 SOFIAPUBFUN int auth_strcmp(char const *quoted, char const *unquoted);
00164 
00165 SOFIA_END_DECLS
00166 
00167 #endif

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