Annotation of src/usr.bin/ssh/sftp-client.h, Revision 1.16
1.16 ! djm 1: /* $OpenBSD: sftp-client.h,v 1.15 2008/01/11 07:22:28 chl Exp $ */
1.1 djm 2:
3: /*
1.12 djm 4: * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
1.1 djm 5: *
1.12 djm 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.
1.1 djm 9: *
1.12 djm 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.
1.1 djm 17: */
18:
19: /* Client side of SSH2 filexfer protocol */
20:
1.9 djm 21: #ifndef _SFTP_CLIENT_H
22: #define _SFTP_CLIENT_H
23:
1.3 djm 24: typedef struct SFTP_DIRENT SFTP_DIRENT;
25:
26: struct SFTP_DIRENT {
27: char *filename;
28: char *longname;
29: Attrib a;
30: };
31:
1.5 markus 32: /*
1.14 jmc 33: * Initialise a SSH filexfer connection. Returns NULL on error or
1.13 djm 34: * a pointer to a initialized sftp_conn struct on success.
1.2 djm 35: */
1.10 deraadt 36: struct sftp_conn *do_init(int, int, u_int, u_int);
1.9 djm 37:
1.10 deraadt 38: u_int sftp_proto_version(struct sftp_conn *);
1.1 djm 39:
40: /* Close file referred to by 'handle' */
1.9 djm 41: int do_close(struct sftp_conn *, char *, u_int);
1.3 djm 42:
43: /* Read contents of 'path' to NULL-terminated array 'dir' */
1.9 djm 44: int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
1.3 djm 45:
46: /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
1.6 itojun 47: void free_sftp_dirents(SFTP_DIRENT **);
1.1 djm 48:
49: /* Delete file 'path' */
1.9 djm 50: int do_rm(struct sftp_conn *, char *);
1.1 djm 51:
52: /* Create directory 'path' */
1.9 djm 53: int do_mkdir(struct sftp_conn *, char *, Attrib *);
1.1 djm 54:
55: /* Remove directory 'path' */
1.9 djm 56: int do_rmdir(struct sftp_conn *, char *);
1.1 djm 57:
58: /* Get file attributes of 'path' (follows symlinks) */
1.9 djm 59: Attrib *do_stat(struct sftp_conn *, char *, int);
1.1 djm 60:
61: /* Get file attributes of 'path' (does not follow symlinks) */
1.9 djm 62: Attrib *do_lstat(struct sftp_conn *, char *, int);
1.1 djm 63:
64: /* Set file attributes of 'path' */
1.9 djm 65: int do_setstat(struct sftp_conn *, char *, Attrib *);
1.1 djm 66:
67: /* Set file attributes of open file 'handle' */
1.9 djm 68: int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
1.1 djm 69:
70: /* Canonicalise 'path' - caller must free result */
1.9 djm 71: char *do_realpath(struct sftp_conn *, char *);
1.16 ! djm 72:
! 73: /* Get statistics for filesystem hosting file at "path" */
! 74: struct statvfs;
! 75: int do_statvfs(struct sftp_conn *, const char *, struct statvfs *, int);
1.1 djm 76:
77: /* Rename 'oldpath' to 'newpath' */
1.9 djm 78: int do_rename(struct sftp_conn *, char *, char *);
1.2 djm 79:
80: /* Rename 'oldpath' to 'newpath' */
1.9 djm 81: int do_symlink(struct sftp_conn *, char *, char *);
1.1 djm 82:
83: /* XXX: add callbacks to do_download/do_upload so we can do progress meter */
84:
85: /*
86: * Download 'remote_path' to 'local_path'. Preserve permissions and times
87: * if 'pflag' is set
88: */
1.9 djm 89: int do_download(struct sftp_conn *, char *, char *, int);
1.1 djm 90:
91: /*
92: * Upload 'local_path' to 'remote_path'. Preserve permissions and times
93: * if 'pflag' is set
94: */
1.9 djm 95: int do_upload(struct sftp_conn *, char *, char *, int);
96:
97: #endif