Back to index

opendkim  2.6.2
opendkim-db.h
Go to the documentation of this file.
00001 /*
00002 **  Copyright (c) 2008 Sendmail, Inc. and its suppliers.
00003 **      All rights reserved.
00004 **
00005 **  Copyright (c) 2009-2012, The OpenDKIM Project.  All rights reserved.
00006 **
00007 **  $Id: opendkim-db.h,v 1.15 2010/09/16 04:47:39 cm-msk Exp $
00008 */
00009 
00010 #ifndef _OPENDKIM_DB_H_
00011 #define _OPENDKIM_DB_H_
00012 
00013 #ifndef lint
00014 static char opendkim_db_h_id[] = "@(#)$Id: opendkim-db.h,v 1.15 2010/09/16 04:47:39 cm-msk Exp $";
00015 #endif /* !lint */
00016 
00017 /* system includes */
00018 #include <sys/types.h>
00019 #include <pthread.h>
00020 
00021 /* macros */
00022 #define       DKIMF_DB_FLAG_READONLY      0x0001
00023 #define       DKIMF_DB_FLAG_ICASE  0x0002
00024 #define       DKIMF_DB_FLAG_MATCHBOTH     0x0004
00025 #define       DKIMF_DB_FLAG_VALLIST       0x0008
00026 #define       DKIMF_DB_FLAG_USETLS 0x0010
00027 #define       DKIMF_DB_FLAG_MAKELOCK      0x0020
00028 #define       DKIMF_DB_FLAG_ASCIIONLY     0x0040
00029 #define       DKIMF_DB_FLAG_NOFDLOCK      0x0080
00030 #define       DKIMF_DB_FLAG_SOFTSTART     0x0100
00031 
00032 #define       DKIMF_DB_TYPE_UNKNOWN       (-1)
00033 #define       DKIMF_DB_TYPE_FILE   0
00034 #define       DKIMF_DB_TYPE_REFILE 1
00035 #define       DKIMF_DB_TYPE_CSL    2
00036 #define DKIMF_DB_TYPE_BDB   3
00037 #define DKIMF_DB_TYPE_DSN   4
00038 #define DKIMF_DB_TYPE_LDAP  5
00039 #define DKIMF_DB_TYPE_LUA   6
00040 #define DKIMF_DB_TYPE_MEMCACHE     7
00041 #define DKIMF_DB_TYPE_REPUTE       8
00042 #define DKIMF_DB_TYPE_SOCKET       9
00043 #define DKIMF_DB_TYPE_MDB   10
00044 #define DKIMF_DB_TYPE_ERLANG       11
00045 
00046 #define       DKIMF_LDAP_PARAM_BINDUSER   0
00047 #define       DKIMF_LDAP_PARAM_BINDPW            1
00048 #define       DKIMF_LDAP_PARAM_AUTHMECH   2
00049 #define       DKIMF_LDAP_PARAM_USETLS            3
00050 #define       DKIMF_LDAP_PARAM_AUTHREALM  4
00051 #define       DKIMF_LDAP_PARAM_AUTHUSER   5
00052 #define       DKIMF_LDAP_PARAM_AUTHNAME   6
00053 #define       DKIMF_LDAP_PARAM_TIMEOUT    7
00054 #define       DKIMF_LDAP_PARAM_KA_IDLE    8
00055 #define       DKIMF_LDAP_PARAM_KA_PROBES  9
00056 #define       DKIMF_LDAP_PARAM_KA_INTERVAL       10
00057 
00058 #define DKIMF_LDAP_PARAM_MAX              10
00059 
00060 #ifdef __STDC__
00061 # ifndef __P
00062 #  define __P(x)  x
00063 # endif /* ! __P */
00064 #else /* __STDC__ */
00065 # ifndef __P
00066 #  define __P(x)  ()
00067 # endif /* ! __P */
00068 #endif /* __STDC__ */
00069 
00070 /* types */
00071 struct dkimf_db;
00072 typedef struct dkimf_db * DKIMF_DB;
00073 
00074 struct dkimf_db_data
00075 {
00076        unsigned int  dbdata_flags;
00077        char *        dbdata_buffer;
00078        size_t        dbdata_buflen;
00079 };
00080 typedef struct dkimf_db_data * DKIMF_DBDATA;
00081 
00082 #define       DKIMF_DB_DATA_BINARY 0x01          /* data is binary */
00083 #define       DKIMF_DB_DATA_OPTIONAL      0x02          /* data is optional */
00084 
00085 /* prototypes */
00086 extern int dkimf_db_chown __P((DKIMF_DB, uid_t uid));
00087 extern int dkimf_db_close __P((DKIMF_DB));
00088 extern int dkimf_db_delete __P((DKIMF_DB, void *, size_t));
00089 extern int dkimf_db_get __P((DKIMF_DB, void *, size_t,
00090                              DKIMF_DBDATA, unsigned int, _Bool *));
00091 extern int dkimf_db_mkarray __P((DKIMF_DB, char ***, const char **));
00092 extern int dkimf_db_open __P((DKIMF_DB *, char *, u_int flags,
00093                               pthread_mutex_t *, char **));
00094 extern int dkimf_db_put __P((DKIMF_DB, void *, size_t, void *, size_t));
00095 extern int dkimf_db_rewalk __P((DKIMF_DB, char *, DKIMF_DBDATA, unsigned int,
00096                                 void **));
00097 extern void dkimf_db_set_ldap_param __P((int, char *));
00098 extern int dkimf_db_strerror __P((DKIMF_DB, char *, size_t));
00099 extern int dkimf_db_type __P((DKIMF_DB));
00100 extern int dkimf_db_walk __P((DKIMF_DB, _Bool, void *, size_t *,
00101                               DKIMF_DBDATA, unsigned int));
00102 
00103 #endif /* _OPENDKIM_DB_H_ */