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 *);
79 typedef void (*msg_callback_t)(struct messaging_context *msg, void *private,
80 uint32_t msg_type, uint32_t server_id, DATA_BLOB *data);
82 struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id,
83 struct event_context *ev);
84 NTSTATUS messaging_send(struct messaging_context *msg, uint32_t server,
85 uint32_t msg_type, DATA_BLOB *data);
86 NTSTATUS messaging_register(struct messaging_context *msg, void *private,
89 NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private,
90 msg_callback_t fn, uint32_t *msg_type);
91 struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, uint32_t server_id,
92 struct event_context *ev);
93 struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
94 struct event_context *ev);
95 NTSTATUS messaging_send_ptr(struct messaging_context *msg, uint32_t server,
96 uint32_t msg_type, void *ptr);
97 void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private);
102 NTSTATUS irpc_register(struct messaging_context *msg_ctx,
103 const struct dcerpc_interface_table *table,
104 int call, irpc_function_t fn, void *private);
105 struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx,
107 const struct dcerpc_interface_table *table,
108 int callnum, void *r, TALLOC_CTX *ctx);
109 NTSTATUS irpc_call_recv(struct irpc_request *irpc);
110 NTSTATUS irpc_call(struct messaging_context *msg_ctx,
112 const struct dcerpc_interface_table *table,
113 int callnum, void *r, TALLOC_CTX *ctx);
115 NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
116 uint32_t *irpc_servers_byname(struct messaging_context *msg_ctx, const char *name);
117 void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
118 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);