netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cache.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2008,2009 Frank Lahm <[email protected]>
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
34extern int search_cachebyname(const char *name, uuidtype_t *type,
35 unsigned char *uuid);
36extern int add_cachebyname(const char *inname, const uuidp_t inuuid,
37 const uuidtype_t type, const unsigned long uid);
38extern int search_cachebyuuid(uuidp_t uuidp, char **name, uuidtype_t *type);
39extern int add_cachebyuuid(uuidp_t inuuid, const char *inname, uuidtype_t type,
40 const unsigned long uid);
41
42#endif /* LDAPCACHE_H */
uid_t uuid
int search_cachebyuuid(uuidp_t uuidp, char **name, uuidtype_t *type)
Definition cache.c:295
int add_cachebyuuid(uuidp_t inuuid, const char *inname, uuidtype_t type, const unsigned long uid)
Definition cache.c:353
int search_cachebyname(const char *name, uuidtype_t *type, unsigned char *uuid)
Definition cache.c:233
int add_cachebyname(const char *inname, const uuidp_t inuuid, const uuidtype_t type, const unsigned long uid)
Definition cache.c:141
static enum op type
Definition nad_cp.c:95
const unsigned char * uuidp_t
Definition uuid.h:20
uuidtype_t
Definition uuid.h:24