xref: /onnv-gate/usr/src/cmd/ssh/include/sftp.h (revision 9139:84e06a454b4b)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
50Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
60Sstevel@tonic-gate  * are met:
70Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
80Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
90Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
100Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
110Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
140Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
150Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
160Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
170Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
180Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
190Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
200Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
210Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
220Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
25*9139SJan.Pechanec@Sun.COM /*	$OpenBSD: sftp.h,v 1.4 2002/02/13 00:59:23 djm Exp $	*/
26*9139SJan.Pechanec@Sun.COM 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  * draft-ietf-secsh-filexfer-01.txt
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
31*9139SJan.Pechanec@Sun.COM #ifndef	_SFTP_H
32*9139SJan.Pechanec@Sun.COM #define	_SFTP_H
33*9139SJan.Pechanec@Sun.COM 
34*9139SJan.Pechanec@Sun.COM #ifdef __cplusplus
35*9139SJan.Pechanec@Sun.COM extern "C" {
36*9139SJan.Pechanec@Sun.COM #endif
37*9139SJan.Pechanec@Sun.COM 
380Sstevel@tonic-gate /* version */
390Sstevel@tonic-gate #define	SSH2_FILEXFER_VERSION		3
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /* client to server */
420Sstevel@tonic-gate #define SSH2_FXP_INIT			1
430Sstevel@tonic-gate #define SSH2_FXP_OPEN			3
440Sstevel@tonic-gate #define SSH2_FXP_CLOSE			4
450Sstevel@tonic-gate #define SSH2_FXP_READ			5
460Sstevel@tonic-gate #define SSH2_FXP_WRITE			6
470Sstevel@tonic-gate #define SSH2_FXP_LSTAT			7
480Sstevel@tonic-gate #define SSH2_FXP_STAT_VERSION_0		7
490Sstevel@tonic-gate #define SSH2_FXP_FSTAT			8
500Sstevel@tonic-gate #define SSH2_FXP_SETSTAT		9
510Sstevel@tonic-gate #define SSH2_FXP_FSETSTAT		10
520Sstevel@tonic-gate #define SSH2_FXP_OPENDIR		11
530Sstevel@tonic-gate #define SSH2_FXP_READDIR		12
540Sstevel@tonic-gate #define SSH2_FXP_REMOVE			13
550Sstevel@tonic-gate #define SSH2_FXP_MKDIR			14
560Sstevel@tonic-gate #define SSH2_FXP_RMDIR			15
570Sstevel@tonic-gate #define SSH2_FXP_REALPATH		16
580Sstevel@tonic-gate #define SSH2_FXP_STAT			17
590Sstevel@tonic-gate #define SSH2_FXP_RENAME			18
600Sstevel@tonic-gate #define SSH2_FXP_READLINK		19
610Sstevel@tonic-gate #define SSH2_FXP_SYMLINK		20
620Sstevel@tonic-gate 
630Sstevel@tonic-gate /* server to client */
640Sstevel@tonic-gate #define SSH2_FXP_VERSION		2
650Sstevel@tonic-gate #define SSH2_FXP_STATUS			101
660Sstevel@tonic-gate #define SSH2_FXP_HANDLE			102
670Sstevel@tonic-gate #define SSH2_FXP_DATA			103
680Sstevel@tonic-gate #define SSH2_FXP_NAME			104
690Sstevel@tonic-gate #define SSH2_FXP_ATTRS			105
700Sstevel@tonic-gate 
710Sstevel@tonic-gate #define SSH2_FXP_EXTENDED		200
720Sstevel@tonic-gate #define SSH2_FXP_EXTENDED_REPLY		201
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /* attributes */
750Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_SIZE		0x00000001
760Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_UIDGID	0x00000002
770Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_PERMISSIONS	0x00000004
780Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_ACMODTIME	0x00000008
790Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_EXTENDED	0x80000000
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /* portable open modes */
820Sstevel@tonic-gate #define SSH2_FXF_READ			0x00000001
830Sstevel@tonic-gate #define SSH2_FXF_WRITE			0x00000002
840Sstevel@tonic-gate #define SSH2_FXF_APPEND			0x00000004
850Sstevel@tonic-gate #define SSH2_FXF_CREAT			0x00000008
860Sstevel@tonic-gate #define SSH2_FXF_TRUNC			0x00000010
870Sstevel@tonic-gate #define SSH2_FXF_EXCL			0x00000020
880Sstevel@tonic-gate 
890Sstevel@tonic-gate /* status messages */
900Sstevel@tonic-gate #define SSH2_FX_OK			0
910Sstevel@tonic-gate #define SSH2_FX_EOF			1
920Sstevel@tonic-gate #define SSH2_FX_NO_SUCH_FILE		2
930Sstevel@tonic-gate #define SSH2_FX_PERMISSION_DENIED	3
940Sstevel@tonic-gate #define SSH2_FX_FAILURE			4
950Sstevel@tonic-gate #define SSH2_FX_BAD_MESSAGE		5
960Sstevel@tonic-gate #define SSH2_FX_NO_CONNECTION		6
970Sstevel@tonic-gate #define SSH2_FX_CONNECTION_LOST		7
980Sstevel@tonic-gate #define SSH2_FX_OP_UNSUPPORTED		8
990Sstevel@tonic-gate #define SSH2_FX_MAX			8
1000Sstevel@tonic-gate 
101*9139SJan.Pechanec@Sun.COM struct passwd;
102*9139SJan.Pechanec@Sun.COM 
103*9139SJan.Pechanec@Sun.COM int	sftp_server_main(int, char **, struct passwd *);
104*9139SJan.Pechanec@Sun.COM 
1050Sstevel@tonic-gate #ifdef __cplusplus
1060Sstevel@tonic-gate }
1070Sstevel@tonic-gate #endif
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate #endif /* _SFTP_H */
110