]> andersk Git - openssh.git/blame - sftp-client.h
- djm@cvs.openbsd.org 2008/04/18 12:32:11
[openssh.git] / sftp-client.h
CommitLineData
360b43ab 1/* $OpenBSD: sftp-client.h,v 1.16 2008/04/18 12:32:11 djm Exp $ */
61e96248 2
3/*
ab3932ab 4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
61e96248 5 *
ab3932ab 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.
61e96248 9 *
ab3932ab 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.
61e96248 17 */
18
19/* Client side of SSH2 filexfer protocol */
20
22e6c827 21#ifndef _SFTP_CLIENT_H
22#define _SFTP_CLIENT_H
23
2e4fb373 24typedef struct SFTP_DIRENT SFTP_DIRENT;
25
26struct SFTP_DIRENT {
27 char *filename;
28 char *longname;
29 Attrib a;
30};
31
cd332296 32/*
d95daa6d 33 * Initialise a SSH filexfer connection. Returns NULL on error or
47460206 34 * a pointer to a initialized sftp_conn struct on success.
3a7fe5ba 35 */
9906a836 36struct sftp_conn *do_init(int, int, u_int, u_int);
22e6c827 37
9906a836 38u_int sftp_proto_version(struct sftp_conn *);
61e96248 39
40/* Close file referred to by 'handle' */
22e6c827 41int do_close(struct sftp_conn *, char *, u_int);
61e96248 42
2e4fb373 43/* Read contents of 'path' to NULL-terminated array 'dir' */
22e6c827 44int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
2e4fb373 45
46/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
1c06a9ca 47void free_sftp_dirents(SFTP_DIRENT **);
2e4fb373 48
61e96248 49/* Delete file 'path' */
22e6c827 50int do_rm(struct sftp_conn *, char *);
61e96248 51
52/* Create directory 'path' */
22e6c827 53int do_mkdir(struct sftp_conn *, char *, Attrib *);
61e96248 54
55/* Remove directory 'path' */
22e6c827 56int do_rmdir(struct sftp_conn *, char *);
61e96248 57
58/* Get file attributes of 'path' (follows symlinks) */
22e6c827 59Attrib *do_stat(struct sftp_conn *, char *, int);
61e96248 60
61/* Get file attributes of 'path' (does not follow symlinks) */
22e6c827 62Attrib *do_lstat(struct sftp_conn *, char *, int);
61e96248 63
61e96248 64/* Set file attributes of 'path' */
22e6c827 65int do_setstat(struct sftp_conn *, char *, Attrib *);
61e96248 66
67/* Set file attributes of open file 'handle' */
22e6c827 68int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
61e96248 69
70/* Canonicalise 'path' - caller must free result */
22e6c827 71char *do_realpath(struct sftp_conn *, char *);
61e96248 72
360b43ab 73/* Get statistics for filesystem hosting file at "path" */
74struct statvfs;
75int do_statvfs(struct sftp_conn *, const char *, struct statvfs *, int);
76
61e96248 77/* Rename 'oldpath' to 'newpath' */
22e6c827 78int do_rename(struct sftp_conn *, char *, char *);
61e96248 79
3a7fe5ba 80/* Rename 'oldpath' to 'newpath' */
22e6c827 81int do_symlink(struct sftp_conn *, char *, char *);
3a7fe5ba 82
61e96248 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 */
22e6c827 89int do_download(struct sftp_conn *, char *, char *, int);
61e96248 90
91/*
92 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
93 * if 'pflag' is set
94 */
22e6c827 95int do_upload(struct sftp_conn *, char *, char *, int);
96
97#endif
This page took 0.246366 seconds and 5 git commands to generate.