10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * Copyright (c) 2001 Markus Friedl. All rights reserved. 30Sstevel@tonic-gate * Copyright (c) 2001 Damien Miller. All rights reserved. 40Sstevel@tonic-gate * 50Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 60Sstevel@tonic-gate * modification, are permitted provided that the following conditions 70Sstevel@tonic-gate * are met: 80Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 90Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 100Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 110Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 120Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 150Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 160Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 170Sstevel@tonic-gate * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 180Sstevel@tonic-gate * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 190Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 200Sstevel@tonic-gate * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 210Sstevel@tonic-gate * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 220Sstevel@tonic-gate * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 230Sstevel@tonic-gate * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 26*5087Sjp161948 #ifndef _SFTP_COMMON_H 27*5087Sjp161948 #define _SFTP_COMMON_H 28*5087Sjp161948 29*5087Sjp161948 /* $OpenBSD: sftp-common.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */ 30*5087Sjp161948 31*5087Sjp161948 #pragma ident "%Z%%M% %I% %E% SMI" 32*5087Sjp161948 33*5087Sjp161948 #ifdef __cplusplus 34*5087Sjp161948 extern "C" { 35*5087Sjp161948 #endif 36*5087Sjp161948 37*5087Sjp161948 /* Maximum packet that we are willing to send/accept */ 38*5087Sjp161948 #define SFTP_MAX_MSG_LENGTH (256 * 1024) 39*5087Sjp161948 400Sstevel@tonic-gate typedef struct Attrib Attrib; 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* File attributes */ 430Sstevel@tonic-gate struct Attrib { 440Sstevel@tonic-gate u_int32_t flags; 450Sstevel@tonic-gate u_int64_t size; 460Sstevel@tonic-gate u_int32_t uid; 470Sstevel@tonic-gate u_int32_t gid; 480Sstevel@tonic-gate u_int32_t perm; 490Sstevel@tonic-gate u_int32_t atime; 500Sstevel@tonic-gate u_int32_t mtime; 510Sstevel@tonic-gate }; 520Sstevel@tonic-gate 530Sstevel@tonic-gate void attrib_clear(Attrib *); 54*5087Sjp161948 void stat_to_attrib(const struct stat *, Attrib *); 55*5087Sjp161948 void attrib_to_stat(const Attrib *, struct stat *); 560Sstevel@tonic-gate Attrib *decode_attrib(Buffer *); 57*5087Sjp161948 void encode_attrib(Buffer *, const Attrib *); 58*5087Sjp161948 char *ls_file(const char *, const struct stat *, int); 590Sstevel@tonic-gate 600Sstevel@tonic-gate const char *fx2txt(int); 610Sstevel@tonic-gate 620Sstevel@tonic-gate #ifdef __cplusplus 630Sstevel@tonic-gate } 640Sstevel@tonic-gate #endif 650Sstevel@tonic-gate 660Sstevel@tonic-gate #endif /* _SFTP_COMMON_H */ 67