00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _DB_SERVER_INT_H_
00011 #define _DB_SERVER_INT_H_
00012
00013 #define DB_SERVER_TIMEOUT 300
00014 #define DB_SERVER_MAXTIMEOUT 1200
00015 #define DB_SERVER_IDLETIMEOUT 86400
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #define DB_SERVER_FLAGMASK ( \
00029 DB_LOCKDOWN | DB_PRIVATE | DB_RECOVER | DB_RECOVER_FATAL | \
00030 DB_SYSTEM_MEM | DB_USE_ENVIRON | DB_USE_ENVIRON_ROOT)
00031
00032 #define CT_CURSOR 0x001
00033 #define CT_DB 0x002
00034 #define CT_ENV 0x004
00035 #define CT_TXN 0x008
00036
00037 #define CT_JOIN 0x10000000
00038 #define CT_JOINCUR 0x20000000
00039
00040 typedef struct home_entry home_entry;
00041 struct home_entry {
00042 LIST_ENTRY(home_entry) entries;
00043 char *home;
00044 char *dir;
00045 char *name;
00046 char *passwd;
00047 };
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #define DB_SERVER_ENVFLAGS ( \
00058 DB_INIT_CDB | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | \
00059 DB_INIT_TXN | DB_JOINENV)
00060
00061 #define DB_SERVER_DBFLAGS (DB_NOMMAP | DB_RDONLY | DB_READ_UNCOMMITTED)
00062 #define DB_SERVER_DBNOSHARE (DB_EXCL | DB_TRUNCATE)
00063
00064 typedef struct ct_envdata ct_envdata;
00065 typedef struct ct_dbdata ct_dbdata;
00066 struct ct_envdata {
00067 u_int32_t envflags;
00068 u_int32_t onflags;
00069 u_int32_t offflags;
00070 home_entry *home;
00071 };
00072
00073 struct ct_dbdata {
00074 u_int32_t dbflags;
00075 u_int32_t setflags;
00076 char *db;
00077 char *subdb;
00078 DBTYPE type;
00079 };
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 typedef struct ct_entry ct_entry;
00090 struct ct_entry {
00091 LIST_ENTRY(ct_entry) entries;
00092 union {
00093 #ifdef __cplusplus
00094 DbEnv *envp;
00095 DbTxn *txnp;
00096 Db *dbp;
00097 Dbc *dbc;
00098 #else
00099 DB_ENV *envp;
00100 DB_TXN *txnp;
00101 DB *dbp;
00102 DBC *dbc;
00103 #endif
00104 void *anyp;
00105 } handle_u;
00106 union {
00107 ct_envdata envdp;
00108 ct_dbdata dbdp;
00109 } private_u;
00110 long ct_id;
00111 long *ct_activep;
00112 long *ct_origp;
00113 long ct_active;
00114 long ct_timeout;
00115 long ct_idle;
00116 u_int32_t ct_refcount;
00117 u_int32_t ct_type;
00118 struct ct_entry *ct_parent;
00119 struct ct_entry *ct_envparent;
00120 };
00121
00122 #define ct_envp handle_u.envp
00123 #define ct_txnp handle_u.txnp
00124 #define ct_dbp handle_u.dbp
00125 #define ct_dbc handle_u.dbc
00126 #define ct_anyp handle_u.anyp
00127
00128 #define ct_envdp private_u.envdp
00129 #define ct_dbdp private_u.dbdp
00130
00131 extern int __dbsrv_verbose;
00132
00133
00134
00135
00136
00137
00138 #define ACTIVATE_CTP(ctp, id, type) { \
00139 (ctp) = get_tableent(id); \
00140 if ((ctp) == NULL) { \
00141 replyp->status = DB_NOSERVER_ID;\
00142 return; \
00143 } \
00144 DB_ASSERT((ctp)->ct_type & (type)); \
00145 __dbsrv_active(ctp); \
00146 }
00147
00148 #define FREE_IF_CHANGED(dbenv, p, orig) do { \
00149 if ((p) != NULL && (p) != (orig)) \
00150 __os_ufree((dbenv), (p)); \
00151 } while (0)
00152
00153 #endif