globus_i_gsi_credential.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
00018 
00025 #ifndef GLOBUS_I_GSI_CREDENTIAL_H
00026 #define GLOBUS_I_GSI_CREDENTIAL_H
00027 
00028 #include "globus_gsi_credential.h"
00029 #include "proxycertinfo.h"
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 /* DEBUG MACROS */
00036 #ifdef BUILD_DEBUG
00037 
00038 extern int                              globus_i_gsi_cred_debug_level;
00039 extern FILE *                           globus_i_gsi_cred_debug_fstream;
00040 
00041 #define GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_) \
00042     (globus_i_gsi_cred_debug_level >= (_LEVEL_))
00043 
00044 #define GLOBUS_I_GSI_CRED_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
00045     { \
00046         if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
00047         { \
00048            globus_libc_fprintf _MESSAGE_; \
00049         } \
00050     }
00051 
00052 
00053 #define GLOBUS_I_GSI_CRED_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
00054     { \
00055         if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
00056         { \
00057            char *                          _tmp_str_ = \
00058                globus_common_create_nstring _MESSAGE_; \
00059            globus_libc_fprintf(globus_i_gsi_cred_debug_fstream, \
00060                                _tmp_str_); \
00061            globus_libc_free(_tmp_str_); \
00062         } \
00063     }
00064 
00065 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
00066     { \
00067         if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
00068         { \
00069            globus_libc_fprintf(globus_i_gsi_cred_debug_fstream, _MESSAGE_); \
00070         } \
00071     }
00072 
00073 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
00074     { \
00075         if (GLOBUS_I_GSI_CRED_DEBUG(_LEVEL_)) \
00076         { \
00077            _OBJ_NAME_##_print_fp(globus_i_gsi_cred_debug_fstream, _OBJ_); \
00078         } \
00079     }
00080 
00081 #else
00082 
00083 #define GLOBUS_I_GSI_CRED_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
00084 #define GLOBUS_I_GSI_CRED_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
00085 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
00086 #define GLOBUS_I_GSI_CRED_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
00087 
00088 #endif
00089          
00090 #define GLOBUS_I_GSI_CRED_DEBUG_ENTER \
00091             GLOBUS_I_GSI_CRED_DEBUG_FPRINTF( \
00092                 2, (globus_i_gsi_cred_debug_fstream, \
00093                     "%s entering\n", _function_name_))
00094 
00095 #define GLOBUS_I_GSI_CRED_DEBUG_EXIT \
00096             GLOBUS_I_GSI_CRED_DEBUG_FPRINTF( \
00097                 2, (globus_i_gsi_cred_debug_fstream, \
00098                     "%s exiting\n", _function_name_))
00099 
00100 /* ERROR MACROS */
00101 
00102 #define GLOBUS_GSI_CRED_OPENSSL_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
00103     { \
00104         char *                          _tmp_str_ = \
00105             globus_common_create_string _ERRSTR_; \
00106         _RESULT_ = globus_i_gsi_cred_openssl_error_result(_ERRORTYPE_, \
00107                                                           __FILE__, \
00108                                                           _function_name_, \
00109                                                           __LINE__, \
00110                                                           _tmp_str_, \
00111                                                           NULL); \
00112         globus_libc_free(_tmp_str_); \
00113     }
00114 
00115 #define GLOBUS_GSI_CRED_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
00116     { \
00117         char *                          _tmp_str_ = \
00118             globus_common_create_string _ERRSTR_; \
00119         _RESULT_ = globus_i_gsi_cred_error_result(_ERRORTYPE_, \
00120                                                   __FILE__, \
00121                                                   _function_name_, \
00122                                                   __LINE__, \
00123                                                   _tmp_str_, \
00124                                                   NULL); \
00125         globus_libc_free(_tmp_str_); \
00126     }
00127 
00128 #define GLOBUS_GSI_CRED_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
00129     _TOP_RESULT_ = globus_i_gsi_cred_error_chain_result(_TOP_RESULT_, \
00130                                                         _ERRORTYPE_, \
00131                                                         __FILE__, \
00132                                                         _function_name_, \
00133                                                         __LINE__, \
00134                                                         NULL, \
00135                                                         NULL)
00136 
00137 #define GLOBUS_GSI_CRED_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
00138                                                   _ERRORTYPE_, \
00139                                                   _ERRSTR_, \
00140                                                   _LONG_DESC_) \
00141     { \
00142         char *                          _tmp_str_ = \
00143             globus_common_create_string _ERRSTR_; \
00144         _RESULT_ = globus_i_gsi_cred_openssl_error_result(_ERRORTYPE_, \
00145                                                           __FILE__, \
00146                                                           _function_name_, \
00147                                                           __LINE__, \
00148                                                           _tmp_str_, \
00149                                                           _LONG_DESC_); \
00150         globus_libc_free(_tmp_str_); \
00151     }
00152 
00153 #define GLOBUS_GSI_CRED_LONG_ERROR_RESULT(_RESULT_, \
00154                                           _ERRORTYPE_, \
00155                                           _ERRSTR_) \
00156     { \
00157         char *                          _tmp_str_ = \
00158             globus_common_create_string _ERRSTR_; \
00159         _RESULT_ = globus_i_gsi_cred_error_result(_ERRORTYPE_, \
00160                                                   __FILE__, \
00161                                                   _function_name_, \
00162                                                   __LINE__, \
00163                                                   _tmp_str_, \
00164                                                   _LONG_DESC_); \
00165         globus_libc_free(_tmp_str_); \
00166     }
00167 
00168 #define GLOBUS_GSI_CRED_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
00169                                                 _ERRORTYPE_, \
00170                                                 _LONG_DESC_) \
00171     _TOP_RESULT_ = globus_i_gsi_cred_error_chain_result(_TOP_RESULT_, \
00172                                                         _ERRORTYPE_, \
00173                                                         __FILE__, \
00174                                                         _function_name_, \
00175                                                         __LINE__, \
00176                                                         NULL, \
00177                                                         _LONG_DESC_)
00178 
00179 extern char *                    globus_l_gsi_cred_error_strings[];
00180 
00189 typedef struct globus_l_gsi_cred_handle_attrs_s
00190 {
00191     /* the order to search in for a certificate */
00192     globus_gsi_cred_type_t *            search_order; /*{PROXY,USER,HOST}*/
00193 } globus_i_gsi_cred_handle_attrs_t;
00194 
00204 typedef struct globus_l_gsi_cred_handle_s
00205 {
00207     X509 *                              cert;
00209     EVP_PKEY *                          key;
00211     STACK_OF(X509) *                    cert_chain;
00213     globus_gsi_cred_handle_attrs_t      attrs;
00215     time_t                              goodtill;
00216 } globus_i_gsi_cred_handle_t;
00217 
00218 
00219 globus_result_t
00220 globus_i_gsi_cred_goodtill(
00221     globus_gsi_cred_handle_t            cred_handle,
00222     time_t *                            goodtill);
00223 
00224 globus_result_t globus_i_gsi_cred_get_proxycertinfo(
00225     X509 *                              cert,
00226     PROXYCERTINFO **                    proxycertinfo);
00227 
00228 int
00229 globus_i_gsi_cred_password_callback_no_prompt(
00230     char *                              buffer,
00231     int                                 size,
00232     int                                 w);
00233 
00234 globus_result_t
00235 globus_i_gsi_cred_openssl_error_result(
00236     int                                 error_type,
00237     const char *                        filename,
00238     const char *                        function_name,
00239     int                                 line_number,
00240     const char *                        short_desc,
00241     const char *                        long_desc);
00242 
00243 globus_result_t
00244 globus_i_gsi_cred_error_result(
00245     int                                 error_type,
00246     const char *                        filename,
00247     const char *                        function_name,
00248     int                                 line_number,
00249     const char *                        short_desc,
00250     const char *                        long_desc);
00251 
00252 globus_result_t
00253 globus_i_gsi_cred_error_chain_result(
00254     globus_result_t                     chain_result,
00255     int                                 error_type,
00256     const char *                        filename,
00257     const char *                        function_name,
00258     int                                 line_number,
00259     const char *                        short_desc,
00260     const char *                        long_desc);
00261 
00262 globus_result_t
00263 globus_i_gsi_cred_error_join_chains_result(
00264     globus_result_t                     outter_error,
00265     globus_result_t                     inner_error);
00266 
00267 #ifdef __cplusplus
00268 }
00269 #endif
00270 
00271 #endif /* GLOBUS_I_GSI_CREDENTIAL_H */
00272 
00273 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 27 Oct 2014 for globus_gsi_credential by  doxygen 1.4.7