From fae215266b6711b24f4893653b146751885e4e5f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 11 Jan 2005 16:53:02 +0000 Subject: r4690: - add support for async rpc server replies the backend should check for (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_MAY_ASYNC) then it's allowed to reply async then the backend should mark that call as async with dce_call->state_flags |= DCESRV_CALL_STATE_FLAG_ASYNC; later it has to manualy set r->out.result and then send the reply by calling status = dcesrv_reply(p->dce_call); NOTE: that ncacn_np doesn't support async replies yet - implement an async version of echo_TestSleep - reenable the echo_TestSleep torture test (this need to be more strict when we have support for async ncacn_np) metze (This used to be commit f0a0dbeb25b034b1333078ca085999359f5f6209) --- source4/rpc_server/dcerpc_server.h | 41 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'source4/rpc_server/dcerpc_server.h') diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 49fbd4477b..2738cee040 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -3,8 +3,8 @@ server side dcerpc defines - Copyright (C) Andrew Tridgell 2003 - Copyright (C) Stefan (metze) Metzmacher 2004 + Copyright (C) Andrew Tridgell 2003-2005 + Copyright (C) Stefan (metze) Metzmacher 2004-2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,6 +54,10 @@ struct dcesrv_interface { */ NTSTATUS (*dispatch)(struct dcesrv_call_state *, TALLOC_CTX *, void *); + /* the reply function for the chosen interface. + */ + NTSTATUS (*reply)(struct dcesrv_call_state *, TALLOC_CTX *, void *); + /* the ndr_push function for the chosen interface. */ NTSTATUS (*ndr_push)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_push *,void *); @@ -69,6 +73,33 @@ struct dcesrv_call_state { struct dcesrv_connection_context *context; struct dcerpc_packet pkt; + /* the backend can mark the call + * with DCESRV_CALL_STATE_FLAG_ASYNC + * that will cause the frontend to not touch r->out + * and skip the reply + * + * this is only allowed to the backend when DCESRV_CALL_STATE_FLAG_MAY_ASYNC + * is alerady set by the frontend + * + * the backend then needs to call dcesrv_reply() when it's + * ready to send the reply + */ +#define DCESRV_CALL_STATE_FLAG_ASYNC (1<<0) +#define DCESRV_CALL_STATE_FLAG_MAY_ASYNC (1<<1) + uint32_t state_flags; + + /* the time the request arrived in the server */ + struct timeval time; + + /* the backend can use this event context for async replies */ + struct event_context *event_ctx; + + /* this is the pointer to the allocated function struct */ + void *r; + + /* that's the ndr push context used in dcesrv_request */ + struct ndr_pull *ndr_pull; + DATA_BLOB input; struct dcesrv_call_reply { @@ -132,6 +163,9 @@ struct dcesrv_connection { /* the state of the current calls */ struct dcesrv_call_state *call_list; + /* the state of the async pending calls */ + struct dcesrv_call_state *pending_call_list; + /* the maximum size the client wants to receive */ uint32_t cli_max_recv_frag; @@ -187,6 +221,9 @@ struct dcesrv_context { struct dcesrv_interface iface; } *interface_list; } *endpoint_list; + + /* this is the default state_flags for dcesrv_call_state structs */ + uint32_t state_flags; }; /* this structure is used by modules to determine the size of some critical types */ -- cgit