2 Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
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.
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.
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.
28 #define CACHESECONDS 600
30 /********************************************************
32 ********************************************************/
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);
39 #endif /* LDAPCACHE_H */