summaryrefslogtreecommitdiff
path: root/sftp-client.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-13 14:10:32 +1100
committerDamien Miller <djm@mindrot.org>2002-02-13 14:10:32 +1100
commit3db5f530d0fdf8044d6014ab12940efe0bbecca7 (patch)
tree578c5ea0091f934c13d40264b033bbd2532d2e9a /sftp-client.h
parent3606ee29388781894e6374030d0e40fa46da4cf9 (diff)
- djm@cvs.openbsd.org 2002/02/13 00:59:23
[sftp-client.c sftp-client.h sftp-glob.c sftp-glob.h sftp.h] [sftp-int.c sftp-int.h] API cleanup and backwards compat for filexfer v.0 servers; ok markus@
Diffstat (limited to 'sftp-client.h')
-rw-r--r--sftp-client.h49
1 files changed, 29 insertions, 20 deletions
diff --git a/sftp-client.h b/sftp-client.h
index 477c8ed3b..ceda879b9 100644
--- a/sftp-client.h
+++ b/sftp-client.h
@@ -1,7 +1,7 @@
1/* $OpenBSD: sftp-client.h,v 1.8 2002/02/12 12:32:27 djm Exp $ */ 1/* $OpenBSD: sftp-client.h,v 1.9 2002/02/13 00:59:23 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2002 Damien Miller. All rights reserved. 4 * Copyright (c) 2001,2002 Damien Miller. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
@@ -26,6 +26,9 @@
26 26
27/* Client side of SSH2 filexfer protocol */ 27/* Client side of SSH2 filexfer protocol */
28 28
29#ifndef _SFTP_CLIENT_H
30#define _SFTP_CLIENT_H
31
29typedef struct SFTP_DIRENT SFTP_DIRENT; 32typedef struct SFTP_DIRENT SFTP_DIRENT;
30 33
31struct SFTP_DIRENT { 34struct SFTP_DIRENT {
@@ -38,55 +41,59 @@ struct SFTP_DIRENT {
38 * Initialiase a SSH filexfer connection. Returns -1 on error or 41 * Initialiase a SSH filexfer connection. Returns -1 on error or
39 * protocol version on success. 42 * protocol version on success.
40 */ 43 */
41int do_init(int, int); 44struct sftp_conn *
45do_init(int, int, u_int, u_int);
46
47u_int
48sftp_proto_version(struct sftp_conn *);
42 49
43/* Close file referred to by 'handle' */ 50/* Close file referred to by 'handle' */
44int do_close(int, int, char *, u_int); 51int do_close(struct sftp_conn *, char *, u_int);
45 52
46/* List contents of directory 'path' to stdout */ 53/* List contents of directory 'path' to stdout */
47int do_ls(int, int, char *); 54int do_ls(struct sftp_conn *, char *);
48 55
49/* Read contents of 'path' to NULL-terminated array 'dir' */ 56/* Read contents of 'path' to NULL-terminated array 'dir' */
50int do_readdir(int, int, char *, SFTP_DIRENT ***); 57int do_readdir(struct sftp_conn *, char *, SFTP_DIRENT ***);
51 58
52/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */ 59/* Frees a NULL-terminated array of SFTP_DIRENTs (eg. from do_readdir) */
53void free_sftp_dirents(SFTP_DIRENT **); 60void free_sftp_dirents(SFTP_DIRENT **);
54 61
55/* Delete file 'path' */ 62/* Delete file 'path' */
56int do_rm(int, int, char *); 63int do_rm(struct sftp_conn *, char *);
57 64
58/* Create directory 'path' */ 65/* Create directory 'path' */
59int do_mkdir(int, int, char *, Attrib *); 66int do_mkdir(struct sftp_conn *, char *, Attrib *);
60 67
61/* Remove directory 'path' */ 68/* Remove directory 'path' */
62int do_rmdir(int, int, char *); 69int do_rmdir(struct sftp_conn *, char *);
63 70
64/* Get file attributes of 'path' (follows symlinks) */ 71/* Get file attributes of 'path' (follows symlinks) */
65Attrib *do_stat(int, int, char *, int); 72Attrib *do_stat(struct sftp_conn *, char *, int);
66 73
67/* Get file attributes of 'path' (does not follow symlinks) */ 74/* Get file attributes of 'path' (does not follow symlinks) */
68Attrib *do_lstat(int, int, char *, int); 75Attrib *do_lstat(struct sftp_conn *, char *, int);
69 76
70/* Get file attributes of open file 'handle' */ 77/* Get file attributes of open file 'handle' */
71Attrib *do_fstat(int, int, char *, u_int, int); 78Attrib *do_fstat(struct sftp_conn *, char *, u_int, int);
72 79
73/* Set file attributes of 'path' */ 80/* Set file attributes of 'path' */
74int do_setstat(int, int, char *, Attrib *); 81int do_setstat(struct sftp_conn *, char *, Attrib *);
75 82
76/* Set file attributes of open file 'handle' */ 83/* Set file attributes of open file 'handle' */
77int do_fsetstat(int, int, char *, u_int, Attrib *); 84int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
78 85
79/* Canonicalise 'path' - caller must free result */ 86/* Canonicalise 'path' - caller must free result */
80char *do_realpath(int, int, char *); 87char *do_realpath(struct sftp_conn *, char *);
81 88
82/* Rename 'oldpath' to 'newpath' */ 89/* Rename 'oldpath' to 'newpath' */
83int do_rename(int, int, char *, char *); 90int do_rename(struct sftp_conn *, char *, char *);
84 91
85/* Rename 'oldpath' to 'newpath' */ 92/* Rename 'oldpath' to 'newpath' */
86int do_symlink(int, int, char *, char *); 93int do_symlink(struct sftp_conn *, char *, char *);
87 94
88/* Return target of symlink 'path' - caller must free result */ 95/* Return target of symlink 'path' - caller must free result */
89char *do_readlink(int, int, char *); 96char *do_readlink(struct sftp_conn *, char *);
90 97
91/* XXX: add callbacks to do_download/do_upload so we can do progress meter */ 98/* XXX: add callbacks to do_download/do_upload so we can do progress meter */
92 99
@@ -94,10 +101,12 @@ char *do_readlink(int, int, char *);
94 * Download 'remote_path' to 'local_path'. Preserve permissions and times 101 * Download 'remote_path' to 'local_path'. Preserve permissions and times
95 * if 'pflag' is set 102 * if 'pflag' is set
96 */ 103 */
97int do_download(int, int, char *, char *, int, size_t, int); 104int do_download(struct sftp_conn *, char *, char *, int);
98 105
99/* 106/*
100 * Upload 'local_path' to 'remote_path'. Preserve permissions and times 107 * Upload 'local_path' to 'remote_path'. Preserve permissions and times
101 * if 'pflag' is set 108 * if 'pflag' is set
102 */ 109 */
103int do_upload(int, int, char *, char *, int , size_t, int); 110int do_upload(struct sftp_conn *, char *, char *, int);
111
112#endif