xref: /titanic_50/usr/src/cmd/ssh/include/sftp.h (revision 6f8d59d8fcaf391990ca04c7bdcf65ab23320fe0)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
57c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
67c478bd9Sstevel@tonic-gate  * are met:
77c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
87c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
97c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
107c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
117c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
147c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
157c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
167c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
177c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
187c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
197c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
207c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
217c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
227c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
25*6f8d59d8SJan Pechanec /*	$OpenBSD: sftp.h,v 1.4 2002/02/13 00:59:23 djm Exp $	*/
26*6f8d59d8SJan Pechanec 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * draft-ietf-secsh-filexfer-01.txt
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
31*6f8d59d8SJan Pechanec #ifndef	_SFTP_H
32*6f8d59d8SJan Pechanec #define	_SFTP_H
33*6f8d59d8SJan Pechanec 
34*6f8d59d8SJan Pechanec #ifdef __cplusplus
35*6f8d59d8SJan Pechanec extern "C" {
36*6f8d59d8SJan Pechanec #endif
37*6f8d59d8SJan Pechanec 
387c478bd9Sstevel@tonic-gate /* version */
397c478bd9Sstevel@tonic-gate #define	SSH2_FILEXFER_VERSION		3
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /* client to server */
427c478bd9Sstevel@tonic-gate #define SSH2_FXP_INIT			1
437c478bd9Sstevel@tonic-gate #define SSH2_FXP_OPEN			3
447c478bd9Sstevel@tonic-gate #define SSH2_FXP_CLOSE			4
457c478bd9Sstevel@tonic-gate #define SSH2_FXP_READ			5
467c478bd9Sstevel@tonic-gate #define SSH2_FXP_WRITE			6
477c478bd9Sstevel@tonic-gate #define SSH2_FXP_LSTAT			7
487c478bd9Sstevel@tonic-gate #define SSH2_FXP_STAT_VERSION_0		7
497c478bd9Sstevel@tonic-gate #define SSH2_FXP_FSTAT			8
507c478bd9Sstevel@tonic-gate #define SSH2_FXP_SETSTAT		9
517c478bd9Sstevel@tonic-gate #define SSH2_FXP_FSETSTAT		10
527c478bd9Sstevel@tonic-gate #define SSH2_FXP_OPENDIR		11
537c478bd9Sstevel@tonic-gate #define SSH2_FXP_READDIR		12
547c478bd9Sstevel@tonic-gate #define SSH2_FXP_REMOVE			13
557c478bd9Sstevel@tonic-gate #define SSH2_FXP_MKDIR			14
567c478bd9Sstevel@tonic-gate #define SSH2_FXP_RMDIR			15
577c478bd9Sstevel@tonic-gate #define SSH2_FXP_REALPATH		16
587c478bd9Sstevel@tonic-gate #define SSH2_FXP_STAT			17
597c478bd9Sstevel@tonic-gate #define SSH2_FXP_RENAME			18
607c478bd9Sstevel@tonic-gate #define SSH2_FXP_READLINK		19
617c478bd9Sstevel@tonic-gate #define SSH2_FXP_SYMLINK		20
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /* server to client */
647c478bd9Sstevel@tonic-gate #define SSH2_FXP_VERSION		2
657c478bd9Sstevel@tonic-gate #define SSH2_FXP_STATUS			101
667c478bd9Sstevel@tonic-gate #define SSH2_FXP_HANDLE			102
677c478bd9Sstevel@tonic-gate #define SSH2_FXP_DATA			103
687c478bd9Sstevel@tonic-gate #define SSH2_FXP_NAME			104
697c478bd9Sstevel@tonic-gate #define SSH2_FXP_ATTRS			105
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define SSH2_FXP_EXTENDED		200
727c478bd9Sstevel@tonic-gate #define SSH2_FXP_EXTENDED_REPLY		201
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /* attributes */
757c478bd9Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_SIZE		0x00000001
767c478bd9Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_UIDGID	0x00000002
777c478bd9Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_PERMISSIONS	0x00000004
787c478bd9Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_ACMODTIME	0x00000008
797c478bd9Sstevel@tonic-gate #define SSH2_FILEXFER_ATTR_EXTENDED	0x80000000
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /* portable open modes */
827c478bd9Sstevel@tonic-gate #define SSH2_FXF_READ			0x00000001
837c478bd9Sstevel@tonic-gate #define SSH2_FXF_WRITE			0x00000002
847c478bd9Sstevel@tonic-gate #define SSH2_FXF_APPEND			0x00000004
857c478bd9Sstevel@tonic-gate #define SSH2_FXF_CREAT			0x00000008
867c478bd9Sstevel@tonic-gate #define SSH2_FXF_TRUNC			0x00000010
877c478bd9Sstevel@tonic-gate #define SSH2_FXF_EXCL			0x00000020
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /* status messages */
907c478bd9Sstevel@tonic-gate #define SSH2_FX_OK			0
917c478bd9Sstevel@tonic-gate #define SSH2_FX_EOF			1
927c478bd9Sstevel@tonic-gate #define SSH2_FX_NO_SUCH_FILE		2
937c478bd9Sstevel@tonic-gate #define SSH2_FX_PERMISSION_DENIED	3
947c478bd9Sstevel@tonic-gate #define SSH2_FX_FAILURE			4
957c478bd9Sstevel@tonic-gate #define SSH2_FX_BAD_MESSAGE		5
967c478bd9Sstevel@tonic-gate #define SSH2_FX_NO_CONNECTION		6
977c478bd9Sstevel@tonic-gate #define SSH2_FX_CONNECTION_LOST		7
987c478bd9Sstevel@tonic-gate #define SSH2_FX_OP_UNSUPPORTED		8
997c478bd9Sstevel@tonic-gate #define SSH2_FX_MAX			8
1007c478bd9Sstevel@tonic-gate 
101*6f8d59d8SJan Pechanec struct passwd;
102*6f8d59d8SJan Pechanec 
103*6f8d59d8SJan Pechanec int	sftp_server_main(int, char **, struct passwd *);
104*6f8d59d8SJan Pechanec 
1057c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #endif /* _SFTP_H */
110