2004-11-16 09:00:52 +00:00
2005-02-10 03:48:43 +00:00
# ifdef _SAMBA_BUILD_
2005-02-10 05:09:35 +00:00
# include "system/filesys.h"
2006-09-22 23:22:39 +00:00
# endif
# if (_SAMBA_BUILD_ >= 4)
2005-02-10 03:48:43 +00:00
# include "lib/tdb/include/tdb.h"
2006-09-22 23:22:39 +00:00
# elif defined(_SAMBA_BUILD_)
# include "tdb/include/tdb.h"
2005-02-10 03:48:43 +00:00
# else
2004-11-16 09:00:52 +00:00
# include "tdb.h"
# endif
2004-03-31 06:45:39 +00:00
/* this private structure is used by the ltdb backend in the
ldb_context */
struct ltdb_private {
TDB_CONTEXT * tdb ;
unsigned int connect_flags ;
2004-05-01 09:45:56 +00:00
/* a double is used for portability and ease of string
handling . It has plenty of digits of precision */
2006-09-21 06:44:12 +00:00
unsigned long long sequence_number ;
2004-05-01 09:45:56 +00:00
2006-10-18 21:45:46 +00:00
/* the low level tdb seqnum - used to avoid loading BASEINFO when
possible */
int tdb_seqnum ;
2005-01-02 07:49:29 +00:00
struct ltdb_cache {
struct ldb_message * indexlist ;
struct ldb_message * attributes ;
struct ldb_message * subclasses ;
2004-05-01 09:45:56 +00:00
struct {
char * name ;
int flags ;
} last_attribute ;
2005-01-02 07:49:29 +00:00
} * cache ;
2004-03-31 06:45:39 +00:00
} ;
2006-03-03 17:44:03 +00:00
/*
the async local context
holds also internal search state during a full db search
*/
2006-07-22 16:56:33 +00:00
struct ltdb_context {
2006-03-03 17:44:03 +00:00
struct ldb_module * module ;
/* search stuff */
2006-08-22 18:09:49 +00:00
const struct ldb_parse_tree * tree ;
2006-11-22 00:59:34 +00:00
struct ldb_dn * base ;
2006-03-03 17:44:03 +00:00
enum ldb_scope scope ;
const char * const * attrs ;
/* async stuff */
void * context ;
2006-07-22 16:56:33 +00:00
int ( * callback ) ( struct ldb_context * , void * , struct ldb_reply * ) ;
2006-03-03 17:44:03 +00:00
} ;
2004-05-01 09:45:56 +00:00
/* special record types */
# define LTDB_INDEX "@INDEX"
# define LTDB_INDEXLIST "@INDEXLIST"
# define LTDB_IDX "@IDX"
# define LTDB_IDXATTR "@IDXATTR"
# define LTDB_BASEINFO "@BASEINFO"
# define LTDB_ATTRIBUTES "@ATTRIBUTES"
# define LTDB_SUBCLASSES "@SUBCLASSES"
/* special attribute types */
# define LTDB_SEQUENCE_NUMBER "sequenceNumber"
2006-09-21 06:44:12 +00:00
# define LTDB_MOD_TIMESTAMP "whenChanged"
2004-05-01 09:45:56 +00:00
# define LTDB_OBJECTCLASS "objectClass"
2004-11-16 09:00:52 +00:00
/* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c */
2005-01-02 07:49:29 +00:00
int ltdb_cache_reload ( struct ldb_module * module ) ;
2004-11-16 09:00:52 +00:00
int ltdb_cache_load ( struct ldb_module * module ) ;
int ltdb_increase_sequence_number ( struct ldb_module * module ) ;
2005-05-17 21:43:47 +00:00
int ltdb_check_at_attributes_values ( const struct ldb_val * value ) ;
2004-11-16 09:00:52 +00:00
/* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c */
struct ldb_parse_tree ;
2006-07-22 16:56:33 +00:00
int ltdb_search_indexed ( struct ldb_handle * handle ) ;
2004-11-16 09:00:52 +00:00
int ltdb_index_add ( struct ldb_module * module , const struct ldb_message * msg ) ;
int ltdb_index_del ( struct ldb_module * module , const struct ldb_message * msg ) ;
int ltdb_reindex ( struct ldb_module * module ) ;
/* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c */
int ltdb_pack_data ( struct ldb_module * module ,
const struct ldb_message * message ,
struct TDB_DATA * data ) ;
void ltdb_unpack_data_free ( struct ldb_module * module ,
struct ldb_message * message ) ;
int ltdb_unpack_data ( struct ldb_module * module ,
const struct TDB_DATA * data ,
struct ldb_message * message ) ;
/* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
int ltdb_has_wildcard ( struct ldb_module * module , const char * attr_name ,
const struct ldb_val * val ) ;
void ltdb_search_dn1_free ( struct ldb_module * module , struct ldb_message * msg ) ;
2006-11-22 00:59:34 +00:00
int ltdb_search_dn1 ( struct ldb_module * module , struct ldb_dn * dn , struct ldb_message * msg ) ;
2006-01-31 11:16:43 +00:00
int ltdb_add_attr_results ( struct ldb_module * module ,
TALLOC_CTX * mem_ctx ,
struct ldb_message * msg ,
2004-11-16 09:00:52 +00:00
const char * const attrs [ ] ,
2005-11-08 00:11:45 +00:00
unsigned int * count ,
2004-11-16 09:00:52 +00:00
struct ldb_message * * * res ) ;
2006-03-03 17:44:03 +00:00
int ltdb_filter_attrs ( struct ldb_message * msg , const char * const * attrs ) ;
2006-05-29 23:46:43 +00:00
int ltdb_search ( struct ldb_module * module , struct ldb_request * req ) ;
2004-11-16 09:00:52 +00:00
/* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
2006-07-22 16:56:33 +00:00
struct ldb_handle * init_ltdb_handle ( struct ltdb_private * ltdb , struct ldb_module * module ,
2006-10-16 03:15:41 +00:00
struct ldb_request * req ) ;
2006-11-22 00:59:34 +00:00
struct TDB_DATA ltdb_key ( struct ldb_module * module , struct ldb_dn * dn ) ;
2004-11-16 09:00:52 +00:00
int ltdb_store ( struct ldb_module * module , const struct ldb_message * msg , int flgs ) ;
2006-11-22 00:59:34 +00:00
int ltdb_delete_noindex ( struct ldb_module * module , struct ldb_dn * dn ) ;
2004-11-16 09:00:52 +00:00
int ltdb_modify_internal ( struct ldb_module * module , const struct ldb_message * msg ) ;
2004-12-19 10:56:29 +00:00
int ltdb_index_del_value ( struct ldb_module * module , const char * dn ,
struct ldb_message_element * el , int v_idx ) ;
2005-07-20 00:59:38 +00:00
struct tdb_context * ltdb_wrap_open ( TALLOC_CTX * mem_ctx ,
const char * path , int hash_size , int tdb_flags ,
2006-07-03 06:40:56 +00:00
int open_flags , mode_t mode ,
struct ldb_context * ldb ) ;
2005-07-20 00:59:38 +00:00