1 /* 2 * Copyright 2009,2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__HPKG__HPKG_DEFS_H_ 6 #define _PACKAGE__HPKG__HPKG_DEFS_H_ 7 8 9 #include <SupportDefs.h> 10 11 12 namespace BPackageKit { 13 14 namespace BHPKG { 15 16 17 // magic & version of package and repository files 18 enum { 19 B_HPKG_MAGIC = 'hpkg', 20 B_HPKG_VERSION = 1, 21 // 22 B_HPKG_REPO_MAGIC = 'hpkr', 23 B_HPKG_REPO_VERSION = 1 24 }; 25 26 27 // attribute types 28 enum { 29 // types 30 B_HPKG_ATTRIBUTE_TYPE_INVALID = 0, 31 B_HPKG_ATTRIBUTE_TYPE_INT = 1, 32 B_HPKG_ATTRIBUTE_TYPE_UINT = 2, 33 B_HPKG_ATTRIBUTE_TYPE_STRING = 3, 34 B_HPKG_ATTRIBUTE_TYPE_RAW = 4, 35 // 36 B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT 37 }; 38 39 40 // attribute encodings 41 enum { 42 // signed/unsigned int encodings 43 B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT = 0, 44 B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT = 1, 45 B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT = 2, 46 B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT = 3, 47 48 // string encodings 49 B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE = 0, 50 // null-terminated string 51 B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE = 1, 52 // unsigned LEB128 index into string table 53 54 // raw data encodings 55 B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE = 0, 56 // unsigned LEB128 size, raw bytes 57 B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP = 1 58 // unsigned LEB128 size, unsigned LEB128 offset into the heap 59 }; 60 61 62 // maximum number of bytes of data to be encoded inline; more will be allocated 63 // on the heap 64 #define B_HPKG_MAX_INLINE_DATA_SIZE 8 65 66 67 // name of file containing package information (in package's root folder) 68 #define B_HPKG_PACKAGE_INFO_FILE_NAME ".PackageInfo" 69 70 71 // package attribute IDs 72 enum BHPKGAttributeID { 73 B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY = 0, 74 B_HPKG_ATTRIBUTE_ID_FILE_TYPE = 1, 75 B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS = 2, 76 B_HPKG_ATTRIBUTE_ID_FILE_USER = 3, 77 B_HPKG_ATTRIBUTE_ID_FILE_GROUP = 4, 78 B_HPKG_ATTRIBUTE_ID_FILE_ATIME = 5, 79 B_HPKG_ATTRIBUTE_ID_FILE_MTIME = 6, 80 B_HPKG_ATTRIBUTE_ID_FILE_CRTIME = 7, 81 B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS = 8, 82 B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS = 9, 83 B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS = 10, 84 B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE = 11, 85 B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE = 12, 86 B_HPKG_ATTRIBUTE_ID_DATA = 13, 87 B_HPKG_ATTRIBUTE_ID_DATA_SIZE = 14, 88 B_HPKG_ATTRIBUTE_ID_DATA_COMPRESSION = 15, 89 B_HPKG_ATTRIBUTE_ID_DATA_CHUNK_SIZE = 16, 90 B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH = 17, 91 B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME = 18, 92 B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY = 19, 93 B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION = 20, 94 B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR = 21, 95 B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER = 22, 96 B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS = 23, 97 B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE = 24, 98 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 25, 99 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 26, 100 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 27, 101 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE = 28, 102 B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 29, 103 B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 30, 104 B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31, 105 B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE = 32, 106 B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES = 33, 107 B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS = 34, 108 B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS = 35, 109 B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS = 36, 110 B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES = 37, 111 B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR = 38, 112 B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM = 39, 113 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE = 40, 114 // 115 B_HPKG_ATTRIBUTE_ID_ENUM_COUNT, 116 }; 117 118 119 // compression types 120 enum { 121 B_HPKG_COMPRESSION_NONE = 0, 122 B_HPKG_COMPRESSION_ZLIB = 1 123 }; 124 125 126 // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE) 127 enum { 128 B_HPKG_FILE_TYPE_FILE = 0, 129 B_HPKG_FILE_TYPE_DIRECTORY = 1, 130 B_HPKG_FILE_TYPE_SYMLINK = 2 131 }; 132 133 134 // default values 135 enum { 136 B_HPKG_DEFAULT_FILE_TYPE = B_HPKG_FILE_TYPE_FILE, 137 B_HPKG_DEFAULT_FILE_PERMISSIONS = 0644, 138 B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS = 0755, 139 B_HPKG_DEFAULT_SYMLINK_PERMISSIONS = 0777, 140 B_HPKG_DEFAULT_DATA_COMPRESSION = B_HPKG_COMPRESSION_NONE, 141 B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB = 64 * 1024 142 }; 143 144 145 } // namespace BHPKG 146 147 } // namespace BPackageKit 148 149 150 #endif // _PACKAGE__HPKG__HPKG_DEFS_H_ 151