xref: /titanic_50/usr/src/cmd/ssh/include/sftp-common.h (revision cd3e933325e68e23516a196a8fea7f49b1e497c3)
1 /*
2  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
3  * Copyright (c) 2001 Damien Miller.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef	_SFTP_COMMON_H
27 #define	_SFTP_COMMON_H
28 
29 /* $OpenBSD: sftp-common.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* Maximum packet that we are willing to send/accept */
38 #define	SFTP_MAX_MSG_LENGTH	(256 * 1024)
39 
40 typedef struct Attrib Attrib;
41 
42 /* File attributes */
43 struct Attrib {
44 	u_int32_t	flags;
45 	u_int64_t	size;
46 	u_int32_t	uid;
47 	u_int32_t	gid;
48 	u_int32_t	perm;
49 	u_int32_t	atime;
50 	u_int32_t	mtime;
51 };
52 
53 void	 attrib_clear(Attrib *);
54 void	 stat_to_attrib(const struct stat *, Attrib *);
55 void	 attrib_to_stat(const Attrib *, struct stat *);
56 Attrib	*decode_attrib(Buffer *);
57 void	 encode_attrib(Buffer *, const Attrib *);
58 char	*ls_file(const char *, const struct stat *, int);
59 
60 const char *fx2txt(int);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* _SFTP_COMMON_H */
67