smbXcli: rework smbXcli_base.c to use smbXcli_conn/smbXcli_req
[Samba/gebeck_regimport.git] / libcli / smb / smbXcli_base.h
blob3f39be8c2dc58badc43db2f860b45f33cb8836e6
1 /*
2 Unix SMB/CIFS implementation.
3 Infrastructure for async SMB client requests
4 Copyright (C) Volker Lendecke 2008
5 Copyright (C) Stefan Metzmacher 2011
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _SMBXCLI_BASE_H_
22 #define _SMBXCLI_BASE_H_
24 struct smbXcli_conn;
25 struct smb_trans_enc_state;
27 struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
28 int fd,
29 const char *remote_name,
30 enum smb_signing_setting signing_state,
31 uint32_t smb1_capabilities);
33 bool smbXcli_conn_is_connected(struct smbXcli_conn *conn);
34 void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status);
36 bool smbXcli_conn_has_async_calls(struct smbXcli_conn *conn);
38 enum protocol_types smbXcli_conn_protocol(struct smbXcli_conn *conn);
39 bool smbXcli_conn_use_unicode(struct smbXcli_conn *conn);
41 void smbXcli_conn_set_sockopt(struct smbXcli_conn *conn, const char *options);
42 const struct sockaddr_storage *smbXcli_conn_local_sockaddr(struct smbXcli_conn *conn);
43 const struct sockaddr_storage *smbXcli_conn_remote_sockaddr(struct smbXcli_conn *conn);
44 const char *smbXcli_conn_remote_name(struct smbXcli_conn *conn);
46 void smbXcli_req_unset_pending(struct tevent_req *req);
47 bool smbXcli_req_set_pending(struct tevent_req *req);
49 bool smb1cli_conn_activate_signing(struct smbXcli_conn *conn,
50 const DATA_BLOB user_session_key,
51 const DATA_BLOB response);
52 bool smb1cli_conn_check_signing(struct smbXcli_conn *conn,
53 const uint8_t *buf, uint32_t seqnum);
54 bool smb1cli_conn_signing_is_active(struct smbXcli_conn *conn);
56 void smb1cli_conn_set_encryption(struct smbXcli_conn *conn,
57 struct smb_trans_enc_state *es);
58 bool smb1cli_conn_encryption_on(struct smbXcli_conn *conn);
60 bool smb1cli_is_andx_req(uint8_t cmd);
61 size_t smb1cli_req_wct_ofs(struct tevent_req **reqs, int num_reqs);
63 uint16_t smb1cli_req_mid(struct tevent_req *req);
64 void smb1cli_req_set_mid(struct tevent_req *req, uint16_t mid);
66 uint32_t smb1cli_req_seqnum(struct tevent_req *req);
67 void smb1cli_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
69 struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
70 struct tevent_context *ev,
71 struct smbXcli_conn *conn,
72 uint8_t smb_command,
73 uint8_t additional_flags,
74 uint8_t clear_flags,
75 uint16_t additional_flags2,
76 uint16_t clear_flags2,
77 uint32_t timeout_msec,
78 uint32_t pid,
79 uint16_t tid,
80 uint16_t uid,
81 uint8_t wct, uint16_t *vwv,
82 int iov_count,
83 struct iovec *bytes_iov);
84 NTSTATUS smb1cli_req_chain_submit(struct tevent_req **reqs, int num_reqs);
86 struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
87 struct tevent_context *ev,
88 struct smbXcli_conn *conn,
89 uint8_t smb_command,
90 uint8_t additional_flags,
91 uint8_t clear_flags,
92 uint16_t additional_flags2,
93 uint16_t clear_flags2,
94 uint32_t timeout_msec,
95 uint32_t pid,
96 uint16_t tid,
97 uint16_t uid,
98 uint8_t wct, uint16_t *vwv,
99 uint32_t num_bytes,
100 const uint8_t *bytes);
101 NTSTATUS smb1cli_req_recv(struct tevent_req *req,
102 TALLOC_CTX *mem_ctx, uint8_t **pinbuf,
103 uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
104 uint32_t *pnum_bytes, uint8_t **pbytes);
106 #endif /* _SMBXCLI_BASE_H_ */