Refactoring: Add the routine cli_request_send()
[obnox/samba-ctdb.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 #include "includes.h"
21
22 /*
23  * Ship a new smb request to the server
24  */
25
26 struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, struct cli_state *cli,
27                                    uint8_t smb_command,
28                                    uint8_t additional_flags,
29                                    uint8_t wct, const uint16_t *vwv,
30                                    uint16_t num_bytes, const uint8_t *bytes);
31
32 /*
33  * Convenience function to get the SMB part out of an async_req
34  */
35
36 struct cli_request *cli_request_get(struct async_req *req);
37
38 /*
39  * Fetch an error out of a NBT packet
40  */
41
42 NTSTATUS cli_pull_error(char *buf);
43
44 /*
45  * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
46  */
47
48 void cli_set_error(struct cli_state *cli, NTSTATUS status);
49
50 /*
51  * Create a temporary event context for use in the sync helper functions
52  */
53
54 struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx,
55                                         struct cli_state *cli);
56
57 /*
58  * Attach an event context permanently to a cli_struct
59  */
60
61 NTSTATUS cli_add_event_ctx(struct cli_state *cli,
62                            struct event_context *event_ctx);