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 {
}
static void cli_smb_received(struct tevent_req *subreq);
+static NTSTATUS cli_state_dispatch_smb1(struct cli_state *cli,
+ TALLOC_CTX *frame,
+ uint8_t *inbuf);
static bool cli_state_receive_next(struct cli_state *cli)
{
req = cli->conn.pending[0];
state = tevent_req_data(req, struct cli_smb_state);
+ cli->conn.dispatch_incoming = cli_state_dispatch_smb1;
+
/*
* We're the first ones, add the read_smb request that waits for the
* answer from the server
}
}
-static NTSTATUS cli_state_dispatch_smb1(struct cli_state *cli,
- TALLOC_CTX *frame,
- uint8_t *inbuf);
-
static void cli_smb_received(struct tevent_req *subreq)
{
struct cli_state *cli = tevent_req_callback_data(
return;
}
- status = cli_state_dispatch_smb1(cli, frame, inbuf);
+ status = cli->conn.dispatch_incoming(cli, frame, inbuf);
TALLOC_FREE(frame);
if (NT_STATUS_IS_OK(status)) {
/*