s4-drepl: We won't need a working schema for empty replicas sent.
[Samba.git] / source4 / lib / messaging / irpc.h
blobbdb1b8fedbff11f575b70a5a43b870827c513919
1 /*
2 Unix SMB/CIFS implementation.
4 Samba internal rpc code - header
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef IRPC_H
23 #define IRPC_H
25 #include "lib/messaging/messaging.h"
26 #include "librpc/gen_ndr/irpc.h"
29 an incoming irpc message
31 struct irpc_message {
32 struct server_id from;
33 void *private_data;
34 struct irpc_header header;
35 struct ndr_pull *ndr;
36 bool defer_reply;
37 bool no_reply;
38 struct messaging_context *msg_ctx;
39 struct irpc_list *irpc;
40 void *data;
41 struct tevent_context *ev;
44 /* don't allow calls to take too long */
45 #define IRPC_CALL_TIMEOUT 10
46 /* wait for the calls as long as it takes */
47 #define IRPC_CALL_TIMEOUT_INF 0
50 /* the server function type */
51 typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r);
53 /* register a server function with the irpc messaging system */
54 #define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private_data) \
55 irpc_register(msg_ctx, &ndr_table_ ## pipename, \
56 NDR_ ## funcname, \
57 (irpc_function_t)function, private_data)
59 struct ndr_interface_table;
61 NTSTATUS irpc_register(struct messaging_context *msg_ctx,
62 const struct ndr_interface_table *table,
63 int call, irpc_function_t fn, void *private_data);
65 struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
66 struct messaging_context *msg_ctx,
67 struct server_id server_id,
68 const struct ndr_interface_table *table);
69 struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
70 struct messaging_context *msg_ctx,
71 const char *dest_task,
72 const struct ndr_interface_table *table);
73 void irpc_binding_handle_add_security_token(struct dcerpc_binding_handle *h,
74 struct security_token *token);
76 NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
77 struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name);
78 void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
79 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);
81 #endif