s4/script/rodcdns: str type doesn't need decoding
[Samba.git] / source3 / include / g_lock.h
blobc3e3a509b80f013a998d160dcb4e0cee33bdc91d
1 /*
2 Unix SMB/CIFS implementation.
3 global locks based on dbwrap and messaging
4 Copyright (C) 2009 by Volker Lendecke
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _G_LOCK_H_
21 #define _G_LOCK_H_
23 #include "dbwrap/dbwrap.h"
25 struct g_lock_ctx;
26 struct messaging_context;
28 enum g_lock_type {
29 G_LOCK_READ = 0,
30 G_LOCK_WRITE = 1,
33 struct g_lock_rec {
34 enum g_lock_type lock_type;
35 struct server_id pid;
38 struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
39 struct messaging_context *msg);
41 struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
42 struct tevent_context *ev,
43 struct g_lock_ctx *ctx,
44 TDB_DATA key,
45 enum g_lock_type type);
46 NTSTATUS g_lock_lock_recv(struct tevent_req *req);
47 NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, TDB_DATA key,
48 enum g_lock_type lock_type, struct timeval timeout);
49 NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, TDB_DATA key);
51 NTSTATUS g_lock_write_data(struct g_lock_ctx *ctx, TDB_DATA key,
52 const uint8_t *buf, size_t buflen);
54 NTSTATUS g_lock_do(TDB_DATA key, enum g_lock_type lock_type,
55 struct timeval timeout,
56 void (*fn)(void *private_data), void *private_data);
58 int g_lock_locks(struct g_lock_ctx *ctx,
59 int (*fn)(TDB_DATA key, void *private_data),
60 void *private_data);
61 NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key,
62 void (*fn)(const struct g_lock_rec *locks,
63 size_t num_locks,
64 const uint8_t *data,
65 size_t datalen,
66 void *private_data),
67 void *private_data);
69 #endif