1 #ifndef _DICT_CACHE_H_INCLUDED_ 2 #define _DICT_CACHE_H_INCLUDED_ 3 4 /*++ 5 /* NAME 6 /* dict_cache 3h 7 /* SUMMARY 8 /* External cache manager 9 /* SYNOPSIS 10 /* #include <dict_cache.h> 11 /* DESCRIPTION 12 /* .nf 13 14 /* 15 * Utility library. 16 */ 17 #include <dict.h> 18 #include <check_arg.h> 19 20 /* 21 * External interface. 22 */ 23 typedef struct DICT_CACHE DICT_CACHE; 24 typedef int (*DICT_CACHE_VALIDATOR_FN) (const char *, const char *, void *); 25 26 extern DICT_CACHE *dict_cache_open(const char *, int, int); 27 extern void dict_cache_close(DICT_CACHE *); 28 extern const char *dict_cache_lookup(DICT_CACHE *, const char *); 29 extern int dict_cache_update(DICT_CACHE *, const char *, const char *); 30 extern int dict_cache_delete(DICT_CACHE *, const char *); 31 extern int dict_cache_sequence(DICT_CACHE *, int, const char **, const char **); 32 extern void dict_cache_control(DICT_CACHE *,...); 33 extern const char *dict_cache_name(DICT_CACHE *); 34 35 #define DICT_CACHE_FLAG_VERBOSE (1<<0) /* verbose operation */ 36 #define DICT_CACHE_FLAG_STATISTICS (1<<1) /* log cache statistics */ 37 38 /* Legacy API: type-unchecked argument, internal use. */ 39 #define DICT_CACHE_CTL_END 0 /* list terminator */ 40 #define DICT_CACHE_CTL_FLAGS 1 /* see above */ 41 #define DICT_CACHE_CTL_INTERVAL 2 /* cleanup interval */ 42 #define DICT_CACHE_CTL_VALIDATOR 3 /* call-back validator */ 43 #define DICT_CACHE_CTL_CONTEXT 4 /* call-back context */ 44 45 /* Safer API: type-checked arguments, external use. */ 46 #define CA_DICT_CACHE_CTL_END DICT_CACHE_CTL_END 47 #define CA_DICT_CACHE_CTL_FLAGS(v) DICT_CACHE_CTL_FLAGS, CHECK_VAL(DICT_CACHE, int, (v)) 48 #define CA_DICT_CACHE_CTL_INTERVAL(v) DICT_CACHE_CTL_INTERVAL, CHECK_VAL(DICT_CACHE, int, (v)) 49 #define CA_DICT_CACHE_CTL_VALIDATOR(v) DICT_CACHE_CTL_VALIDATOR, CHECK_VAL(DICT_CACHE, DICT_CACHE_VALIDATOR_FN, (v)) 50 #define CA_DICT_CACHE_CTL_CONTEXT(v) DICT_CACHE_CTL_CONTEXT, CHECK_PTR(DICT_CACHE, void, (v)) 51 52 CHECK_VAL_HELPER_DCL(DICT_CACHE, int); 53 CHECK_VAL_HELPER_DCL(DICT_CACHE, DICT_CACHE_VALIDATOR_FN); 54 CHECK_PTR_HELPER_DCL(DICT_CACHE, void); 55 56 /* LICENSE 57 /* .ad 58 /* .fi 59 /* The Secure Mailer license must be distributed with this software. 60 /* AUTHOR(S) 61 /* Wietse Venema 62 /* IBM T.J. Watson Research 63 /* P.O. Box 704 64 /* Yorktown Heights, NY 10598, USA 65 /*--*/ 66 67 #endif 68