]> andersk Git - gssapi-openssh.git/blame - openssh/sftp-client.h
Import of OpenSSH 5.1p1
[gssapi-openssh.git] / openssh / sftp-client.h
CommitLineData
22616013 1/* $OpenBSD: sftp-client.h,v 1.17 2008/06/08 20:15:29 dtucker Exp $ */
3c0ef626 2
3/*
cdd66111 4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
3c0ef626 5 *
cdd66111 6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
3c0ef626 9 *
cdd66111 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3c0ef626 17 */
18
19/* Client side of SSH2 filexfer protocol */
20
e9a17296 21#ifndef _SFTP_CLIENT_H
22#define _SFTP_CLIENT_H
23
3c0ef626 24typedef struct SFTP_DIRENT SFTP_DIRENT;
25
26struct SFTP_DIRENT {
27 char *filename;
28 char *longname;
29 Attrib a;
30};
31
22616013 32/*
33 * Used for statvfs responses on the wire from the server, because the
34 * server's native format may be larger than the client's.
35 */
36struct sftp_statvfs {
37 u_int64_t f_bsize;
38 u_int64_t f_frsize;
39 u_int64_t f_blocks;
40 u_int64_t f_bfree;
41 u_int64_t f_bavail;
42 u_int64_t f_files;
43 u_int64_t f_ffree;
44 u_int64_t f_favail;
45 u_int64_t f_fsid;
46 u_int64_t f_flag;
47 u_int64_t f_namemax;
48};
49
3c0ef626 50/*
665a873d 51 * Initialise a SSH filexfer connection. Returns NULL on error or
996d5e62 52 * a pointer to a initialized sftp_conn struct on success.
3c0ef626 53 */
680cee3b 54struct sftp_conn *do_init(int, int, u_int, u_int);
e9a17296 55
680cee3b 56u_int sftp_proto_version(struct sftp_conn *);
3c0ef626 57
58/* Close file referred to by 'handle' */
e9a17296 59int do_close(struct sftp_conn *, char *, u_int);
3c0ef626 60
3c0ef626 61/* Read contents of 'path' to NULL-terminated array 'dir' */
e9a17296 62int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
3c0ef626 63
64/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
65void free_sftp_dirents(SFTP_DIRENT **);
66
67/* Delete file 'path' */
e9a17296 68int do_rm(struct sftp_conn *, char *);
3c0ef626 69
70/* Create directory 'path' */
e9a17296 71int do_mkdir(struct sftp_conn *, char *, Attrib *);
3c0ef626 72
73/* Remove directory 'path' */
e9a17296 74int do_rmdir(struct sftp_conn *, char *);
3c0ef626 75
76/* Get file attributes of 'path' (follows symlinks) */
e9a17296 77Attrib *do_stat(struct sftp_conn *, char *, int);
3c0ef626 78
79/* Get file attributes of 'path' (does not follow symlinks) */
e9a17296 80Attrib *do_lstat(struct sftp_conn *, char *, int);
3c0ef626 81
3c0ef626 82/* Set file attributes of 'path' */
e9a17296 83int do_setstat(struct sftp_conn *, char *, Attrib *);
3c0ef626 84
85/* Set file attributes of open file 'handle' */
e9a17296 86int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
3c0ef626 87
88/* Canonicalise 'path' - caller must free result */
e9a17296 89char *do_realpath(struct sftp_conn *, char *);
3c0ef626 90
22616013 91/* Get statistics for filesystem hosting file at "path" */
92int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
93
3c0ef626 94/* Rename 'oldpath' to 'newpath' */
e9a17296 95int do_rename(struct sftp_conn *, char *, char *);
3c0ef626 96
97/* Rename 'oldpath' to 'newpath' */
e9a17296 98int do_symlink(struct sftp_conn *, char *, char *);
3c0ef626 99
3c0ef626 100/* XXX: add callbacks to do_download/do_upload so we can do progress meter */
101
102/*
103 * Download 'remote_path' to 'local_path'. Preserve permissions and times
104 * if 'pflag' is set
105 */
e9a17296 106int do_download(struct sftp_conn *, char *, char *, int);
3c0ef626 107
108/*
109 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
110 * if 'pflag' is set
111 */
e9a17296 112int do_upload(struct sftp_conn *, char *, char *, int);
113
114#endif
This page took 0.139929 seconds and 5 git commands to generate.