netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cache.h File Reference

LDAP cache interface. More...

Go to the source code of this file.

Macros

#define CACHESECONDS   600

Functions

int search_cachebyname (const char *name, uuidtype_t *type, unsigned char *uuid)
 Search cache by name and uuid type.
int add_cachebyname (const char *inname, const uuidp_t inuuid, const uuidtype_t type, const unsigned long uid)
int search_cachebyuuid (uuidp_t uuidp, char **name, uuidtype_t *type)
int add_cachebyuuid (uuidp_t inuuid, const char *inname, uuidtype_t type, const unsigned long uid)

Detailed Description

LDAP cache interface.

We need to cache all LDAP query results, they just take too long. We do hashing with chaining. Two caches are needed:

  1. name -> uuid, indexed by a hash(f(): hashstring) of the name
  2. uuid -> name, indexed by a hash of the uuid(f(): hashuuid) Both hash funcs result in a value 0-255 with which we index in an array. We malloc and free all elements as needed. The cache caches for CACHESECONDS.

Macro Definition Documentation

◆ CACHESECONDS

#define CACHESECONDS   600

Function Documentation

◆ add_cachebyname()

int add_cachebyname ( const char * inname,
const uuidp_t inuuid,
const uuidtype_t type,
const unsigned long uid )
extern

◆ add_cachebyuuid()

int add_cachebyuuid ( uuidp_t inuuid,
const char * inname,
uuidtype_t type,
const unsigned long uid )
extern

◆ search_cachebyname()

int search_cachebyname ( const char * name,
uuidtype_t * type,
unsigned char * uuid )
extern

Search cache by name and uuid type.

Parameters
[in]namename to search
[in,out]typetype (user or group) of name, returns found type here which might mark it as a negative entry
[out]uuidfound uuid is returned here
Returns
0 on success, entry found; -1 no entry found

◆ search_cachebyuuid()

int search_cachebyuuid ( uuidp_t uuidp,
char ** name,
uuidtype_t * type )
extern

Caller must free allocated name