1 #ifndef _REQUEST_H
2 #define _REQUEST_H
3 /*
4    Unix SMB/CIFS implementation.
5    SMB parameters and setup
6    Copyright (C) Andrew Tridgell 2003
7    Copyright (C) James Myers 2003 <myersjj@samba.org>
8 
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #include "libcli/raw/signing.h"
24 
25 #define BUFINFO_FLAG_UNICODE 0x0001
26 #define BUFINFO_FLAG_SMB2    0x0002
27 
28 /*
29   buffer limit structure used by both SMB and SMB2
30  */
31 struct request_bufinfo {
32 	TALLOC_CTX *mem_ctx;
33 	uint32_t flags;
34 	const uint8_t *align_base;
35 	const uint8_t *data;
36 	size_t data_size;
37 };
38 
39 /*
40   Shared state structure between client and server, representing the basic packet.
41 */
42 
43 struct smb_request_buffer {
44 	/* the raw SMB buffer, including the 4 byte length header */
45 	uint8_t *buffer;
46 
47 	/* the size of the raw buffer, including 4 byte header */
48 	size_t size;
49 
50 	/* how much has been allocated - on reply the buffer is over-allocated to
51 	   prevent too many realloc() calls
52 	*/
53 	size_t allocated;
54 
55 	/* the start of the SMB header - this is always buffer+4 */
56 	uint8_t *hdr;
57 
58 	/* the command words and command word count. vwv points
59 	   into the raw buffer */
60 	uint8_t *vwv;
61 	unsigned int wct;
62 
63 	/* the data buffer and size. data points into the raw buffer */
64 	uint8_t *data;
65 	size_t data_size;
66 
67 	/* ptr is used as a moving pointer into the data area
68 	 * of the packet. The reason its here and not a local
69 	 * variable in each function is that when a realloc of
70 	 * a send packet is done we need to move this
71 	 * pointer */
72 	uint8_t *ptr;
73 
74 	/* this is used to range check and align strings and buffers */
75 	struct request_bufinfo bufinfo;
76 };
77 
78 #endif
79