Add struct rpc_cli_transport
authorVolker Lendecke <vl@samba.org>
Thu, 22 Jan 2009 17:50:37 +0000 (18:50 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 22 Jan 2009 21:59:53 +0000 (22:59 +0100)
source3/include/client.h

index 09fdb8146206cf7916df2cb6bc192e57af497303..c47f058318dd5c9d29e731ee8f4ea27d78214773 100644 (file)
@@ -61,6 +61,56 @@ struct cli_pipe_auth_data {
        } a_u;
 };
 
+/**
+ * rpc_cli_transport defines a transport mechanism to ship rpc requests
+ * asynchronously to a server and receive replies
+ */
+
+struct rpc_cli_transport {
+
+       /**
+        * Trigger an async read from the server. May return a short read.
+        */
+       struct async_req *(*read_send)(TALLOC_CTX *mem_ctx,
+                                      struct event_context *ev,
+                                       uint8_t *data, size_t size,
+                                      void *priv);
+       /**
+        * Get the result from the read_send operation.
+        */
+       NTSTATUS (*read_recv)(struct async_req *req, ssize_t *preceived);
+
+       /**
+        * Trigger an async write to the server. May return a short write.
+        */
+       struct async_req *(*write_send)(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       const uint8_t *data, size_t size,
+                                       void *priv);
+       /**
+        * Get the result from the read_send operation.
+        */
+       NTSTATUS (*write_recv)(struct async_req *req, ssize_t *psent);
+
+       /**
+        * This is an optimization for the SMB transport. It models the
+        * TransactNamedPipe API call: Send and receive data in one round
+        * trip. The transport implementation is free to set this to NULL,
+        * cli_pipe.c will fall back to the explicit write/read routines.
+        */
+       struct async_req *(*trans_send)(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       uint8_t *data, size_t data_len,
+                                       uint32_t max_rdata_len,
+                                       void *priv);
+       /**
+        * Get the result from the read_send operation.
+        */
+       NTSTATUS (*trans_recv)(struct async_req *req, TALLOC_CTX *mem_ctx,
+                              uint8_t **prdata, uint32_t *prdata_len);
+       void *priv;
+};
+
 struct rpc_pipe_client {
        struct rpc_pipe_client *prev, *next;