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.com> 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_CLIENT_PLUGIN_H 26 /** Defined when <sofia-sip/auth_client_plugin.h> has been included. */ 27 #define AUTH_CLIENT_PLUGIN_H 28 29 /**@file sofia-sip/auth_client_plugin.h 30 * @brief Client-side plugin interface for authentication 31 * 32 * @note For extensions in 1.12.6 or later, 33 * you have to define SOFIA_EXTEND_AUTH_CLIENT to 1 34 * before including this file. 35 * 36 * @author Pekka Pessi <Pekka.Pessi@nokia.com> 37 * 38 * @date Created: Fri May 19 16:18:21 EEST 2006 39 */ 40 41 #ifndef AUTH_CLIENT_H 42 #include "sofia-sip/auth_client.h" 43 #endif 44 45 #ifndef MSG_HEADER_H 46 #include <sofia-sip/msg_header.h> 47 #endif 48 49 SOFIA_BEGIN_DECLS 50 51 /* ====================================================================== */ 52 53 struct auth_client_s { 54 su_home_t ca_home[1]; 55 auth_client_plugin_t const *ca_auc; 56 57 auth_client_t *ca_next; 58 59 char const *ca_scheme; 60 char const *ca_realm; 61 char *ca_user; 62 char *ca_pass; 63 64 msg_hclass_t *ca_credential_class; 65 66 #if SOFIA_EXTEND_AUTH_CLIENT 67 int ca_clear; 68 #endif 69 }; 70 71 struct auth_client_plugin 72 { 73 int auc_plugin_size; /* Size of this structure */ 74 int auc_size; /* Size of the client structure */ 75 76 char const *auc_name; /* Name of the autentication scheme */ 77 78 /** Store challenge */ 79 int (*auc_challenge)(auth_client_t *ca, 80 msg_auth_t const *ch); 81 82 /** Authorize request. */ 83 int (*auc_authorize)(auth_client_t *ca, 84 su_home_t *h, 85 char const *method, 86 url_t const *url, 87 msg_payload_t const *body, 88 msg_header_t **return_headers); 89 90 /** Store nextnonce from Authentication-Info or Proxy-Authentication-Info. */ 91 int (*auc_info)(auth_client_t *ca, msg_auth_info_t const *ai); 92 93 #if SOFIA_EXTEND_AUTH_CLIENT 94 /** Clear credentials (user/pass). @NEW_1_12_6. */ 95 int (*auc_clear)(auth_client_t *ca); 96 #endif 97 }; 98 99 /** Check if authentication client has been extended. @NEW_1_12_6. */ 100 #define AUTH_CLIENT_IS_EXTENDED(ca) \ 101 ((ca)->ca_auc && \ 102 (ca)->ca_auc->auc_plugin_size > \ 103 (int)offsetof(auth_client_plugin_t, auc_clear) \ 104 && (ca)->ca_auc->auc_clear != NULL) 105 106 SOFIA_END_DECLS 107 108 #endif /* !defined AUTH_CLIENT_PLUGIN_H */ 109