xref: /titanic_44/usr/src/cmd/ssh/include/sftp-common.h (revision 90685d2c52744c6540828f16cdd2db815d467e37)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 Damien Miller.  All rights reserved.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
67c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
77c478bd9Sstevel@tonic-gate  * are met:
87c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
97c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
107c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
117c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
127c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
157c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
167c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
177c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
187c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
197c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
207c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
217c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
227c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
237c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
26*90685d2cSjp161948 #ifndef	_SFTP_COMMON_H
27*90685d2cSjp161948 #define	_SFTP_COMMON_H
28*90685d2cSjp161948 
29*90685d2cSjp161948 /* $OpenBSD: sftp-common.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */
30*90685d2cSjp161948 
31*90685d2cSjp161948 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*90685d2cSjp161948 
33*90685d2cSjp161948 #ifdef __cplusplus
34*90685d2cSjp161948 extern "C" {
35*90685d2cSjp161948 #endif
36*90685d2cSjp161948 
37*90685d2cSjp161948 /* Maximum packet that we are willing to send/accept */
38*90685d2cSjp161948 #define	SFTP_MAX_MSG_LENGTH	(256 * 1024)
39*90685d2cSjp161948 
407c478bd9Sstevel@tonic-gate typedef struct Attrib Attrib;
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /* File attributes */
437c478bd9Sstevel@tonic-gate struct Attrib {
447c478bd9Sstevel@tonic-gate 	u_int32_t	flags;
457c478bd9Sstevel@tonic-gate 	u_int64_t	size;
467c478bd9Sstevel@tonic-gate 	u_int32_t	uid;
477c478bd9Sstevel@tonic-gate 	u_int32_t	gid;
487c478bd9Sstevel@tonic-gate 	u_int32_t	perm;
497c478bd9Sstevel@tonic-gate 	u_int32_t	atime;
507c478bd9Sstevel@tonic-gate 	u_int32_t	mtime;
517c478bd9Sstevel@tonic-gate };
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate void	 attrib_clear(Attrib *);
54*90685d2cSjp161948 void	 stat_to_attrib(const struct stat *, Attrib *);
55*90685d2cSjp161948 void	 attrib_to_stat(const Attrib *, struct stat *);
567c478bd9Sstevel@tonic-gate Attrib	*decode_attrib(Buffer *);
57*90685d2cSjp161948 void	 encode_attrib(Buffer *, const Attrib *);
58*90685d2cSjp161948 char	*ls_file(const char *, const struct stat *, int);
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate const char *fx2txt(int);
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #ifdef __cplusplus
637c478bd9Sstevel@tonic-gate }
647c478bd9Sstevel@tonic-gate #endif
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate #endif /* _SFTP_COMMON_H */
67