1 /** 2 * @file libcomprex/types.h Type definitions. 3 * 4 * $Id: types.h,v 1.10 2003/01/01 06:22:36 chipx86 Exp $ 5 * 6 * @Copyright (C) 2001-2003 The GNUpdate Project. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public 19 * License along with this library; if not, write to the 20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 * Boston, MA 02111-1307, USA. 22 */ 23 #ifndef _LIBCOMPREX_TYPES_H_ 24 #define _LIBCOMPREX_TYPES_H_ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /** 31 * A status result. 32 */ 33 typedef enum 34 { 35 CX_SUCCESS, /**< Operation completed successfully. */ 36 CX_NOT_SUPPORTED, /**< The feature is not supported in that module. */ 37 CX_INVALID_FORMAT, /**< Invalid file format. */ 38 CX_ERROR, /**< Fatal error. */ 39 CX_FILE_NOT_FOUND, /**< File not found. */ 40 CX_READ_ONLY, /**< The file is read-only. */ 41 CX_INVALID_VERSION, /**< Invalid or unsupported archive version. */ 42 CX_EOF, /**< End of file. */ 43 CX_CORRUPT /**< Corruption. */ 44 45 } CxStatus; 46 47 /** 48 * The access mode used when opening a file or archive. 49 */ 50 typedef enum 51 { 52 /** Don't handle compression/decompression with the file. */ 53 CX_MODE_RAW = 0x01, 54 55 /** Allows reading and writing to files. */ 56 CX_MODE_READ_WRITE = 0x02, 57 58 /** Allows reading, but not writing, of files. */ 59 CX_MODE_READ_ONLY = 0x04, 60 61 /** An error has occurred. Most likely, the specified file is NULL. */ 62 CX_MODE_ERROR = 0xFF 63 64 } CxAccessMode; 65 66 /** 67 * An archive type. 68 */ 69 typedef enum 70 { 71 CX_ARCHIVE_SINGLE, /**< Single-file archives. */ 72 CX_ARCHIVE_MULTI, /**< Multi-file archives. */ 73 CX_ARCHIVE_UNKNOWN /**< Unknown archive type (usually an error). */ 74 75 } CxArchiveType; 76 77 /** 78 * @name Access mode macros 79 */ 80 /*@{*/ 81 #define CX_IS_MODE_RAW(mode) \ 82 (((mode) & CX_MODE_RAW) == CX_MODE_RAW) 83 84 #define CX_IS_MODE_READ_WRITE(mode) \ 85 (((mode) & CX_MODE_READ_WRITE) == CX_MODE_READ_WRITE) 86 87 #define CX_IS_MODE_READ_ONLY(mode) \ 88 (((mode) & CX_MODE_READ_ONLY) == CX_MODE_READ_ONLY) 89 90 /*@}*/ 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif /* _LIBCOMPREX_TYPES_H_ */ 97 98