From 0093e1b62cf02d1c3bdc3f18c8c4cc3d0abbf776 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 6 Jun 2005 05:47:14 +0000 Subject: r7320: added support for a private pointer in irpc registered handlers (This used to be commit eec521dffd4ca9efa7f6e31c50cf1ff365aae209) --- source4/lib/messaging/irpc.h | 7 ++++--- source4/lib/messaging/messaging.c | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index 99a2d60f35..cba17a2c97 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -25,6 +25,7 @@ */ struct irpc_message { uint32_t from; + void *private; }; /* don't allow calls to take too long */ @@ -35,10 +36,10 @@ struct irpc_message { typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r); /* register a server function with the irpc messaging system */ -#define IRPC_REGISTER(msg_ctx, pipename, funcname, function) \ +#define IRPC_REGISTER(msg_ctx, pipename, funcname, function, private) \ irpc_register(msg_ctx, &dcerpc_table_ ## pipename, \ DCERPC_ ## funcname, \ - (irpc_function_t)function) + (irpc_function_t)function, private) /* make a irpc call */ #define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr) \ @@ -84,7 +85,7 @@ void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void NTSTATUS irpc_register(struct messaging_context *msg_ctx, const struct dcerpc_interface_table *table, - int call, irpc_function_t fn); + int call, irpc_function_t fn, void *private); struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, uint32_t server_id, const struct dcerpc_interface_table *table, diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 823058b0cf..70eb2e7680 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -422,6 +422,7 @@ struct irpc_list { const struct dcerpc_interface_table *table; int callnum; irpc_function_t fn; + void *private; }; @@ -430,7 +431,7 @@ struct irpc_list { */ NTSTATUS irpc_register(struct messaging_context *msg_ctx, const struct dcerpc_interface_table *table, - int callnum, irpc_function_t fn) + int callnum, irpc_function_t fn, void *private) { struct irpc_list *irpc; @@ -449,6 +450,7 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, irpc->table = table; irpc->callnum = callnum; irpc->fn = fn; + irpc->private = private; GUID_from_string(irpc->table->uuid, &irpc->uuid); return NT_STATUS_OK; @@ -514,7 +516,8 @@ static void irpc_handler_request(struct messaging_context *msg_ctx, if (!NT_STATUS_IS_OK(status)) goto failed; /* make the call */ - m.from = src; + m.from = src; + m.private = i->private; header->status = i->fn(&m, r); /* setup the reply */ -- cgit