1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/*
Unix SMB/CIFS implementation.
Infrastructure for async SMB client requests
Copyright (C) Volker Lendecke 2008
Copyright (C) Stefan Metzmacher 2011
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SMBXCLI_BASE_H_
#define _SMBXCLI_BASE_H_
struct smbXcli_conn;
struct smb_trans_enc_state;
struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
int fd,
const char *remote_name,
enum smb_signing_setting signing_state,
uint32_t smb1_capabilities);
bool smbXcli_conn_is_connected(struct smbXcli_conn *conn);
void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status);
bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn);
enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn);
bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn);
void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options);
const struct sockaddr_storage *smbXcli_conn_local_sockaddr(struct smbXcli_conn *conn);
const struct sockaddr_storage *smbXcli_conn_remote_sockaddr(struct smbXcli_conn *conn);
const char *smbXcli_conn_remote_name(struct smbXcli_conn *conn);
void smbXcli_req_unset_pending(struct tevent_req *req);
bool smbXcli_req_set_pending(struct tevent_req *req);
bool smb1cli_conn_activate_signing(struct smbXcli_conn *conn,
const DATA_BLOB user_session_key,
const DATA_BLOB response);
bool smb1cli_conn_check_signing(struct smbXcli_conn *conn,
const uint8_t *buf, uint32_t seqnum);
bool smb1cli_conn_signing_is_active(struct smbXcli_conn *conn);
void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
struct smb_trans_enc_state *es);
bool smb1cli_conn_encryption_on(struct smbXcli_conn *conn);
bool smb1cli_is_andx_req(uint8_t cmd);
size_t smb1cli_req_wct_ofs(struct tevent_req **reqs, int num_reqs);
uint16_t smb1cli_req_mid(struct tevent_req *req);
void smb1cli_req_set_mid(struct tevent_req *req, uint16_t mid);
uint32_t smb1cli_req_seqnum(struct tevent_req *req);
void smb1cli_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
uint8_t smb_command,
uint8_t additional_flags,
uint8_t clear_flags,
uint16_t additional_flags2,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
uint16_t tid,
uint16_t uid,
uint8_t wct, uint16_t *vwv,
int iov_count,
struct iovec *bytes_iov);
NTSTATUS smb1cli_req_chain_submit(struct tevent_req **reqs, int num_reqs);
struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
uint8_t smb_command,
uint8_t additional_flags,
uint8_t clear_flags,
uint16_t additional_flags2,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
uint16_t tid,
uint16_t uid,
uint8_t wct, uint16_t *vwv,
uint32_t num_bytes,
const uint8_t *bytes);
NTSTATUS smb1cli_req_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx, uint8_t **pinbuf,
uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
uint32_t *pnum_bytes, uint8_t **pbytes);
struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
uint16_t cmd,
uint32_t additional_flags,
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
uint32_t tid,
uint64_t uid,
const uint8_t *fixed,
uint16_t fixed_len,
const uint8_t *dyn,
uint32_t dyn_len);
NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
int num_reqs);
struct smb2cli_req_expected_response {
NTSTATUS status;
uint16_t body_size;
};
struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct smbXcli_conn *conn,
uint16_t cmd,
uint32_t additional_flags,
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
uint32_t tid,
uint64_t uid,
const uint8_t *fixed,
uint16_t fixed_len,
const uint8_t *dyn,
uint32_t dyn_len);
NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct iovec **piov,
const struct smb2cli_req_expected_response *expected,
size_t num_expected);
#endif /* _SMBXCLI_BASE_H_ */
|