a5cae25a2ba9772b455df9029ddea80acbaf79ac
[mat/samba.git] / source3 / libsmb / cli_smb2_fnum.h
1 /*
2    Unix SMB/CIFS implementation.
3    smb2 wrapper client routines
4    Copyright (C) Jeremy Allison 2013
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 __SMB2CLI_FNUM_H__
21 #define __SMB2CLI_FNUM_H__
22
23 struct smbXcli_conn;
24 struct smbXcli_session;
25 struct cli_state;
26 struct file_info;
27
28 NTSTATUS cli_smb2_create_fnum(struct cli_state *cli,
29                         const char *fname,
30                         uint32_t create_flags,
31                         uint32_t desired_access,
32                         uint32_t file_attributes,
33                         uint32_t share_access,
34                         uint32_t create_disposition,
35                         uint32_t create_options,
36                         uint16_t *pfid,
37                         struct smb2_create_returns *cr);
38
39 NTSTATUS cli_smb2_close_fnum(struct cli_state *cli, uint16_t fnum);
40 NTSTATUS cli_smb2_mkdir(struct cli_state *cli, const char *dirname);
41 NTSTATUS cli_smb2_rmdir(struct cli_state *cli, const char *dirname);
42 NTSTATUS cli_smb2_unlink(struct cli_state *cli,const char *fname);
43 NTSTATUS cli_smb2_list(struct cli_state *cli,
44                         const char *pathname,
45                         uint16_t attribute,
46                         NTSTATUS (*fn)(const char *,
47                                 struct file_info *,
48                                 const char *,
49                                 void *),
50                         void *state);
51 NTSTATUS cli_smb2_qpathinfo_basic(struct cli_state *cli,
52                         const char *name,
53                         SMB_STRUCT_STAT *sbuf,
54                         uint32_t *attributes);
55 NTSTATUS cli_smb2_qpathinfo_alt_name(struct cli_state *cli,
56                         const char *name,
57                         fstring alt_name);
58 NTSTATUS cli_smb2_qfileinfo_basic(struct cli_state *cli,
59                         uint16_t fnum,
60                         uint16_t *mode,
61                         off_t *size,
62                         struct timespec *create_time,
63                         struct timespec *access_time,
64                         struct timespec *write_time,
65                         struct timespec *change_time,
66                         SMB_INO_T *ino);
67 NTSTATUS cli_smb2_getattrE(struct cli_state *cli,
68                         uint16_t fnum,
69                         uint16_t *attr,
70                         off_t *size,
71                         time_t *change_time,
72                         time_t *access_time,
73                         time_t *write_time);
74 NTSTATUS cli_smb2_getatr(struct cli_state *cli,
75                         const char *name,
76                         uint16_t *attr,
77                         off_t *size,
78                         time_t *write_time);
79 NTSTATUS cli_smb2_qpathinfo2(struct cli_state *cli,
80                         const char *fname,
81                         struct timespec *create_time,
82                         struct timespec *access_time,
83                         struct timespec *write_time,
84                         struct timespec *change_time,
85                         off_t *size,
86                         uint16_t *mode,
87                         SMB_INO_T *ino);
88 NTSTATUS cli_smb2_qpathinfo_streams(struct cli_state *cli,
89                         const char *name,
90                         TALLOC_CTX *mem_ctx,
91                         unsigned int *pnum_streams,
92                         struct stream_struct **pstreams);
93 NTSTATUS cli_smb2_setatr(struct cli_state *cli,
94                         const char *fname,
95                         uint16_t attr,
96                         time_t mtime);
97 NTSTATUS cli_smb2_setattrE(struct cli_state *cli,
98                         uint16_t fnum,
99                         time_t change_time,
100                         time_t access_time,
101                         time_t write_time);
102 NTSTATUS cli_smb2_dskattr(struct cli_state *cli,
103                         int *bsize,
104                         int *total,
105                         int *avail);
106 NTSTATUS cli_smb2_query_security_descriptor(struct cli_state *cli,
107                         uint16_t fnum,
108                         uint32_t sec_info,
109                         TALLOC_CTX *mem_ctx,
110                         struct security_descriptor **ppsd);
111 NTSTATUS cli_smb2_set_security_descriptor(struct cli_state *cli,
112                         uint16_t fnum,
113                         uint32_t sec_info,
114                         const struct security_descriptor *sd);
115 NTSTATUS cli_smb2_rename(struct cli_state *cli,
116                         const char *fname_src,
117                         const char *fname_dst);
118 NTSTATUS cli_smb2_set_ea_fnum(struct cli_state *cli,
119                         uint16_t fnum,
120                         const char *ea_name,
121                         const char *ea_val,
122                         size_t ea_len);
123 NTSTATUS cli_smb2_get_ea_list_path(struct cli_state *cli,
124                         const char *name,
125                         TALLOC_CTX *ctx,
126                         size_t *pnum_eas,
127                         struct ea_struct **pea_list);
128 NTSTATUS cli_smb2_set_ea_path(struct cli_state *cli,
129                         const char *name,
130                         const char *ea_name,
131                         const char *ea_val,
132                         size_t ea_len);
133 struct tevent_req *cli_smb2_read_send(TALLOC_CTX *mem_ctx,
134                                 struct tevent_context *ev,
135                                 struct cli_state *cli,
136                                 uint16_t fnum,
137                                 off_t offset,
138                                 size_t size);
139 NTSTATUS cli_smb2_read_recv(struct tevent_req *req,
140                                 ssize_t *received,
141                                 uint8_t **rcvbuf);
142 struct tevent_req *cli_smb2_write_send(TALLOC_CTX *mem_ctx,
143                                         struct tevent_context *ev,
144                                         struct cli_state *cli,
145                                         uint16_t fnum,
146                                         uint16_t mode,
147                                         const uint8_t *buf,
148                                         off_t offset,
149                                         size_t size);
150 NTSTATUS cli_smb2_write_recv(struct tevent_req *req,
151                              size_t *pwritten);
152 struct tevent_req *cli_smb2_writeall_send(TALLOC_CTX *mem_ctx,
153                         struct tevent_context *ev,
154                         struct cli_state *cli,
155                         uint16_t fnum,
156                         uint16_t mode,
157                         const uint8_t *buf,
158                         off_t offset,
159                         size_t size);
160 NTSTATUS cli_smb2_writeall_recv(struct tevent_req *req,
161                         size_t *pwritten);
162 #endif /* __SMB2CLI_FNUM_H__ */