| 1 |
/* |
/* |
| 2 |
Copyright (c) 2008 TeraTerm Project |
Copyright (c) 2008-2012 TeraTerm Project |
| 3 |
All rights reserved. |
All rights reserved. |
| 4 |
|
|
| 5 |
Redistribution and use in source and binary forms, with or without modification, |
Redistribution and use in source and binary forms, with or without modification, |
| 6 |
are permitted provided that the following conditions are met: |
are permitted provided that the following conditions are met: |
| 7 |
|
|
| 8 |
Redistributions of source code must retain the above copyright notice, this list of |
1. Redistributions of source code must retain the above copyright notice, |
| 9 |
conditions and the following disclaimer. |
this list of conditions and the following disclaimer. |
| 10 |
|
2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
Redistributions in binary form must reproduce the above copyright notice, this list |
this list of conditions and the following disclaimer in the documentation |
| 12 |
of conditions and the following disclaimer in the documentation and/or other materials |
and/or other materials provided with the distribution. |
| 13 |
provided with the distribution. |
3. The name of the author may not be used to endorse or promote products derived |
| 14 |
|
from this software without specific prior written permission. |
| 15 |
The name of Robert O'Callahan may not be used to endorse or promote products derived from |
|
| 16 |
this software without specific prior written permission. |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 17 |
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 18 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND |
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 19 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 20 |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
| 21 |
THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 22 |
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
| 24 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
OF SUCH DAMAGE. |
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 25 |
*/ |
*/ |
| 26 |
|
|
| 27 |
#ifndef __SFTP_H |
#ifndef __SFTP_H |
| 32 |
#define SFTP_DEBUG |
#define SFTP_DEBUG |
| 33 |
#endif |
#endif |
| 34 |
|
|
| 35 |
|
/* version */ |
| 36 |
|
#define SSH2_FILEXFER_VERSION 3 |
| 37 |
|
|
| 38 |
|
/* client to server */ |
| 39 |
|
#define SSH2_FXP_INIT 1 |
| 40 |
|
#define SSH2_FXP_OPEN 3 |
| 41 |
|
#define SSH2_FXP_CLOSE 4 |
| 42 |
|
#define SSH2_FXP_READ 5 |
| 43 |
|
#define SSH2_FXP_WRITE 6 |
| 44 |
|
#define SSH2_FXP_LSTAT 7 |
| 45 |
|
#define SSH2_FXP_STAT_VERSION_0 7 |
| 46 |
|
#define SSH2_FXP_FSTAT 8 |
| 47 |
|
#define SSH2_FXP_SETSTAT 9 |
| 48 |
|
#define SSH2_FXP_FSETSTAT 10 |
| 49 |
|
#define SSH2_FXP_OPENDIR 11 |
| 50 |
|
#define SSH2_FXP_READDIR 12 |
| 51 |
|
#define SSH2_FXP_REMOVE 13 |
| 52 |
|
#define SSH2_FXP_MKDIR 14 |
| 53 |
|
#define SSH2_FXP_RMDIR 15 |
| 54 |
|
#define SSH2_FXP_REALPATH 16 |
| 55 |
|
#define SSH2_FXP_STAT 17 |
| 56 |
|
#define SSH2_FXP_RENAME 18 |
| 57 |
|
#define SSH2_FXP_READLINK 19 |
| 58 |
|
#define SSH2_FXP_SYMLINK 20 |
| 59 |
|
|
| 60 |
|
/* server to client */ |
| 61 |
|
#define SSH2_FXP_VERSION 2 |
| 62 |
|
#define SSH2_FXP_STATUS 101 |
| 63 |
|
#define SSH2_FXP_HANDLE 102 |
| 64 |
|
#define SSH2_FXP_DATA 103 |
| 65 |
|
#define SSH2_FXP_NAME 104 |
| 66 |
|
#define SSH2_FXP_ATTRS 105 |
| 67 |
|
|
| 68 |
|
#define SSH2_FXP_EXTENDED 200 |
| 69 |
|
#define SSH2_FXP_EXTENDED_REPLY 201 |
| 70 |
|
|
| 71 |
|
/* attributes */ |
| 72 |
|
#define SSH2_FILEXFER_ATTR_SIZE 0x00000001 |
| 73 |
|
#define SSH2_FILEXFER_ATTR_UIDGID 0x00000002 |
| 74 |
|
#define SSH2_FILEXFER_ATTR_PERMISSIONS 0x00000004 |
| 75 |
|
#define SSH2_FILEXFER_ATTR_ACMODTIME 0x00000008 |
| 76 |
|
#define SSH2_FILEXFER_ATTR_EXTENDED 0x80000000 |
| 77 |
|
|
| 78 |
|
/* portable open modes */ |
| 79 |
|
#define SSH2_FXF_READ 0x00000001 |
| 80 |
|
#define SSH2_FXF_WRITE 0x00000002 |
| 81 |
|
#define SSH2_FXF_APPEND 0x00000004 |
| 82 |
|
#define SSH2_FXF_CREAT 0x00000008 |
| 83 |
|
#define SSH2_FXF_TRUNC 0x00000010 |
| 84 |
|
#define SSH2_FXF_EXCL 0x00000020 |
| 85 |
|
|
| 86 |
|
/* statvfs@openssh.com f_flag flags */ |
| 87 |
|
#define SSH2_FXE_STATVFS_ST_RDONLY 0x00000001 |
| 88 |
|
#define SSH2_FXE_STATVFS_ST_NOSUID 0x00000002 |
| 89 |
|
|
| 90 |
|
/* status messages */ |
| 91 |
|
#define SSH2_FX_OK 0 |
| 92 |
|
#define SSH2_FX_EOF 1 |
| 93 |
|
#define SSH2_FX_NO_SUCH_FILE 2 |
| 94 |
|
#define SSH2_FX_PERMISSION_DENIED 3 |
| 95 |
|
#define SSH2_FX_FAILURE 4 |
| 96 |
|
#define SSH2_FX_BAD_MESSAGE 5 |
| 97 |
|
#define SSH2_FX_NO_CONNECTION 6 |
| 98 |
|
#define SSH2_FX_CONNECTION_LOST 7 |
| 99 |
|
#define SSH2_FX_OP_UNSUPPORTED 8 |
| 100 |
|
#define SSH2_FX_MAX 8 |
| 101 |
|
|
| 102 |
|
|
| 103 |
|
void sftp_do_init(PTInstVar pvar, Channel_t *c); |
| 104 |
|
void sftp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen); |
| 105 |
|
|
| 106 |
#endif |
#endif |