2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2014
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_
21 #define _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_
23 struct smb2_negotiate_context
{
28 struct smb2_negotiate_contexts
{
29 uint16_t num_contexts
;
30 struct smb2_negotiate_context
*contexts
;
34 parse a set of SMB2 negotiate contexts
36 NTSTATUS
smb2_negotiate_context_parse(TALLOC_CTX
*mem_ctx
, const DATA_BLOB buffer
,
37 uint16_t expected_count
,
38 struct smb2_negotiate_contexts
*contexts
);
41 negotiate a buffer of a set of negotiate contexts
43 NTSTATUS
smb2_negotiate_context_push(TALLOC_CTX
*mem_ctx
, DATA_BLOB
*buffer
,
44 const struct smb2_negotiate_contexts contexts
);
46 NTSTATUS
smb2_negotiate_context_add(TALLOC_CTX
*mem_ctx
,
47 struct smb2_negotiate_contexts
*c
,
53 * return the first context with the given tag
55 struct smb2_negotiate_context
*smb2_negotiate_context_find(const struct smb2_negotiate_contexts
*b
,
57 #define WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK 31
59 struct smb3_signing_capabilities
{
60 #define SMB3_SIGNING_CAPABILITIES_MAX_ALGOS 3
62 uint16_t algos
[SMB3_SIGNING_CAPABILITIES_MAX_ALGOS
];
65 struct smb3_encryption_capabilities
{
66 #define SMB3_ENCRYTION_CAPABILITIES_MAX_ALGOS 4
68 uint16_t algos
[SMB3_ENCRYTION_CAPABILITIES_MAX_ALGOS
];
71 struct smb311_capabilities
{
72 struct smb3_signing_capabilities signing
;
73 struct smb3_encryption_capabilities encryption
;
76 const char *smb3_signing_algorithm_name(uint16_t algo
);
77 const char *smb3_encryption_algorithm_name(uint16_t algo
);
79 struct smb311_capabilities
smb311_capabilities_parse(const char *role
,
80 const char * const *signing_algos
,
81 const char * const *encryption_algos
);
83 NTSTATUS
smb311_capabilities_check(const struct smb311_capabilities
*c
,
84 const char *debug_prefix
,
86 NTSTATUS error_status
,
88 enum protocol_types protocol
,
90 uint16_t cipher_algo
);
92 #endif /* _LIBCLI_SMB_SMB2_NEGOTIATE_BLOB_H_ */