s4: messaging. Add imessaging_reinit_all() function.
[kai/samba-autobuild/.git] / source4 / lib / messaging / messaging.h
1 /* 
2    Unix SMB/CIFS implementation.
3    messages.c header
4    Copyright (C) Andrew Tridgell 2000
5    Copyright (C) 2001, 2002 by Martin Pool
6    
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.
11    
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.
16    
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/>.
19 */
20
21 #ifndef _SOURCE4_LIB_MESSAGING_MESSAGES_H_
22 #define _SOURCE4_LIB_MESSAGING_MESSAGES_H_
23
24 #include "librpc/gen_ndr/server_id.h"
25 #include "librpc/gen_ndr/messaging.h"
26
27 struct imessaging_context;
28
29 /* taskid for messaging of parent process */
30 #define SAMBA_PARENT_TASKID     0
31
32 typedef void (*msg_callback_t)(struct imessaging_context *msg, void *private_data,
33                                uint32_t msg_type,
34                                struct server_id server_id, DATA_BLOB *data);
35
36 NTSTATUS imessaging_send(struct imessaging_context *msg, struct server_id server,
37                         uint32_t msg_type, const DATA_BLOB *data);
38 NTSTATUS imessaging_register(struct imessaging_context *msg, void *private_data,
39                             uint32_t msg_type,
40                             msg_callback_t fn);
41 NTSTATUS imessaging_register_tmp(struct imessaging_context *msg, void *private_data,
42                                 msg_callback_t fn, uint32_t *msg_type);
43 struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
44                                            struct loadparm_context *lp_ctx,
45                                            struct server_id server_id,
46                                            struct tevent_context *ev);
47 void imessaging_dgm_unref_all(void);
48 NTSTATUS imessaging_reinit_all(void);
49 int imessaging_cleanup(struct imessaging_context *msg);
50 struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
51                                            struct loadparm_context *lp_ctx,
52                                          struct tevent_context *ev);
53 NTSTATUS imessaging_send_ptr(struct imessaging_context *msg, struct server_id server,
54                             uint32_t msg_type, void *ptr);
55 void imessaging_deregister(struct imessaging_context *msg, uint32_t msg_type, void *private_data);
56 struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx);
57
58 #endif