py:dcerpc/raw_testcase: add generate_request_auth() helper function
[Samba.git] / source3 / lib / gencache.h
blobccf16e9d2c2ceb282fc2c17eee4c45a954b24134
1 /*
2 * Unix SMB/CIFS implementation.
4 * Generic, persistent and shared between processes cache mechanism for use
5 * by various parts of the Samba code
7 * Copyright (C) Rafal Szczesniak 2002
8 * Copyright (C) Volker Lendecke 2009
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __LIB_GENCACHE_H__
25 #define __LIB_GENCACHE_H__
27 #include "replace.h"
28 #include "system/time.h"
29 #include "lib/util/data_blob.h"
31 bool gencache_set(const char *keystr, const char *value, time_t timeout);
32 bool gencache_del(const char *keystr);
33 bool gencache_get(const char *keystr, TALLOC_CTX *mem_ctx, char **value,
34 time_t *ptimeout);
37 * This might look like overkill, but namemap_cache.c shows it's
38 * necessary :-)
40 struct gencache_timeout;
41 bool gencache_timeout_expired(const struct gencache_timeout *t);
43 bool gencache_parse(const char *keystr,
44 void (*parser)(const struct gencache_timeout *timeout,
45 DATA_BLOB blob,
46 void *private_data),
47 void *private_data);
48 bool gencache_get_data_blob(const char *keystr, TALLOC_CTX *mem_ctx,
49 DATA_BLOB *blob,
50 time_t *timeout, bool *was_expired);
51 bool gencache_set_data_blob(const char *keystr, DATA_BLOB blob,
52 time_t timeout);
53 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
54 time_t timeout, void *private_data),
55 void *private_data, const char *pattern);
56 void gencache_iterate(void (*fn)(const char* key, const char *value,
57 time_t timeout, void* dptr),
58 void* data, const char* keystr_pattern);
60 #endif