ctdb-server: Remove duplicate logic
[samba4-gss.git] / source4 / lib / messaging / messaging.h
blobc665b8223212d1eb824df74597c1f73335c74adc
1 /*
2 Unix SMB/CIFS implementation.
3 messages.c header
4 Copyright (C) Andrew Tridgell 2000
5 Copyright (C) 2001, 2002 by Martin Pool
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SOURCE4_LIB_MESSAGING_MESSAGES_H_
22 #define _SOURCE4_LIB_MESSAGING_MESSAGES_H_
24 #include "librpc/gen_ndr/server_id.h"
25 #include "lib/util/data_blob.h"
26 #include "librpc/gen_ndr/messaging.h"
28 struct loadparm_context;
29 struct imessaging_context;
31 /* taskid for messaging of parent process */
32 #define SAMBA_PARENT_TASKID 0
34 typedef void (*msg_callback_t)(
35 struct imessaging_context *msg,
36 void *private_data,
37 uint32_t msg_type,
38 struct server_id server_id,
39 size_t num_fds,
40 int *fds,
41 DATA_BLOB *data);
43 NTSTATUS imessaging_send(struct imessaging_context *msg, struct server_id server,
44 uint32_t msg_type, const DATA_BLOB *data);
45 NTSTATUS imessaging_register(struct imessaging_context *msg, void *private_data,
46 uint32_t msg_type,
47 msg_callback_t fn);
48 NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_data,
49 msg_callback_t fn, uint32_t *msg_type);
50 struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
51 struct loadparm_context *lp_ctx,
52 struct server_id server_id,
53 struct tevent_context *ev);
54 struct imessaging_context *imessaging_init_discard_incoming(
55 TALLOC_CTX *mem_ctx,
56 struct loadparm_context *lp_ctx,
57 struct server_id server_id,
58 struct tevent_context *ev);
59 void imessaging_dgm_unref_ev(struct tevent_context *ev);
60 NTSTATUS imessaging_reinit_all(void);
61 int imessaging_cleanup(struct imessaging_context *msg);
62 struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
63 struct loadparm_context *lp_ctx,
64 struct tevent_context *ev);
65 NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server,
66 uint32_t msg_type, void *ptr);
67 size_t imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data);
68 struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx);
69 NTSTATUS imessaging_process_cleanup(struct imessaging_context *msg_ctx,
70 pid_t pid);
72 #endif