/* 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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"
typedefstruct util_cache_node_t { void *payload; /* Pointer to the payload */
apr_time_t add_time; /* Time node was added to cache */ struct util_cache_node_t *next;
} util_cache_node_t;
typedefstruct util_ald_cache util_ald_cache_t;
struct util_ald_cache { unsignedlong size; /* Size of cache array */ unsignedlong maxentries; /* Maximum number of cache entries */ unsignedlong numentries; /* Current number of cache entries */ unsignedlong fullmark; /* Used to keep track of when cache becomes 3/4 full */
apr_time_t marktime; /* Time that the cache became 3/4 full */ unsignedlong ttl; /* Time to live for items in cache */ unsignedlong (*hash)(void *); /* Func to hash the payload */ int (*compare)(void *, void *); /* Func to compare two payloads */ void * (*copy)(util_ald_cache_t *cache, void *); /* Func to alloc mem and copy payload to new mem */ void (*free)(util_ald_cache_t *cache, void *); /* Func to free mem used by the payload */ void (*display)(request_rec *r, util_ald_cache_t *cache, void *); /* Func to display the payload contents */
util_cache_node_t **nodes;
unsignedlong numpurges; /* No. of times the cache has been purged */ double avg_purgetime; /* Average time to purge the cache */
apr_time_t last_purge; /* Time of the last purge */ unsignedlong npurged; /* Number of elements purged in last purge. This is not obvious: it won't be 3/4 the size of the cache if
there were a lot of expired entries. */
unsignedlong fetches; /* Number of fetches */ unsignedlong hits; /* Number of cache hits */ unsignedlong inserts; /* Number of inserts */ unsignedlong removes; /* Number of removes */
/* * 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.
*/ typedefstruct util_url_node_t { constchar *url;
util_ald_cache_t *search_cache;
util_ald_cache_t *compare_cache;
util_ald_cache_t *dn_compare_cache;
} util_url_node_t;
/* * When a group is found, subgroups are stored in the group's cache entry.
*/ typedefstruct util_compare_subgroup_t { constchar **subgroupDNs; int len;
} util_compare_subgroup_t;
/* * 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.
*/ typedefstruct util_search_node_t { constchar *username; /* Cache key */ constchar *dn; /* DN returned from search */ constchar *bindpw; /* The most recently used bind password;
NULL if the bind failed */
apr_time_t lastbind; /* Time of last successful bind */ constchar **vals; /* Values of queried attributes */ int numvals; /* Number of queried attributes */
} util_search_node_t;
/* * We cache every successful compare operation, using the DN, attrib, and * value as the key.
*/ typedefstruct util_compare_node_t { constchar *dn; /* DN, attrib and value combine to be the key */ constchar *attrib; constchar *value;
apr_time_t lastcompare; 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. */ struct util_compare_subgroup_t *subgroupList;
} util_compare_node_t;
/* * We cache every successful compare dn operation, using the dn in the require * statement and the dn fetched based on the client-provided username.
*/ typedefstruct util_dn_compare_node_t { constchar *reqdn; /* The DN in the require dn statement */ constchar *dn; /* The DN found in the search */
} util_dn_compare_node_t;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.