Add an entry for the "check" command to the tdbtool manpage.
[Samba/gebeck_regimport.git] / source3 / include / async_smb.h
blob25fd353632aa58af9c57ae1f58570246f25d1c62
1 /*
2 Unix SMB/CIFS implementation.
3 Infrastructure for async SMB client requests
4 Copyright (C) Volker Lendecke 2008
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 __ASYNC_SMB_H__
21 #define __ASYNC_SMB_H__
23 #include "includes.h"
25 /**
26 * struct cli_request is the state holder for an async client request we sent
27 * to the server. It can consist of more than one struct async_req that we
28 * have to server if the application did a cli_chain_cork() and
29 * cli_chain_uncork()
32 struct cli_request {
33 /**
34 * "prev" and "next" form the doubly linked list in
35 * cli_state->outstanding_requests
37 struct cli_request *prev, *next;
39 /**
40 * num_async: How many chained requests do we serve?
42 int num_async;
44 /**
45 * async: This is the list of chained requests that were queued up by
46 * cli_request_chain before we sent out this request
48 struct async_req **async;
50 /**
51 * The client connection for this request
53 struct cli_state *cli;
55 /**
56 * The enc_state to decrypt the reply
58 struct smb_trans_enc_state *enc_state;
60 /**
61 * The mid we used for this request. Mainly used to demultiplex on
62 * receiving replies.
64 uint16_t mid;
66 /**
67 * The bytes we have to ship to the server
69 char *outbuf;
71 /**
72 * How much from "outbuf" did we already send
74 size_t sent;
76 /**
77 * The reply comes in here. Its intended size is implicit by
78 * smb_len(), its current size can be read via talloc_get_size()
80 char *inbuf;
82 /**
83 * Specific requests might add stuff here. Maybe convert this to a
84 * private_pointer at some point.
86 union {
87 struct {
88 off_t ofs;
89 size_t size;
90 ssize_t received;
91 uint8_t *rcvbuf;
92 } read;
93 struct {
94 DATA_BLOB data;
95 uint16_t num_echos;
96 } echo;
97 } data;
99 /**
100 * For requests that don't follow the strict request/reply pattern
101 * such as the transaction request family and echo requests it is
102 * necessary to break the standard procedure in
103 * handle_incoming_pdu(). For a simple example look at
104 * cli_echo_recv_helper().
106 struct {
107 void (*fn)(struct async_req *req);
108 void *priv;
109 } recv_helper;
113 * Ship a new smb request to the server
116 struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
117 struct event_context *ev,
118 struct cli_state *cli,
119 uint8_t smb_command,
120 uint8_t additional_flags,
121 uint8_t wct, const uint16_t *vwv,
122 uint16_t num_bytes, const uint8_t *bytes);
124 bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
125 size_t size_hint);
126 void cli_chain_uncork(struct cli_state *cli);
127 bool cli_in_chain(struct cli_state *cli);
128 bool smb_splice_chain(char **poutbuf, uint8_t smb_command,
129 uint8_t wct, const uint16_t *vwv,
130 size_t bytes_alignment,
131 uint16_t num_bytes, const uint8_t *bytes);
133 NTSTATUS cli_pull_reply(struct async_req *req,
134 uint8_t *pwct, uint16_t **pvwv,
135 uint16_t *pnum_bytes, uint8_t **pbytes);
138 * Fetch an error out of a NBT packet
141 NTSTATUS cli_pull_error(char *buf);
144 * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
147 void cli_set_error(struct cli_state *cli, NTSTATUS status);
149 #endif