xref: /haiku/headers/os/package/hpkg/HPKGDefs.h (revision 47039b852eeebb91396d19e0f9313cf23bf535ee)
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,
21*47039b85SIngo Weinhold 	B_HPKG_MINOR_VERSION		= 0,
22aaf05784SOliver Tappe 	//
23aaf05784SOliver Tappe 	B_HPKG_REPO_MAGIC			= 'hpkr',
24*47039b85SIngo Weinhold 	B_HPKG_REPO_VERSION			= 2,
25*47039b85SIngo Weinhold 	B_HPKG_REPO_MINOR_VERSION	= 0
265fb1c6ffSOliver Tappe };
275fb1c6ffSOliver Tappe 
285fb1c6ffSOliver Tappe 
29b3211314SIngo Weinhold // package attribute IDs
30b3211314SIngo Weinhold enum BHPKGPackageSectionID {
31b3211314SIngo Weinhold 	B_HPKG_SECTION_HEADER					= 0,
32b3211314SIngo Weinhold 	B_HPKG_SECTION_HEAP						= 1,
33b3211314SIngo Weinhold 	B_HPKG_SECTION_PACKAGE_TOC				= 2,
34b3211314SIngo Weinhold 	B_HPKG_SECTION_PACKAGE_ATTRIBUTES		= 3,
35b3211314SIngo Weinhold 	B_HPKG_SECTION_REPOSITORY_INFO			= 4,
36b3211314SIngo Weinhold 	//
37b3211314SIngo Weinhold 	B_HPKG_SECTION_ENUM_COUNT
38b3211314SIngo Weinhold };
39b3211314SIngo Weinhold 
40b3211314SIngo Weinhold 
415fb1c6ffSOliver Tappe // attribute types
425fb1c6ffSOliver Tappe enum {
435fb1c6ffSOliver Tappe 	// types
445fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INVALID			= 0,
455fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INT				= 1,
465fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_UINT				= 2,
475fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_STRING			= 3,
486f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_RAW				= 4,
496f0278cdSOliver Tappe 	//
506f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT
515fb1c6ffSOliver Tappe };
525fb1c6ffSOliver Tappe 
535fb1c6ffSOliver Tappe 
545fb1c6ffSOliver Tappe // attribute encodings
555fb1c6ffSOliver Tappe enum {
565fb1c6ffSOliver Tappe 	// signed/unsigned int encodings
575fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT		= 0,
585fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT	= 1,
595fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT	= 2,
605fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT	= 3,
615fb1c6ffSOliver Tappe 
625fb1c6ffSOliver Tappe 	// string encodings
635fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE	= 0,
645fb1c6ffSOliver Tappe 		// null-terminated string
655fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE	= 1,
665fb1c6ffSOliver Tappe 		// unsigned LEB128 index into string table
675fb1c6ffSOliver Tappe 
685fb1c6ffSOliver Tappe 	// raw data encodings
695fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE	= 0,
705fb1c6ffSOliver Tappe 		// unsigned LEB128 size, raw bytes
715fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP		= 1
725fb1c6ffSOliver Tappe 		// unsigned LEB128 size, unsigned LEB128 offset into the heap
735fb1c6ffSOliver Tappe };
745fb1c6ffSOliver Tappe 
755fb1c6ffSOliver Tappe 
765fb1c6ffSOliver Tappe // maximum number of bytes of data to be encoded inline; more will be allocated
775fb1c6ffSOliver Tappe // on the heap
78171fd58cSIngo Weinhold enum {
79171fd58cSIngo Weinhold 	B_HPKG_MAX_INLINE_DATA_SIZE	= 8
80171fd58cSIngo Weinhold };
815fb1c6ffSOliver Tappe 
825fb1c6ffSOliver Tappe 
835fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder)
84171fd58cSIngo Weinhold extern const char* const B_HPKG_PACKAGE_INFO_FILE_NAME;
855fb1c6ffSOliver Tappe 
865fb1c6ffSOliver Tappe 
876f0278cdSOliver Tappe // package attribute IDs
8833bc4425SOliver Tappe enum BHPKGAttributeID {
8933bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY 			=  0,
9033bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_TYPE					=  1,
9133bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS			=  2,
9233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_USER					=  3,
9333bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_GROUP					=  4,
9433bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATIME					=  5,
9533bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_MTIME					=  6,
9633bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_CRTIME					=  7,
9733bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS			=  8,
9833bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS			=  9,
9933bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS			= 10,
10033bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE				= 11,
10133bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE			= 12,
10233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA						= 13,
1031f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH				= 14,
1041f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME				= 15,
1051f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY				= 16,
1061f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION			= 17,
1071f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR				= 18,
1081f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER			= 19,
1091f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS				= 20,
1101f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE		= 21,
1111f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR		= 22,
1121f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR		= 23,
1131f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO		= 24,
1141f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION	= 25,
1151f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT			= 26,
1161f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE				= 27,
1171f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES			= 28,
1181f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES			= 29,
1191f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS			= 30,
1201f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS			= 31,
1211f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS			= 32,
1221f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES			= 33,
1231f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR	= 34,
1241f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM			= 35,
1251f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE	= 36,
1261f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE	= 37,
1271f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_URL					= 38,
1281f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL			= 39,
1291f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_INSTALL_PATH		= 40,
1301f633814SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_BASE_PACKAGE		= 41,
1316f0278cdSOliver Tappe 	//
13233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_ENUM_COUNT,
1336f0278cdSOliver Tappe };
1346f0278cdSOliver Tappe 
1356f0278cdSOliver Tappe 
136aaf05784SOliver Tappe // compression types
137aaf05784SOliver Tappe enum {
138aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_NONE	= 0,
139aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_ZLIB	= 1
140aaf05784SOliver Tappe };
141aaf05784SOliver Tappe 
142aaf05784SOliver Tappe 
14333bc4425SOliver Tappe // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE)
144aaf05784SOliver Tappe enum {
145aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_FILE		= 0,
146aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_DIRECTORY	= 1,
147aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_SYMLINK	= 2
148aaf05784SOliver Tappe };
149aaf05784SOliver Tappe 
150aaf05784SOliver Tappe 
1515fb1c6ffSOliver Tappe // default values
1525fb1c6ffSOliver Tappe enum {
153aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_TYPE				= B_HPKG_FILE_TYPE_FILE,
154aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_PERMISSIONS			= 0644,
155aaf05784SOliver Tappe 	B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS	= 0755,
1561f633814SIngo Weinhold 	B_HPKG_DEFAULT_SYMLINK_PERMISSIONS		= 0777
1575fb1c6ffSOliver Tappe };
1585fb1c6ffSOliver Tappe 
1595fb1c6ffSOliver Tappe 
160327b38d6SIngo Weinhold // Writer Init() flags
161327b38d6SIngo Weinhold enum {
162327b38d6SIngo Weinhold 	B_HPKG_WRITER_UPDATE_PACKAGE	= 0x01,
163327b38d6SIngo Weinhold 		// update the package (don't truncate)
164327b38d6SIngo Weinhold 	B_HPKG_WRITER_FORCE_ADD			= 0x02,
165327b38d6SIngo Weinhold 		// when updating a pre-existing entry, don't fail, but replace the
166327b38d6SIngo Weinhold 		// entry, if possible (directories will be merged, but won't replace a
167327b38d6SIngo Weinhold 		// non-directory)
168327b38d6SIngo Weinhold };
169327b38d6SIngo Weinhold 
170327b38d6SIngo Weinhold 
171d59e0febSIngo Weinhold // Reader Init() flags
172d59e0febSIngo Weinhold enum {
173d59e0febSIngo Weinhold 	B_HPKG_READER_DONT_PRINT_VERSION_MISMATCH_MESSAGE	= 0x01
174d59e0febSIngo Weinhold 		// Fail silently when encountering a package format version mismatch.
175d59e0febSIngo Weinhold 		// Don't print anything to the error output.
176d59e0febSIngo Weinhold };
177d59e0febSIngo Weinhold 
178d59e0febSIngo Weinhold 
179796343edSIngo Weinhold enum {
180796343edSIngo Weinhold 	B_HPKG_COMPRESSION_LEVEL_NONE		= 0,
181796343edSIngo Weinhold 	B_HPKG_COMPRESSION_LEVEL_FASTEST	= 1,
182796343edSIngo Weinhold 	B_HPKG_COMPRESSION_LEVEL_BEST		= 9
183796343edSIngo Weinhold };
184796343edSIngo Weinhold 
185796343edSIngo Weinhold 
1865fb1c6ffSOliver Tappe }	// namespace BHPKG
1875fb1c6ffSOliver Tappe 
1885fb1c6ffSOliver Tappe }	// namespace BPackageKit
1895fb1c6ffSOliver Tappe 
1905fb1c6ffSOliver Tappe 
1915fb1c6ffSOliver Tappe #endif	// _PACKAGE__HPKG__HPKG_DEFS_H_
192