/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef APU_LDAP_CACHE_H
#define APU_LDAP_CACHE_H
/**
* @file util_ldap_cache.h
* @brief This switches LDAP support on or off.
*/
/* this whole thing disappears if LDAP is not enabled */
#if APR_HAS_LDAP
/*
* LDAP Cache Manager
*/
#include "util_ldap.h"
typedef struct util_cache_node_t {
struct util_ald_cache {
void * (*copy)(util_ald_cache_t *cache, void *); /* Func to alloc mem and copy payload to new mem */
void (*display)(request_rec *r, util_ald_cache_t *cache, void *); /* Func to display the payload contents */
obvious: it won't be 3/4 the size of the cache if
there were a lot of expired entries. */
#endif
};
#ifndef WIN32
#else
#endif
/*
* LDAP Cache
*/
/*
* Maintain a cache of LDAP URLs that the server handles. Each node in
* the cache contains the search cache for that URL, and a compare cache
* for the URL. The compare cash is populated when doing require group
* compares.
*/
typedef struct util_url_node_t {
const char *url;
/*
* When a group is found, subgroups are stored in the group's cache entry.
*/
typedef struct util_compare_subgroup_t {
const char **subgroupDNs;
int len;
/*
* We cache every successful search and bind operation, using the username
* as the key. Each node in the cache contains the returned DN, plus the
* password used to bind.
*/
typedef struct util_search_node_t {
NULL if the bind failed */
/*
* We cache every successful compare operation, using the DN, attrib, and
* value as the key.
*/
typedef struct util_compare_node_t {
const char *attrib;
const char *value;
int result;
int sgl_processed; /* 0 if no sgl processing yet. 1 if sgl has been processed (even if SGL is NULL). Saves repeat work on leaves. */
/*
* We cache every successful compare dn operation, using the dn in the require
* statement and the dn fetched based on the client-provided username.
*/
typedef struct util_dn_compare_node_t {
/*
* Function prototypes for LDAP cache
*/
/* util_ldap_cache.c */
unsigned long util_ldap_url_node_hash(void *n);
int util_ldap_url_node_compare(void *a, void *b);
unsigned long util_ldap_search_node_hash(void *n);
int util_ldap_search_node_compare(void *a, void *b);
unsigned long util_ldap_compare_node_hash(void *n);
int util_ldap_compare_node_compare(void *a, void *b);
unsigned long util_ldap_dn_compare_node_hash(void *n);
int util_ldap_dn_compare_node_compare(void *a, void *b);
/* util_ldap_cache_mgr.c */
/* Cache alloc and free function, dealing or not with shm */
/* Cache managing function */
unsigned long util_ald_hash_string(int nstr, ...);
long cache_size,
unsigned long (*hashfunc)(void *),
int (*comparefunc)(void *, void *),
#endif /* APR_HAS_LDAP */
#endif /* APU_LDAP_CACHE_H */