1*a6c5e0d9Schristos /* $NetBSD: sftp-common.h,v 1.8 2022/10/05 22:39:36 christos Exp $ */ 2*a6c5e0d9Schristos /* $OpenBSD: sftp-common.h,v 1.13 2022/09/19 10:41:58 djm Exp $ */ 3ca32bd8dSchristos 4ca32bd8dSchristos /* 5ca32bd8dSchristos * Copyright (c) 2001 Markus Friedl. All rights reserved. 6ca32bd8dSchristos * Copyright (c) 2001 Damien Miller. All rights reserved. 7ca32bd8dSchristos * 8ca32bd8dSchristos * Redistribution and use in source and binary forms, with or without 9ca32bd8dSchristos * modification, are permitted provided that the following conditions 10ca32bd8dSchristos * are met: 11ca32bd8dSchristos * 1. Redistributions of source code must retain the above copyright 12ca32bd8dSchristos * notice, this list of conditions and the following disclaimer. 13ca32bd8dSchristos * 2. Redistributions in binary form must reproduce the above copyright 14ca32bd8dSchristos * notice, this list of conditions and the following disclaimer in the 15ca32bd8dSchristos * documentation and/or other materials provided with the distribution. 16ca32bd8dSchristos * 17ca32bd8dSchristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18ca32bd8dSchristos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19ca32bd8dSchristos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20ca32bd8dSchristos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21ca32bd8dSchristos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22ca32bd8dSchristos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23ca32bd8dSchristos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24ca32bd8dSchristos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25ca32bd8dSchristos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26ca32bd8dSchristos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27ca32bd8dSchristos */ 28ca32bd8dSchristos 29ca32bd8dSchristos /* Maximum packet that we are willing to send/accept */ 30ca32bd8dSchristos #define SFTP_MAX_MSG_LENGTH (256 * 1024) 31ca32bd8dSchristos 3251acf88eSchristos struct sshbuf; 33ca32bd8dSchristos typedef struct Attrib Attrib; 34ca32bd8dSchristos 35ca32bd8dSchristos /* File attributes */ 36ca32bd8dSchristos struct Attrib { 37ca32bd8dSchristos u_int32_t flags; 38ca32bd8dSchristos u_int64_t size; 39ca32bd8dSchristos u_int32_t uid; 40ca32bd8dSchristos u_int32_t gid; 41ca32bd8dSchristos u_int32_t perm; 42ca32bd8dSchristos u_int32_t atime; 43ca32bd8dSchristos u_int32_t mtime; 44ca32bd8dSchristos }; 45ca32bd8dSchristos 46ca32bd8dSchristos void attrib_clear(Attrib *); 47ca32bd8dSchristos void stat_to_attrib(const struct stat *, Attrib *); 48ca32bd8dSchristos void attrib_to_stat(const Attrib *, struct stat *); 4951acf88eSchristos int decode_attrib(struct sshbuf *, Attrib *); 5051acf88eSchristos int encode_attrib(struct sshbuf *, const Attrib *); 51*a6c5e0d9Schristos char *ls_file(const char *, const struct stat *, int, int, 52*a6c5e0d9Schristos const char *, const char *); 53ca32bd8dSchristos 54ca32bd8dSchristos const char *fx2txt(int); 55