From e7f36ff1a5ec909573ef398d215608e7c9aa71fe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 Aug 2004 03:10:43 +0000 Subject: r2100: rework the dcerpc client side library so that it is async. We now generate a separate *_send() async function for every RPC call, and there is a single dcerpc_ndr_request_recv() call that processes the receive side of any rpc call. The caller can use dcerpc_event_context() to get a pointer to the event context for the pipe so that events can be waited for asynchronously. The only part that remains synchronous is the initial bind calls. These could also be made async if necessary, although I suspect most applications won't need them to be. (This used to be commit f5d004d8eb8c76c03342cace1976b27266cfa1f0) --- source4/build/pidl/client.pm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source4/build/pidl') diff --git a/source4/build/pidl/client.pm b/source4/build/pidl/client.pm index 89d367f037..13939c3372 100644 --- a/source4/build/pidl/client.pm +++ b/source4/build/pidl/client.pm @@ -19,18 +19,29 @@ sub ParseFunction($) $res .= " -NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) +struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) { - NTSTATUS status; - if (p->flags & DCERPC_DEBUG_PRINT_IN) { NDR_PRINT_IN_DEBUG($name, r); } - status = dcerpc_ndr_request(p, DCERPC_$uname, mem_ctx, + return dcerpc_ndr_request_send(p, DCERPC_$uname, mem_ctx, (ndr_push_flags_fn_t) ndr_push_$name, (ndr_pull_flags_fn_t) ndr_pull_$name, r, sizeof(*r)); +} + +"; + + $res .= +" +NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) +{ + struct rpc_request *req = dcerpc_$name\_send(p, mem_ctx, r); + NTSTATUS status; + if (req == NULL) return NT_STATUS_NO_MEMORY; + + status = dcerpc_ndr_request_recv(req); if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) { NDR_PRINT_OUT_DEBUG($name, r); -- cgit