s3-spoolss: add rpccli_spoolss_getprinterdriver convenience wrapper.
[ira/wip.git] / source3 / include / async_smb.h
1 /*
2    Unix SMB/CIFS implementation.
3    Infrastructure for async SMB client requests
4    Copyright (C) Volker Lendecke 2008
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef __ASYNC_SMB_H__
21 #define __ASYNC_SMB_H__
22
23 #include "includes.h"
24
25 bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
26                       uint8_t wct, const uint16_t *vwv,
27                       size_t bytes_alignment,
28                       uint32_t num_bytes, const uint8_t *bytes);
29
30 /*
31  * Fetch an error out of a NBT packet
32  */
33
34 NTSTATUS cli_pull_error(char *buf);
35
36 /*
37  * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
38  */
39
40 void cli_set_error(struct cli_state *cli, NTSTATUS status);
41
42 struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
43                                       struct event_context *ev,
44                                       struct cli_state *cli,
45                                       uint8_t smb_command,
46                                       uint8_t additional_flags,
47                                       uint8_t wct, uint16_t *vwv,
48                                       int iov_count,
49                                       struct iovec *bytes_iov);
50 NTSTATUS cli_smb_req_send(struct tevent_req *req);
51 size_t cli_smb_wct_ofs(struct tevent_req **reqs, int num_reqs);
52 NTSTATUS cli_smb_chain_send(struct tevent_req **reqs, int num_reqs);
53 uint8_t *cli_smb_inbuf(struct tevent_req *req);
54 bool cli_has_async_calls(struct cli_state *cli);
55 void cli_smb_req_unset_pending(struct tevent_req *req);
56 bool cli_smb_req_set_pending(struct tevent_req *req);
57 uint16_t cli_smb_req_mid(struct tevent_req *req);
58 void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid);
59 struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
60                                 struct cli_state *cli,
61                                 uint8_t smb_command, uint8_t additional_flags,
62                                 uint8_t wct, uint16_t *vwv,
63                                 uint32_t num_bytes,
64                                 const uint8_t *bytes);
65 NTSTATUS cli_smb_recv(struct tevent_req *req, uint8_t min_wct,
66                       uint8_t *pwct, uint16_t **pvwv,
67                       uint32_t *pnum_bytes, uint8_t **pbytes);
68
69 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
70                                                     struct event_context *ev,
71                                                     struct cli_state *cli);
72 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
73                                           uint16_t *pfnum,
74                                           uint8_t *plevel);
75
76 #endif