source: trunk/third/openssh/sftp-client.h @ 22570

Revision 22570, 3.1 KB checked in by ghudson, 18 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r22569, which included commits to RCS files with non-trunk default branches.
Line 
1/* $OpenBSD: sftp-client.h,v 1.14 2005/04/26 12:59:02 jmc Exp $ */
2
3/*
4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
5 *
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.
9 *
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.
17 */
18
19/* Client side of SSH2 filexfer protocol */
20
21#ifndef _SFTP_CLIENT_H
22#define _SFTP_CLIENT_H
23
24typedef struct SFTP_DIRENT SFTP_DIRENT;
25
26struct SFTP_DIRENT {
27        char *filename;
28        char *longname;
29        Attrib a;
30};
31
32/*
33 * Initialise a SSH filexfer connection. Returns NULL on error or
34 * a pointer to a initialized sftp_conn struct on success.
35 */
36struct sftp_conn *do_init(int, int, u_int, u_int);
37
38u_int sftp_proto_version(struct sftp_conn *);
39
40/* Close file referred to by 'handle' */
41int do_close(struct sftp_conn *, char *, u_int);
42
43/* Read contents of 'path' to NULL-terminated array 'dir' */
44int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
45
46/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
47void free_sftp_dirents(SFTP_DIRENT **);
48
49/* Delete file 'path' */
50int do_rm(struct sftp_conn *, char *);
51
52/* Create directory 'path' */
53int do_mkdir(struct sftp_conn *, char *, Attrib *);
54
55/* Remove directory 'path' */
56int do_rmdir(struct sftp_conn *, char *);
57
58/* Get file attributes of 'path' (follows symlinks) */
59Attrib *do_stat(struct sftp_conn *, char *, int);
60
61/* Get file attributes of 'path' (does not follow symlinks) */
62Attrib *do_lstat(struct sftp_conn *, char *, int);
63
64/* Get file attributes of open file 'handle' */
65Attrib *do_fstat(struct sftp_conn *, char *, u_int, int);
66
67/* Set file attributes of 'path' */
68int do_setstat(struct sftp_conn *, char *, Attrib *);
69
70/* Set file attributes of open file 'handle' */
71int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
72
73/* Canonicalise 'path' - caller must free result */
74char *do_realpath(struct sftp_conn *, char *);
75
76/* Rename 'oldpath' to 'newpath' */
77int do_rename(struct sftp_conn *, char *, char *);
78
79/* Rename 'oldpath' to 'newpath' */
80int do_symlink(struct sftp_conn *, char *, char *);
81
82/* Return target of symlink 'path' - caller must free result */
83char *do_readlink(struct sftp_conn *, char *);
84
85/* XXX: add callbacks to do_download/do_upload so we can do progress meter */
86
87/*
88 * Download 'remote_path' to 'local_path'. Preserve permissions and times
89 * if 'pflag' is set
90 */
91int do_download(struct sftp_conn *, char *, char *, int);
92
93/*
94 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
95 * if 'pflag' is set
96 */
97int do_upload(struct sftp_conn *, char *, char *, int);
98
99#endif
Note: See TracBrowser for help on using the repository browser.