s4:libcli/smb2: make sure only one idle event runs at a time
[kai/samba.git] / source4 / libcli / smb2 / smb2.h
index ba626fbe06eecb3771028a92edd2965b3c6ee6e6..6d66e7a7e405380f093339c6d682b144ea367100 100644 (file)
 struct smb2_handle;
 struct smb2_lease_break;
 
-/*
-  information returned from the negotiate process
-*/
-struct smb2_negotiate {
-       DATA_BLOB secblob;
-       NTTIME system_time;
-       NTTIME server_start_time;
-       uint16_t security_mode;
-       uint16_t dialect_revision;
-};
-
 struct smb2_request_buffer {
        /* the raw SMB2 buffer, including the 4 byte length header */
        uint8_t *buffer;
@@ -70,40 +59,23 @@ struct smb2_request_buffer {
 
 /* this is the context for the smb2 transport layer */
 struct smb2_transport {
-       /* socket level info */
-       struct smbcli_socket *socket;
-
-       struct smb2_negotiate negotiate;
-
-       /* next seqnum to allocate */
-       uint64_t seqnum;
+       struct tevent_context *ev; /* TODO: remove this !!! */
+       struct smbXcli_conn *conn;
 
        /* the details for coumpounded requests */
        struct {
-               uint32_t missing;
                bool related;
-               struct smb2_request_buffer buffer;
+               struct tevent_req **reqs;
        } compound;
 
-       struct {
-               uint16_t charge;
-               uint16_t ask_num;
-       } credits;
-
-       /* a list of requests that are pending for receive on this
-          connection */
-       struct smb2_request *pending_recv;
-
-       /* context of the stream -> packet parser */
-       struct packet_context *packet;
-
        /* an idle function - if this is defined then it will be
           called once every period microseconds while we are waiting
           for a packet */
        struct {
                void (*func)(struct smb2_transport *, void *);
                void *private_data;
-               uint_t period;
+               unsigned int period;
+               struct tevent_timer *te;
        } idle;
 
        struct {
@@ -123,10 +95,9 @@ struct smb2_transport {
                /* private data passed to the oplock handler */
                void *private_data;
        } lease;
+       struct tevent_req *break_subreq;
 
        struct smbcli_options options;
-
-       bool signing_required;
 };
 
 
@@ -144,10 +115,9 @@ struct smb2_tree {
 struct smb2_session {
        struct smb2_transport *transport;
        struct gensec_security *gensec;
-       uint64_t uid;
        uint32_t pid;
        DATA_BLOB session_key;
-       bool signing_active;
+       struct smbXcli_session *smbXcli;
 };
 
 
@@ -162,30 +132,28 @@ enum smb2_request_state {SMB2_REQUEST_INIT, /* we are creating the request */
 
 /* the context for a single SMB2 request */
 struct smb2_request {
-       /* allow a request to be part of a list of requests */
-       struct smb2_request *next, *prev;
-
        /* each request is in one of 3 possible states */
        enum smb2_request_state state;
-       
+
+       struct tevent_req *subreq;
+
        struct smb2_transport *transport;
        struct smb2_session   *session;
        struct smb2_tree      *tree;
 
-       uint64_t seqnum;
-
        struct {
-               bool do_cancel;
                bool can_cancel;
-               uint32_t pending_id;
        } cancel;
 
        /* the NT status for this request. Set by packet receive code
           or code detecting error. */
        NTSTATUS status;
-       
+
        struct smb2_request_buffer in;
        struct smb2_request_buffer out;
+       struct iovec *recv_iov;
+
+       uint16_t credit_charge;
 
        /* information on what to do with a reply when it is received
           asyncronously. If this is not setup when a reply is received then