s3:printing: Allow to run samba-bgqd as a standalone systemd service
[Samba.git] / source4 / lib / messaging / irpc.h
blob21a45f7a6c7a3f3e8a9ba1d609f86fd1ab1bbd2f
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 "libcli/util/werror.h"
27 #include "librpc/gen_ndr/irpc.h"
30 an incoming irpc message
32 struct irpc_message {
33 struct server_id from;
34 void *private_data;
35 struct irpc_header header;
36 struct ndr_pull *ndr;
37 bool defer_reply;
38 bool no_reply;
39 struct imessaging_context *msg_ctx;
40 struct irpc_list *irpc;
41 void *data;
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 imessaging_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 imessaging_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 imessaging_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 imessaging_context *msg_ctx, const char *name);
77 NTSTATUS irpc_servers_byname(struct imessaging_context *msg_ctx,
78 TALLOC_CTX *mem_ctx, const char *name,
79 unsigned *num_servers,
80 struct server_id **servers);
81 struct irpc_name_records *irpc_all_servers(struct imessaging_context *msg_ctx,
82 TALLOC_CTX *mem_ctx);
83 void irpc_remove_name(struct imessaging_context *msg_ctx, const char *name);
84 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);
86 #endif