15fb1c6ffSOliver Tappe /* 2fc0cec53SIngo Weinhold * Copyright 2009-2013, Haiku, Inc. 35fb1c6ffSOliver Tappe * Distributed under the terms of the MIT License. 45fb1c6ffSOliver Tappe */ 55fb1c6ffSOliver Tappe #ifndef _PACKAGE__HPKG__HPKG_DEFS_H_ 65fb1c6ffSOliver Tappe #define _PACKAGE__HPKG__HPKG_DEFS_H_ 75fb1c6ffSOliver Tappe 85fb1c6ffSOliver Tappe 95fb1c6ffSOliver Tappe #include <SupportDefs.h> 105fb1c6ffSOliver Tappe 115fb1c6ffSOliver Tappe 125fb1c6ffSOliver Tappe namespace BPackageKit { 135fb1c6ffSOliver Tappe 145fb1c6ffSOliver Tappe namespace BHPKG { 155fb1c6ffSOliver Tappe 165fb1c6ffSOliver Tappe 17aaf05784SOliver Tappe // magic & version of package and repository files 185fb1c6ffSOliver Tappe enum { 195fb1c6ffSOliver Tappe B_HPKG_MAGIC = 'hpkg', 20fc0cec53SIngo Weinhold B_HPKG_VERSION = 2, 21aaf05784SOliver Tappe // 22aaf05784SOliver Tappe B_HPKG_REPO_MAGIC = 'hpkr', 231f633814SIngo Weinhold B_HPKG_REPO_VERSION = 2 245fb1c6ffSOliver Tappe }; 255fb1c6ffSOliver Tappe 265fb1c6ffSOliver Tappe 27b3211314SIngo Weinhold // package attribute IDs 28b3211314SIngo Weinhold enum BHPKGPackageSectionID { 29b3211314SIngo Weinhold B_HPKG_SECTION_HEADER = 0, 30b3211314SIngo Weinhold B_HPKG_SECTION_HEAP = 1, 31b3211314SIngo Weinhold B_HPKG_SECTION_PACKAGE_TOC = 2, 32b3211314SIngo Weinhold B_HPKG_SECTION_PACKAGE_ATTRIBUTES = 3, 33b3211314SIngo Weinhold B_HPKG_SECTION_REPOSITORY_INFO = 4, 34b3211314SIngo Weinhold // 35b3211314SIngo Weinhold B_HPKG_SECTION_ENUM_COUNT 36b3211314SIngo Weinhold }; 37b3211314SIngo Weinhold 38b3211314SIngo Weinhold 395fb1c6ffSOliver Tappe // attribute types 405fb1c6ffSOliver Tappe enum { 415fb1c6ffSOliver Tappe // types 425fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_INVALID = 0, 435fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_INT = 1, 445fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_UINT = 2, 455fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_STRING = 3, 466f0278cdSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_RAW = 4, 476f0278cdSOliver Tappe // 486f0278cdSOliver Tappe B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT 495fb1c6ffSOliver Tappe }; 505fb1c6ffSOliver Tappe 515fb1c6ffSOliver Tappe 525fb1c6ffSOliver Tappe // attribute encodings 535fb1c6ffSOliver Tappe enum { 545fb1c6ffSOliver Tappe // signed/unsigned int encodings 555fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT = 0, 565fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT = 1, 575fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT = 2, 585fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT = 3, 595fb1c6ffSOliver Tappe 605fb1c6ffSOliver Tappe // string encodings 615fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE = 0, 625fb1c6ffSOliver Tappe // null-terminated string 635fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE = 1, 645fb1c6ffSOliver Tappe // unsigned LEB128 index into string table 655fb1c6ffSOliver Tappe 665fb1c6ffSOliver Tappe // raw data encodings 675fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE = 0, 685fb1c6ffSOliver Tappe // unsigned LEB128 size, raw bytes 695fb1c6ffSOliver Tappe B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP = 1 705fb1c6ffSOliver Tappe // unsigned LEB128 size, unsigned LEB128 offset into the heap 715fb1c6ffSOliver Tappe }; 725fb1c6ffSOliver Tappe 735fb1c6ffSOliver Tappe 745fb1c6ffSOliver Tappe // maximum number of bytes of data to be encoded inline; more will be allocated 755fb1c6ffSOliver Tappe // on the heap 76171fd58cSIngo Weinhold enum { 77171fd58cSIngo Weinhold B_HPKG_MAX_INLINE_DATA_SIZE = 8 78171fd58cSIngo Weinhold }; 795fb1c6ffSOliver Tappe 805fb1c6ffSOliver Tappe 815fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder) 82171fd58cSIngo Weinhold extern const char* const B_HPKG_PACKAGE_INFO_FILE_NAME; 835fb1c6ffSOliver Tappe 845fb1c6ffSOliver Tappe 856f0278cdSOliver Tappe // package attribute IDs 8633bc4425SOliver Tappe enum BHPKGAttributeID { 8733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY = 0, 8833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_TYPE = 1, 8933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS = 2, 9033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_USER = 3, 9133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_GROUP = 4, 9233bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATIME = 5, 9333bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_MTIME = 6, 9433bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_CRTIME = 7, 9533bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS = 8, 9633bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS = 9, 9733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS = 10, 9833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE = 11, 9933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE = 12, 10033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DATA = 13, 1011f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH = 14, 1021f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME = 15, 1031f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY = 16, 1041f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION = 17, 1051f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR = 18, 1061f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER = 19, 1071f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS = 20, 1081f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE = 21, 1091f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 22, 1101f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 23, 1111f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 24, 1121f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION = 25, 1131f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 26, 1141f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 27, 1151f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 28, 1161f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES = 29, 1171f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS = 30, 1181f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS = 31, 1191f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS = 32, 1201f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES = 33, 1211f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR = 34, 1221f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM = 35, 1231f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE = 36, 1241f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE = 37, 1251f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_URL = 38, 1261f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL = 39, 1271f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_INSTALL_PATH = 40, 1281f633814SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_BASE_PACKAGE = 41, 1296f0278cdSOliver Tappe // 13033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_ENUM_COUNT, 1316f0278cdSOliver Tappe }; 1326f0278cdSOliver Tappe 1336f0278cdSOliver Tappe 134aaf05784SOliver Tappe // compression types 135aaf05784SOliver Tappe enum { 136aaf05784SOliver Tappe B_HPKG_COMPRESSION_NONE = 0, 137aaf05784SOliver Tappe B_HPKG_COMPRESSION_ZLIB = 1 138aaf05784SOliver Tappe }; 139aaf05784SOliver Tappe 140aaf05784SOliver Tappe 14133bc4425SOliver Tappe // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE) 142aaf05784SOliver Tappe enum { 143aaf05784SOliver Tappe B_HPKG_FILE_TYPE_FILE = 0, 144aaf05784SOliver Tappe B_HPKG_FILE_TYPE_DIRECTORY = 1, 145aaf05784SOliver Tappe B_HPKG_FILE_TYPE_SYMLINK = 2 146aaf05784SOliver Tappe }; 147aaf05784SOliver Tappe 148aaf05784SOliver Tappe 1495fb1c6ffSOliver Tappe // default values 1505fb1c6ffSOliver Tappe enum { 151aaf05784SOliver Tappe B_HPKG_DEFAULT_FILE_TYPE = B_HPKG_FILE_TYPE_FILE, 152aaf05784SOliver Tappe B_HPKG_DEFAULT_FILE_PERMISSIONS = 0644, 153aaf05784SOliver Tappe B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS = 0755, 1541f633814SIngo Weinhold B_HPKG_DEFAULT_SYMLINK_PERMISSIONS = 0777 1555fb1c6ffSOliver Tappe }; 1565fb1c6ffSOliver Tappe 1575fb1c6ffSOliver Tappe 158327b38d6SIngo Weinhold // Writer Init() flags 159327b38d6SIngo Weinhold enum { 160327b38d6SIngo Weinhold B_HPKG_WRITER_UPDATE_PACKAGE = 0x01, 161327b38d6SIngo Weinhold // update the package (don't truncate) 162327b38d6SIngo Weinhold B_HPKG_WRITER_FORCE_ADD = 0x02, 163327b38d6SIngo Weinhold // when updating a pre-existing entry, don't fail, but replace the 164327b38d6SIngo Weinhold // entry, if possible (directories will be merged, but won't replace a 165327b38d6SIngo Weinhold // non-directory) 166327b38d6SIngo Weinhold }; 167327b38d6SIngo Weinhold 168327b38d6SIngo Weinhold 169*796343edSIngo Weinhold enum { 170*796343edSIngo Weinhold B_HPKG_COMPRESSION_LEVEL_NONE = 0, 171*796343edSIngo Weinhold B_HPKG_COMPRESSION_LEVEL_FASTEST = 1, 172*796343edSIngo Weinhold B_HPKG_COMPRESSION_LEVEL_BEST = 9 173*796343edSIngo Weinhold }; 174*796343edSIngo Weinhold 175*796343edSIngo Weinhold 1765fb1c6ffSOliver Tappe } // namespace BHPKG 1775fb1c6ffSOliver Tappe 1785fb1c6ffSOliver Tappe } // namespace BPackageKit 1795fb1c6ffSOliver Tappe 1805fb1c6ffSOliver Tappe 1815fb1c6ffSOliver Tappe #endif // _PACKAGE__HPKG__HPKG_DEFS_H_ 182