iptsec
1.12.11
|
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_CLIENT_PLUGIN_H 00026 00027 #define AUTH_CLIENT_PLUGIN_H 00028 00041 #ifndef AUTH_CLIENT_H 00042 #include "sofia-sip/auth_client.h" 00043 #endif 00044 00045 #ifndef MSG_HEADER_H 00046 #include <sofia-sip/msg_header.h> 00047 #endif 00048 00049 SOFIA_BEGIN_DECLS 00050 00051 /* ====================================================================== */ 00052 00053 struct auth_client_s { 00054 su_home_t ca_home[1]; 00055 auth_client_plugin_t const *ca_auc; 00056 00057 auth_client_t *ca_next; 00058 00059 char const *ca_scheme; 00060 char const *ca_realm; 00061 char *ca_user; 00062 char *ca_pass; 00063 00064 msg_hclass_t *ca_credential_class; 00065 00066 #if SOFIA_EXTEND_AUTH_CLIENT 00067 int ca_clear; 00068 #endif 00069 }; 00070 00071 struct auth_client_plugin 00072 { 00073 int auc_plugin_size; /* Size of this structure */ 00074 int auc_size; /* Size of the client structure */ 00075 00076 char const *auc_name; /* Name of the autentication scheme */ 00077 00079 int (*auc_challenge)(auth_client_t *ca, 00080 msg_auth_t const *ch); 00081 00083 int (*auc_authorize)(auth_client_t *ca, 00084 su_home_t *h, 00085 char const *method, 00086 url_t const *url, 00087 msg_payload_t const *body, 00088 msg_header_t **return_headers); 00089 00091 int (*auc_info)(auth_client_t *ca, msg_auth_info_t const *ai); 00092 00093 #if SOFIA_EXTEND_AUTH_CLIENT 00094 00095 int (*auc_clear)(auth_client_t *ca); 00096 00098 int (*auc_save_credentials)(auth_client_t *ca, 00099 char const *scheme, 00100 char const *realm, 00101 char const *user, 00102 char const *pass); 00103 00105 int (*auc_copy_credentials)(auth_client_t *dst, 00106 auth_client_t const *src); 00107 #endif 00108 }; 00109 00111 #define AUTH_CLIENT_IS_EXTENDED(ca) \ 00112 ((ca)->ca_auc && \ 00113 (ca)->ca_auc->auc_plugin_size > \ 00114 (int)offsetof(auth_client_plugin_t, auc_clear) \ 00115 && (ca)->ca_auc->auc_clear != NULL) 00116 00120 #define AUTH_CLIENT_SAVE_CREDENTIALS(ca) \ 00121 ((ca)->ca_auc && \ 00122 (ca)->ca_auc->auc_plugin_size > \ 00123 (int)offsetof(auth_client_plugin_t, auc_save_credentials) \ 00124 ? (ca)->ca_auc->auc_save_credentials : NULL) 00125 00126 SOFIAPUBFUN int auth_client_save_credentials(auth_client_t *ac, 00127 char const *scheme, 00128 char const *realm, 00129 char const *user, 00130 char const *pass); 00131 00135 #define AUTH_CLIENT_COPY_CREDENTIALS(ca) \ 00136 ((ca)->ca_auc && \ 00137 (ca)->ca_auc->auc_plugin_size > \ 00138 (int)offsetof(auth_client_plugin_t, auc_copy_credentials) \ 00139 ? (ca)->ca_auc->auc_copy_credentials : NULL) 00140 00141 SOFIAPUBFUN int auth_client_copy_credentials(auth_client_t *ac, 00142 auth_client_t const *src); 00143 00144 SOFIA_END_DECLS 00145 00146 #endif /* !defined AUTH_CLIENT_PLUGIN_H */