xref: /haiku/headers/os/package/hpkg/HPKGDefs.h (revision 171fd58c4b47c2da9cf13b7e501d3661d4a98e42)
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
76*171fd58cSIngo Weinhold enum {
77*171fd58cSIngo Weinhold 	B_HPKG_MAX_INLINE_DATA_SIZE	= 8
78*171fd58cSIngo Weinhold };
795fb1c6ffSOliver Tappe 
805fb1c6ffSOliver Tappe 
815fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder)
82*171fd58cSIngo 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,
10133bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_SIZE					= 14,
10233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_COMPRESSION			= 15,
10333bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_CHUNK_SIZE				= 16,
10433bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH				= 17,
10533bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME				= 18,
10633bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY				= 19,
10733bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION			= 20,
10833bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR				= 21,
10933bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER			= 22,
11033bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS				= 23,
11133bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE		= 24,
11233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR		= 25,
11333bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR		= 26,
11433bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO		= 27,
115202c1daaSIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION	= 28,
11633bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT			= 29,
11733bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE				= 30,
11833bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES			= 31,
11933bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE		= 32,
12033bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES			= 33,
12133bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS			= 34,
12233bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS			= 35,
12333bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS			= 36,
12433bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES			= 37,
12533bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR	= 38,
12633bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM			= 39,
127ed6d59a9SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE	= 40,
12822e1ec0eSIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE	= 41,
1298b684dd3SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_URL					= 42,
1308b684dd3SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL			= 43,
131f19957b8SIngo Weinhold 	B_HPKG_ATTRIBUTE_ID_PACKAGE_INSTALL_PATH		= 44,
1326f0278cdSOliver Tappe 	//
13333bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_ENUM_COUNT,
1346f0278cdSOliver Tappe };
1356f0278cdSOliver Tappe 
1366f0278cdSOliver Tappe 
137aaf05784SOliver Tappe // compression types
138aaf05784SOliver Tappe enum {
139aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_NONE	= 0,
140aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_ZLIB	= 1
141aaf05784SOliver Tappe };
142aaf05784SOliver Tappe 
143aaf05784SOliver Tappe 
14433bc4425SOliver Tappe // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE)
145aaf05784SOliver Tappe enum {
146aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_FILE		= 0,
147aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_DIRECTORY	= 1,
148aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_SYMLINK	= 2
149aaf05784SOliver Tappe };
150aaf05784SOliver Tappe 
151aaf05784SOliver Tappe 
1525fb1c6ffSOliver Tappe // default values
1535fb1c6ffSOliver Tappe enum {
154aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_TYPE				= B_HPKG_FILE_TYPE_FILE,
155aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_PERMISSIONS			= 0644,
156aaf05784SOliver Tappe 	B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS	= 0755,
157aaf05784SOliver Tappe 	B_HPKG_DEFAULT_SYMLINK_PERMISSIONS		= 0777,
158aaf05784SOliver Tappe 	B_HPKG_DEFAULT_DATA_COMPRESSION			= B_HPKG_COMPRESSION_NONE,
1595fb1c6ffSOliver Tappe 	B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB		= 64 * 1024
1605fb1c6ffSOliver Tappe };
1615fb1c6ffSOliver Tappe 
1625fb1c6ffSOliver Tappe 
163327b38d6SIngo Weinhold // Writer Init() flags
164327b38d6SIngo Weinhold enum {
165327b38d6SIngo Weinhold 	B_HPKG_WRITER_UPDATE_PACKAGE	= 0x01,
166327b38d6SIngo Weinhold 		// update the package (don't truncate)
167327b38d6SIngo Weinhold 	B_HPKG_WRITER_FORCE_ADD			= 0x02,
168327b38d6SIngo Weinhold 		// when updating a pre-existing entry, don't fail, but replace the
169327b38d6SIngo Weinhold 		// entry, if possible (directories will be merged, but won't replace a
170327b38d6SIngo Weinhold 		// non-directory)
171327b38d6SIngo Weinhold };
172327b38d6SIngo Weinhold 
173327b38d6SIngo Weinhold 
1745fb1c6ffSOliver Tappe }	// namespace BHPKG
1755fb1c6ffSOliver Tappe 
1765fb1c6ffSOliver Tappe }	// namespace BPackageKit
1775fb1c6ffSOliver Tappe 
1785fb1c6ffSOliver Tappe 
1795fb1c6ffSOliver Tappe #endif	// _PACKAGE__HPKG__HPKG_DEFS_H_
180