ze-filter  (ze-filter-0.8.0-develop-180218)
zeBTree.h
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : janvier 2002
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 
25 #ifndef __ZE_BTREE_H
26 
32 typedef struct ZEBT_T ZEBT_T;
33 typedef struct ZEBTREC_T ZEBTREC_T;
34 
35 typedef int (*ZEBT_CMP_F) (void *, void *);
36 typedef bool (*ZEBT_SEL_F) (void *, void *);
37 typedef int (*ZEBT_BROWSE_F) (void *, void *);
38 
39 bool zeBTree_Lock (ZEBT_T *);
40 bool zeBTree_unLock (ZEBT_T *);
41 
42 bool zeBTree_Init (ZEBT_T *, size_t, ZEBT_CMP_F);
43 
44 bool zeBTree_Set_BTree_Size(ZEBT_T *, bool, int);
45 
46 bool zeBTree_Destroy (ZEBT_T *);
47 
48 bool zeBTree_Clear (ZEBT_T *);
49 
50 int zeBTree_Count(ZEBT_T *);
51 
52 int zeBTree_Browse (ZEBT_T *, ZEBT_BROWSE_F, void *);
53 
54 bool zeBTree_Cpy(ZEBT_T *, ZEBT_T *, ZEBT_SEL_F, void *);
55 
56 bool zeBTree_Cleanup(ZEBT_T *, ZEBT_SEL_F, void *);
57 
58 void *zeBTree_Get (ZEBT_T *, void *);
59 
60 bool zeBTree_Add (ZEBT_T *, void *);
61 
62 bool zeBTree_Del (ZEBT_T *, void *);
63 
64 
65 #ifndef MAX_BTNODES
66 # define MAX_BTNODES 0x800000
67 #endif
68 
69 #ifndef NB_BTCLEANUP
70 # define NB_BTCLEANUP ((4 * MAX_BTNODES) / 5)
71 #endif
72 
73 struct ZEBT_T {
75  int count;
76  size_t size;
79  bool chkCount;
80  int maxCount;
81  int nbErr;
82  pthread_mutex_t mutex;
83 };
84 
85 #define JBT_INITIALIZER \
86  { \
87  SIGNATURE, 0, 0, NULL, NULL, \
88  FALSE, MAX_BTNODES, 0, PTHREAD_MUTEX_INITIALIZER \
89  }
90 
93 #define __ZE_BTREE_H
94 #endif
95 
bool zeBTree_Set_BTree_Size(ZEBT_T *, bool, int)
Definition: zeBTree.c:170
bool zeBTree_Del(ZEBT_T *, void *)
Definition: zeBTree.c:356
uint32_t signature
Definition: zeBTree.h:74
int count
Definition: zeBTree.h:75
void * zeBTree_Get(ZEBT_T *, void *)
Definition: zeBTree.c:281
bool zeBTree_Init(ZEBT_T *, size_t, ZEBT_CMP_F)
Definition: zeBTree.c:96
bool chkCount
Definition: zeBTree.h:79
bool zeBTree_Add(ZEBT_T *, void *)
Definition: zeBTree.c:309
bool zeBTree_Destroy(ZEBT_T *)
Definition: zeBTree.c:192
Error dont have limits h nor values h typedef int bool
Definition: ze-sys.h:261
pthread_mutex_t mutex
Definition: zeBTree.h:82
int zeBTree_Count(ZEBT_T *)
Definition: zeBTree.c:245
bool zeBTree_Clear(ZEBT_T *)
Definition: zeBTree.c:222
bool zeBTree_Cpy(ZEBT_T *, ZEBT_T *, ZEBT_SEL_F, void *)
Definition: zeBTree.c:515
int(* ZEBT_BROWSE_F)(void *, void *)
Definition: zeBTree.h:37
ZEBT_CMP_F reccmp
Definition: zeBTree.h:78
bool(* ZEBT_SEL_F)(void *, void *)
Definition: zeBTree.h:36
size_t size
Definition: zeBTree.h:76
int(* ZEBT_CMP_F)(void *, void *)
Definition: zeBTree.h:35
bool zeBTree_unLock(ZEBT_T *)
Definition: zeBTree.c:151
int maxCount
Definition: zeBTree.h:80
int nbErr
Definition: zeBTree.h:81
bool zeBTree_Lock(ZEBT_T *)
Definition: zeBTree.c:131
long uint32_t
Definition: ze-sys.h:489
bool zeBTree_Cleanup(ZEBT_T *, ZEBT_SEL_F, void *)
Definition: zeBTree.c:564
int zeBTree_Browse(ZEBT_T *, ZEBT_BROWSE_F, void *)
Definition: zeBTree.c:262
ZEBTREC_T * root
Definition: zeBTree.h:77
Definition: zeBTree.h:73