| RSA BSAFE Micro Edition Suite |
Streamlined security for mobile and embedded devices |
 
![]() |
00001 /* $Id: r_time.h,v 1.54 2005/08/10 00:14:56 itaylor 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 */
00010
00017 #ifndef HEADER_COMMON_R_TIME_H
00018 #define HEADER_COMMON_R_TIME_H
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024 #include "r_com.h"
00025
00026 typedef union r_time_t_st R_TIME_T;
00027 union r_time_t_st {
00028 struct r_secs_st{
00029 R_INT32 high; /* high 32 bits */
00030 R_UINT32 low; /* low 32 bits */
00031 R_UINT32 nano;
00032 } secs;
00033 R_INT32 force_align;
00034 unsigned char bytes[sizeof(R_INT32)*3];
00035 };
00036
00049 #ifdef CT_INT32
00050 #undef CT_INT32
00051 #endif
00052 #ifdef CT_UINT32
00053 #undef CT_UINT32
00054 #endif
00055 #define CT_INT32 R_INT32
00056 #define CT_UINT32 R_UINT32
00057
00058 #define CRYPTO_TIME_T R_TIME_T
00059
00060 #define CRYPTO_time R_time
00061 #define CRYPTO_time_offset R_time_offset
00062 #define CRYPTO_time_export R_time_export
00063 #define CRYPTO_time_import R_time_import
00064 #define CRYPTO_time_cmp R_time_cmp
00065
00066 #define CRYPTO_time_to_int R_time_to_int
00067 #define CRYPTO_time_from_int R_time_from_int
00068
00069 #define CRYPTO_get_time_cb R_time_get_func
00070 #define CRYPTO_set_time_cb R_time_set_func
00071
00072 #define CRYPTO_get_time_offset_cb R_time_get_offset_func
00073 #define CRYPTO_set_time_offset_cb R_time_set_offset_func
00074
00075 #define CRYPTO_get_time_cmp_cb R_time_get_cmp_func
00076 #define CRYPTO_set_time_cmp_cb R_time_set_cmp_func
00077
00078 #define CRYPTO_get_time_import_cb R_time_get_import_func
00079 #define CRYPTO_set_time_import_cb R_time_set_import_func
00080
00081 #define CRYPTO_get_time_export_cb R_time_get_export_func
00082 #define CRYPTO_set_time_export_cb R_time_set_export_func
00083
00097 #define R_TIME_FMT_UTC 23
00098
00104 #define R_TIME_FMT_GENERALIZEDTIME 24
00105
00109 #define R_TIME_FMT_BIGENDIAN 3
00110
00127 #define R_TIME_LEN_UTC (13+1)
00128
00133 #define R_TIME_LEN_UTC (13+1)
00134 #define R_TIME_LEN_GENERALIZEDTIME (20+1)
00135 #define R_TIME_LEN_BIGENDIAN (sizeof(R_INT32)*2)
00136
00152 #define R_TIME_MIN_UTC "500101000000Z"
00153
00157 #define R_TIME_MAX_UTC "491231235959Z"
00158
00162 #define R_TIME_NAN_UTC "000000000000Z"
00163
00167 #define R_TIME_MIN_GENERALIZEDTIME "00000101000000.0Z"
00168
00172 #define R_TIME_MAX_GENERALIZEDTIME "99991231235959.9Z"
00173
00177 #define R_TIME_NAN_GENERALIZEDTIME "00000000000000.0Z"
00178
00183 #define CRYPTO_FMT_UTC R_TIME_FMT_UTC
00184 #define CRYPTO_FMT_GENERALIZEDTIME R_TIME_FMT_GENERALIZEDTIME
00185 #define CRYPTO_FMT_BIGENDIAN R_TIME_FMT_BIGENDIAN
00186
00187 #define CRYPTO_LEN_UTC R_TIME_LEN_UTC
00188 #define CRYPTO_LEN_GENERALIZEDTIME R_TIME_LEN_GENERALIZEDTIME
00189 #define CRYPTO_LEN_BIGENDIAN R_TIME_LEN_BIGENDIAN
00190
00191 #define CRYPTO_MIN_UTC R_TIME_MIN_UTC
00192 #define CRYPTO_MAX_UTC R_TIME_MAX_UTC
00193 #define CRYPTO_NAN_UTC R_TIME_NAN_UTC
00194 #define CRYPTO_MIN_GENERALIZEDTIME R_TIME_MIN_GENERALIZEDTIME
00195 #define CRYPTO_MAX_GENERALIZEDTIME R_TIME_MAX_GENERALIZEDTIME
00196 #define CRYPTO_NAN_GENERALIZEDTIME R_TIME_NAN_GENERALIZEDTIME
00197
00198
00216 typedef int R_CDECL R_TIME_CMP_FUNC_T(R_TIME_T *tm1, R_TIME_T *tm2);
00217
00238 typedef int R_CDECL R_TIME_EXPORT_FUNC_T(R_TIME_T *tm, int format, char *buffer,
00239 int buf_len);
00240
00248 typedef R_TIME_T * R_CDECL R_TIME_FUNC_T(R_TIME_T *tm);
00249
00264 typedef int R_CDECL R_TIME_IMPORT_FUNC_T(char *buffer, int buf_len,
00265 int format, R_TIME_T *tm);
00266
00281 typedef R_TIME_T * R_CDECL R_TIME_OFFSET_FUNC_T(R_TIME_T *ret, R_TIME_T *tm,
00282 R_INT32 secs_offset, R_INT32 nano_offset);
00283
00288 /*
00289 * @defgroup TIME_FUNCS R_time Functions
00290 * This section outlines the functions that facilitate time management.
00291 * @ingroup R_TIME_FUNC_MAIN
00292 * @{
00293 */
00294
00295 int R_CDECL R_time_size(void);
00296
00297 R_TIME_T * R_CDECL R_time_new(void);
00298 void R_CDECL R_time_free(R_TIME_T *tm);
00299
00300 R_TIME_T * R_CDECL R_time(R_TIME_T *tm);
00301 R_TIME_FUNC_T * R_CDECL R_time_get_func(void);
00302 void R_CDECL R_time_set_func(R_TIME_FUNC_T *func);
00303
00304 R_TIME_T * R_CDECL R_time_offset(R_TIME_T *ret, R_TIME_T *tm,
00305 R_INT32 secs_offset, R_INT32 nano_offset);
00306 R_TIME_OFFSET_FUNC_T * R_CDECL R_time_get_offset_func(void);
00307 void R_CDECL R_time_set_offset_func(R_TIME_OFFSET_FUNC_T *func);
00308
00309 int R_CDECL R_time_from_int(R_TIME_T *tm, int i);
00310 int R_CDECL R_time_to_int(R_TIME_T *tm);
00311
00312 int R_CDECL R_time_cmp(R_TIME_T *tm1, R_TIME_T *tm2);
00313 R_TIME_CMP_FUNC_T * R_CDECL R_time_get_cmp_func(void);
00314 void R_CDECL R_time_set_cmp_func(R_TIME_CMP_FUNC_T *func);
00315
00316 int R_CDECL R_time_import(char *buffer, int buf_len, int format, R_TIME_T *tm);
00317 R_TIME_IMPORT_FUNC_T * R_CDECL R_time_get_import_func(void);
00318 void R_CDECL R_time_set_import_func(R_TIME_IMPORT_FUNC_T *func);
00319
00320 int R_CDECL R_time_export(R_TIME_T *tm, int format, char *buffer, int buf_len);
00321 R_TIME_EXPORT_FUNC_T * R_CDECL R_time_get_export_func(void);
00322 void R_CDECL R_time_set_export_func(R_TIME_EXPORT_FUNC_T *func);
00323
00324 /*
00325 * @}
00326 */
00327
00328 #ifdef __cplusplus
00329 }
00330 #endif
00331 #endif /* HEADER_COMMON_R_TIME_H */
00332
00333
00334
00335
00336
00337