00001
00002
00003
00004
00005 #include "int64.h"
00006
00007 #define SSH_FXP_INIT 1
00008 #define SSH_FXP_VERSION 2
00009 #define SSH_FXP_OPEN 3
00010 #define SSH_FXP_CLOSE 4
00011 #define SSH_FXP_READ 5
00012 #define SSH_FXP_WRITE 6
00013 #define SSH_FXP_LSTAT 7
00014 #define SSH_FXP_FSTAT 8
00015 #define SSH_FXP_SETSTAT 9
00016 #define SSH_FXP_FSETSTAT 10
00017 #define SSH_FXP_OPENDIR 11
00018 #define SSH_FXP_READDIR 12
00019 #define SSH_FXP_REMOVE 13
00020 #define SSH_FXP_MKDIR 14
00021 #define SSH_FXP_RMDIR 15
00022 #define SSH_FXP_REALPATH 16
00023 #define SSH_FXP_STAT 17
00024 #define SSH_FXP_RENAME 18
00025 #define SSH_FXP_STATUS 101
00026 #define SSH_FXP_HANDLE 102
00027 #define SSH_FXP_DATA 103
00028 #define SSH_FXP_NAME 104
00029 #define SSH_FXP_ATTRS 105
00030 #define SSH_FXP_EXTENDED 200
00031 #define SSH_FXP_EXTENDED_REPLY 201
00032
00033 #define SSH_FX_OK 0
00034 #define SSH_FX_EOF 1
00035 #define SSH_FX_NO_SUCH_FILE 2
00036 #define SSH_FX_PERMISSION_DENIED 3
00037 #define SSH_FX_FAILURE 4
00038 #define SSH_FX_BAD_MESSAGE 5
00039 #define SSH_FX_NO_CONNECTION 6
00040 #define SSH_FX_CONNECTION_LOST 7
00041 #define SSH_FX_OP_UNSUPPORTED 8
00042
00043 #define SSH_FILEXFER_ATTR_SIZE 0x00000001
00044 #define SSH_FILEXFER_ATTR_UIDGID 0x00000002
00045 #define SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
00046 #define SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
00047 #define SSH_FILEXFER_ATTR_EXTENDED 0x80000000
00048
00049 #define SSH_FXF_READ 0x00000001
00050 #define SSH_FXF_WRITE 0x00000002
00051 #define SSH_FXF_APPEND 0x00000004
00052 #define SSH_FXF_CREAT 0x00000008
00053 #define SSH_FXF_TRUNC 0x00000010
00054 #define SSH_FXF_EXCL 0x00000020
00055
00056 #define SFTP_PROTO_VERSION 3
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 int sftp_senddata(char *data, int len);
00068 int sftp_recvdata(char *data, int len);
00069
00070 struct fxp_attrs {
00071 unsigned long flags;
00072 uint64 size;
00073 unsigned long uid;
00074 unsigned long gid;
00075 unsigned long permissions;
00076 unsigned long atime;
00077 unsigned long mtime;
00078 };
00079
00080 struct fxp_handle {
00081 char *hstring;
00082 int hlen;
00083 };
00084
00085 struct fxp_name {
00086 char *filename, *longname;
00087 struct fxp_attrs attrs;
00088 };
00089
00090 struct fxp_names {
00091 int nnames;
00092 struct fxp_name *names;
00093 };
00094
00095 const char *fxp_error(void);
00096 int fxp_error_type(void);
00097
00098
00099
00100
00101 int fxp_init(void);
00102
00103
00104
00105
00106
00107 char *fxp_realpath(char *path);
00108
00109
00110
00111
00112 struct fxp_handle *fxp_open(char *path, int type);
00113
00114
00115
00116
00117 struct fxp_handle *fxp_opendir(char *path);
00118
00119
00120
00121
00122 void fxp_close(struct fxp_handle *handle);
00123
00124
00125
00126
00127 int fxp_mkdir(char *path);
00128
00129
00130
00131
00132 int fxp_rmdir(char *path);
00133
00134
00135
00136
00137 int fxp_remove(char *fname);
00138
00139
00140
00141
00142 int fxp_rename(char *srcfname, char *dstfname);
00143
00144
00145
00146
00147 int fxp_stat(char *fname, struct fxp_attrs *attrs);
00148 int fxp_fstat(struct fxp_handle *handle, struct fxp_attrs *attrs);
00149
00150
00151
00152
00153 int fxp_setstat(char *fname, struct fxp_attrs attrs);
00154 int fxp_fsetstat(struct fxp_handle *handle, struct fxp_attrs attrs);
00155
00156
00157
00158
00159 int fxp_read(struct fxp_handle *handle, char *buffer, uint64 offset,
00160 int len);
00161
00162
00163
00164
00165 int fxp_write(struct fxp_handle *handle, char *buffer, uint64 offset,
00166 int len);
00167
00168
00169
00170
00171 struct fxp_names *fxp_readdir(struct fxp_handle *handle);
00172
00173
00174
00175
00176 void fxp_free_names(struct fxp_names *names);
00177
00178
00179
00180
00181 struct fxp_name *fxp_dup_name(struct fxp_name *name);
00182 void fxp_free_name(struct fxp_name *name);