summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-30 03:10:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:24 -0500
commite7f36ff1a5ec909573ef398d215608e7c9aa71fe (patch)
tree8874e1dbc422a02631e48c772dc8749f255819aa /source4/librpc/rpc/dcerpc.h
parent18bbab726884725ccf2f3264223866194855f320 (diff)
downloadsamba-e7f36ff1a5ec909573ef398d215608e7c9aa71fe.tar.gz
samba-e7f36ff1a5ec909573ef398d215608e7c9aa71fe.tar.bz2
samba-e7f36ff1a5ec909573ef398d215608e7c9aa71fe.zip
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)
Diffstat (limited to 'source4/librpc/rpc/dcerpc.h')
-rw-r--r--source4/librpc/rpc/dcerpc.h55
1 files changed, 50 insertions, 5 deletions
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 2c36241020..2dce5df92a 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -32,7 +32,6 @@ struct dcerpc_security {
};
struct dcerpc_pipe {
- TALLOC_CTX *mem_ctx;
int reference_count;
uint32_t call_id;
uint32_t srv_max_xmit_frag;
@@ -47,16 +46,33 @@ struct dcerpc_pipe {
struct dcerpc_transport {
enum dcerpc_transport_t transport;
void *private;
- NTSTATUS (*full_request)(struct dcerpc_pipe *,
- TALLOC_CTX *, DATA_BLOB *, DATA_BLOB *);
- NTSTATUS (*secondary_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
- NTSTATUS (*initial_request)(struct dcerpc_pipe *, TALLOC_CTX *, DATA_BLOB *);
+
NTSTATUS (*shutdown_pipe)(struct dcerpc_pipe *);
+
const char *(*peer_name)(struct dcerpc_pipe *);
+
+ /* send a request to the server */
+ NTSTATUS (*send_request)(struct dcerpc_pipe *, DATA_BLOB *);
+
+ /* send a read request to the server */
+ NTSTATUS (*send_read)(struct dcerpc_pipe *);
+
+ /* get an event context for the connection */
+ struct event_context *(*event_context)(struct dcerpc_pipe *);
+
+ /* a callback to the dcerpc code when a full fragment
+ has been received */
+ void (*recv_data)(struct dcerpc_pipe *, DATA_BLOB *, NTSTATUS status);
} transport;
/* the last fault code from a DCERPC fault */
uint32_t last_fault_code;
+
+ /* pending requests */
+ struct rpc_request *pending;
+
+ /* private pointer for pending full requests */
+ void *full_request_private;
};
/* dcerpc pipe flags */
@@ -119,3 +135,32 @@ struct dcerpc_binding {
const char **options;
uint32_t flags;
};
+
+
+enum rpc_request_state {
+ RPC_REQUEST_PENDING,
+ RPC_REQUEST_DONE
+};
+
+/*
+ handle for an async dcerpc request
+*/
+struct rpc_request {
+ struct rpc_request *next, *prev;
+ struct dcerpc_pipe *p;
+ NTSTATUS status;
+ uint32_t call_id;
+ enum rpc_request_state state;
+ DATA_BLOB payload;
+ uint_t flags;
+ uint32_t fault_code;
+
+ /* use by the ndr level async recv call */
+ struct rpc_request_ndr {
+ NTSTATUS (*ndr_push)(struct ndr_push *, int, void *);
+ NTSTATUS (*ndr_pull)(struct ndr_pull *, int, void *);
+ void *struct_ptr;
+ size_t struct_size;
+ TALLOC_CTX *mem_ctx;
+ } ndr;
+};