ena.4: Add a missing space.
[dragonfly.git] / crypto / openssh / sftp-client.h
blob14a3b8182c490bb7799f56e22d0fc96f168dcb71
1 /* $OpenBSD: sftp-client.h,v 1.27 2015/05/08 06:45:13 djm Exp $ */
3 /*
4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
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.
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.
19 /* Client side of SSH2 filexfer protocol */
21 #ifndef _SFTP_CLIENT_H
22 #define _SFTP_CLIENT_H
24 #ifdef USE_SYSTEM_GLOB
25 # include <glob.h>
26 #else
27 # include "openbsd-compat/glob.h"
28 #endif
30 typedef struct SFTP_DIRENT SFTP_DIRENT;
32 struct SFTP_DIRENT {
33 char *filename;
34 char *longname;
35 Attrib a;
39 * Used for statvfs responses on the wire from the server, because the
40 * server's native format may be larger than the client's.
42 struct sftp_statvfs {
43 u_int64_t f_bsize;
44 u_int64_t f_frsize;
45 u_int64_t f_blocks;
46 u_int64_t f_bfree;
47 u_int64_t f_bavail;
48 u_int64_t f_files;
49 u_int64_t f_ffree;
50 u_int64_t f_favail;
51 u_int64_t f_fsid;
52 u_int64_t f_flag;
53 u_int64_t f_namemax;
57 * Initialise a SSH filexfer connection. Returns NULL on error or
58 * a pointer to a initialized sftp_conn struct on success.
60 struct sftp_conn *do_init(int, int, u_int, u_int, u_int64_t);
62 u_int sftp_proto_version(struct sftp_conn *);
64 /* Close file referred to by 'handle' */
65 int do_close(struct sftp_conn *, const u_char *, u_int);
67 /* Read contents of 'path' to NULL-terminated array 'dir' */
68 int do_readdir(struct sftp_conn *, const char *, SFTP_DIRENT ***);
70 /* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
71 void free_sftp_dirents(SFTP_DIRENT **);
73 /* Delete file 'path' */
74 int do_rm(struct sftp_conn *, const char *);
76 /* Create directory 'path' */
77 int do_mkdir(struct sftp_conn *, const char *, Attrib *, int);
79 /* Remove directory 'path' */
80 int do_rmdir(struct sftp_conn *, const char *);
82 /* Get file attributes of 'path' (follows symlinks) */
83 Attrib *do_stat(struct sftp_conn *, const char *, int);
85 /* Get file attributes of 'path' (does not follow symlinks) */
86 Attrib *do_lstat(struct sftp_conn *, const char *, int);
88 /* Set file attributes of 'path' */
89 int do_setstat(struct sftp_conn *, const char *, Attrib *);
91 /* Set file attributes of open file 'handle' */
92 int do_fsetstat(struct sftp_conn *, const u_char *, u_int, Attrib *);
94 /* Canonicalise 'path' - caller must free result */
95 char *do_realpath(struct sftp_conn *, const char *);
97 /* Get statistics for filesystem hosting file at "path" */
98 int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
100 /* Rename 'oldpath' to 'newpath' */
101 int do_rename(struct sftp_conn *, const char *, const char *, int force_legacy);
103 /* Link 'oldpath' to 'newpath' */
104 int do_hardlink(struct sftp_conn *, const char *, const char *);
106 /* Rename 'oldpath' to 'newpath' */
107 int do_symlink(struct sftp_conn *, const char *, const char *);
109 /* Call fsync() on open file 'handle' */
110 int do_fsync(struct sftp_conn *conn, u_char *, u_int);
113 * Download 'remote_path' to 'local_path'. Preserve permissions and times
114 * if 'pflag' is set
116 int do_download(struct sftp_conn *, const char *, const char *,
117 Attrib *, int, int, int);
120 * Recursively download 'remote_directory' to 'local_directory'. Preserve
121 * times if 'pflag' is set
123 int download_dir(struct sftp_conn *, const char *, const char *,
124 Attrib *, int, int, int, int);
127 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
128 * if 'pflag' is set
130 int do_upload(struct sftp_conn *, const char *, const char *, int, int, int);
133 * Recursively upload 'local_directory' to 'remote_directory'. Preserve
134 * times if 'pflag' is set
136 int upload_dir(struct sftp_conn *, const char *, const char *, int, int, int,
137 int);
139 /* Concatenate paths, taking care of slashes. Caller must free result. */
140 char *path_append(const char *, const char *);
142 #endif