summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-08-13 15:49:19 +0200
committerStefan Metzmacher <metze@samba.org>2013-08-15 09:07:06 +0200
commit7efdc323d1a1abdae70bcafefe07b3cffcdb2521 (patch)
tree26b496170fbdb17405b888b9e17e2746c4a3bc70
parent111f529a2a5832b822445bb4f63b142d8ccb2cb7 (diff)
downloadsamba-7efdc323d1a1abdae70bcafefe07b3cffcdb2521.tar.gz
samba-7efdc323d1a1abdae70bcafefe07b3cffcdb2521.tar.bz2
samba-7efdc323d1a1abdae70bcafefe07b3cffcdb2521.zip
libcli/smb: add smb2cli_conn_req_possible()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--libcli/smb/smbXcli_base.c22
-rw-r--r--libcli/smb/smbXcli_base.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 9e8725c43a..1176bb8e87 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -2453,6 +2453,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 6b3156f42a..a7cfcc3260 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);