]> arthur.barton.de Git - netatalk.git/blob - libatalk/acl/cache.h
Merge branch 'v3-cleanup' into v3.1.6-alex
[netatalk.git] / libatalk / acl / cache.h
1 /*
2    Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2 of the License, or
7    (at your option) any later version.
8  
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13  */
14
15 #ifndef LDAPCACHE_H
16 #define LDAPCACHE_H
17
18 /* 
19  * We need to cache all LDAP querie results, they just take too long.
20  * We do hashing with chaining. Two caches are needed:
21  * 1) name -> uuid, indexed by a hash(f(): hashstring) of the name
22  * 2) uuid -> name, indexed by a hash of the uuid(f(): hashuuid)
23  * Both hash funcs result in a value 0-255 with which we index a array.
24  * We malloc and free all elements as needed.
25  * The cache caches for CACHESECONDS.
26  */
27
28 #define CACHESECONDS 600
29
30 /******************************************************** 
31  * Interface
32  ********************************************************/
33
34 extern int search_cachebyname( const char *name, uuidtype_t *type, unsigned char *uuid);
35 extern int add_cachebyname( const char *inname, const uuidp_t inuuid, const uuidtype_t type, const unsigned long uid);
36 extern int search_cachebyuuid( uuidp_t uuidp, char **name, uuidtype_t *type);
37 extern int add_cachebyuuid( uuidp_t inuuid, const char *inname, uuidtype_t type, const unsigned long uid);
38
39 #endif /* LDAPCACHE_H */