]>
Commit | Line | Data |
---|---|---|
1c06a9ca | 1 | /* $OpenBSD: sftp-client.h,v 1.6 2001/06/26 06:33:01 itojun Exp $ */ |
61e96248 | 2 | |
3 | /* | |
4 | * Copyright (c) 2001 Damien Miller. All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | */ | |
26 | ||
27 | /* Client side of SSH2 filexfer protocol */ | |
28 | ||
2e4fb373 | 29 | typedef struct SFTP_DIRENT SFTP_DIRENT; |
30 | ||
31 | struct SFTP_DIRENT { | |
32 | char *filename; | |
33 | char *longname; | |
34 | Attrib a; | |
35 | }; | |
36 | ||
cd332296 | 37 | /* |
38 | * Initialiase a SSH filexfer connection. Returns -1 on error or | |
3a7fe5ba | 39 | * protocol version on success. |
40 | */ | |
1c06a9ca | 41 | int do_init(int, int); |
61e96248 | 42 | |
43 | /* Close file referred to by 'handle' */ | |
1c06a9ca | 44 | int do_close(int, int, char *, u_int); |
61e96248 | 45 | |
46 | /* List contents of directory 'path' to stdout */ | |
1c06a9ca | 47 | int do_ls(int, int, char *); |
61e96248 | 48 | |
2e4fb373 | 49 | /* Read contents of 'path' to NULL-terminated array 'dir' */ |
1c06a9ca | 50 | int do_readdir(int, int, char *, SFTP_DIRENT ***); |
2e4fb373 | 51 | |
52 | /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */ | |
1c06a9ca | 53 | void free_sftp_dirents(SFTP_DIRENT **); |
2e4fb373 | 54 | |
61e96248 | 55 | /* Delete file 'path' */ |
1c06a9ca | 56 | int do_rm(int, int, char *); |
61e96248 | 57 | |
58 | /* Create directory 'path' */ | |
1c06a9ca | 59 | int do_mkdir(int, int, char *, Attrib *); |
61e96248 | 60 | |
61 | /* Remove directory 'path' */ | |
1c06a9ca | 62 | int do_rmdir(int, int, char *); |
61e96248 | 63 | |
64 | /* Get file attributes of 'path' (follows symlinks) */ | |
1c06a9ca | 65 | Attrib *do_stat(int, int, char *, int); |
61e96248 | 66 | |
67 | /* Get file attributes of 'path' (does not follow symlinks) */ | |
1c06a9ca | 68 | Attrib *do_lstat(int, int, char *, int); |
61e96248 | 69 | |
70 | /* Get file attributes of open file 'handle' */ | |
1c06a9ca | 71 | Attrib *do_fstat(int, int, char *, u_int, int); |
61e96248 | 72 | |
73 | /* Set file attributes of 'path' */ | |
1c06a9ca | 74 | int do_setstat(int, int, char *, Attrib *); |
61e96248 | 75 | |
76 | /* Set file attributes of open file 'handle' */ | |
1c06a9ca | 77 | int do_fsetstat(int, int, char *, u_int, Attrib *); |
61e96248 | 78 | |
79 | /* Canonicalise 'path' - caller must free result */ | |
1c06a9ca | 80 | char *do_realpath(int, int, char *); |
61e96248 | 81 | |
82 | /* Rename 'oldpath' to 'newpath' */ | |
1c06a9ca | 83 | int do_rename(int, int, char *, char *); |
61e96248 | 84 | |
3a7fe5ba | 85 | /* Rename 'oldpath' to 'newpath' */ |
1c06a9ca | 86 | int do_symlink(int, int, char *, char *); |
3a7fe5ba | 87 | |
88 | /* Return target of symlink 'path' - caller must free result */ | |
1c06a9ca | 89 | char *do_readlink(int, int, char *); |
3a7fe5ba | 90 | |
61e96248 | 91 | /* XXX: add callbacks to do_download/do_upload so we can do progress meter */ |
92 | ||
93 | /* | |
94 | * Download 'remote_path' to 'local_path'. Preserve permissions and times | |
95 | * if 'pflag' is set | |
96 | */ | |
1c06a9ca | 97 | int do_download(int, int, char *, char *, int); |
61e96248 | 98 | |
99 | /* | |
100 | * Upload 'local_path' to 'remote_path'. Preserve permissions and times | |
101 | * if 'pflag' is set | |
102 | */ | |
1c06a9ca | 103 | int do_upload(int, int, char *, char *, int); |