RSA BSAFE SSL-C

Security protocol components for C

Search

r_lib.h

Go to the documentation of this file.
00001 /* $Id: r_lib.h,v 1.68.2.1 2004/11/12 05:35:53 dapelt Exp $ */
00002 /*
00003  * Copyright (C) 1998-2003 RSA Security Inc. All rights reserved.
00004  *
00005  * This work contains proprietary information of RSA Security.
00006  * Distribution is limited to authorized licensees of RSA
00007  * Security. Any unauthorized reproduction, distribution or
00008  * modification of this work is strictly prohibited.
00009  */
00016 #ifndef HEADER_COMMON_R_LIB_H
00017 #define HEADER_COMMON_R_LIB_H
00018 
00019 #ifdef  __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #if defined(Rm_ALL_DIRECT) && !defined(Rm_LIB_CTX_DIRECT)
00024 #define Rm_LIB_CTX_DIRECT
00025 #endif
00026 
00027 #if defined(Rm_LIB_CTX_TABLE) && defined(Rm_LIB_CTX_DIRECT)
00028 #undef Rm_LIB_CTX_TABLE
00029 #endif
00030 
00031 #ifdef Rm_LIB_CTX_FULL
00032 
00033 #ifdef Rm_LIB_CTX_TABLE
00034 #undef Rm_LIB_CTX_TABLE
00035 #endif /* Rm_LIB_CTX_TABLE */
00036 
00037 #ifdef Rm_LIB_CTX_DIRECT
00038 #undef Rm_LIB_CTX_DIRECT
00039 #endif /* Rm_LIB_CTX_DIRECT */
00040 
00041 #endif /* Rm_LIB_CTX_FULL */
00042 
00043 #include "r_com.h"
00044 #include "r_res.h"
00045 #include "r_flg.h"
00046 #include "r_strtbl.h"
00047 
00048 #ifndef NO_BIO
00049 #include "bio.h"
00050 #endif
00051 
00072 #ifndef HEADER_COMMON_R_LIB_CTX_TYPEDEF_DEF
00073 #define HEADER_COMMON_R_LIB_CTX_TYPEDEF_DEF
00074 
00083 typedef struct r_lib_ctx_st R_LIB_CTX;
00084 #endif
00085 
00091 typedef struct r_lib_method_st                  R_LIB_METHOD;
00092 
00093 /* The library context debug structure which is used to define the type of
00094  * debugging required and the location where the debug information is sent.
00095  */
00096 typedef struct r_lib_debug_st
00097 {
00098     R_FLG dbg_flg;
00099 #ifndef NO_BIO
00100     BIO *bio;
00101 #else
00102     void *bio;
00103 #endif
00104 } R_LIB_DEBUG;
00105 
00106 #define R_DBG_SET(bit_num, dbg_prt)             \
00107     (((dbg_prt) != NULL) ? R_FLG_SET((bit_num), (&((dbg_prt)->dbg_flg))) : 0)
00108 #define R_DBG_ON(bit_num, dbg_prt)              \
00109     (((dbg_prt) != NULL) ? R_FLG_ISSET((bit_num), (&((dbg_prt)->dbg_flg))) : 0)
00110 #define R_DBG_CLR(bit_num, dbg_prt)             \
00111     (((dbg_prt) != NULL) ? R_FLG_CLR((bit_num), (&((dbg_prt)->dbg_flg))) : 0)
00112 #define R_DBG_SET_ALL(dbg_prt)                  \
00113     (((dbg_prt) != NULL) ? R_FLG_SET_ALL((&((dbg_prt)->dbg_flg))) : 0)
00114 #define R_DBG_ZERO(dbg_prt)                     \
00115     (((dbg_prt) != NULL) ? R_FLG_ZERO((&((dbg_prt)->dbg_flg))) : 0)
00116 
00117 /* The R_LIB_DEBUG control defines */
00118 #define R_LIB_DEBUG_GET                         1
00119 #define R_LIB_DEBUG_SET                         2
00120 
00121 /* The library context feature structure which is used to store the state of
00122  * the library features.
00123  */
00124 typedef struct r_lib_feat_st
00125 {
00126     unsigned long feature;
00127 } R_LIB_FEAT;
00128 
00129 /* Feature hash defines */
00130 #define R_LIB_FEATURE_LOCKING                   0x00000001L
00131 
00132 /* The R_LIB_FEAT control defines */
00133 #define R_LIB_FEAT_SET                          1
00134 #define R_LIB_FEAT_GET                          2
00135 #define R_LIB_FEAT_DISABLE                      3
00136 #define R_LIB_FEAT_ENABLE                       4
00137 #define R_LIB_FEAT_IS_ENABLED                   5
00138 
00183 #define R_LIB_CTX_INFO_ID_RESOURCE_LIST 0x01
00184 
00188 #define R_LIB_CTX_INFO_ID_MODE     0x02
00189 
00193 #define R_LIB_CTX_INFO_ID_HW_CTX     0x03
00194 
00195 /* the old name for the hardware context info id */
00196 #define R_LIB_CTX_INFO_HDW_CTX     R_LIB_CTX_INFO_ID_HW_CTX
00197 
00201 #define R_LIB_CTX_FIPS140_MODE  0x01
00202 
00206 #define R_LIB_CTX_STANDARD_MODE 0x02
00207 
00211 #define R_LIB_CTX_HARDWARE_MODE 0x04
00212 
00216 #define R_LIB_CTX_SOFTWARE_MODE 0x08
00217 
00231 /* Retrieve string defines */
00232 #define R_LIB_CTX_get_error_string(lib_ctx, mod_id, code)                     \
00233     R_LIB_CTX_get_string((lib_ctx), (mod_id), R_RES_SUB_ID_ERROR_STRINGS,     \
00234         (code))
00235 #define R_LIB_CTX_get_reason_string(lib_ctx, mod_id, code)                    \
00236     R_LIB_CTX_get_string((lib_ctx), (mod_id), R_RES_SUB_ID_REASON_STRINGS,    \
00237         (code))
00238 #define R_LIB_CTX_get_detail_string(lib_ctx, mod_id, code)                    \
00239     R_LIB_CTX_get_string((lib_ctx), (mod_id), R_RES_SUB_ID_DETAIL_STRINGS,    \
00240         (code))
00241 #define R_LIB_CTX_get_function_string(lib_ctx, mod_id, code)                  \
00242     R_LIB_CTX_get_string((lib_ctx), (mod_id), R_RES_SUB_ID_FUNCTION_STRINGS,  \
00243         (code))
00244 
00245 #define R_LIB_CTX_load_module(lib_ctx, mod_id, impl_id, sub_id,               \
00246     flag, ptr, type, name)                                                    \
00247     (*type) = R_RES_FLAG_GLOBAL;                                              \
00248     if (R_LIB_CTX_get_module((lib_ctx), (mod_id), (impl_id), (sub_id),        \
00249         (flag), (void **)(ptr)) != R_ERROR_NONE)                              \
00250     {                                                                         \
00251         name((lib_ctx), (flag), (ptr));                                       \
00252         (*type) = R_RES_FLAG_PRIVATE;                                         \
00253     }
00254 
00255 #define R_LIB_CTX_load_typed_module(lib_ctx, mod_id, impl_id, sub_id,         \
00256     flag, ptr, type, name)                                                    \
00257     (*type) = R_RES_FLAG_GLOBAL;                                              \
00258     if (R_LIB_CTX_get_module((lib_ctx), (mod_id), (impl_id), (sub_id),        \
00259         (flag), (void **)(ptr)) != R_ERROR_NONE)                              \
00260     {                                                                         \
00261         name((lib_ctx), (flag), (sub_id), (ptr));                             \
00262         (*type) = R_RES_FLAG_PRIVATE;                                         \
00263     }
00264 
00265 #define R_LIB_CTX_unload_module(lib_ctx, ptr, type, name)                     \
00266     if (type == R_RES_FLAG_PRIVATE)                                           \
00267     {                                                                         \
00268         name(ptr);                                                            \
00269     }
00270 
00271 int R_CDECL R_LIB_CTX_new(R_RES_LIST *r_list, R_RES_FLAG flag, R_LIB_CTX **lib_ctx);
00272 int R_CDECL R_LIB_CTX_free(R_LIB_CTX *lib_ctx);
00273 int R_CDECL R_LIB_CTX_dup(R_LIB_CTX *lib_ctx, R_RES_FLAG flag, R_LIB_CTX **res_ctx);
00274 int R_CDECL R_LIB_CTX_set_info(R_LIB_CTX *lib_ctx, int info_id, void *value);
00275 int R_CDECL R_LIB_CTX_get_info(R_LIB_CTX *lib_ctx, int info_id, void *value);
00276 
00277 int R_CDECL R_LIB_CTX_module_setup(R_LIB_CTX *lib_ctx, int mod_id, int imp_id,
00278     int sub_id, R_RES_FLAG flag, void *rgen);
00279 
00280 R_RES_LIST * R_CDECL R_LIB_CTX_get_resource_list(R_LIB_CTX *lib_ctx);
00281 
00282 char * R_CDECL R_LIB_CTX_get_string(R_LIB_CTX *lib_ctx, int mod_id, int table_id,
00283         int err_code);
00284 
00285 #if defined(Rm_LIB_CTX_TABLE) || defined(Rm_LIB_CTX_DIRECT)
00286 
00287 #include "rx_lib.h"
00288 
00289 #endif /* defined(Rm_LIB_CTX_TABLE) || defined(Rm_LIB_CTX_DIRECT) */
00290 
00291 #if !defined(Rm_LIB_CTX_TABLE) && !defined(Rm_LIB_CTX_DIRECT)
00292 
00293 int R_CDECL R_LIB_CTX_get_resource(R_LIB_CTX *res_ctx, int mod_id, int impl_id,
00294         int sub_id, R_RES_FLAG flag, int res_type, void **data);
00295 int R_CDECL R_LIB_CTX_get_module(R_LIB_CTX *res_ctx, int mod_id, int impl_id,
00296         int sub_id, R_RES_FLAG flag, void **mod);
00297 int R_CDECL R_LIB_CTX_get_module_data(R_LIB_CTX *lib_ctx, int mod_id, void **impl_data);
00298 
00299 int R_CDECL R_LIB_CTX_set_features(R_LIB_CTX *lib_ctx, int impl_id,
00300     R_LIB_FEAT *features);
00301 int R_CDECL R_LIB_CTX_get_features(R_LIB_CTX *lib_ctx, int impl_id,
00302     R_LIB_FEAT *features);
00303 int R_CDECL R_LIB_CTX_reset_features(R_LIB_CTX *lib_ctx, int impl_id);
00304 int R_CDECL R_LIB_CTX_feature_disable(R_LIB_CTX *lib_ctx, int impl_id,
00305     R_LIB_FEAT *feature);
00306 int R_CDECL R_LIB_CTX_feature_enable(R_LIB_CTX *lib_ctx, int impl_id,
00307     R_LIB_FEAT *feature);
00308 int R_CDECL R_LIB_CTX_is_feature_enabled(R_LIB_CTX *lib_ctx, int impl_id,
00309     R_LIB_FEAT *feature);
00310 
00311 int R_CDECL R_LIB_CTX_get_lib_debug_data(R_LIB_CTX *lib_ctx, R_LIB_DEBUG **data);
00312 int R_CDECL R_LIB_CTX_set_lib_debug_data(R_LIB_CTX *lib_ctx, R_LIB_DEBUG *data);
00313 
00314 #endif /* !defined(Rm_LIB_CTX_TABLE) && !defined(Rm_LIB_CTX_DIRECT) */
00315 
00316 /* end defgroup RES_LIST_FN */
00321 #ifdef  __cplusplus
00322 }
00323 #endif
00324 
00325 #endif /* HEADER_COMMON_R_LIB_H */

Copyright (c) 1999-2004 RSA Security Inc. All rights reserved. 050-001001-2600-000-000 - 2.6