summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/basic.mk42
-rw-r--r--source4/lib/gencache/gencache.h94
-rw-r--r--source4/lib/ldb/config.mk4
-rw-r--r--source4/lib/socket/config.mk4
4 files changed, 117 insertions, 27 deletions
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 8653779044..a118636c52 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -1,32 +1,28 @@
# LIB BASIC subsystem
-include samba3/config.mk
-include socket/config.mk
-include charset/config.mk
-include ldb-samba/config.mk
-include tls/config.mk
-include registry/config.mk
-include policy/config.mk
-include messaging/config.mk
-include events/config.mk
-include cmdline/config.mk
-include socket_wrapper/config.mk
-include nss_wrapper/config.mk
-include appweb/config.mk
-include stream/config.mk
-include util/config.mk
-include tdr/config.mk
-include dbwrap/config.mk
-include crypto/config.mk
+mkinclude samba3/config.mk
+mkinclude socket/config.mk
+mkinclude charset/config.mk
+mkinclude ldb-samba/config.mk
+mkinclude tls/config.mk
+mkinclude registry/config.mk
+mkinclude policy/config.mk
+mkinclude messaging/config.mk
+mkinclude events/config.mk
+mkinclude cmdline/config.mk
+mkinclude socket_wrapper/config.mk
+mkinclude nss_wrapper/config.mk
+mkinclude appweb/config.mk
+mkinclude stream/config.mk
+mkinclude util/config.mk
+mkinclude tdr/config.mk
+mkinclude dbwrap/config.mk
+mkinclude crypto/config.mk
-################################################
-# Start SUBSYSTEM LIBCOMPRESSION
[SUBSYSTEM::LIBCOMPRESSION]
OBJ_FILES = compression/mszip.o
-# End SUBSYSTEM LIBCOMPRESION
-################################################
[SUBSYSTEM::GENCACHE]
-PRIVATE_PROTO_HEADER = gencache/gencache.h
+PUBLIC_HEADERS = gencache/gencache.h
OBJ_FILES = gencache/gencache.o
PRIVATE_DEPENDENCIES = TDB_WRAP
diff --git a/source4/lib/gencache/gencache.h b/source4/lib/gencache/gencache.h
new file mode 100644
index 0000000000..1481676fd9
--- /dev/null
+++ b/source4/lib/gencache/gencache.h
@@ -0,0 +1,94 @@
+#ifndef __LIB_GENCACHE_GENCACHE_H__
+#define __LIB_GENCACHE_GENCACHE_H__
+
+/**
+ * Cache initialisation function. Opens cache tdb file or creates
+ * it if does not exist.
+ *
+ * @return true on successful initialisation of the cache or
+ * false on failure
+ **/
+bool gencache_init(struct loadparm_context *lp_ctx);
+
+/**
+ * Cache shutdown function. Closes opened cache tdb file.
+ *
+ * @return true on successful closing the cache or
+ * false on failure during cache shutdown
+ **/
+bool gencache_shutdown(void);
+
+/**
+ * Set an entry in the cache file. If there's no such
+ * one, then add it.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param value text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly stored
+ * @retval false on failure
+ **/
+bool gencache_set(const char *keystr, const char *value, time_t timeout);
+
+/**
+ * Set existing entry to the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly set
+ * @retval false on failure
+ **/
+bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout);
+
+/**
+ * Delete one entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ *
+ * @retval true upon successful deletion
+ * @retval false in case of failure
+ **/
+bool gencache_del(const char *keystr);
+
+/**
+ * Get existing entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr buffer that is allocated and filled with the entry value
+ * buffer's disposing must be done outside
+ * @param timeout pointer to a time_t that is filled with entry's
+ * timeout
+ *
+ * @retval true when entry is successfuly fetched
+ * @retval false for failure
+ **/
+bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+
+/**
+ * Iterate through all entries which key matches to specified pattern
+ *
+ * @param fn pointer to the function that will be supplied with each single
+ * matching cache entry (key, value and timeout) as an arguments
+ * @param data void pointer to an arbitrary data that is passed directly to the fn
+ * function on each call
+ * @param keystr_pattern pattern the existing entries' keys are matched to
+ *
+ **/
+void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
+ void* data, const char* keystr_pattern);
+
+/********************************************************************
+ lock a key
+********************************************************************/
+int gencache_lock_entry( const char *key );
+
+/********************************************************************
+ unlock a key
+********************************************************************/
+void gencache_unlock_entry( const char *key );
+
+#endif /* __LIB_GENCACHE_GENCACHE_H__ */
+
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index 75ce89d6cf..0e7caa381f 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -193,5 +193,5 @@ PRIVATE_DEPENDENCIES = \
################################################
-include tools/config.mk
-include ldb_ildap/config.mk
+mkinclude tools/config.mk
+mkinclude ldb_ildap/config.mk
diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk
index fe64c90b81..5a7a62d8ae 100644
--- a/source4/lib/socket/config.mk
+++ b/source4/lib/socket/config.mk
@@ -13,7 +13,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL EXT_SOCKET EXT_NSL
# Start MODULE socket_ip
[MODULE::socket_ip]
SUBSYSTEM = samba-socket
-OUTPUT_TYPE = INTEGRATED
+OUTPUT_TYPE = MERGED_OBJ
OBJ_FILES = \
socket_ip.o
PRIVATE_DEPENDENCIES = EXT_SOCKET EXT_NSL LIBSAMBA-ERRORS
@@ -24,7 +24,7 @@ PRIVATE_DEPENDENCIES = EXT_SOCKET EXT_NSL LIBSAMBA-ERRORS
# Start MODULE socket_unix
[MODULE::socket_unix]
SUBSYSTEM = samba-socket
-OUTPUT_TYPE = INTEGRATED
+OUTPUT_TYPE = MERGED_OBJ
OBJ_FILES = \
socket_unix.o
PRIVATE_DEPENDENCIES = EXT_SOCKET EXT_NSL