15fb1c6ffSOliver Tappe /* 295d84e41SOliver Tappe * Copyright 2009,2011, 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', 20aaf05784SOliver Tappe B_HPKG_VERSION = 1, 21aaf05784SOliver Tappe // 22aaf05784SOliver Tappe B_HPKG_REPO_MAGIC = 'hpkr', 23aaf05784SOliver Tappe B_HPKG_REPO_VERSION = 1 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 765fb1c6ffSOliver Tappe #define B_HPKG_MAX_INLINE_DATA_SIZE 8 775fb1c6ffSOliver Tappe 785fb1c6ffSOliver Tappe 795fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder) 805fb1c6ffSOliver Tappe #define B_HPKG_PACKAGE_INFO_FILE_NAME ".PackageInfo" 815fb1c6ffSOliver Tappe 825fb1c6ffSOliver Tappe 836f0278cdSOliver Tappe // package attribute IDs 8433bc4425SOliver Tappe enum BHPKGAttributeID { 8533bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY = 0, 8633bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_TYPE = 1, 8733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS = 2, 8833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_USER = 3, 8933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_GROUP = 4, 9033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATIME = 5, 9133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_MTIME = 6, 9233bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_CRTIME = 7, 9333bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS = 8, 9433bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS = 9, 9533bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS = 10, 9633bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE = 11, 9733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE = 12, 9833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DATA = 13, 9933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DATA_SIZE = 14, 10033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DATA_COMPRESSION = 15, 10133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_DATA_CHUNK_SIZE = 16, 10233bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH = 17, 10333bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME = 18, 10433bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY = 19, 10533bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION = 20, 10633bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR = 21, 10733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER = 22, 10833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS = 23, 10933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE = 24, 11033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 25, 11133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 26, 11233bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 27, 113*202c1daaSIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION = 28, 11433bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 29, 11533bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 30, 11633bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31, 11733bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE = 32, 11833bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES = 33, 11933bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS = 34, 12033bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS = 35, 12133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS = 36, 12233bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES = 37, 12333bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR = 38, 12433bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM = 39, 125ed6d59a9SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE = 40, 12622e1ec0eSIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE = 41, 1278b684dd3SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_URL = 42, 1288b684dd3SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL = 43, 129f19957b8SIngo Weinhold B_HPKG_ATTRIBUTE_ID_PACKAGE_INSTALL_PATH = 44, 1306f0278cdSOliver Tappe // 13133bc4425SOliver Tappe B_HPKG_ATTRIBUTE_ID_ENUM_COUNT, 1326f0278cdSOliver Tappe }; 1336f0278cdSOliver Tappe 1346f0278cdSOliver Tappe 135aaf05784SOliver Tappe // compression types 136aaf05784SOliver Tappe enum { 137aaf05784SOliver Tappe B_HPKG_COMPRESSION_NONE = 0, 138aaf05784SOliver Tappe B_HPKG_COMPRESSION_ZLIB = 1 139aaf05784SOliver Tappe }; 140aaf05784SOliver Tappe 141aaf05784SOliver Tappe 14233bc4425SOliver Tappe // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE) 143aaf05784SOliver Tappe enum { 144aaf05784SOliver Tappe B_HPKG_FILE_TYPE_FILE = 0, 145aaf05784SOliver Tappe B_HPKG_FILE_TYPE_DIRECTORY = 1, 146aaf05784SOliver Tappe B_HPKG_FILE_TYPE_SYMLINK = 2 147aaf05784SOliver Tappe }; 148aaf05784SOliver Tappe 149aaf05784SOliver Tappe 1505fb1c6ffSOliver Tappe // default values 1515fb1c6ffSOliver Tappe enum { 152aaf05784SOliver Tappe B_HPKG_DEFAULT_FILE_TYPE = B_HPKG_FILE_TYPE_FILE, 153aaf05784SOliver Tappe B_HPKG_DEFAULT_FILE_PERMISSIONS = 0644, 154aaf05784SOliver Tappe B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS = 0755, 155aaf05784SOliver Tappe B_HPKG_DEFAULT_SYMLINK_PERMISSIONS = 0777, 156aaf05784SOliver Tappe B_HPKG_DEFAULT_DATA_COMPRESSION = B_HPKG_COMPRESSION_NONE, 1575fb1c6ffSOliver Tappe B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB = 64 * 1024 1585fb1c6ffSOliver Tappe }; 1595fb1c6ffSOliver Tappe 1605fb1c6ffSOliver Tappe 161327b38d6SIngo Weinhold // Writer Init() flags 162327b38d6SIngo Weinhold enum { 163327b38d6SIngo Weinhold B_HPKG_WRITER_UPDATE_PACKAGE = 0x01, 164327b38d6SIngo Weinhold // update the package (don't truncate) 165327b38d6SIngo Weinhold B_HPKG_WRITER_FORCE_ADD = 0x02, 166327b38d6SIngo Weinhold // when updating a pre-existing entry, don't fail, but replace the 167327b38d6SIngo Weinhold // entry, if possible (directories will be merged, but won't replace a 168327b38d6SIngo Weinhold // non-directory) 169327b38d6SIngo Weinhold }; 170327b38d6SIngo Weinhold 171327b38d6SIngo Weinhold 1725fb1c6ffSOliver Tappe } // namespace BHPKG 1735fb1c6ffSOliver Tappe 1745fb1c6ffSOliver Tappe } // namespace BPackageKit 1755fb1c6ffSOliver Tappe 1765fb1c6ffSOliver Tappe 1775fb1c6ffSOliver Tappe #endif // _PACKAGE__HPKG__HPKG_DEFS_H_ 178