mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ./src/config.h
CONFIG_CLEAN_FILES =
-DIST_COMMON = README AUTHORS Makefile.am Makefile.in TODO acconfig.h \
+DIST_COMMON = README AUTHORS INSTALL Makefile.am Makefile.in TODO \
aclocal.m4 config.guess config.sub configure configure.in install-sh \
-ltconfig ltmain.sh missing mkinstalldirs src/config.h.in src/stamp-h.in
+ltconfig ltmain.sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
-src/config.h: src/stamp-h
- @if test ! -f $@; then \
- rm -f src/stamp-h; \
- $(MAKE) src/stamp-h; \
- else :; fi
-src/stamp-h: $(srcdir)/src/config.h.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES= CONFIG_HEADERS=src/config.h \
- $(SHELL) ./config.status
- @echo timestamp > src/stamp-h 2> /dev/null
-$(srcdir)/src/config.h.in: $(srcdir)/src/stamp-h.in
- @if test ! -f $@; then \
- rm -f $(srcdir)/src/stamp-h.in; \
- $(MAKE) $(srcdir)/src/stamp-h.in; \
- else :; fi
-$(srcdir)/src/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
- cd $(top_srcdir) && $(AUTOHEADER)
- @echo timestamp > $(srcdir)/src/stamp-h.in 2> /dev/null
-
-mostlyclean-hdr:
-
-clean-hdr:
-
-distclean-hdr:
- -rm -f src/config.h
-
-maintainer-clean-hdr:
-
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
+ cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+mostlyclean-am: mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-recursive
-clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+clean-am: clean-tags clean-generic mostlyclean-am
clean: clean-recursive
-distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+distclean-am: distclean-tags distclean-generic clean-am
-rm -f libtool
distclean: distclean-recursive
-rm -f config.status
-maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
- maintainer-clean-generic distclean-am
+maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
+ distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
-.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
-install-data-recursive uninstall-data-recursive install-exec-recursive \
-uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
-all-recursive check-recursive installcheck-recursive info-recursive \
-dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+.PHONY: install-data-recursive uninstall-data-recursive \
+install-exec-recursive uninstall-exec-recursive installdirs-recursive \
+uninstalldirs-recursive all-recursive check-recursive \
+installcheck-recursive info-recursive dvi-recursive \
+mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
LDAPAddRequest::~LDAPAddRequest(){
DEBUG(LDAP_DEBUG_DESTROY, "LDAPAddRequest::~LDAPAddRequest()" << endl);
delete m_entry;
+ // flush the cache, as the add may affect searches
+ m_connection->flush_cache();
}
LDAPMessageQueue* LDAPAddRequest::sendRequest(){
LDAPAsynConnection::~LDAPAsynConnection(){
DEBUG(LDAP_DEBUG_DESTROY,
"LDAPAsynConnection::~LDAPAsynConnection()" << endl);
+ if (cur_session){
+ ldap_destroy_cache(cur_session);
+ }
unbind();
//delete m_constr;
}
return 0;
}
+int LDAPAsynConnection::enableCache(long timeout, long maxmem){
+ int retval = ldap_enable_cache(cur_session, timeout, maxmem);
+ if (!retval)
+ m_cacheEnabled = true;
+ return retval;
+}
+
+void LDAPAsynConnection::disableCache(){
+ ldap_disable_cache(cur_session);
+ m_cacheEnabled = false;
+}
+
+void LDAPAsynConnection::uncache_entry(string &dn){
+ if (m_cacheEnabled){
+ ldap_uncache_entry(cur_session, dn.c_str());
+ }
+}
+
+void LDAPAsynConnection::flush_cache(){
+ if (m_cacheEnabled){
+ ldap_flush_cache(cur_session);
+ }
+}
LDAPUrlList::const_iterator& usedUrl,
const LDAPConstraints* cons) const;
-
+ /**
+ * Turn on caching, maxmem is in MB and timeout is in seconds.
+ * maxmem can be zero if you want to restrict caching by timeout only.
+ */
+ int enableCache(long timeout, long maxmem);
+ /// disable caching.
+ void disableCache();
+ /// is cacheEnabled?
+ bool getCacheEnabled() { return m_cacheEnabled;};
+ /// uncache a specific dn. Used internally by methods that write.
+ void uncache_entry(string &dn);
+ /// used to clear the cache. Probably should be used after creating
+ /// an object that a cached search should find.
+ void flush_cache();
+
+
private :
/**
* Private copy constructor. So nobody can call it.
*/
int m_port;
+ protected:
+ /**
+ * Is caching enabled?
+ */
+ bool m_cacheEnabled;
};
#endif //LDAP_ASYN_CONNECTION_H
* This container class is used to store multiple LDAPAttribute-objects.
*/
class LDAPAttributeList{
- private :
- AttrList m_attrs;
+ private :
+ AttrList m_attrs;
- public :
- typedef AttrList::const_iterator const_iterator;
+ public :
+ typedef AttrList::const_iterator const_iterator;
/**
* Copy-constructor
*/
- LDAPAttributeList(const LDAPAttributeList& al);
+ LDAPAttributeList(const LDAPAttributeList& al);
/**
* For internal use only
* list of attributes from a LDAPMessage-struct that was return by
* the C-API
*/
- LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
+ LDAPAttributeList(const LDAPAsynConnection *ld, LDAPMessage *msg);
/**
* Constructs an empty list.
*/
- LDAPAttributeList();
+ LDAPAttributeList();
/**
* Destructor
* Adds one element to the end of the list.
* @param attr The attribute to add to the list.
*/
- void addAttribute(const LDAPAttribute& attr);
+ void addAttribute(const LDAPAttribute& attr);
/**
* Translates the list of Attributes to a 0-terminated array of
* LDAPMod-structures as needed by the C-API
*/
- LDAPMod** toLDAPModArray() const;
-
+ LDAPMod** toLDAPModArray() const;
+
/**
* This method can be used to dump the data of a LDAPResult-Object.
* It is only useful for debugging purposes at the moment
*/
- friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
+ friend ostream& operator << (ostream& s, const LDAPAttributeList& al);
};
#endif // LDAP_ATTRIBUTE_LIST_H
const LDAPConstraints* LDAPConnection::getConstraints() const{
return LDAPAsynConnection::getConstraints();
}
+
+int LDAPConnection::enableCache(long timeout, long maxmem)
+{
+ return LDAPAsynConnection::enableCache(timeout, maxmem);
+}
+
+
+void LDAPConnection::disableCache()
+{
+ LDAPAsynConnection::disableCache();
+}
+
+bool LDAPConnection::getCacheEnabled()
+{
+ return LDAPAsynConnection::getCacheEnabled();
+}
+
+void LDAPConnection::uncache_entry(string &dn)
+{
+ LDAPAsynConnection::uncache_entry(dn);
+}
+
+void LDAPConnection::flush_cache()
+{
+ LDAPAsynConnection::flush_cache();
+}
+
void setConstraints(LDAPConstraints *cons);
const LDAPConstraints* getConstraints() const ;
+
+ /**
+ * Turn on caching, maxmem is in MB and timeout is in seconds.
+ * maxmem can be zero if you want to restrict caching by timeout only.
+ */
+ int enableCache(long timeout, long maxmem);
+ /// disable caching.
+ void disableCache();
+ /// is cacheEnabled?
+ bool getCacheEnabled();
+ /// uncache a specific dn. Used internally by methods that write.
+ void uncache_entry(string &dn);
+ /// used to clear the cache. Probably should be used after creating
+ /// an object that a cached search should find.
+ void flush_cache();
+
};
#endif //LDAP_CONNECTION_H
}
LDAPDeleteRequest::~LDAPDeleteRequest(){
- DEBUG(LDAP_DEBUG_DESTROY,
- "LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
+ DEBUG(LDAP_DEBUG_DESTROY,
+ "LDAPDeleteRequest::~LDAPDeleteRequest()" << endl);
+ // TODO -- flush the entire cache here? or does this invalidate
+ // cached searches that may have found the deleted entry.
+ m_connection->uncache_entry(m_dn);
}
LDAPMessageQueue* LDAPDeleteRequest::sendRequest(){
LDAPModDNRequest::~LDAPModDNRequest(){
DEBUG(LDAP_DEBUG_DESTROY, "LDAPModDNRequest::~LDAPModDNRequest()" << endl);
+ // flush entries from the cache.
+ m_connection->uncache_entry(m_dn);
+ m_connection->uncache_entry(m_newRDN);
}
LDAPMessageQueue* LDAPModDNRequest::sendRequest(){
DEBUG(LDAP_DEBUG_DESTROY,
"LDAPModifyRequest::~LDAPModifyRequest()" << endl);
delete m_modList;
+ // flush this entry from cache.
+ m_connection->uncache_entry(m_dn);
}
LDAPMessageQueue* LDAPModifyRequest::sendRequest(){