diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-08-13 15:49:19 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2013-08-30 11:53:23 +0200 |
commit | c66525ceb3ca896dabd5a0edfae68626143b3e1d (patch) | |
tree | 7f15b1376028687a3e62484d0bc1b42765473177 /libcli | |
parent | 12b040b44f58c517253b78f30ca10630d90dc91d (diff) | |
download | samba-c66525ceb3ca896dabd5a0edfae68626143b3e1d.tar.gz |
libcli/smb: add smb2cli_conn_req_possible()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7efdc323d1a1abdae70bcafefe07b3cffcdb2521)
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 22 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 028f1522d41..b502f4f7054 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -2452,6 +2452,28 @@ bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn) || (talloc_array_length(conn->pending) != 0)); } +bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len) +{ + uint16_t credits = 1; + + if (conn->smb2.cur_credits == 0) { + if (max_dyn_len != NULL) { + *max_dyn_len = 0; + } + return false; + } + + if (conn->smb2.server.capabilities & SMB2_CAP_LARGE_MTU) { + credits = conn->smb2.cur_credits; + } + + if (max_dyn_len != NULL) { + *max_dyn_len = credits * 65536; + } + + return true; +} + uint32_t smb2cli_conn_server_capabilities(struct smbXcli_conn *conn) { return conn->smb2.server.capabilities; diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 6b3156f42a0..a7cfcc32607 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -199,6 +199,7 @@ NTSTATUS smb1cli_echo_recv(struct tevent_req *req); NTSTATUS smb1cli_echo(struct smbXcli_conn *conn, uint32_t timeout_msec, uint16_t num_echos, DATA_BLOB data); +bool smb2cli_conn_req_possible(struct smbXcli_conn *conn, uint32_t *max_dyn_len); uint32_t smb2cli_conn_server_capabilities(struct smbXcli_conn *conn); uint16_t smb2cli_conn_server_security_mode(struct smbXcli_conn *conn); uint32_t smb2cli_conn_max_trans_size(struct smbXcli_conn *conn); |