xref: /haiku/headers/os/package/hpkg/HPKGDefs.h (revision 33bc4425be0b545ed3d0b7e7a9a873d31e5a0330)
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 
275fb1c6ffSOliver Tappe // attribute types
285fb1c6ffSOliver Tappe enum {
295fb1c6ffSOliver Tappe 	// types
305fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INVALID			= 0,
315fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INT				= 1,
325fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_UINT				= 2,
335fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_STRING			= 3,
346f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_RAW				= 4,
356f0278cdSOliver Tappe 	//
366f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT
375fb1c6ffSOliver Tappe };
385fb1c6ffSOliver Tappe 
395fb1c6ffSOliver Tappe 
405fb1c6ffSOliver Tappe // attribute encodings
415fb1c6ffSOliver Tappe enum {
425fb1c6ffSOliver Tappe 	// signed/unsigned int encodings
435fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT		= 0,
445fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT	= 1,
455fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT	= 2,
465fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT	= 3,
475fb1c6ffSOliver Tappe 
485fb1c6ffSOliver Tappe 	// string encodings
495fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE	= 0,
505fb1c6ffSOliver Tappe 		// null-terminated string
515fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE	= 1,
525fb1c6ffSOliver Tappe 		// unsigned LEB128 index into string table
535fb1c6ffSOliver Tappe 
545fb1c6ffSOliver Tappe 	// raw data encodings
555fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE	= 0,
565fb1c6ffSOliver Tappe 		// unsigned LEB128 size, raw bytes
575fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP		= 1
585fb1c6ffSOliver Tappe 		// unsigned LEB128 size, unsigned LEB128 offset into the heap
595fb1c6ffSOliver Tappe };
605fb1c6ffSOliver Tappe 
615fb1c6ffSOliver Tappe 
625fb1c6ffSOliver Tappe // maximum number of bytes of data to be encoded inline; more will be allocated
635fb1c6ffSOliver Tappe // on the heap
645fb1c6ffSOliver Tappe #define B_HPKG_MAX_INLINE_DATA_SIZE	8
655fb1c6ffSOliver Tappe 
665fb1c6ffSOliver Tappe 
675fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder)
685fb1c6ffSOliver Tappe #define B_HPKG_PACKAGE_INFO_FILE_NAME	".PackageInfo"
695fb1c6ffSOliver Tappe 
705fb1c6ffSOliver Tappe 
716f0278cdSOliver Tappe // package attribute IDs
72*33bc4425SOliver Tappe enum BHPKGAttributeID {
73*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY 			=  0,
74*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_TYPE					=  1,
75*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS			=  2,
76*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_USER					=  3,
77*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_GROUP					=  4,
78*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATIME					=  5,
79*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_MTIME					=  6,
80*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_CRTIME					=  7,
81*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS			=  8,
82*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS			=  9,
83*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS			= 10,
84*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE				= 11,
85*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE			= 12,
86*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA						= 13,
87*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_SIZE					= 14,
88*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_COMPRESSION			= 15,
89*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_DATA_CHUNK_SIZE				= 16,
90*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH				= 17,
91*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME				= 18,
92*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY				= 19,
93*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION			= 20,
94*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR				= 21,
95*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER			= 22,
96*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS				= 23,
97*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE		= 24,
98*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR		= 25,
99*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR		= 26,
100*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO		= 27,
101*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE		= 28,
102*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT			= 29,
103*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE				= 30,
104*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES			= 31,
105*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE		= 32,
106*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES			= 33,
107*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS			= 34,
108*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS			= 35,
109*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS			= 36,
110*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES			= 37,
111*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR	= 38,
112*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM			= 39,
1136f0278cdSOliver Tappe 	//
114*33bc4425SOliver Tappe 	B_HPKG_ATTRIBUTE_ID_ENUM_COUNT,
1156f0278cdSOliver Tappe };
1166f0278cdSOliver Tappe 
1176f0278cdSOliver Tappe 
118aaf05784SOliver Tappe // compression types
119aaf05784SOliver Tappe enum {
120aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_NONE	= 0,
121aaf05784SOliver Tappe 	B_HPKG_COMPRESSION_ZLIB	= 1
122aaf05784SOliver Tappe };
123aaf05784SOliver Tappe 
124aaf05784SOliver Tappe 
125*33bc4425SOliver Tappe // file types (B_HPKG_ATTRIBUTE_ID_FILE_TYPE)
126aaf05784SOliver Tappe enum {
127aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_FILE		= 0,
128aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_DIRECTORY	= 1,
129aaf05784SOliver Tappe 	B_HPKG_FILE_TYPE_SYMLINK	= 2
130aaf05784SOliver Tappe };
131aaf05784SOliver Tappe 
132aaf05784SOliver Tappe 
1335fb1c6ffSOliver Tappe // default values
1345fb1c6ffSOliver Tappe enum {
135aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_TYPE				= B_HPKG_FILE_TYPE_FILE,
136aaf05784SOliver Tappe 	B_HPKG_DEFAULT_FILE_PERMISSIONS			= 0644,
137aaf05784SOliver Tappe 	B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS	= 0755,
138aaf05784SOliver Tappe 	B_HPKG_DEFAULT_SYMLINK_PERMISSIONS		= 0777,
139aaf05784SOliver Tappe 	B_HPKG_DEFAULT_DATA_COMPRESSION			= B_HPKG_COMPRESSION_NONE,
1405fb1c6ffSOliver Tappe 	B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB		= 64 * 1024
1415fb1c6ffSOliver Tappe };
1425fb1c6ffSOliver Tappe 
1435fb1c6ffSOliver Tappe 
1445fb1c6ffSOliver Tappe }	// namespace BHPKG
1455fb1c6ffSOliver Tappe 
1465fb1c6ffSOliver Tappe }	// namespace BPackageKit
1475fb1c6ffSOliver Tappe 
1485fb1c6ffSOliver Tappe 
1495fb1c6ffSOliver Tappe #endif	// _PACKAGE__HPKG__HPKG_DEFS_H_
150