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