1204917Sdes/* $OpenBSD: sftp-common.h,v 1.11 2010/01/13 01:40:16 djm Exp $ */
276259Sgreen
376259Sgreen/*
476259Sgreen * Copyright (c) 2001 Markus Friedl.  All rights reserved.
576259Sgreen * Copyright (c) 2001 Damien Miller.  All rights reserved.
676259Sgreen *
776259Sgreen * Redistribution and use in source and binary forms, with or without
876259Sgreen * modification, are permitted provided that the following conditions
976259Sgreen * are met:
1076259Sgreen * 1. Redistributions of source code must retain the above copyright
1176259Sgreen *    notice, this list of conditions and the following disclaimer.
1276259Sgreen * 2. Redistributions in binary form must reproduce the above copyright
1376259Sgreen *    notice, this list of conditions and the following disclaimer in the
1476259Sgreen *    documentation and/or other materials provided with the distribution.
1576259Sgreen *
1676259Sgreen * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1776259Sgreen * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1876259Sgreen * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1976259Sgreen * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2076259Sgreen * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2176259Sgreen * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2276259Sgreen * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2376259Sgreen * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2476259Sgreen * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2576259Sgreen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2676259Sgreen */
2776259Sgreen
28157016Sdes/* Maximum packet that we are willing to send/accept */
29157016Sdes#define SFTP_MAX_MSG_LENGTH	(256 * 1024)
30157016Sdes
3176259Sgreentypedef struct Attrib Attrib;
3276259Sgreen
3376259Sgreen/* File attributes */
3476259Sgreenstruct Attrib {
3576259Sgreen	u_int32_t	flags;
3676259Sgreen	u_int64_t	size;
3776259Sgreen	u_int32_t	uid;
3876259Sgreen	u_int32_t	gid;
3976259Sgreen	u_int32_t	perm;
4076259Sgreen	u_int32_t	atime;
4176259Sgreen	u_int32_t	mtime;
4276259Sgreen};
4376259Sgreen
4492555Sdesvoid	 attrib_clear(Attrib *);
45126274Sdesvoid	 stat_to_attrib(const struct stat *, Attrib *);
46126274Sdesvoid	 attrib_to_stat(const Attrib *, struct stat *);
4792555SdesAttrib	*decode_attrib(Buffer *);
48126274Sdesvoid	 encode_attrib(Buffer *, const Attrib *);
49204917Sdeschar	*ls_file(const char *, const struct stat *, int, int);
5076259Sgreen
5192555Sdesconst char *fx2txt(int);
52