globus_i_gsi_cert_utils.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 
00024 #ifndef GLOBUS_I_GSI_CERT_UTILS_H
00025 #define GLOBUS_I_GSI_CERT_UTILS_H
00026 
00027 #include "globus_gsi_cert_utils.h"
00028 
00029 /* DEBUG MACROS */
00030 
00031 #ifdef BUILD_DEBUG
00032 
00033 extern int                              globus_i_gsi_cert_utils_debug_level;
00034 extern FILE *                           globus_i_gsi_cert_utils_debug_fstream;
00035 
00036 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG(_LEVEL_) \
00037     (globus_i_gsi_cert_utils_debug_level >= (_LEVEL_))
00038 
00039 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
00040     { \
00041         if (GLOBUS_I_GSI_CERT_UTILS_DEBUG(_LEVEL_)) \
00042         { \
00043            globus_libc_fprintf _MESSAGE_; \
00044         } \
00045     }
00046 
00047 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
00048     { \
00049         if (GLOBUS_I_GSI_CERT_UTILS_DEBUG(_LEVEL_)) \
00050         { \
00051            char *                          _tmp_str_ = \
00052                globus_common_create_nstring _MESSAGE_; \
00053            globus_libc_fprintf(globus_i_gsi_cert_utils_debug_fstream, \
00054                                "%s", _tmp_str_); \
00055            globus_libc_free(_tmp_str_); \
00056         } \
00057     }
00058 
00059 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
00060     { \
00061         if (GLOBUS_I_GSI_CERT_UTILS_DEBUG(_LEVEL_)) \
00062         { \
00063            globus_libc_fprintf(globus_i_gsi_cert_utils_debug_fstream, \
00064                                _MESSAGE_); \
00065         } \
00066     }
00067 
00068 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_PRINT_OBJECT(_LEVEL_, \
00069                                                    _OBJ_NAME_, \
00070                                                    _OBJ_) \
00071     { \
00072         if (GLOBUS_I_GSI_CERT_UTILS_DEBUG(_LEVEL_)) \
00073         { \
00074            _OBJ_NAME_##_print_fp(globus_i_gsi_cert_utils_debug_fstream, \
00075                                  _OBJ_); \
00076         } \
00077     }
00078 
00079 #else
00080 
00081 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
00082 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
00083 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
00084 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_PRINT_OBJECT(_LEVEL_, \
00085                                                    _OBJ_NAME_, _OBJ_) {}
00086 
00087 #endif
00088          
00089 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_ENTER \
00090             GLOBUS_I_GSI_CERT_UTILS_DEBUG_FPRINTF( \
00091                 1, (globus_i_gsi_cert_utils_debug_fstream, \
00092                     "%s entering\n", _function_name_))
00093 
00094 #define GLOBUS_I_GSI_CERT_UTILS_DEBUG_EXIT \
00095             GLOBUS_I_GSI_CERT_UTILS_DEBUG_FPRINTF( \
00096                 2, (globus_i_gsi_cert_utils_debug_fstream, \
00097                     "%s exiting\n", _function_name_))
00098 
00099 /* ERROR MACROS */
00100 
00101 extern char *                    globus_l_gsi_cert_utils_error_strings[];
00102 
00103 #define GLOBUS_GSI_CERT_UTILS_OPENSSL_ERROR_RESULT(_RESULT_, \
00104                                                    _ERRORTYPE_, _ERRSTR_) \
00105     { \
00106         char *                          _tmp_str_ = \
00107             globus_common_create_string _ERRSTR_; \
00108         _RESULT_ = globus_i_gsi_cert_utils_openssl_error_result(_ERRORTYPE_, \
00109                                                           __FILE__, \
00110                                                           _function_name_, \
00111                                                           __LINE__, \
00112                                                           _tmp_str_, \
00113                                                           NULL); \
00114         globus_libc_free(_tmp_str_); \
00115     }
00116 
00117 #define GLOBUS_GSI_CERT_UTILS_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
00118     { \
00119         char *                          _tmp_str_ = \
00120             globus_common_create_string _ERRSTR_; \
00121         _RESULT_ = globus_i_gsi_cert_utils_error_result(_ERRORTYPE_, \
00122                                                   __FILE__, \
00123                                                   _function_name_, \
00124                                                   __LINE__, \
00125                                                   _tmp_str_, \
00126                                                   NULL); \
00127         globus_libc_free(_tmp_str_); \
00128     }
00129 
00130 #define GLOBUS_GSI_CERT_UTILS_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
00131     _TOP_RESULT_ = globus_i_gsi_cert_utils_error_chain_result(_TOP_RESULT_, \
00132                                                         _ERRORTYPE_, \
00133                                                         __FILE__, \
00134                                                         _function_name_, \
00135                                                         __LINE__, \
00136                                                         NULL, \
00137                                                         NULL)
00138 
00139 #define GLOBUS_GSI_CERT_UTILS_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
00140                                                         _ERRORTYPE_, \
00141                                                         _ERRSTR_, \
00142                                                         _LONG_DESC_) \
00143     { \
00144         char *                          _tmp_str_ = \
00145             globus_common_create_string _ERRSTR_; \
00146         _RESULT_ = globus_i_gsi_cert_utils_openssl_error_result( \
00147              _ERRORTYPE_, \
00148              __FILE__, \
00149              _function_name_, \
00150              __LINE__, \
00151              _tmp_str_, \
00152              _LONG_DESC_); \
00153         globus_libc_free(_tmp_str_); \
00154     }
00155 
00156 #define GLOBUS_GSI_CERT_UTILS_LONG_ERROR_RESULT(_RESULT_, \
00157                                                 _ERRORTYPE_, \
00158                                                 _ERRSTR_, \
00159                                                 _LONG_DESC_) \
00160     { \
00161         char *                          _tmp_str_ = \
00162             globus_common_create_string _ERRSTR_; \
00163         _RESULT_ = globus_i_gsi_cert_utils_error_result(_ERRORTYPE_, \
00164                                                         __FILE__, \
00165                                                         _function_name_, \
00166                                                         __LINE__, \
00167                                                         _tmp_str_, \
00168                                                         _LONG_DESC_); \
00169         globus_libc_free(_tmp_str_); \
00170     }
00171 
00172 #define GLOBUS_GSI_CERT_UTILS_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
00173                                                       _ERRORTYPE_, \
00174                                                       _LONG_DESC_) \
00175     _TOP_RESULT_ = globus_i_gsi_cert_utils_error_chain_result(_TOP_RESULT_, \
00176                                                         _ERRORTYPE_, \
00177                                                         __FILE__, \
00178                                                         _function_name_, \
00179                                                         __LINE__, \
00180                                                         NULL, \
00181                                                         _LONG_DESC_)
00182 
00183 #define GLOBUS_GSI_CERT_UTILS_MALLOC_ERROR(_MIN_RESULT_) \
00184     { \
00185         char *                          _tmp_str_ = \
00186         globus_l_gsi_cert_utils_error_strings[ \
00187             GLOBUS_GSI_CERT_UTILS_ERROR_OUT_OF_MEMORY]; \
00188         _MIN_RESULT_ = globus_error_put( \
00189             globus_error_wrap_errno_error( \
00190                 GLOBUS_GSI_CERT_UTILS_MODULE, \
00191                 errno, \
00192                 GLOBUS_GSI_CERT_UTILS_ERROR_OUT_OF_MEMORY, \
00193                 __FILE__, \
00194                 _function_name_, \
00195                 __LINE__, \
00196                 "%s", \
00197                 _tmp_str_)); \
00198     }
00199 
00200 globus_result_t
00201 globus_i_gsi_cert_utils_openssl_error_result(
00202     int                                 error_type,
00203     const char *                        filename,
00204     const char *                        function_name,
00205     int                                 line_number,
00206     const char *                        short_desc,
00207     const char *                        long_desc);
00208 
00209 globus_result_t
00210 globus_i_gsi_cert_utils_error_result(
00211     int                                 error_type,
00212     const char *                        filename,
00213     const char *                        function_name,
00214     int                                 line_number,
00215     const char *                        short_desc,
00216     const char *                        long_desc);
00217 
00218 globus_result_t
00219 globus_i_gsi_cert_utils_error_chain_result(
00220     globus_result_t                     chain_result,
00221     int                                 error_type,
00222     const char *                        filename,
00223     const char *                        function_name,
00224     int                                 line_number,
00225     const char *                        short_desc,
00226     const char *                        long_desc);
00227 
00228 EXTERN_C_END
00229 
00230 #endif /* GLOBUS_I_GSI_CERT_UTILS_H */
00231 
00232 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 4 Sep 2016 for globus_gsi_cert_utils by  doxygen 1.4.7