/* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * * Copyright 2003-2007 The OpenLDAP Foundation. * Portions Copyright 2003 IBM Corporation. * Portions Copyright 2003 Symas Corporation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . */ /* ACKNOWLEDGEMENTS: * This work was initially developed by Apurva Kumar for inclusion * in OpenLDAP Software and subsequently rewritten by Howard Chu. */ #include "portable.h" #ifdef SLAPD_OVER_PROXYCACHE #include #include #include #include "slap.h" #include "lutil.h" #include "ldap_rq.h" #include "avl.h" #include "config.h" /* query cache structs */ /* query */ typedef struct Query_s { Filter* filter; /* Search Filter */ struct berval base; /* Search Base */ int scope; /* Search scope */ } Query; struct query_template_s; typedef struct Qbase_s { Avlnode *scopes[4]; /* threaded AVL trees of cached queries */ struct berval base; int queries; } Qbase; /* struct representing a cached query */ typedef struct cached_query_s { Filter *filter; Filter *first; Qbase *qbase; int scope; struct berval q_uuid; /* query identifier */ struct query_template_s *qtemp; /* template of the query */ time_t expiry_time; /* time till the query is considered valid */ struct cached_query_s *next; /* next query in the template */ struct cached_query_s *prev; /* previous query in the template */ struct cached_query_s *lru_up; /* previous query in the LRU list */ struct cached_query_s *lru_down; /* next query in the LRU list */ } CachedQuery; /* * URL representation: * * ldap:///????x-uuid=,x-template=