Changeset 988 for vendor/current/source4/libcli/libcli.h
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/libcli/libcli.h
r414 r988 23 23 24 24 #include "librpc/gen_ndr/nbt.h" 25 #include "libcli/raw/libcliraw.h" 25 26 26 27 struct substitute_context; … … 31 32 */ 32 33 struct smbcli_state { 34 struct smbcli_options options; 35 struct smbcli_socket *sock; /* NULL if connected */ 33 36 struct smbcli_transport *transport; 34 37 struct smbcli_session *session; … … 62 65 }; 63 66 64 65 66 67 #include "libcli/raw/libcliraw.h" 67 68 struct gensec_settings; 68 #include "libcli/libcli_proto.h" 69 70 ssize_t smbcli_read(struct smbcli_tree *tree, int fnum, void *_buf, off_t offset, size_t size); 71 72 /**************************************************************************** 73 write to a file 74 write_mode: 0x0001 disallow write cacheing 75 0x0002 return bytes remaining 76 0x0004 use raw named pipe protocol 77 0x0008 start of message mode named pipe protocol 78 ****************************************************************************/ 79 ssize_t smbcli_write(struct smbcli_tree *tree, 80 int fnum, uint16_t write_mode, 81 const void *_buf, off_t offset, size_t size); 82 83 /**************************************************************************** 84 write to a file using a SMBwrite and not bypassing 0 byte writes 85 ****************************************************************************/ 86 ssize_t smbcli_smbwrite(struct smbcli_tree *tree, 87 int fnum, const void *_buf, off_t offset, size_t size1); 88 89 bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, 90 const char **ports, 91 struct tevent_context *ev_ctx, 92 struct resolve_context *resolve_ctx, 93 struct smbcli_options *options, 94 const char *socket_options, 95 struct nbt_name *calling, 96 struct nbt_name *called); 97 NTSTATUS smbcli_negprot(struct smbcli_state *cli, bool unicode, int maxprotocol); 98 NTSTATUS smbcli_session_setup(struct smbcli_state *cli, 99 struct cli_credentials *credentials, 100 const char *workgroup, 101 struct smbcli_session_options options, 102 struct gensec_settings *gensec_settings); 103 NTSTATUS smbcli_tconX(struct smbcli_state *cli, const char *sharename, 104 const char *devtype, const char *password); 105 NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx, 106 struct smbcli_state **ret_cli, 107 const char *host, 108 const char **ports, 109 const char *sharename, 110 const char *devtype, 111 const char *socket_options, 112 struct cli_credentials *credentials, 113 struct resolve_context *resolve_ctx, 114 struct tevent_context *ev, 115 struct smbcli_options *options, 116 struct smbcli_session_options *session_options, 117 struct gensec_settings *gensec_settings); 118 NTSTATUS smbcli_tdis(struct smbcli_state *cli); 119 120 /**************************************************************************** 121 Initialise a client state structure. 122 ****************************************************************************/ 123 struct smbcli_state *smbcli_state_init(TALLOC_CTX *mem_ctx); 124 bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, 125 char **hostname, char **sharename); 126 127 /**************************************************************************** 128 Symlink a file (UNIX extensions). 129 ****************************************************************************/ 130 NTSTATUS smbcli_unix_symlink(struct smbcli_tree *tree, const char *fname_src, 131 const char *fname_dst); 132 133 /**************************************************************************** 134 Hard a file (UNIX extensions). 135 ****************************************************************************/ 136 NTSTATUS smbcli_unix_hardlink(struct smbcli_tree *tree, const char *fname_src, 137 const char *fname_dst); 138 139 /**************************************************************************** 140 chmod a file (UNIX extensions). 141 ****************************************************************************/ 142 NTSTATUS smbcli_unix_chmod(struct smbcli_tree *tree, const char *fname, mode_t mode); 143 144 /**************************************************************************** 145 chown a file (UNIX extensions). 146 ****************************************************************************/ 147 NTSTATUS smbcli_unix_chown(struct smbcli_tree *tree, const char *fname, uid_t uid, 148 gid_t gid); 149 150 /**************************************************************************** 151 Rename a file. 152 ****************************************************************************/ 153 NTSTATUS smbcli_rename(struct smbcli_tree *tree, const char *fname_src, 154 const char *fname_dst); 155 156 /**************************************************************************** 157 Delete a file. 158 ****************************************************************************/ 159 NTSTATUS smbcli_unlink(struct smbcli_tree *tree, const char *fname); 160 161 /**************************************************************************** 162 Create a directory. 163 ****************************************************************************/ 164 NTSTATUS smbcli_mkdir(struct smbcli_tree *tree, const char *dname); 165 166 /**************************************************************************** 167 Remove a directory. 168 ****************************************************************************/ 169 NTSTATUS smbcli_rmdir(struct smbcli_tree *tree, const char *dname); 170 171 /**************************************************************************** 172 Set or clear the delete on close flag. 173 ****************************************************************************/ 174 NTSTATUS smbcli_nt_delete_on_close(struct smbcli_tree *tree, int fnum, 175 bool flag); 176 177 /**************************************************************************** 178 Create/open a file - exposing the full horror of the NT API :-). 179 Used in CIFS-on-CIFS NTVFS. 180 ****************************************************************************/ 181 int smbcli_nt_create_full(struct smbcli_tree *tree, const char *fname, 182 uint32_t CreatFlags, uint32_t DesiredAccess, 183 uint32_t FileAttributes, uint32_t ShareAccess, 184 uint32_t CreateDisposition, uint32_t CreateOptions, 185 uint8_t SecurityFlags); 186 187 /**************************************************************************** 188 Open a file (using SMBopenx) 189 WARNING: if you open with O_WRONLY then getattrE won't work! 190 ****************************************************************************/ 191 int smbcli_open(struct smbcli_tree *tree, const char *fname, int flags, 192 int share_mode); 193 194 /**************************************************************************** 195 Close a file. 196 ****************************************************************************/ 197 NTSTATUS smbcli_close(struct smbcli_tree *tree, int fnum); 198 199 /**************************************************************************** 200 send a lock with a specified locktype 201 this is used for testing LOCKING_ANDX_CANCEL_LOCK 202 ****************************************************************************/ 203 NTSTATUS smbcli_locktype(struct smbcli_tree *tree, int fnum, 204 uint32_t offset, uint32_t len, int timeout, 205 uint8_t locktype); 206 207 /**************************************************************************** 208 Lock a file. 209 ****************************************************************************/ 210 NTSTATUS smbcli_lock(struct smbcli_tree *tree, int fnum, 211 uint32_t offset, uint32_t len, int timeout, 212 enum brl_type lock_type); 213 214 /**************************************************************************** 215 Unlock a file. 216 ****************************************************************************/ 217 NTSTATUS smbcli_unlock(struct smbcli_tree *tree, int fnum, uint32_t offset, uint32_t len); 218 219 /**************************************************************************** 220 Lock a file with 64 bit offsets. 221 ****************************************************************************/ 222 NTSTATUS smbcli_lock64(struct smbcli_tree *tree, int fnum, 223 off_t offset, off_t len, int timeout, 224 enum brl_type lock_type); 225 226 /**************************************************************************** 227 Unlock a file with 64 bit offsets. 228 ****************************************************************************/ 229 NTSTATUS smbcli_unlock64(struct smbcli_tree *tree, int fnum, off_t offset, 230 off_t len); 231 232 /**************************************************************************** 233 Do a SMBgetattrE call. 234 ****************************************************************************/ 235 NTSTATUS smbcli_getattrE(struct smbcli_tree *tree, int fnum, 236 uint16_t *attr, size_t *size, 237 time_t *c_time, time_t *a_time, time_t *m_time); 238 239 /**************************************************************************** 240 Do a SMBgetatr call 241 ****************************************************************************/ 242 NTSTATUS smbcli_getatr(struct smbcli_tree *tree, const char *fname, 243 uint16_t *attr, size_t *size, time_t *t); 244 245 /**************************************************************************** 246 Do a SMBsetatr call. 247 ****************************************************************************/ 248 NTSTATUS smbcli_setatr(struct smbcli_tree *tree, const char *fname, uint16_t mode, 249 time_t t); 250 251 /**************************************************************************** 252 Do a setfileinfo basic_info call. 253 ****************************************************************************/ 254 NTSTATUS smbcli_fsetatr(struct smbcli_tree *tree, int fnum, uint16_t mode, 255 NTTIME create_time, NTTIME access_time, 256 NTTIME write_time, NTTIME change_time); 257 258 /**************************************************************************** 259 truncate a file to a given size 260 ****************************************************************************/ 261 NTSTATUS smbcli_ftruncate(struct smbcli_tree *tree, int fnum, uint64_t size); 262 263 /**************************************************************************** 264 Check for existence of a dir. 265 ****************************************************************************/ 266 NTSTATUS smbcli_chkpath(struct smbcli_tree *tree, const char *path); 267 268 /**************************************************************************** 269 Query disk space. 270 ****************************************************************************/ 271 NTSTATUS smbcli_dskattr(struct smbcli_tree *tree, uint32_t *bsize, 272 uint64_t *total, uint64_t *avail); 273 274 /**************************************************************************** 275 Create and open a temporary file. 276 ****************************************************************************/ 277 int smbcli_ctemp(struct smbcli_tree *tree, const char *path, char **tmp_path); 278 279 /**************************************************************************** 280 Interpret a long filename structure. 281 ****************************************************************************/ 282 int smbcli_list_new(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 283 enum smb_search_data_level level, 284 void (*fn)(struct clilist_file_info *, const char *, void *), 285 void *caller_state); 286 287 /**************************************************************************** 288 Interpret a short filename structure. 289 The length of the structure is returned. 290 ****************************************************************************/ 291 int smbcli_list_old(struct smbcli_tree *tree, const char *Mask, uint16_t attribute, 292 void (*fn)(struct clilist_file_info *, const char *, void *), 293 void *caller_state); 294 295 /**************************************************************************** 296 Do a directory listing, calling fn on each file found. 297 This auto-switches between old and new style. 298 ****************************************************************************/ 299 int smbcli_list(struct smbcli_tree *tree, const char *Mask,uint16_t attribute, 300 void (*fn)(struct clilist_file_info *, const char *, void *), void *state); 301 302 /**************************************************************************** 303 send a qpathinfo call 304 ****************************************************************************/ 305 NTSTATUS smbcli_qpathinfo(struct smbcli_tree *tree, const char *fname, 306 time_t *c_time, time_t *a_time, time_t *m_time, 307 size_t *size, uint16_t *mode); 308 309 /**************************************************************************** 310 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level 311 ****************************************************************************/ 312 NTSTATUS smbcli_qpathinfo2(struct smbcli_tree *tree, const char *fname, 313 time_t *c_time, time_t *a_time, time_t *m_time, 314 time_t *w_time, size_t *size, uint16_t *mode, 315 ino_t *ino); 316 317 /**************************************************************************** 318 send a qfileinfo QUERY_FILE_NAME_INFO call 319 ****************************************************************************/ 320 NTSTATUS smbcli_qfilename(struct smbcli_tree *tree, int fnum, const char **name); 321 322 /**************************************************************************** 323 send a qfileinfo call 324 ****************************************************************************/ 325 NTSTATUS smbcli_qfileinfo(struct smbcli_tree *tree, int fnum, 326 uint16_t *mode, size_t *size, 327 time_t *c_time, time_t *a_time, time_t *m_time, 328 time_t *w_time, ino_t *ino); 329 330 /**************************************************************************** 331 send a qpathinfo SMB_QUERY_FILE_ALT_NAME_INFO call 332 ****************************************************************************/ 333 NTSTATUS smbcli_qpathinfo_alt_name(struct smbcli_tree *tree, const char *fname, 334 const char **alt_name); 335 336 /* The following definitions come from ../source4/libcli/climessage.c */ 337 338 339 /**************************************************************************** 340 start a message sequence 341 ****************************************************************************/ 342 bool smbcli_message_start(struct smbcli_tree *tree, const char *host, const char *username, 343 int *grp); 344 345 /**************************************************************************** 346 send a message 347 ****************************************************************************/ 348 bool smbcli_message_text(struct smbcli_tree *tree, char *msg, int len, int grp); 349 350 /**************************************************************************** 351 end a message 352 ****************************************************************************/ 353 bool smbcli_message_end(struct smbcli_tree *tree, int grp); 354 355 int smbcli_deltree(struct smbcli_tree *tree, const char *dname); 69 356 70 357 #endif /* __LIBCLI_H__ */
Note:
See TracChangeset
for help on using the changeset viewer.