s3:libsmb: abstract the incoming dispatch function via a function pointer
[idra/samba.git] / source3 / include / client.h
index dfd457b8913acf3527f28dc1e1b51ce4961108b7..79ce709069c5c5bbe8cfbe3891c4a5fd94172129 100644 (file)
@@ -51,18 +51,11 @@ struct cli_state {
         * A list of subsidiary connections for DFS.
         */
         struct cli_state *prev, *next;
-       int fd;
-       uint16 cnum;
-       uint16 pid;
-       uint16 mid;
-       uint16 vuid;
-       int protocol;
+       enum protocol_types protocol;
        int sec_mode;
        int rap_error;
        NTSTATUS raw_status; /* maybe via NT_STATUS_DOS() */
 
-       char *desthost;
-
        /* The credentials used to open the cli_state connection. */
        char *domain;
        char *user_name;
@@ -79,10 +72,6 @@ struct cli_state {
 
        char *share;
        char *dev;
-       struct nmb_name called;
-       struct sockaddr_storage src_ss;
-       struct nmb_name calling;
-       struct sockaddr_storage dest_ss;
 
        DATA_BLOB secblob; /* cryptkey or negTokenInit */
        uint32 sesskey;
@@ -130,8 +119,35 @@ struct cli_state {
        /* Where (if anywhere) this is mounted under DFS. */
        char *dfs_mountpoint;
 
-       struct tevent_queue *outgoing;
-       struct tevent_req **pending;
+       struct {
+               int fd;
+               struct sockaddr_storage local_ss;
+               struct sockaddr_storage remote_ss;
+               const char *remote_name;
+               const char *remote_realm;
+               struct tevent_req *read_smb_req;
+               struct tevent_queue *outgoing;
+               struct tevent_req **pending;
+               /*
+                * The incoming dispatch function should return:
+                * - NT_STATUS_RETRY, if more incoming PDUs are expected.
+                * - NT_STATUS_OK, if no more processing is desired, e.g.
+                *                 the dispatch function called
+                *                 tevent_req_done().
+                * - All other return values disconnect the connection.
+                */
+               NTSTATUS (*dispatch_incoming)(struct cli_state *cli,
+                                             TALLOC_CTX *frame,
+                                             uint8_t *inbuf);
+       } conn;
+
+       struct {
+               uint16_t mid;
+               uint16_t pid;
+               uint16_t vc_num;
+               uint16_t tid;
+               uint16_t uid;
+       } smb1;
 
        struct {
                uint64_t mid;