1 /* 2 * Copyright 2009,2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__HPKG__V1__HPKG_DEFS_H_ 6 #define _PACKAGE__HPKG__V1__HPKG_DEFS_H_ 7 8 9 #include <SupportDefs.h> 10 11 12 namespace BPackageKit { 13 14 namespace BHPKG { 15 16 namespace V1 { 17 18 19 // magic & version of package and repository files 20 enum { 21 B_HPKG_MAGIC = 'hpkg', 22 B_HPKG_VERSION = 1, 23 // 24 B_HPKG_REPO_MAGIC = 'hpkr', 25 B_HPKG_REPO_VERSION = 1 26 }; 27 28 29 // package attribute IDs 30 enum BHPKGPackageSectionID { 31 B_HPKG_SECTION_HEADER = 0, 32 B_HPKG_SECTION_HEAP = 1, 33 B_HPKG_SECTION_PACKAGE_TOC = 2, 34 B_HPKG_SECTION_PACKAGE_ATTRIBUTES = 3, 35 B_HPKG_SECTION_REPOSITORY_INFO = 4, 36 // 37 B_HPKG_SECTION_ENUM_COUNT 38 }; 39 40 41 // attribute types 42 enum { 43 // types 44 B_HPKG_ATTRIBUTE_TYPE_INVALID = 0, 45 B_HPKG_ATTRIBUTE_TYPE_INT = 1, 46 B_HPKG_ATTRIBUTE_TYPE_UINT = 2, 47 B_HPKG_ATTRIBUTE_TYPE_STRING = 3, 48 B_HPKG_ATTRIBUTE_TYPE_RAW = 4, 49 // 50 B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT 51 }; 52 53 54 // attribute encodings 55 enum { 56 // signed/unsigned int encodings 57 B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT = 0, 58 B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT = 1, 59 B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT = 2, 60 B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT = 3, 61 62 // string encodings 63 B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE = 0, 64 // null-terminated string 65 B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE = 1, 66 // unsigned LEB128 index into string table 67 68 // raw data encodings 69 B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE = 0, 70 // unsigned LEB128 size, raw bytes 71 B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP = 1 72 // unsigned LEB128 size, unsigned LEB128 offset into the heap 73 }; 74 75 76 // maximum number of bytes of data to be encoded inline; more will be allocated 77 // on the heap 78 enum { 79 B_HPKG_MAX_INLINE_DATA_SIZE = 8 80 }; 81 82 83 // name of file containing package information (in package's root folder) 84 extern const char* const B_HPKG_PACKAGE_INFO_FILE_NAME; 85 86 87 // package attribute IDs 88 enum BHPKGAttributeID { 89 B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY = 0, 90 B_HPKG_ATTRIBUTE_ID_FILE_TYPE = 1, 91 B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS = 2, 92 B_HPKG_ATTRIBUTE_ID_FILE_USER = 3, 93 B_HPKG_ATTRIBUTE_ID_FILE_GROUP = 4, 94 B_HPKG_ATTRIBUTE_ID_FILE_ATIME = 5, 95 B_HPKG_ATTRIBUTE_ID_FILE_MTIME = 6, 96 B_HPKG_ATTRIBUTE_ID_FILE_CRTIME = 7, 97 B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS = 8, 98 B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS = 9, 99 B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS = 10, 100 B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE = 11, 101 B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE = 12, 102 B_HPKG_ATTRIBUTE_ID_DATA = 13, 103 B_HPKG_ATTRIBUTE_ID_DATA_SIZE = 14, 104 B_HPKG_ATTRIBUTE_ID_DATA_COMPRESSION = 15, 105 B_HPKG_ATTRIBUTE_ID_DATA_CHUNK_SIZE = 16, 106 B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH = 17, 107 B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME = 18, 108 B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY = 19, 109 B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION = 20, 110 B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR = 21, 111 B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER = 22, 112 B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS = 23, 113 B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE = 24, 114 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 25, 115 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 26, 116 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 27, 117 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION = 28, 118 B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 29, 119 B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 30, 120 B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31, 121 B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE = 32, 122 B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES = 33, 123 B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS = 34, 124 B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS = 35, 125 B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS = 36, 126 B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES = 37, 127 B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR = 38, 128 B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM = 39, 129 B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE = 40, 130 B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE = 41, 131 B_HPKG_ATTRIBUTE_ID_PACKAGE_URL = 42, 132 B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL = 43, 133 B_HPKG_ATTRIBUTE_ID_PACKAGE_INSTALL_PATH = 44, 134 // 135 B_HPKG_ATTRIBUTE_ID_ENUM_COUNT, 136 }; 137 138 139 // compression types 140 enum { 141 B_HPKG_COMPRESSION_NONE = 0, 142 B_HPKG_COMPRESSION_ZLIB = 1 143 }; 144 145 146 // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE) 147 enum { 148 B_HPKG_FILE_TYPE_FILE = 0, 149 B_HPKG_FILE_TYPE_DIRECTORY = 1, 150 B_HPKG_FILE_TYPE_SYMLINK = 2 151 }; 152 153 154 // default values 155 enum { 156 B_HPKG_DEFAULT_FILE_TYPE = B_HPKG_FILE_TYPE_FILE, 157 B_HPKG_DEFAULT_FILE_PERMISSIONS = 0644, 158 B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS = 0755, 159 B_HPKG_DEFAULT_SYMLINK_PERMISSIONS = 0777, 160 B_HPKG_DEFAULT_DATA_COMPRESSION = B_HPKG_COMPRESSION_NONE, 161 B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB = 64 * 1024 162 }; 163 164 165 // Writer Init() flags 166 enum { 167 B_HPKG_WRITER_UPDATE_PACKAGE = 0x01, 168 // update the package (don't truncate) 169 B_HPKG_WRITER_FORCE_ADD = 0x02, 170 // when updating a pre-existing entry, don't fail, but replace the 171 // entry, if possible (directories will be merged, but won't replace a 172 // non-directory) 173 }; 174 175 176 } // namespace V1 177 178 } // namespace BHPKG 179 180 } // namespace BPackageKit 181 182 183 #endif // _PACKAGE__HPKG__V1__HPKG_DEFS_H_ 184