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 2 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, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "librpc/gen_ndr/irpc.h"
26 an incoming irpc message
31 struct irpc_header header;
34 struct messaging_context *msg_ctx;
35 struct irpc_list *irpc;
37 struct event_context *ev;
40 /* don't allow calls to take too long */
41 #define IRPC_CALL_TIMEOUT 10
44 /* the server function type */
45 typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r);
47 /* register a server function with the irpc messaging system */
48 #define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private) \
49 irpc_register(msg_ctx, &dcerpc_table_ ## pipename, \
50 DCERPC_ ## funcname, \
51 (irpc_function_t)function, private)
53 /* make a irpc call */
54 #define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
55 irpc_call(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr, ctx)
57 #define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
58 irpc_call_send(msg_ctx, server_id, &dcerpc_table_ ## pipename, DCERPC_ ## funcname, ptr, ctx)
65 struct messaging_context *msg_ctx;
66 const struct dcerpc_interface_table *table;
74 void (*fn)(struct irpc_request *);
80 struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id,
81 struct event_context *ev);
82 NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server,
83 uint32_t msg_type, DATA_BLOB *data);
84 void messaging_register(struct messaging_context *msg, void *private,
86 void (*fn)(struct messaging_context *, void *, uint32_t, uint32_t, DATA_BLOB *));
87 struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id,
88 struct event_context *ev);
89 struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
90 struct event_context *ev);
91 NTSTATUS messaging_send_ptr(struct messaging_context *msg, uint32_t server,
92 uint32_t msg_type, void *ptr);
93 void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private);
98 NTSTATUS irpc_register(struct messaging_context *msg_ctx,
99 const struct dcerpc_interface_table *table,
100 int call, irpc_function_t fn, void *private);
101 struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx,
103 const struct dcerpc_interface_table *table,
104 int callnum, void *r, TALLOC_CTX *ctx);
105 NTSTATUS irpc_call_recv(struct irpc_request *irpc);
106 NTSTATUS irpc_call(struct messaging_context *msg_ctx,
108 const struct dcerpc_interface_table *table,
109 int callnum, void *r, TALLOC_CTX *ctx);
111 NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
112 uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name);
113 void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
114 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);