1 /* 2 Unix SMB/CIFS implementation. 3 4 Samba internal rpc code - header 5 6 Copyright (C) Andrew Tridgell 2005 7 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. 12 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. 17 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/>. 20 */ 21 22 #ifndef IRPC_H 23 #define IRPC_H 24 25 #include "lib/messaging/messaging.h" 26 #include "librpc/gen_ndr/irpc.h" 27 28 /* 29 an incoming irpc message 30 */ 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 imessaging_context *msg_ctx; 39 struct irpc_list *irpc; 40 void *data; 41 }; 42 43 /* don't allow calls to take too long */ 44 #define IRPC_CALL_TIMEOUT 10 45 /* wait for the calls as long as it takes */ 46 #define IRPC_CALL_TIMEOUT_INF 0 47 48 49 /* the server function type */ 50 typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r); 51 52 /* register a server function with the irpc messaging system */ 53 #define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private_data) \ 54 irpc_register(msg_ctx, &ndr_table_ ## pipename, \ 55 NDR_ ## funcname, \ 56 (irpc_function_t)function, private_data) 57 58 struct ndr_interface_table; 59 60 NTSTATUS irpc_register(struct imessaging_context *msg_ctx, 61 const struct ndr_interface_table *table, 62 int call, irpc_function_t fn, void *private_data); 63 64 struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx, 65 struct imessaging_context *msg_ctx, 66 struct server_id server_id, 67 const struct ndr_interface_table *table); 68 struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx, 69 struct imessaging_context *msg_ctx, 70 const char *dest_task, 71 const struct ndr_interface_table *table); 72 void irpc_binding_handle_add_security_token(struct dcerpc_binding_handle *h, 73 struct security_token *token); 74 75 NTSTATUS irpc_add_name(struct imessaging_context *msg_ctx, const char *name); 76 NTSTATUS irpc_servers_byname(struct imessaging_context *msg_ctx, 77 TALLOC_CTX *mem_ctx, const char *name, 78 unsigned *num_servers, 79 struct server_id **servers); 80 struct irpc_name_records *irpc_all_servers(struct imessaging_context *msg_ctx, 81 TALLOC_CTX *mem_ctx); 82 void irpc_remove_name(struct imessaging_context *msg_ctx, const char *name); 83 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status); 84 85 #endif 86 87