xref: /openssh-portable/sftp-common.h (revision 7d845f4a)
1*7d845f4aSdjm@openbsd.org /* $OpenBSD: sftp-common.h,v 1.12 2015/01/14 13:54:13 djm Exp $ */
233804263SDamien Miller 
333804263SDamien Miller /*
433804263SDamien Miller  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
533804263SDamien Miller  * Copyright (c) 2001 Damien Miller.  All rights reserved.
633804263SDamien Miller  *
733804263SDamien Miller  * Redistribution and use in source and binary forms, with or without
833804263SDamien Miller  * modification, are permitted provided that the following conditions
933804263SDamien Miller  * are met:
1033804263SDamien Miller  * 1. Redistributions of source code must retain the above copyright
1133804263SDamien Miller  *    notice, this list of conditions and the following disclaimer.
1233804263SDamien Miller  * 2. Redistributions in binary form must reproduce the above copyright
1333804263SDamien Miller  *    notice, this list of conditions and the following disclaimer in the
1433804263SDamien Miller  *    documentation and/or other materials provided with the distribution.
1533804263SDamien Miller  *
1633804263SDamien Miller  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1733804263SDamien Miller  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1833804263SDamien Miller  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1933804263SDamien Miller  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2033804263SDamien Miller  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2133804263SDamien Miller  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2233804263SDamien Miller  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2333804263SDamien Miller  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2433804263SDamien Miller  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2533804263SDamien Miller  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2633804263SDamien Miller  */
2733804263SDamien Miller 
2854446189SDamien Miller /* Maximum packet that we are willing to send/accept */
2954446189SDamien Miller #define SFTP_MAX_MSG_LENGTH	(256 * 1024)
3054446189SDamien Miller 
31*7d845f4aSdjm@openbsd.org struct sshbuf;
3233804263SDamien Miller typedef struct Attrib Attrib;
3333804263SDamien Miller 
3433804263SDamien Miller /* File attributes */
3533804263SDamien Miller struct Attrib {
3633804263SDamien Miller 	u_int32_t	flags;
3733804263SDamien Miller 	u_int64_t	size;
3833804263SDamien Miller 	u_int32_t	uid;
3933804263SDamien Miller 	u_int32_t	gid;
4033804263SDamien Miller 	u_int32_t	perm;
4133804263SDamien Miller 	u_int32_t	atime;
4233804263SDamien Miller 	u_int32_t	mtime;
4333804263SDamien Miller };
4433804263SDamien Miller 
45b4c774cfSBen Lindstrom void	 attrib_clear(Attrib *);
46f58b58ceSDamien Miller void	 stat_to_attrib(const struct stat *, Attrib *);
47f58b58ceSDamien Miller void	 attrib_to_stat(const Attrib *, struct stat *);
48*7d845f4aSdjm@openbsd.org int	 decode_attrib(struct sshbuf *, Attrib *);
49*7d845f4aSdjm@openbsd.org int	 encode_attrib(struct sshbuf *, const Attrib *);
502901e2daSDarren Tucker char	*ls_file(const char *, const struct stat *, int, int);
5133804263SDamien Miller 
52b4c774cfSBen Lindstrom const char *fx2txt(int);
53