Allow overriding the function that ships the request in the Samba 3
[amitay/samba.git] / source3 / include / client.h
index 3459ae20d0439f2c98058128743de5b0fbb2dca6..86b4bee662854027d31ca9a338347aaf90b09961 100644 (file)
@@ -52,25 +52,38 @@ struct cli_pipe_auth_data {
 
        char *domain;
        char *user_name;
+       DATA_BLOB user_session_key;
 
        union {
                struct schannel_auth_struct *schannel_auth;
                NTLMSSP_STATE *ntlmssp_state;
                struct kerberos_auth_struct *kerberos_auth;
        } a_u;
-       void (*cli_auth_data_free_func)(struct cli_pipe_auth_data *);
 };
 
 struct rpc_pipe_client {
        struct rpc_pipe_client *prev, *next;
 
-       struct cli_state *cli;
+       enum dcerpc_transport_t transport_type;
+
+       union {
+               struct {
+                       struct cli_state *cli;
+                       const char *pipe_name;
+                       uint16 fnum;
+               } np;
+               struct {
+                       int fd;
+               } sock;
+       } trans ;
 
-       const char *pipe_name;
-       uint16 fnum;
+       struct ndr_syntax_id abstract_syntax;
+       struct ndr_syntax_id transfer_syntax;
 
-       const struct ndr_syntax_id *abstract_syntax;
-       const struct ndr_syntax_id *transfer_syntax;
+       NTSTATUS (*dispatch) (struct rpc_pipe_client *cli,
+                       TALLOC_CTX *mem_ctx,
+                       const struct ndr_interface_table *table,
+                       uint32_t opnum, void *r);
 
        char *desthost;
        char *srv_name_slash;
@@ -186,6 +199,7 @@ struct cli_state {
        bool use_kerberos;
        bool fallback_after_kerberos;
        bool use_spnego;
+       bool got_kerberos_mechanism; /* Server supports krb5 in SPNEGO. */
 
        bool use_oplocks; /* should we use oplocks? */
        bool use_level_II_oplocks; /* should we use level II oplocks? */
@@ -196,40 +210,35 @@ struct cli_state {
        bool force_dos_errors;
        bool case_sensitive; /* False by default. */
 
-       struct event_context *event_ctx;
+       /**
+        * fd_event is around while we have async requests outstanding or are
+        * building a chained request.
+        *
+        * (fd_event!=NULL) &&
+        *  ((outstanding_request!=NULL)||(chain_accumulator!=NULL))
+        *
+        * should always be true, as well as the reverse: If both cli_request
+        * pointers are NULL, no fd_event is around.
+        */
        struct fd_event *fd_event;
        char *evt_inbuf;
 
+       /**
+        * A linked list of requests that are waiting for a reply
+        */
        struct cli_request *outstanding_requests;
-};
-
-struct cli_request {
-       struct cli_request *prev, *next;
-       struct async_req *async;
 
-       struct cli_state *cli;
-
-       struct smb_trans_enc_state *enc_state;
-
-       uint16_t mid;
-
-       char *outbuf;
-       size_t sent;
-       char *inbuf;
-
-       union {
-               struct {
-                       off_t ofs;
-                       size_t size;
-                       ssize_t received;
-                       uint8_t *rcvbuf;
-               } read;
-       } data;
+       /**
+        * The place to build up the list of chained requests. In CIFS, a
+        * single cli_request corresponds to a MID and can serve more than one
+        * chained async_req.
+        */
+       struct cli_request *chain_accumulator;
 };
 
 typedef struct file_info {
        struct cli_state *cli;
-       SMB_BIG_UINT size;
+       uint64_t size;
        uint16 mode;
        uid_t uid;
        gid_t gid;