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/>.
25 #include "lib/messaging/messaging.h"
26 #include "librpc/gen_ndr/irpc.h"
27 #include "librpc/gen_ndr/server_id.h"
30 an incoming irpc message
33 struct server_id from;
35 struct irpc_header header;
38 struct messaging_context *msg_ctx;
39 struct irpc_list *irpc;
41 struct tevent_context *ev;
44 /* don't allow calls to take too long */
45 #define IRPC_CALL_TIMEOUT 10
48 /* the server function type */
49 typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r);
51 /* register a server function with the irpc messaging system */
52 #define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private_data) \
53 irpc_register(msg_ctx, &ndr_table_ ## pipename, \
55 (irpc_function_t)function, private_data)
57 /* make a irpc call */
58 #define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
59 irpc_call(msg_ctx, server_id, &ndr_table_ ## pipename, NDR_ ## funcname, ptr, ctx)
61 #define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
62 irpc_call_send(msg_ctx, server_id, &ndr_table_ ## pipename, NDR_ ## funcname, ptr, ctx)
69 struct messaging_context *msg_ctx;
70 const struct ndr_interface_table *table;
79 void (*fn)(struct irpc_request *);
83 void (*handler)(struct irpc_request *irpc, struct irpc_message *m);
88 NTSTATUS irpc_register(struct messaging_context *msg_ctx,
89 const struct ndr_interface_table *table,
90 int call, irpc_function_t fn, void *private_data);
91 struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx,
92 struct server_id server_id,
93 const struct ndr_interface_table *table,
94 int callnum, void *r, TALLOC_CTX *ctx);
95 NTSTATUS irpc_call_recv(struct irpc_request *irpc);
96 NTSTATUS irpc_call(struct messaging_context *msg_ctx,
97 struct server_id server_id,
98 const struct ndr_interface_table *table,
99 int callnum, void *r, TALLOC_CTX *ctx);
101 struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
102 struct messaging_context *msg_ctx,
103 struct server_id server_id,
104 const struct ndr_interface_table *table);
106 NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
107 struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name);
108 void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
109 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);